/* ==========================================================================
   Motifhane — tasarım değişkenleri. Marka renklerini buradan değiştirin.
   ========================================================================== */
:root {
  --bg: #f7f1ea;
  --bg-2: #efe6db;
  --card: #fffcf8;
  --ink: #2b2420;
  --ink-2: #5a4e46;
  --muted: #8a7d73;
  --line: #e6dacd;
  --line-2: #d8c9b9;
  --accent: #c8553d;        /* kiremit */
  --accent-ink: #ffffff;
  --accent-2: #a8432e;
  --accent-soft: #f6dcd3;
  --sage: #6f8f72;
  --sage-soft: #dfe8dc;
  --plum: #5b3b56;
  --mustard: #e2a93b;
  --danger: #b3261e;
  --ok: #2f7d5b;
  --shadow-sm: 0 1px 2px rgba(43, 36, 32, .06), 0 1px 1px rgba(43, 36, 32, .04);
  --shadow: 0 6px 24px -8px rgba(43, 36, 32, .18), 0 2px 6px rgba(43, 36, 32, .06);
  --shadow-lg: 0 24px 60px -20px rgba(43, 36, 32, .35);
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --header-h: 64px;
  --maxw: 1200px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; }
h2 { font-size: clamp(22px, 3vw, 30px); font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0 0 1em; }
kbd { font: 12px/1 var(--font); color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.ico { flex: none; }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-dot { width: 14px; height: 14px; border-radius: 3px; background: var(--accent); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { transform: scale(.7); opacity: .5; } to { transform: scale(1.1); opacity: 1; } }
.fatal { max-width: 420px; margin: 20vh auto; text-align: center; padding: 0 16px; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 760px; }
.container-xs { max-width: 440px; }
.site-main { min-height: calc(100vh - var(--header-h) - 200px); }
.site-main.is-loading { opacity: .6; transition: opacity .2s .15s; }
.page { padding: 32px 0 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.hide { display: none !important; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { max-width: var(--maxw); margin: 0 auto; height: var(--header-h); padding: 0 20px; display: flex; align-items: center; gap: 20px; }
.header-left { display: flex; align-items: center; gap: 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; grid-template-columns: repeat(4, 7px); gap: 1.5px; padding: 4px; background: var(--ink); border-radius: 8px; }
.brand-mark i { width: 7px; height: 7px; border-radius: 1.5px; background: #6b5a50; }
.brand-mark i.on { background: var(--accent); }
.brand-name { font: 800 21px/1 var(--font-display); letter-spacing: -0.02em; }
.main-nav { display: flex; gap: 4px; }
.main-nav a { text-decoration: none; padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-weight: 500; }
.main-nav a:hover { background: var(--bg-2); color: var(--ink); }
.main-nav a.active { color: var(--ink); background: var(--bg-2); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.burger { display: none; }
.user-btn { border: 0; background: none; padding: 2px; border-radius: 999px; cursor: pointer; margin-left: 4px; }
.lang-code { font-weight: 700; font-size: 13px; }
@media (max-width: 860px) {
  .main-nav { display: none; }
  .burger { display: inline-flex; }
  .hide-sm { display: none !important; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 0 var(--accent-2); }
.btn-primary:hover { background: var(--accent-2); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: var(--card); border-color: var(--ink-2); }
.btn-soft { background: var(--accent-soft); color: var(--accent-2); }
.btn-soft:hover { background: #f1cbbf; }
.btn-danger { background: var(--danger); color: #fff; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-ghost.is-busy::after { border-color: var(--ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); text-decoration: none;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn.active, .icon-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.with-dot .dot { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; display: inline-flex; align-items: center; gap: 4px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- forms ---------- */
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.form-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c2bd; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; }
.form-ok { background: var(--sage-soft); color: #2d4a30; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.segmented { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 4px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.segmented button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- cards / badges ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: rgba(43,36,32,.75); color: #fff; }
.badge-public { background: var(--sage); }
.pro-badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; font: 800 10px/1 var(--font); letter-spacing: .06em; background: linear-gradient(135deg, var(--mustard), var(--accent)); color: #fff; vertical-align: middle; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; font-weight: 700; font-family: var(--font-display); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--bg-2); text-decoration: none; font-size: 14px; color: var(--ink-2); border: 0; cursor: pointer; }
.chip:hover, .chip.active { background: var(--ink); color: #fff; }

/* ---------- chart grid ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.chart-card a { text-decoration: none; display: block; }
.chart-thumb {
  position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--card);
  border: 1px solid var(--line); display: grid; place-items: center; transition: transform .2s, box-shadow .2s;
}
.chart-thumb img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; background: #fff; }
.chart-thumb .badge { position: absolute; top: 10px; left: 10px; }
.chart-card a:hover .chart-thumb { transform: translateY(-3px); box-shadow: var(--shadow); }
.thumb-empty { color: var(--line-2); }
.chart-meta { padding: 10px 2px 0; }
.chart-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-sub { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; gap: 8px; }
.chart-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-likes { display: inline-flex; align-items: center; gap: 4px; }
.chart-likes.is-liked { color: var(--accent); }
.chart-likes.is-liked svg { fill: currentColor; }
.skeleton .chart-thumb { background: linear-gradient(90deg, var(--bg-2), var(--card), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.sk-line { height: 12px; border-radius: 6px; background: var(--bg-2); margin-top: 8px; }
.sk-line.short { width: 50%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.h-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 220px); gap: 16px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x mandatory; }
.h-scroll > * { scroll-snap-align: start; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-art { display: grid; place-items: center; margin-bottom: 12px; }
.doodle { image-rendering: pixelated; width: 99px; height: 81px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.page-btn { min-width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-weight: 600; }
.page-btn.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.page-gap { padding: 0 4px; align-self: center; color: var(--muted); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button, .tabs a { border: 0; background: none; padding: 12px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs .active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- toasts / modal / menu ---------- */
.toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; opacity: 0; transform: translateY(10px); transition: all .25s; text-align: center; }
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--danger); }
.toast-success { background: var(--ok); }
.modal-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(36, 28, 24, .45); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .18s; }
.modal-backdrop.show { opacity: 1; }
.modal { background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; max-height: calc(100vh - 32px); overflow: auto; transform: translateY(8px) scale(.98); transition: transform .18s; }
.modal-backdrop.show .modal { transform: none; }
.modal-sm { max-width: 400px; } .modal-md { max-width: 520px; } .modal-lg { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; gap: 12px; }
.modal-head h2 { font-size: 20px; margin: 0; }
.modal-body { padding: 16px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; flex-wrap: wrap; }
.confirm-text { margin: 8px 0 0; font-size: 16px; }
.pop-menu { position: fixed; z-index: 150; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 210px; max-height: 70vh; overflow: auto; animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 9px; cursor: pointer; text-align: left; font-size: 15px; }
.pop-item:hover { background: var(--bg-2); }
.pop-item:disabled { opacity: .4; cursor: default; }
.pop-item.danger { color: var(--danger); }
.pop-item span { flex: 1; }
.pop-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- cookie bar ---------- */
.cookie-bar { position: fixed; z-index: 90; left: 16px; bottom: 16px; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 18px; font-size: 14px; }
.cookie-bar p { margin: 0 0 12px; color: var(--ink-2); }
.cookie-actions { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 520px) { .cookie-bar { left: 8px; right: 8px; bottom: 8px; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: 40px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 40px 20px 24px; display: grid; grid-template-columns: 1.3fr 1fr 1.4fr; gap: 32px; }
.footer-brand p { color: var(--muted); margin-top: 12px; max-width: 280px; }
.footer-links { display: grid; gap: 8px; align-content: start; }
.footer-links a { text-decoration: none; color: var(--ink-2); }
.footer-links a:hover { color: var(--accent); }
.footer-news h3 { margin-bottom: 4px; }
.footer-news p { color: var(--muted); font-size: 14px; }
.newsletter { display: flex; gap: 8px; }
.footer-bottom { grid-column: 1 / -1; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 14px; padding-top: 20px; border-top: 1px solid var(--line); }
.footer-bottom a { color: var(--muted); }
.social { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-size: 14px; }
@media (max-width: 860px) { .footer-inner { grid-template-columns: 1fr; } .newsletter { flex-direction: column; } }

/* ---------- home ---------- */
.hero { padding: 56px 0 40px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent-2); background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; font-size: 14px; margin-bottom: 18px; }
.hero h1 { font-size: clamp(36px, 5.6vw, 64px); line-height: 1.02; letter-spacing: -0.03em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-text { font-size: 18px; color: var(--ink-2); max-width: 520px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.hero-art { position: relative; min-height: 420px; }
.hero-stage { position: relative; width: 100%; aspect-ratio: 1 / .92; }
.hero-tile { position: absolute; border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; background: #fff; border: 6px solid #fff; }
.hero-tile canvas { display: block; width: 100%; height: 100%; }
.hero-tile.t1 { width: 54%; left: 0; top: 6%; transform: rotate(-5deg); }
.hero-tile.t2 { width: 50%; right: 2%; top: 0; transform: rotate(4deg); }
.hero-tile.t3 { width: 46%; left: 24%; bottom: 0; transform: rotate(-1deg); }
.hero-tag { position: absolute; background: var(--ink); color: #fff; font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow); }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } .hero-art { min-height: 0; } }
.section { padding: 48px 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; color: var(--accent-2); text-decoration: none; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; display: grid; gap: 14px; align-content: start; text-decoration: none; transition: transform .2s, box-shadow .2s; }
.step:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.step-num { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font: 800 16px var(--font-display); background: var(--ink); color: #fff; }
.step-art { border-radius: 14px; overflow: hidden; background: var(--bg-2); aspect-ratio: 16 / 10; display: grid; place-items: center; }
.step-art canvas { width: 100%; height: 100%; display: block; }
.step p { color: var(--ink-2); margin: 0; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.feature { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.feature .ico { color: var(--accent); margin-top: 2px; }
@media (max-width: 860px) { .features { grid-template-columns: 1fr; } }
.cta-band { background: var(--ink); color: #fff; border-radius: 28px; padding: 40px; display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; position: relative; overflow: hidden; }
.cta-band h2 { margin: 0 0 6px; color: #fff; }
.cta-band p { margin: 0; color: #d9cfc6; }
.cta-band .btn-primary { box-shadow: none; }

/* ---------- gallery ---------- */
.banners { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 28px; }
.banner { border-radius: 22px; padding: 24px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; position: relative; overflow: hidden; min-height: 170px; }
.banner h2 { font-size: 24px; margin: 0; max-width: 340px; }
.banner p { margin: 0; max-width: 360px; color: var(--ink-2); }
.banner-upload { background: var(--mustard); background: linear-gradient(120deg, #f3d48f, #e9b65a); }
.banner-pro { background: var(--plum); color: #fff; }
.banner-pro p { color: #e8d6e4; }
.banner .tagpill { background: rgba(255,255,255,.75); color: var(--ink); padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.banner-art { position: absolute; right: -10px; bottom: -10px; width: 180px; opacity: .95; }
.banner-art canvas { width: 100%; image-rendering: pixelated; border-radius: 12px; transform: rotate(-6deg); }
@media (max-width: 860px) { .banners { grid-template-columns: 1fr; } .banner-art { width: 120px; } }
.gallery-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.gallery-tools .search { flex: 1; min-width: 220px; position: relative; }
.gallery-tools .search .ico { position: absolute; left: 12px; top: 12px; color: var(--muted); }
.gallery-tools .search input { padding-left: 40px; }
.gallery-tools select { width: auto; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.login-nudge { margin-top: 28px; text-align: center; background: var(--card); border: 1px dashed var(--line-2); border-radius: 18px; padding: 24px; }

/* ---------- chart detail ---------- */
.chart-page { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 32px; align-items: start; }
.chart-view { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 16px; position: sticky; top: calc(var(--header-h) + 16px); }
.chart-view canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; border-radius: 10px; }
.view-switch { display: flex; justify-content: center; margin-bottom: 12px; }
.variant-dots { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.variant-dot { border: 2px solid transparent; border-radius: 999px; padding: 3px; background: none; cursor: pointer; display: flex; gap: 1px; }
.variant-dot.active { border-color: var(--ink); }
.variant-dot span { width: 12px; height: 18px; display: block; }
.variant-dot span:first-child { border-radius: 9px 0 0 9px; } .variant-dot span:last-child { border-radius: 0 9px 9px 0; }
.chart-info h1 { margin-bottom: 8px; }
.author-row { display: flex; align-items: center; gap: 10px; margin: 12px 0 16px; }
.author-row a { text-decoration: none; font-weight: 700; }
.stats { display: flex; gap: 16px; color: var(--muted); font-size: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.stats span { display: inline-flex; gap: 5px; align-items: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.btn.liked { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.btn.liked svg { fill: currentColor; }
.desc { white-space: pre-wrap; color: var(--ink-2); }
.palette-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 20px; }
.palette-list span { width: 26px; height: 26px; border-radius: 7px; border: 1px solid rgba(0,0,0,.08); }
.comments { margin-top: 28px; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.comment-head a { font-weight: 700; text-decoration: none; }
.comment p { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.comment-form { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.comment-form textarea { min-height: 44px; }
@media (max-width: 900px) { .chart-page { grid-template-columns: 1fr; } .chart-view { position: static; } }

/* ---------- profile ---------- */
.profile-head { display: flex; gap: 24px; align-items: center; margin-bottom: 28px; flex-wrap: wrap; }
.profile-head h1 { margin: 0; display: flex; align-items: center; gap: 10px; }
.profile-stats { display: flex; gap: 18px; color: var(--ink-2); margin: 8px 0; flex-wrap: wrap; }
.profile-stats b { color: var(--ink); }
.profile-stats button { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
.user-list { display: grid; gap: 4px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; text-decoration: none; }
.user-row:hover { background: var(--bg-2); }

/* ---------- messages ---------- */
.msg-layout { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - var(--header-h) - 64px); min-height: 480px; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: var(--card); }
.msg-list { border-right: 1px solid var(--line); overflow: auto; }
.msg-list-head { padding: 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.msg-list-head h1 { font-size: 22px; margin: 0; }
.convo { display: flex; gap: 10px; padding: 12px 16px; text-decoration: none; border-bottom: 1px solid var(--line); }
.convo:hover, .convo.active { background: var(--bg); }
.convo-main { flex: 1; min-width: 0; }
.convo-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.convo-last { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo.unread .convo-last { color: var(--ink); font-weight: 600; }
.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.thread-head a { text-decoration: none; font-weight: 700; }
.thread-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 75%; padding: 9px 14px; border-radius: 18px; background: var(--bg-2); white-space: pre-wrap; word-break: break-word; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.bubble:not(.mine) { border-bottom-left-radius: 6px; }
.bubble time { display: block; font-size: 11px; opacity: .65; margin-top: 2px; }
.thread-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.thread-form textarea { min-height: 44px; max-height: 140px; }
.thread-empty { flex: 1; display: grid; place-items: center; color: var(--muted); padding: 24px; text-align: center; }
@media (max-width: 760px) {
  .msg-layout { grid-template-columns: 1fr; height: calc(100vh - var(--header-h) - 32px); }
  .msg-layout.has-thread .msg-list { display: none; }
  .msg-layout:not(.has-thread) .thread { display: none; }
}

/* ---------- notifications ---------- */
.notif { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; text-decoration: none; }
.notif:hover { background: var(--card); }
.notif.unread { background: var(--card); box-shadow: inset 3px 0 0 var(--accent); }
.notif-text { flex: 1; }
.notif-text small { display: block; color: var(--muted); }
.notif-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line); image-rendering: pixelated; }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); flex: none; }

/* ---------- auth ---------- */
.auth-wrap { min-height: calc(100vh - var(--header-h) - 120px); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 28px; margin-bottom: 4px; }
.auth-card form { display: grid; gap: 14px; margin-top: 20px; }
.auth-alt { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.auth-alt a { color: var(--accent-2); font-weight: 600; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
.settings-nav { display: grid; gap: 4px; position: sticky; top: calc(var(--header-h) + 16px); }
.settings-nav a { padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
.settings-nav a:hover { background: var(--bg-2); }
.settings-section { scroll-margin-top: calc(var(--header-h) + 16px); margin-bottom: 20px; }
.settings-section form { display: grid; gap: 14px; }
.avatar-edit { display: flex; gap: 16px; align-items: center; }
@media (max-width: 760px) { .settings-grid { grid-template-columns: 1fr; } .settings-nav { position: static; grid-auto-flow: column; overflow-x: auto; } }

/* ---------- pro ---------- */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 860px; margin: 32px auto 0; }
.plan { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 28px; display: grid; gap: 14px; align-content: start; }
.plan.featured { background: var(--ink); color: #fff; border-color: var(--ink); position: relative; }
.plan h2 { margin: 0; }
.plan .price { font: 800 34px/1 var(--font-display); }
.plan .price small { font: 500 15px var(--font); opacity: .7; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.plan li { display: flex; gap: 10px; align-items: flex-start; }
.plan li .ico { color: var(--sage); margin-top: 2px; }
.plan.featured li .ico { color: var(--mustard); }
.plan .muted { opacity: .75; color: inherit; }
@media (max-width: 760px) { .plans { grid-template-columns: 1fr; } }

/* ---------- static pages ---------- */
.prose { max-width: 720px; }
.prose h2 { margin-top: 1.6em; font-size: 22px; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 1.2em; }
.contact-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 32px; }
.contact-grid form { display: grid; gap: 14px; }
@media (max-width: 760px) { .contact-grid { grid-template-columns: 1fr; } }
.nf { text-align: center; padding: 80px 16px; }

/* ---------- admin ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.stat-card b { display: block; font: 800 28px/1.1 var(--font-display); }
.stat-card span { color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; background: var(--bg); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table td .row { flex-wrap: nowrap; }

/* ==========================================================================
   Editor
   ========================================================================== */
body.is-bare .site-header, body.is-bare .site-footer { display: none; }
body.is-bare { overflow: hidden; background: var(--bg-2); }
.editor { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto 1fr; background: var(--bg-2); }
.ed-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); min-height: 58px; }
.ed-title { flex: 1; min-width: 80px; max-width: 360px; border: 0; border-bottom: 2px solid transparent; background: transparent; font: 800 20px/1.2 var(--font-display); padding: 4px 2px; color: var(--ink); }
.ed-title:focus { outline: none; border-bottom-color: var(--accent); }
.ed-status { font-size: 13px; color: var(--muted); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.ed-status .dotc { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); }
.ed-status.dirty .dotc { background: var(--mustard); }
.ed-status.err .dotc { background: var(--danger); }
.ed-tabs { display: flex; justify-content: center; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.ed-body { position: relative; min-height: 0; display: grid; grid-template-columns: 1fr auto; }
.ed-stage { position: relative; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto 1fr; }
.ed-strip { position: relative; height: 92px; border-bottom: 1px solid var(--line); background: #fff; overflow: hidden; }
.ed-strip canvas { display: block; width: 100%; height: 100%; }
.ed-strip-handle { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 44px; height: 10px; cursor: ns-resize; display: grid; place-items: center; }
.ed-strip-handle::after { content: ''; width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); }
.ed-canvas-wrap { position: relative; overflow: hidden; touch-action: none; background:
  linear-gradient(45deg, #ebe3d9 25%, transparent 25%) 0 0 / 24px 24px,
  linear-gradient(-45deg, #ebe3d9 25%, transparent 25%) 0 0 / 24px 24px,
  linear-gradient(45deg, transparent 75%, #ebe3d9 75%) 0 0 / 24px 24px,
  linear-gradient(-45deg, transparent 75%, #ebe3d9 75%) 0 0 / 24px 24px, #f1eae1; background-position: 0 0, 0 12px, 12px -12px, -12px 0; }
.ed-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ed-canvas-wrap.tool-brush, .ed-canvas-wrap.tool-eraser, .ed-canvas-wrap.tool-line, .ed-canvas-wrap.tool-rect { cursor: crosshair; }
.ed-canvas-wrap.tool-fill { cursor: cell; }
.ed-canvas-wrap.tool-picker { cursor: copy; }
.ed-canvas-wrap.tool-select, .ed-canvas-wrap.tool-wand { cursor: default; }
.ed-canvas-wrap.tool-move { cursor: move; }
.ed-canvas-wrap.panning { cursor: grabbing !important; }
.edge-ctl { position: absolute; display: flex; gap: 4px; z-index: 3; }
.edge-ctl button { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-sm); color: var(--ink-2); padding: 0; }
.edge-ctl button:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.edge-ctl.vertical { flex-direction: column; }
.ed-dock { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 5; width: max-content; max-width: calc(100% - 16px); }
.ed-bar { display: flex; align-items: center; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 5px; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ed-bar::-webkit-scrollbar { display: none; }
.ed-bar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex: none; }
.ed-bar .icon-btn { width: 38px; height: 38px; flex: none; border-radius: 11px; }
.ed-bar .split { display: inline-flex; align-items: center; }
.ed-bar .split .caret { width: 18px; height: 38px; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; display: grid; place-items: center; }
.ed-bar .size-badge { position: absolute; bottom: 3px; right: 3px; font-size: 9px; font-weight: 800; line-height: 1; background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 3px; }
.pal-bar .swatch { position: relative; width: 32px; height: 32px; border-radius: 9px; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); cursor: pointer; flex: none; padding: 0; margin: 0 1px; }
.pal-bar .swatch.active { border-color: var(--card); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 1px rgba(0,0,0,.12); }
.pal-bar .swatch .key { position: absolute; right: 1px; bottom: 0; font-size: 9px; font-weight: 800; color: rgba(0,0,0,.45); mix-blend-mode: multiply; }
.ed-side { width: 300px; background: var(--card); border-left: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; }
.ed-side.closed { display: none; }
.ed-side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ed-side-head h3 { margin: 0; font-size: 16px; }
.ed-side-body { padding: 14px; display: grid; gap: 12px; }
.ed-side textarea { min-height: 260px; }
.variant-item { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; background: #fff; }
.variant-item.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.variant-item .mini { display: flex; flex: none; border-radius: 6px; overflow: hidden; }
.variant-item .mini span { width: 10px; height: 26px; }
.variant-item input { border: 0; background: transparent; font: 600 14px var(--font); min-width: 0; flex: 1; padding: 4px; border-radius: 6px; }
.variant-item input:focus { outline: none; background: var(--bg); }
.color-edit { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; }
.color-edit input[type="color"] { width: 56px; height: 44px; border: 1px solid var(--line-2); border-radius: 10px; padding: 2px; background: #fff; cursor: pointer; }
.preset-row { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.preset-row button { aspect-ratio: 1; border-radius: 6px; border: 1px solid rgba(0,0,0,.1); cursor: pointer; padding: 0; }
.sel-bar { background: var(--ink); color: #fff; border-color: var(--ink); }
.sel-bar .icon-btn { color: #e9e1d9; }
.sel-bar .icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.sel-bar .lbl { font-size: 12px; padding: 0 8px; color: #cfc4ba; white-space: nowrap; }
.zoom-ctl { position: absolute; right: 12px; top: 12px; z-index: 4; display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; box-shadow: var(--shadow-sm); }
.zoom-ctl .icon-btn { width: 34px; height: 34px; }
.coord { position: absolute; left: 12px; top: 12px; z-index: 4; background: rgba(43,36,32,.8); color: #fff; font: 600 12px var(--font); padding: 4px 8px; border-radius: 8px; pointer-events: none; }

/* knit mode */
.knit-wrap { position: relative; min-height: 0; display: grid; grid-template-rows: auto 1fr auto; background: #3b3431; }
.knit-wrap .ed-canvas-wrap { background: #3b3431; }
.knit-top { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 10px; flex-wrap: wrap; }
.knit-note { background: var(--accent); color: #fff; border-radius: 14px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; font-size: 14px; max-width: 640px; }
.knit-note .btn { background: #fff; color: var(--accent-2); box-shadow: none; }
.knit-bottom { display: flex; justify-content: center; padding: 12px; }
.knit-counter { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 18px; padding: 8px 10px; box-shadow: var(--shadow-lg); }
.knit-counter .num { min-width: 120px; text-align: center; font: 800 20px/1 var(--font-display); }
.knit-counter .num small { display: block; font: 500 12px var(--font); color: var(--muted); margin-top: 4px; }
.knit-counter .icon-btn { width: 52px; height: 52px; border-radius: 14px; background: var(--bg-2); }
.knit-counts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.knit-counts span { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1); color: #fff; padding: 4px 8px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.knit-counts i { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }

/* preview */
.preview-wrap { position: relative; min-height: 0; display: grid; grid-template-rows: 1fr auto; background: radial-gradient(circle at 50% 40%, #fffaf3, #efe6db); }
.preview-stage { position: relative; min-height: 0; display: grid; place-items: center; padding: 16px; overflow: hidden; }
.preview-stage svg { width: 100%; height: 100%; max-width: 560px; max-height: 100%; }
.preview-stage canvas.swatch { max-width: 100%; max-height: 100%; border-radius: 18px; box-shadow: var(--shadow-lg); }
.preview-bar { display: flex; justify-content: center; padding: 12px; gap: 10px; flex-wrap: wrap; align-items: center; }

/* upload */
.drop { border: 2px dashed var(--line-2); border-radius: 18px; padding: 28px; text-align: center; background: var(--bg); cursor: pointer; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .ico { color: var(--accent); margin: 0 auto 8px; }
.up-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.up-preview { background: #fff; border: 1px solid var(--line); border-radius: 14px; min-height: 220px; display: grid; place-items: center; overflow: hidden; }
.up-preview canvas { max-width: 100%; max-height: 320px; image-rendering: pixelated; }
.slider-row { display: grid; gap: 4px; }
.slider-row .lbl { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; }
@media (max-width: 640px) { .up-grid { grid-template-columns: 1fr; } }
.start-options { display: grid; gap: 12px; }
.start-option { display: grid; justify-items: center; gap: 6px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fff; cursor: pointer; text-align: center; transition: border-color .15s, transform .15s; }
.start-option:hover { border-color: var(--ink); transform: translateY(-2px); }
.start-option b { font-size: 16px; }
.start-option span { color: var(--muted); font-size: 14px; }
.size-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 760px) {
  .ed-side { position: absolute; right: 0; top: 0; bottom: 0; z-index: 8; width: min(320px, 90vw); box-shadow: var(--shadow-lg); }
  .ed-strip { height: 64px; }
  .ed-top .hide-sm { display: none; }
  .ed-title { font-size: 17px; }
}

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- MVC (server-rendered) additions ---------- */
.pop-menu[hidden], .cookie-bar[hidden] { display: none !important; }
.pop-menu form { margin: 0; }
a.pop-item { text-decoration: none; color: inherit; }
.segmented a { color: var(--ink-2); }
.segmented a.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.profile-stats a { color: inherit; text-decoration: none; }
.profile-stats a:hover b { color: var(--accent); }
.msg-back { display: none; }
@media (max-width: 760px) { .msg-back { display: inline-flex; } }
.actions form { display: contents; }
.author-row form { margin: 0; }
dialog.native-dialog { border: 0; padding: 0; color: var(--ink); background: var(--card); }
dialog.native-dialog[open] { display: block; transform: none; }
dialog.native-dialog::backdrop { background: rgba(36, 28, 24, .45); }
dialog.native-dialog .field span { font-weight: 600; font-size: 14px; }
.comment form { margin: 0; }
.chart-view .canvas-host canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; border-radius: 10px; }

/* knit mode and preview fill the whole editor stage (the stage grid has a strip row + canvas row) */
.ed-stage > .knit-wrap, .ed-stage > .preview-wrap { grid-row: 1 / -1; min-height: 0; }
.knit-top .segmented button.active { color: var(--ink) !important; }
