/* =====================================================================
   The Colorist’s Muse — brand theme
   Ink & paper base, with accent colors taken from real marker inks.
   ===================================================================== */
:root {
  /* Base */
  --paper: #fbf8f4;
  --card: #ffffff;
  --ink: #241a33;
  --ink-2: #3a2e4a;
  --muted: #6e6580;
  --line: #ece6ee;
  --line-2: #e2daea;

  /* Marker inks */
  --coral: #ff7a59;
  --sun: #ffc23d;
  --teal: #18b6a4;
  --sky: #3fa7ff;
  --violet: #6c4cf1;
  --pink: #ff4f9a;

  --accent: var(--violet);
  --accent-soft: #f1ecff;
  --accent-ink: #5137d6;
  --grad: linear-gradient(135deg, #6c4cf1 0%, #a94cf0 48%, #ff4f9a 100%);
  --rainbow: linear-gradient(90deg, #ff7a59, #ffc23d, #18b6a4, #3fa7ff, #6c4cf1, #ff4f9a);

  --radius: 18px;
  --sh-1: 0 1px 2px rgba(36, 26, 51, .05), 0 6px 18px rgba(36, 26, 51, .06);
  --sh-2: 0 2px 6px rgba(36, 26, 51, .06), 0 18px 40px rgba(36, 26, 51, .10);
  --sh-btn: 0 6px 16px rgba(108, 76, 241, .28);

  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;

  font-family: var(--font);
  color: var(--ink);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  background:
    radial-gradient(900px 500px at 105% -10%, rgba(255, 79, 154, .07), transparent 60%),
    radial-gradient(800px 500px at -10% 10%, rgba(24, 182, 164, .07), transparent 60%),
    radial-gradient(700px 600px at 50% 120%, rgba(255, 194, 61, .08), transparent 60%),
    var(--paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--ink); }
h1 { margin: 0; font-size: 1.35rem; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; font-weight: 800; letter-spacing: -.01em; }
h3 { font-size: .98rem; margin: 1.2rem 0 .35rem; font-weight: 800; }
.tag { margin: 0; color: var(--muted); font-size: .85rem; }
code { background: #f4eff7; padding: 1px 6px; border-radius: 6px; font-size: .85em; }
::selection { background: #e6dcff; }

/* ---------------- Header ---------------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 14px 28px; position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .82); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar::before { /* signature ink stripe */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--rainbow);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo { width: 44px; height: 44px; flex: none; filter: drop-shadow(0 4px 10px rgba(108, 76, 241, .3)); }
.logo svg { width: 100%; height: 100%; display: block; }
.wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.wordmark h1 { font-family: var(--display); font-weight: 700; font-size: 1.45rem; letter-spacing: -.02em; }
.wordmark h1 em {
  font-style: italic; font-weight: 600; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wordmark .tag { margin-top: 3px; }

.tabs { display: flex; gap: 4px; background: #f4f0f8; padding: 5px; border-radius: 999px; border: 1px solid var(--line); }
.tab {
  border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  font: inherit; color: var(--muted); font-weight: 700; font-size: .92rem;
  display: inline-flex; align-items: center; gap: 7px; transition: background .15s, color .15s, box-shadow .15s;
}
.tab .ti { width: 18px; height: 18px; flex: none; }
.tab:hover { color: var(--ink); }
.tab.active { background: #fff; color: var(--accent-ink); box-shadow: 0 2px 8px rgba(36, 26, 51, .1); }
.pill { background: #e9e3ef; color: var(--ink-2); border-radius: 999px; padding: 1px 8px; font-size: .72rem; font-weight: 800; }
.tab.active .pill { background: var(--grad); color: #fff; }

/* ---------------- Layout ---------------- */
main { padding: 26px 28px 40px; max-width: 1480px; margin: 0 auto; }
.tabpanel { display: none; animation: fadeUp .35s ease both; }
.tabpanel.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-bottom: 20px; box-shadow: var(--sh-1);
}
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card { margin-top: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Card titles with an icon badge */
.ct { display: flex; align-items: center; gap: 10px; }
.ic {
  width: 34px; height: 34px; border-radius: 11px; display: inline-grid; place-items: center; flex: none; color: #fff;
  box-shadow: 0 4px 10px rgba(36, 26, 51, .12);
}
.ic svg { width: 19px; height: 19px; }
.ic-violet { background: linear-gradient(135deg, #7c5cff, #5a3be0); }
.ic-pink { background: linear-gradient(135deg, #ff6fb0, #ef3d86); }
.ic-teal { background: linear-gradient(135deg, #2fcab8, #0e9c8c); }
.ic-sun { background: linear-gradient(135deg, #ffd166, #f7a823); }
.ic-coral { background: linear-gradient(135deg, #ff9474, #f25f3c); }
.ic-sky { background: linear-gradient(135deg, #63b9ff, #2f88e8); }
.step-n {
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--grad); color: #fff; font-size: .8rem; font-weight: 800;
}

/* ---------------- Forms ---------------- */
.form, .controls { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; font-weight: 700; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 10px; }
label.inline input[type=range] { flex: 1; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 120px; }
input, select, textarea {
  font: inherit; font-weight: 500; color: var(--ink); padding: 9px 12px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #b9a6ff; box-shadow: 0 0 0 4px rgba(108, 76, 241, .14); }
input::placeholder, textarea::placeholder { color: #a79fb3; }
input[type=color] { padding: 3px; height: 42px; width: 100%; cursor: pointer; }
input[type=file] { padding: 7px; font-size: .85rem; background: #faf7fc; border-style: dashed; cursor: pointer; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 700; border: 0; border-radius: 9px; padding: 6px 12px; margin-right: 10px; cursor: pointer;
  background: var(--accent-soft); color: var(--accent-ink);
}
input[type=range] { padding: 0; accent-color: var(--accent); border: 0; }
input[type=range]:focus { box-shadow: none; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
textarea { width: 100%; resize: vertical; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.checks label, .check-line { flex-direction: row; align-items: center; font-weight: 600; color: var(--ink-2); }
.hint { color: var(--muted); font-size: .83rem; margin: .2rem 0; line-height: 1.5; }
.hidden { display: none !important; }
details.sub { margin-top: 16px; border-top: 1px dashed var(--line-2); padding-top: 12px; }
details.sub summary { cursor: pointer; font-weight: 800; color: var(--ink-2); }
details.sub .btn { margin-top: 8px; }

/* ---------------- Buttons ---------------- */
.btn {
  font: inherit; font-weight: 800; border: 1.5px solid var(--line-2); background: #fff; color: var(--ink);
  padding: 9px 16px; border-radius: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform .12s, box-shadow .15s, border-color .15s, background .15s, filter .15s;
}
.btn:hover { border-color: #c7b8ff; box-shadow: 0 4px 12px rgba(36, 26, 51, .08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: var(--sh-btn); }
.btn.primary:hover { filter: brightness(1.06) saturate(1.05); box-shadow: 0 10px 22px rgba(108, 76, 241, .34); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 11px; font-size: .82rem; flex: 1; border-radius: 10px; }
.btn.big { padding: 14px; font-size: 1.02rem; margin-top: 8px; border-radius: 14px; }
.btn.light { background: rgba(255, 255, 255, .9); border-color: transparent; }
label.btn { flex-direction: row; color: var(--ink); font-size: 1rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions .btn { padding: 8px 13px; font-size: .88rem; }
.btn.danger { background: #e0473a; border-color: #e0473a; color: #fff; }
.btn.danger:hover { filter: brightness(1.06); border-color: #e0473a; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.danger-text { color: #d23b2e; }

/* ---------------- Hero / welcome ---------------- */
.hero {
  position: relative; overflow: hidden; border-radius: 26px; margin-bottom: 22px; padding: 34px 38px;
  background:
    radial-gradient(420px 260px at 92% 20%, rgba(255, 79, 154, .16), transparent 70%),
    radial-gradient(380px 260px at 70% 110%, rgba(24, 182, 164, .16), transparent 70%),
    radial-gradient(360px 240px at 5% 0%, rgba(255, 194, 61, .18), transparent 70%),
    linear-gradient(180deg, #ffffff, #fdfaff);
  border: 1px solid var(--line); box-shadow: var(--sh-2);
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 24px; align-items: center;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent-soft); padding: 6px 12px; border-radius: 999px;
}
.hero h2 {
  font-family: var(--display); font-weight: 700; font-size: clamp(1.9rem, 3.4vw, 2.9rem); line-height: 1.05;
  letter-spacing: -.03em; margin: 14px 0 12px;
}
.hero h2 em { font-style: italic; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.04rem; color: var(--ink-2); line-height: 1.6; margin: 0 0 20px; max-width: 560px; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .cta .btn { padding: 12px 20px; font-size: .98rem; border-radius: 14px; }
.hero-art { display: flex; justify-content: center; }
.hero-art svg { width: 100%; max-width: 380px; height: auto; }
.steps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px; grid-column: 1 / -1; }
.step3 { display: flex; gap: 12px; align-items: flex-start; background: rgba(255, 255, 255, .75); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.step3 b { display: block; font-size: .95rem; margin-bottom: 2px; }
.step3 span.t { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.trust { grid-column: 1 / -1; display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: .83rem; font-weight: 700; margin-top: 4px; }
.trust span { display: inline-flex; align-items: center; gap: 6px; }
.trust svg { width: 16px; height: 16px; color: var(--teal); }

/* Collection summary (once there are markers) */
.hero.compact { grid-template-columns: 1fr auto; padding: 24px 30px; }
.hero.compact h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 8px 0 6px; }
.stats { display: flex; gap: 22px; flex-wrap: wrap; margin: 6px 0 14px; }
.stat b { display: block; font-family: var(--display); font-size: 1.9rem; line-height: 1; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.hero-strip { display: flex; flex-wrap: wrap; gap: 4px; max-width: 640px; }
.hero-strip i {
  width: 18px; height: 18px; border-radius: 6px 6px 8px 8px; display: block;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), inset 0 2px 0 rgba(255, 255, 255, .45);
}
.hero.compact .cta { flex-direction: column; align-items: stretch; }

/* ---------------- Scanner ---------------- */
.seg { display: flex; gap: 4px; background: #f4f0f8; padding: 4px; border-radius: 14px; margin: 10px 0 6px; flex-wrap: wrap; border: 1px solid var(--line); }
.segbtn {
  flex: 1 1 110px; border: 0; background: transparent; padding: 8px 10px; border-radius: 10px; font: inherit; font-size: .83rem;
  font-weight: 800; cursor: pointer; color: var(--muted); transition: background .15s, color .15s;
}
.segbtn:hover { color: var(--ink); }
.segbtn.active { background: #fff; color: var(--accent-ink); box-shadow: 0 2px 6px rgba(36, 26, 51, .1); }
.scan-wrap { margin: 10px 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #1d1626; }
#scanCanvas { width: 100%; cursor: crosshair; display: block; }
#scanCanvas.boxing { cursor: crosshair; touch-action: none; }
#gridOpts { align-items: flex-end; }
#gridOpts label { min-width: 90px; }
.autofind {
  display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding: 14px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(108, 76, 241, .08), rgba(255, 79, 154, .08)); border: 1px solid #e6dcfb;
}
.autofind .btn { align-self: flex-start; }
.review-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; margin: 10px 0; padding-right: 4px; }
.rv { display: grid; grid-template-columns: 24px 36px 1fr 1.4fr 28px; gap: 6px; align-items: center; padding: 3px; border-radius: 10px; }
.rv .n { color: var(--muted); font-size: .75rem; text-align: right; cursor: pointer; font-weight: 800; }
.rv input[type=color] { height: 34px; padding: 2px; }
.rv input { padding: 7px 9px; font-size: .86rem; min-width: 0; }
.rv.target { background: var(--accent-soft); outline: 2px solid var(--accent); }
.rv.target .n { color: var(--accent); }
.rv input.auto, .auto-key { background: #fff7d1; border-color: #f2d36e; }
.auto-key { padding: 0 6px; border-radius: 6px; border: 1px solid #f2d36e; }
.ocr-box { background: #f7f4ff; border: 1px solid #e6dcfb; border-radius: 16px; padding: 14px; margin: 8px 0 12px; display: flex; flex-direction: column; gap: 6px; }
.ocr-box .row label { min-width: 140px; }
.ocr-box .btn.small { flex: 0 0 auto; align-self: flex-start; }
.x { border: 0; background: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); border-radius: 8px; }
.x:hover { color: var(--ink); background: #f4f0f8; }
.flash { animation: flash 1.3s ease; }
@keyframes flash { 0%, 100% { box-shadow: var(--sh-1); } 30% { box-shadow: 0 0 0 5px rgba(108, 76, 241, .35), var(--sh-2); } }

/* ---------------- Collection: marker caps ---------------- */
.marker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 14px; }
.marker {
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fff; position: relative;
  box-shadow: 0 1px 2px rgba(36, 26, 51, .04); transition: transform .15s, box-shadow .15s;
}
.marker:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.marker .chip { height: 62px; position: relative; }
.marker .chip::after { /* glossy cap highlight */
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, 0) 38%),
    linear-gradient(0deg, rgba(0, 0, 0, .14) 0%, rgba(0, 0, 0, 0) 22%);
}
.marker .meta { padding: 8px 10px 10px; font-size: .78rem; border-top: 1px solid rgba(0, 0, 0, .05); }
.marker .code { font-weight: 900; font-size: .95rem; letter-spacing: -.01em; }
.marker .name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.marker .del {
  position: absolute; top: 6px; right: 6px; border: 0; background: rgba(255, 255, 255, .92); border-radius: 50%; z-index: 2;
  width: 24px; height: 24px; cursor: pointer; display: none; line-height: 1; font-weight: 800; color: var(--ink-2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.marker:hover .del { display: block; }
.selecting .marker { cursor: pointer; }
.selecting .marker .del { display: none !important; }
.marker.sel { outline: 3px solid #e0473a; outline-offset: -3px; }
.marker.sel::after {
  content: '✓'; position: absolute; top: 7px; left: 7px; width: 24px; height: 24px; border-radius: 50%; z-index: 2;
  background: #e0473a; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .8rem;
}
.erase-bar { background: #fff5f3; border: 1px solid #f6cfc8; border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.erase-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .86rem; }
.erase-row .btn.small { flex: 0 0 auto; }
.erase-row select { padding: 6px 10px; font-size: .86rem; }

/* ---------------- Empty states ---------------- */
.empty { color: var(--muted); text-align: center; padding: 34px 20px; line-height: 1.55; }
.empty .empty-art { display: block; margin: 0 auto 10px; width: 120px; height: auto; opacity: .95; }
.empty b { color: var(--ink-2); }

/* ---------------- Studio ---------------- */
.studio { display: grid; grid-template-columns: 300px 1fr 330px; gap: 20px; align-items: start; }
.studio > .card { margin-bottom: 0; }
@media (max-width: 1200px) { .studio { grid-template-columns: 290px 1fr; } .recipe { grid-column: 1 / -1; } }
@media (max-width: 800px) { .studio { grid-template-columns: 1fr; } }
.controls h2 { margin: 10px 0 2px; display: flex; align-items: center; gap: 10px; }
.controls h2:first-child { margin-top: 0; }
.controls hr { border: 0; border-top: 1px dashed var(--line-2); margin: 6px 0; width: 100%; }
.canvas-card { padding: 16px; }
.canvas-wrap {
  display: flex; justify-content: center; align-items: center; min-height: 460px; border-radius: 14px; padding: 18px;
  background-color: #f6f2f9;
  background-image: radial-gradient(#e2d9ea 1.2px, transparent 1.2px);
  background-size: 18px 18px;
}
#pageCanvas { max-width: 100%; height: auto; cursor: pointer; display: none; border-radius: 4px; box-shadow: 0 2px 4px rgba(36, 26, 51, .08), 0 18px 40px rgba(36, 26, 51, .16); }
#pageCanvas.ready { display: block; }
#regionInfo { text-align: center; margin-top: 10px; }

.palette-strip { display: flex; height: 52px; border-radius: 14px; overflow: hidden; margin-bottom: 14px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .08); }
.palette-strip div { flex: 1; }
.family { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: #fff; }
.family-title { font-weight: 800; font-size: .9rem; margin-bottom: 8px; display: flex; justify-content: space-between; }
.family-title span { color: var(--muted); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.mchip { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; background: #f7f4f9; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px 3px 3px; }
.mchip i { width: 22px; height: 22px; border-radius: 50%; display: inline-block; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12), inset 0 2px 0 rgba(255, 255, 255, .4); }
.steps { margin: 8px 0 0; padding-left: 18px; font-size: .83rem; color: var(--ink-2); line-height: 1.55; }
.patterns-used { font-size: .83rem; margin-top: 6px; }

.alt { display: flex; height: 38px; border-radius: 12px; overflow: hidden; cursor: pointer; margin-bottom: 8px; border: 2px solid transparent; box-shadow: 0 2px 6px rgba(36, 26, 51, .08); transition: transform .12s, border-color .12s; }
.alt:hover { border-color: var(--accent); transform: translateY(-1px); }
.alt div { flex: 1; }

/* ---------------- Saved ---------------- */
.saved-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.saved { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: #fff; box-shadow: var(--sh-1); transition: transform .15s, box-shadow .15s; }
.saved:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.saved img { width: 100%; display: block; background: #f6f2f9; }
.saved .body { padding: 14px; }
.saved .row { margin-top: 10px; }

/* ---------------- Popover & toast ---------------- */
.pop {
  position: fixed; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--sh-2); padding: 14px; width: 310px; max-height: 70vh; overflow: auto;
}
.pop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mini-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.mini-grid button { aspect-ratio: 1; border: 2px solid transparent; border-radius: 8px; cursor: pointer; padding: 0; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .1); }
.mini-grid button.sel { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: 999px; font-size: .92rem; font-weight: 700; z-index: 30; box-shadow: var(--sh-2);
  border-left: 5px solid transparent; border-image: var(--rainbow) 1; border-image-slice: 0 0 0 1;
}
.toast-btn { margin-left: 12px; background: none; border: 0; color: #d4c6ff; font: inherit; font-weight: 800; cursor: pointer; }

/* ---------------- Learn ---------------- */
.learn { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.learn > .card { margin-bottom: 0; }
.lessons { position: sticky; top: 96px; }
#lessonNav { display: flex; flex-direction: column; gap: 4px; }
#lessonNav button {
  text-align: left; border: 0; background: transparent; padding: 10px 11px; border-radius: 12px; font: inherit; cursor: pointer;
  display: flex; gap: 11px; align-items: center; color: var(--ink); font-weight: 700; transition: background .12s;
}
#lessonNav button > span:first-child {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: #f4f0f8; flex: none; font-size: 1rem;
}
#lessonNav button:hover { background: #f7f4fa; }
#lessonNav button.active { background: var(--accent-soft); color: var(--accent-ink); }
#lessonNav button.active > span:first-child { background: #fff; box-shadow: 0 2px 6px rgba(108, 76, 241, .2); }
#lessonNav small { display: block; color: var(--muted); font-weight: 600; font-size: .74rem; }
.lesson { max-width: 920px; padding: 26px 30px; }
.lesson-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.lesson-bar label.inline { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.lesson-bar select { max-width: 360px; min-width: 0; width: 100%; }
#lessonBody h2 { font-family: var(--display); font-size: 2rem; font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; }
#lessonBody h3 { font-size: 1.08rem; margin: 26px 0 8px; color: var(--accent-ink); }
#lessonBody p, #lessonBody li { line-height: 1.7; font-size: .95rem; color: var(--ink-2); }
#lessonBody ol, #lessonBody ul { padding-left: 22px; }
.lede { color: var(--muted) !important; font-size: 1.05rem !important; margin-top: 0; }
.demo { background: #f7f4f9; border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.demo > * { max-width: 100%; min-width: 0; }
.demo canvas { max-width: 100%; height: auto; border-radius: 10px; }
.demo .cap { font-size: .8rem; color: var(--muted); text-align: center; }
.demo .row .btn { min-width: 0; white-space: normal; }
.demo-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tip { background: linear-gradient(135deg, #f3eeff, #fff0f7); border: 1px solid #ebe0fb; border-radius: 14px; padding: 12px 16px; margin: 14px 0; font-size: .92rem; }
.tip b:first-child { color: var(--accent-ink); }
.use { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.qa { border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin: 8px 0; background: #fff; }
.qa summary { cursor: pointer; font-weight: 800; }
.qa p { margin: 8px 0 2px; }
.lesson-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.learn-link { color: var(--accent-ink); font-weight: 800; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- Footer ---------------- */
.site-foot {
  max-width: 1480px; margin: 0 auto; padding: 8px 28px 34px; display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .84rem; font-weight: 600;
}
.site-foot .fb { display: flex; align-items: center; gap: 10px; }
.site-foot .fb svg { width: 28px; height: 28px; }
.site-foot .fb b { font-family: var(--display); color: var(--ink); font-size: 1rem; }
.site-foot .ink { height: 4px; width: 100%; background: var(--rainbow); border-radius: 4px; opacity: .55; flex-basis: 100%; }

/* ---------------- Narrow windows ---------------- */
.grid-2 > *, .studio > *, .learn > *, .card, .row > *, .erase-row > * { min-width: 0; }
select, input, textarea { max-width: 100%; }
@media (max-width: 1000px) {
  .topbar { gap: 10px; }
  .tabs { width: 100%; border-radius: 16px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 auto; justify-content: center; }
  .hero { grid-template-columns: 1fr; padding: 28px 24px; }
  .hero-art { display: none; }
  .hero.compact { grid-template-columns: 1fr; }
  .hero.compact .cta { flex-direction: row; }
}
@media (max-width: 800px) {
  .learn { grid-template-columns: 1fr; }
  .lessons { position: static !important; }
  .steps3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 12px 10px; position: static; }
  .tab { padding: 7px 10px; font-size: .84rem; }
  .tab .ti { display: none; }
  main { padding: 14px 10px 30px; }
  .card { padding: 16px 14px; border-radius: 16px; }
  .hero { padding: 22px 18px; border-radius: 20px; }
  .row > label { flex: 1 1 100%; }
  .wordmark h1 { font-size: 1.15rem; }
  .logo { width: 36px; height: 36px; }
  .rv { grid-template-columns: 18px 30px 1fr 1fr 24px; gap: 4px; }
  .lesson { padding: 18px 14px; }
  #lessonBody h2 { font-size: 1.55rem; }
}

.marker .approx { position: absolute; left: 6px; bottom: 6px; z-index: 2; font-size: .66rem; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,.92); color: var(--ink-2); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
#bulkResult:empty { display: none; }

/* =====================================================================
   Layout v3: dark "marker case" sidebar, serif headings with a marker swipe,
   a progress track for the steps, gradient buttons. Built on the app's own
   violet / pink / ink palette.
   ===================================================================== */
:root {
  --paper: #f6f4fb;
  --ink: #241a33;
  --ink-2: #3a2e4a;
  --muted: #6e6580;
  --line: #e7e1ef;
  --line-2: #dcd3e8;
  --case: #211731;
  --case-2: #2c2040;
  --accent: #6c4cf1;
  --accent-soft: #f1ecff;
  --accent-ink: #5137d6;
  --grad: linear-gradient(135deg, #6c4cf1 0%, #a94cf0 48%, #ff4f9a 100%);
  --radius: 20px;
}
body {
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(255, 79, 154, .08), transparent 60%),
    radial-gradient(800px 520px at 20% 0%, rgba(108, 76, 241, .07), transparent 60%),
    radial-gradient(700px 600px at 60% 115%, rgba(24, 182, 164, .08), transparent 60%),
    var(--paper);
  background-attachment: fixed;
}

/* ---- Shell: sidebar flush to the left edge, page beside it ---- */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; align-items: start; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--case-2), var(--case) 60%);
  color: #e9e3f3; padding: 24px 14px 18px; display: flex; flex-direction: column; gap: 22px;
  border-radius: 0 26px 26px 0; box-shadow: 6px 0 30px rgba(36, 26, 51, .12);
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.sidebar .logo { width: 44px; height: 44px; filter: drop-shadow(0 4px 12px rgba(169, 76, 240, .45)); }
.sidebar .wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.sidebar .wordmark b { font-family: var(--display); font-weight: 700; font-size: 1.2rem; color: #fff; letter-spacing: -.01em; }
.sidebar .wordmark span { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 1.15rem; background: linear-gradient(90deg, #c4b2ff, #ff8cc0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.side-nav { display: flex; flex-direction: column; gap: 3px; background: none; border: 0; padding: 0; border-radius: 0; }
.side-nav .tab {
  position: relative; width: 100%; justify-content: flex-start; gap: 12px; padding: 11px 14px; border-radius: 12px;
  font-weight: 700; font-size: .95rem; color: #cfc5df; letter-spacing: 0; text-transform: none;
}
.side-nav .tab .ti { width: 20px; height: 20px; opacity: .85; }
.side-nav .tab:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav .tab.active { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: none; }
.side-nav .tab.active::before { /* a marker stroke down the left edge */
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 5px; border-radius: 0 5px 5px 0; background: var(--grad);
}
.side-nav .tab.active .ti { opacity: 1; color: #ffb3d4; }
.side-nav .tab .tl { flex: 1; text-align: left; }
.side-nav .pill { background: rgba(255, 255, 255, .12); color: #e9e3f3; }
.side-nav .tab.active .pill { background: var(--grad); color: #fff; }
.side-foot { margin-top: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .05); color: #b6abc8; font-size: .78rem; font-weight: 600; line-height: 1.45; }
.side-foot svg { width: 17px; height: 17px; flex: none; color: #7ee0d2; margin-top: 1px; }
main { padding: 30px 38px 40px; max-width: 1380px; margin: 0; }

/* ---- Page headers: serif title with a highlighter swipe ---- */
.page-head { margin: 0 0 24px; }
.page-title {
  display: inline; font-family: var(--display); font-weight: 700; font-size: clamp(1.9rem, 3vw, 2.45rem); letter-spacing: -.02em; color: var(--ink);
  line-height: 1.15; background: linear-gradient(transparent 64%, rgba(255, 194, 61, .5) 64%, rgba(255, 194, 61, .5) 92%, transparent 92%);
  padding: 0 4px; margin-left: -4px; text-transform: none;
}
.page-sub { margin: 10px 0 0; color: var(--muted); font-size: 1rem; max-width: 640px; line-height: 1.55; }

/* ---- Cards & titles ---- */
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: 0 1px 2px rgba(36, 26, 51, .04), 0 10px 26px rgba(36, 26, 51, .06); }
h2, .card h2, .ct { font-family: var(--font); font-weight: 800; text-transform: none; letter-spacing: -.01em; font-size: 1.08rem; color: var(--ink); }
h3 { font-family: var(--font); font-weight: 800; text-transform: none; letter-spacing: 0; font-size: .98rem; color: var(--ink); }
.sec { margin: 0 0 4px; font-size: 1.22rem; font-family: var(--display); font-weight: 700; letter-spacing: -.01em; }
.sec-2 { margin-top: 26px; }
input, select, textarea { border: 1.5px solid var(--line-2); border-radius: 12px; }
input:focus, select:focus, textarea:focus { border-color: #b9a6ff; box-shadow: 0 0 0 4px rgba(108, 76, 241, .14); }
input[type=file]::file-selector-button { background: var(--accent-soft); color: var(--accent-ink); }
input[type=range], input[type=checkbox] { accent-color: var(--accent); }

/* ---- Buttons: rounded rectangles; primary is the brand gradient ---- */
.btn { border-radius: 12px; border: 1.5px solid var(--line-2); padding: 9px 18px; font-weight: 800; color: var(--ink); }
.btn:hover { border-color: #c7b8ff; box-shadow: 0 4px 12px rgba(36, 26, 51, .08); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(108, 76, 241, .28); }
.btn.primary:hover { filter: brightness(1.06) saturate(1.05); background: var(--grad); box-shadow: 0 10px 22px rgba(108, 76, 241, .34); }
.btn.primary:active { transform: translateY(0); box-shadow: 0 4px 10px rgba(108, 76, 241, .25); }
.btn.small { border-radius: 10px; padding: 7px 12px; }
.btn.big, .btn.danger { border-radius: 12px; }
.seg { background: #f1edf7; border: 1px solid var(--line); border-radius: 14px; }
.segbtn { border-radius: 10px; }
.segbtn.active { color: var(--accent-ink); background: #fff; }
.autofind { background: linear-gradient(135deg, rgba(108, 76, 241, .07), rgba(255, 79, 154, .07)); border: 1px solid #e6dcfb; border-radius: 16px; }
.ocr-box { background: #f7f4ff; border: 1px solid #e6dcfb; border-radius: 16px; }
.rv.target { background: var(--accent-soft); outline-color: var(--accent); }
.rv.target .n { color: var(--accent); }
.flash { animation: flash3 1.3s ease; }
@keyframes flash3 { 0%, 100% { box-shadow: 0 10px 26px rgba(36, 26, 51, .06); } 30% { box-shadow: 0 0 0 5px rgba(108, 76, 241, .3), 0 10px 26px rgba(36, 26, 51, .1); } }

/* ---- Home hero ---- */
.hero { border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 2px 6px rgba(36, 26, 51, .05), 0 18px 40px rgba(36, 26, 51, .08);
  background: radial-gradient(420px 260px at 92% 20%, rgba(255, 79, 154, .14), transparent 70%), radial-gradient(380px 260px at 70% 110%, rgba(24, 182, 164, .14), transparent 70%), radial-gradient(360px 240px at 5% 0%, rgba(255, 194, 61, .16), transparent 70%), linear-gradient(180deg, #fff, #fdfbff); }
.hero .eyebrow { font-family: var(--font); color: var(--accent-ink); background: var(--accent-soft); }
.hero h2 { font-family: var(--display); font-weight: 700; text-transform: none; letter-spacing: -.03em; font-size: clamp(1.9rem, 3.4vw, 2.9rem); line-height: 1.05; }
.hero h2 em { font-style: italic; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.hero .cta .btn { border-radius: 14px; padding: 12px 20px; }
.step3 { border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .8); }
.stat b { font-family: var(--display); font-weight: 700; color: var(--ink); }
.trust svg { color: var(--teal); }

/* ---- Steps: a progress track with numbered dots ---- */
.stepper { display: flex; gap: 0; margin: 0 0 22px; max-width: 760px; counter-reset: none; }
.stp {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px;
  background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--muted); font-weight: 700; font-size: .84rem;
}
.stp::after { /* the track between dots */
  content: ''; position: absolute; top: 16px; left: calc(50% + 20px); right: calc(-50% + 20px); height: 3px; border-radius: 3px; background: var(--line-2);
}
.stp:last-child::after { display: none; }
.stp .num {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem;
  background: #fff; border: 2px solid var(--line-2); color: var(--muted); position: relative; z-index: 1; transition: all .15s;
}
.stp:hover .num { border-color: #b9a6ff; color: var(--accent-ink); }
.stp.done { color: var(--ink-2); }
.stp.done .num { background: var(--accent-soft); border-color: #cbbcff; color: var(--accent-ink); }
.stp.done::after { background: linear-gradient(90deg, #a48fff, #cbbcff); }
.stp.active { color: var(--ink); }
.stp.active .num { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 0 0 5px rgba(108, 76, 241, .14), 0 6px 14px rgba(108, 76, 241, .3); }
.wiz-step > .card { max-width: 980px; }
.wiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 980px; margin-top: 6px; }
.wiz-nav .btn { padding: 11px 24px; font-size: 1rem; }

/* Step 1: choose a page */
.dropzone {
  margin: 16px 0 6px; border: 1.5px solid #e2d9fb; border-radius: 18px; position: relative;
  background: linear-gradient(135deg, #f6f2ff, #fff5fa); min-height: 170px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 24px; cursor: pointer; color: var(--muted);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.dropzone:hover, .dropzone.over { border-color: #b9a6ff; box-shadow: 0 0 0 5px rgba(108, 76, 241, .1); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone .dz-ic { width: 54px; height: 54px; padding: 13px; border-radius: 16px; color: #fff; background: var(--grad); box-shadow: 0 8px 18px rgba(108, 76, 241, .3); margin-bottom: 6px; }
.dropzone b { font-family: var(--display); font-weight: 700; font-size: 1.12rem; color: var(--ink); text-transform: none; letter-spacing: -.01em; }
.dropzone span { font-size: .88rem; font-weight: 600; }
.dropzone .browse { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.page-thumb { display: flex; gap: 16px; align-items: center; margin: 12px 0 4px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.page-thumb img { width: 104px; height: 104px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.page-thumb b { display: block; text-transform: none; letter-spacing: 0; font-size: .95rem; margin-bottom: 2px; }
.or { margin: 18px 0 8px; font-weight: 800; color: var(--ink-2); font-size: .9rem; }
.wiz-step .row .btn.small { flex: 0 0 auto; }
.wiz-step label.inline { margin-top: 14px; max-width: 520px; }

/* Step 2 & 3: pick cards */
.chips-pick { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 6px; }
.chip-pick {
  font: inherit; font-weight: 700; font-size: .92rem; color: var(--ink); background: #fff; cursor: pointer;
  border: 1.5px solid var(--line-2); border-radius: 12px; padding: 9px 14px; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.chip-pick:hover { border-color: #c7b8ff; }
.chip-pick.active { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 76, 241, .12); color: var(--accent-ink); }
.vibe-more { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 22px; margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line-2); }
.vibe-more label.inline { margin-top: 0; }
.brand-pick .chip-pick.brand { border-radius: 16px; padding: 14px 16px; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 190px; position: relative; }
.brand-pick .chip-pick.brand b { text-transform: none; letter-spacing: 0; font-size: 1rem; }
.brand-pick .chip-pick.brand small { color: var(--muted); font-weight: 700; }
.brand-pick .dots { display: flex; gap: 3px; margin-top: 4px; }
.brand-pick .dots i { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.brand-pick .tick { position: absolute; top: 10px; right: 12px; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: .75rem; background: #eee9f5; color: transparent; }
.brand-pick .chip-pick.active .tick { background: var(--grad); color: #fff; }

/* Step 4 & 5 */
.wiz-step .checks { margin-top: 16px; max-width: 520px; }
.wiz-step .check-line { margin-top: 12px; }
.make-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.studio.make { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1200px) { .studio.make { grid-template-columns: 1fr; } }
.canvas-wrap { border-radius: 16px; background-color: #f6f2f9; background-image: radial-gradient(#e2d9ea 1.2px, transparent 1.2px); }
.saved { border-radius: 18px; }
#lessonBody h2 { font-family: var(--display); font-weight: 700; text-transform: none; letter-spacing: -.02em; font-size: 2rem; }
#lessonBody h3 { color: var(--accent-ink); }
.lessons { top: 24px; }

/* ---- Narrow windows: the sidebar becomes a dark bar across the top ---- */
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 15; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 0 0 20px 20px; overflow: visible; min-width: 0; }
  .sidebar .brand { padding: 0; }
  .sidebar .logo { width: 36px; height: 36px; }
  .sidebar .wordmark { display: none; }
  .side-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav .tab { width: auto; flex: 0 0 auto; padding: 9px 12px; gap: 8px; font-size: .86rem; }
  .side-nav .tab .ti { display: inline; width: 19px; height: 19px; }
  .side-nav .tab.active::before { left: 10px; right: 10px; top: auto; bottom: 2px; width: auto; height: 3px; border-radius: 3px; }
  .side-foot { display: none; }
  main { padding: 18px 14px 30px; }
  .page-head { margin-bottom: 18px; }
}
@media (max-width: 560px) {
  .side-nav .tab .tl { display: none; }
  .side-nav .tab.active .tl { display: inline; }
  .card { padding: 18px 16px; border-radius: 18px; }
  .stp { font-size: .7rem; }
  .stp .num { width: 30px; height: 30px; font-size: .82rem; }
  .stp::after { top: 14px; left: calc(50% + 17px); right: calc(-50% + 17px); }
  .brand-pick .chip-pick.brand { min-width: 0; flex: 1 1 100%; }
}

/* Review list: label pictures, duplicate codes, unsure guesses */
.rv-label { grid-column: 3 / 5; max-width: 100%; height: 34px; object-fit: contain; object-position: left center; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.rv-warn { grid-column: 3 / 5; font-size: .78rem; font-weight: 800; color: #c0392b; }
.rv-warn:empty { display: none; }
.rv.dup { background: #fff1ef; outline: 2px solid #f0a59b; }
.rv.dup input[data-f=code] { border-color: #e0473a; background: #fff; }
.rv input.guess::placeholder { color: #c2185b; font-weight: 800; }
.rv input.guess { border-style: dashed; border-color: #f3a7c1; }
.rv { row-gap: 4px; padding: 5px; }

/* Help page */
.help { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.help > .card { margin-bottom: 0; }
.help-nav { position: sticky; top: 24px; }
#helpNav { display: flex; flex-direction: column; gap: 2px; }
#helpNav a { padding: 9px 11px; border-radius: 10px; color: var(--ink); font-weight: 700; text-decoration: none; font-size: .93rem; }
#helpNav a:hover { background: #f7f4fa; }
#helpNav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.help-body { max-width: 900px; }
.help-topic { scroll-margin-top: 20px; }
.help-topic p, .help-topic li, .help-topic dd { line-height: 1.65; color: var(--ink-2); font-size: .95rem; }
.help-topic ol, .help-topic ul { padding-left: 22px; }
.help-topic li { margin: 4px 0; }
.help-topic h3 { margin: 20px 0 6px; color: var(--accent-ink); }
.help-topic a, .help-go { color: var(--accent-ink); font-weight: 800; text-underline-offset: 3px; }
.help-dl { margin: 10px 0; }
.help-dl dt { font-weight: 800; color: var(--ink); margin-top: 12px; }
.help-dl dd { margin: 3px 0 0 0; }
.help-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-weight: 800; font-size: .84rem; text-decoration: none; white-space: nowrap; margin-right: 10px; }
.help-link span { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-size: .74rem; font-weight: 900; }
.help-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.page-sub .help-link { margin-left: 6px; }
@media (max-width: 800px) { .help { grid-template-columns: 1fr; } .help-nav { position: static; } #helpNav { flex-direction: row; flex-wrap: wrap; } }
@media (max-width: 960px) { .help-topic { scroll-margin-top: 84px; } }

/* Plans page, pages-left counter, pop-ups */
.side-upgrade {
  display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 14px; text-decoration: none;
  background: linear-gradient(135deg, rgba(108, 76, 241, .35), rgba(255, 79, 154, .3)); color: #fff; font-size: .82rem; font-weight: 700;
  border: 1px solid rgba(255, 255, 255, .12); margin-top: auto;
}
.side-upgrade b { font-size: .9rem; }
.side-upgrade:hover { filter: brightness(1.1); }
.side-upgrade + .side-foot { margin-top: 0; }
.step-allowance { margin: 2px 0 0; font-size: .88rem; font-weight: 700; color: var(--accent-ink); }
.step-allowance a { color: var(--accent-ink); font-weight: 800; }
.allowance.out .allowance-text { color: #c0392b; }
.side-upgrade.allowance.out .allowance-text { color: #ffd1cc; }
.rights-note { margin-top: 4px; }
.rights-note a { color: var(--accent-ink); font-weight: 800; }

.plans-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.plan-current { margin: 0; font-weight: 700; color: var(--ink-2); }
.billing { margin: 0; min-width: 300px; }
.billing small { font-weight: 700; color: var(--teal); margin-left: 4px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin-bottom: 22px; align-items: stretch; }
.plan {
  background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 22px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 1px 2px rgba(36, 26, 51, .04), 0 10px 26px rgba(36, 26, 51, .06); position: relative;
}
.plan.best { border: 2px solid transparent; background: linear-gradient(#fff, #fff) padding-box, var(--grad) border-box; box-shadow: 0 14px 34px rgba(108, 76, 241, .18); }
.plan.current { outline: 2px dashed #cbbcff; outline-offset: -8px; }
.plan-tag { align-self: flex-start; font-size: .74rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.plan.best .plan-tag { background: var(--grad); color: #fff; }
.plan-name { font-family: var(--display); font-size: 1.5rem; font-weight: 700; margin: 4px 0 0; letter-spacing: -.01em; }
.price { display: flex; align-items: baseline; gap: 6px; }
.price b { font-family: var(--display); font-size: 2.3rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.price span { color: var(--muted); font-weight: 700; }
.plan small { color: var(--muted); font-weight: 600; margin-top: -6px; }
.plan-blurb { color: var(--ink-2); margin: 2px 0 4px; line-height: 1.5; font-size: .93rem; }
.plan-feats { list-style: none; padding: 0; margin: 4px 0 12px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.plan-feats li { position: relative; padding-left: 26px; font-size: .9rem; line-height: 1.45; color: var(--ink-2); }
.plan-feats li::before { content: ''; position: absolute; left: 0; top: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235137d6' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4 4L18.5 7.5'/%3E%3C/svg%3E") center / 11px no-repeat; }
.soon { font-size: .68rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: #fff3d1; color: #9a6a00; vertical-align: 1px; margin-left: 4px; }
.plan-btn { width: 100%; padding: 11px 16px; }
.plan-faq .qa { margin: 8px 0; }

.modal { position: fixed; inset: 0; z-index: 40; background: rgba(33, 23, 49, .45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 18px; animation: fadeUp .2s ease both; }
.modal-card { position: relative; background: #fff; border-radius: 22px; padding: 28px 26px 24px; max-width: 440px; width: 100%; box-shadow: 0 30px 70px rgba(36, 26, 51, .3); text-align: center; }
.modal-card .x { position: absolute; top: 10px; right: 12px; }
.modal-card p { color: var(--ink-2); line-height: 1.6; }
.modal-art { font-size: 2.4rem; margin-bottom: 4px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
@media (max-width: 960px) { .side-upgrade { display: none; } }
@media (max-width: 560px) { .billing { min-width: 0; width: 100%; } }

/* License key box */
.license-card { max-width: 760px; }
.license-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.license-form input { flex: 1 1 280px; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
.license-on p { font-weight: 700; color: var(--ink-2); margin: 8px 0; }
.license-on .row .btn.small { flex: 0 0 auto; }
.license-msg { min-height: 1.2em; font-weight: 700; }
.license-msg.bad { color: #c0392b; }
.chip-group { flex-basis: 100%; font-weight: 800; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 0 0; }

/* =====================================================================
   Muse theme (matches the Colorist's Muse logo): cream paper, deep plum
   sidebar with stitching, magenta-plum accents, and the logo's swatch colors
   (rose pink, honey, sage, sky blue, lavender). Handwritten accents and washi tape.
   ===================================================================== */
:root {
  --paper: #fbf6f1;
  --card: #fffdfb;
  --ink: #3a2140;
  --ink-2: #57385c;
  --muted: #7a6580;
  --line: #f0e4ea;
  --line-2: #e4d3df;
  --accent: #a33f7f;
  --accent-soft: #f8e7f0;
  --accent-ink: #80245e;
  --rose: #e27aa6;
  --honey: #f0b45e;
  --sage: #93b56a;
  --sky: #7ea6d8;
  --lavender: #b68ad8;
  --plum: #8a4b9a;
  --teal: #5a8236; /* sage green, dark enough to read as text */
  --violet: #8a4b9a;
  --pink: #c9548a;
  --grad: linear-gradient(135deg, #8f4fb3 0%, #a33f7f 52%, #c9548a 100%);
  --case: #3b2042;
  --case-2: #4f2b58;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
}
body {
  color: var(--ink);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .40 0 0 0 0 .25 0 0 0 0 .38 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(900px 520px at 100% -10%, rgba(226, 122, 166, .13), transparent 60%),
    radial-gradient(800px 560px at 15% 0%, rgba(182, 138, 216, .12), transparent 60%),
    radial-gradient(760px 620px at 70% 115%, rgba(147, 181, 106, .12), transparent 60%),
    var(--paper);
  background-attachment: fixed;
}
::selection { background: #f3d3e4; }
code { background: #f5e9ef; }

/* Sidebar: deep plum with a stitched edge */
.sidebar { background: linear-gradient(180deg, var(--case-2), var(--case) 65%); color: #f7eef4; box-shadow: 6px 0 30px rgba(58, 33, 64, .18); }
.sidebar::after { content: ''; position: absolute; inset: 9px; border: 2px dashed rgba(255, 228, 244, .17); border-radius: 0 20px 20px 0; border-left: 0; pointer-events: none; }
.sidebar .wordmark b { color: #fff7fb; }
.sidebar .wordmark span { font-family: var(--hand); font-style: normal; font-weight: 700; font-size: 1.55rem; line-height: .9; background: linear-gradient(90deg, #f7b6d3, #cfa9f2); -webkit-background-clip: text; background-clip: text; color: transparent; }
.side-nav .tab { color: #ead9e6; }
.side-nav .tab:hover { background: rgba(255, 232, 246, .07); color: #fff7fb; }
.side-nav .tab.active { background: rgba(255, 232, 246, .12); color: #fff7fb; }
.side-nav .tab.active .ti { color: #f7b6d3; }
.side-nav .pill { background: rgba(255, 232, 246, .14); color: #f7eef4; }
.side-upgrade { background: linear-gradient(135deg, rgba(182, 138, 216, .42), rgba(226, 122, 166, .38)); }
.side-foot { background: rgba(255, 232, 246, .06); color: #d4bfd0; }
.side-foot svg { color: #b9d39a; }
@media (max-width: 960px) { .sidebar::after { inset: 6px; border-radius: 0 0 16px 16px; border-left: 2px dashed rgba(255, 228, 244, .17); border-top: 0; } }

/* Titles: rose highlighter; handwritten little labels */
.page-title { color: var(--ink); background: linear-gradient(transparent 62%, rgba(226, 122, 166, .32) 62%, rgba(226, 122, 166, .32) 90%, transparent 90%); }
.hero .eyebrow, .plan-tag, .step-allowance, .chip-group {
  font-family: var(--hand); font-weight: 700; letter-spacing: 0; text-transform: none;
}
.hero .eyebrow { font-size: 1.25rem; padding: 2px 14px; background: #f8e7f0; color: var(--accent-ink); }
.plan-tag { font-size: 1.1rem; padding: 0 12px; }
.chip-group { font-size: 1.25rem; color: var(--accent-ink); }
.step-allowance { font-size: 1.2rem; color: var(--accent-ink); }
.step-allowance .hint { font-family: var(--font); font-size: .82rem; }

/* Cards on cream paper, with a strip of washi tape on the big ones */
.card, .plan, .saved, .family, .marker, .qa, .step3, .page-thumb { background: var(--card); border-color: var(--line); }
.card { box-shadow: 0 1px 2px rgba(58, 33, 64, .04), 0 10px 26px rgba(110, 60, 110, .07); }
.hero { background: radial-gradient(420px 260px at 92% 20%, rgba(226, 122, 166, .15), transparent 70%), radial-gradient(380px 260px at 70% 110%, rgba(147, 181, 106, .15), transparent 70%), radial-gradient(360px 240px at 5% 0%, rgba(182, 138, 216, .16), transparent 70%), var(--card); overflow: visible; }
.hero::before, .wiz-step > .card::before, .plan.best::before {
  content: ''; position: absolute; top: -11px; left: 38px; width: 112px; height: 26px; transform: rotate(-3deg); border-radius: 3px; pointer-events: none;
  background: repeating-linear-gradient(45deg, rgba(147, 181, 106, .55) 0 8px, rgba(172, 200, 138, .55) 8px 16px);
  box-shadow: 0 1px 2px rgba(58, 33, 64, .08);
}
.wiz-step > .card { position: relative; }
.wiz-step > .card::before { left: auto; right: 34px; transform: rotate(4deg); background: repeating-linear-gradient(45deg, rgba(182, 138, 216, .5) 0 8px, rgba(204, 170, 230, .5) 8px 16px); }
.plan.best::before { left: 50%; margin-left: -56px; background: repeating-linear-gradient(45deg, rgba(226, 122, 166, .45) 0 8px, rgba(240, 160, 194, .45) 8px 16px); }
.hero h2 em { background: var(--grad); -webkit-background-clip: text; background-clip: text; }
.step3 { background: rgba(255, 253, 251, .85); }
.trust svg { color: var(--sage); }

/* Controls in plum and rose */
.btn:hover { border-color: #e2b4cf; }
.btn.primary { box-shadow: 0 6px 16px rgba(163, 63, 127, .28); }
.btn.primary:hover { box-shadow: 0 10px 22px rgba(163, 63, 127, .34); }
input:focus, select:focus, textarea:focus { border-color: #d99cc0; box-shadow: 0 0 0 4px rgba(163, 63, 127, .13); }
.seg { background: #f5eaf0; }
.autofind { background: linear-gradient(135deg, rgba(182, 138, 216, .1), rgba(226, 122, 166, .08)); border-color: #eed5e3; }
.ocr-box { background: #fbf2f6; border-color: #eedfe8; }
.tip { background: linear-gradient(135deg, #fbeff6, #f4effb); border-color: #eedbe7; }
.ic-violet { background: linear-gradient(135deg, #b68ad8, #8a4b9a); }
.ic-pink { background: linear-gradient(135deg, #ec95ba, #c9548a); }
.ic-teal { background: linear-gradient(135deg, #a9c784, #7a9c52); }
.ic-sky { background: linear-gradient(135deg, #9dbde6, #6a90c2); }

/* Steps, chips, upload box */
.stp:hover .num { border-color: #d99cc0; }
.stp.done .num { background: var(--accent-soft); border-color: #e8bfd6; color: var(--accent-ink); }
.stp.done::after { background: linear-gradient(90deg, #d696bb, #ecc8dc); }
.stp.active .num { box-shadow: 0 0 0 5px rgba(163, 63, 127, .13), 0 6px 14px rgba(163, 63, 127, .3); }
.chip-pick:hover { border-color: #e2b4cf; }
.chip-pick.active { box-shadow: 0 0 0 3px rgba(163, 63, 127, .12); }
.dropzone { background: linear-gradient(135deg, #fbeff6, #f6f0fa); border-color: #e9d2e1; }
.dropzone:hover, .dropzone.over { border-color: #d48fb8; box-shadow: 0 0 0 5px rgba(163, 63, 127, .1); }
.dropzone .dz-ic { box-shadow: 0 8px 18px rgba(163, 63, 127, .3); }
.canvas-wrap { background-color: #f8eff3; background-image: radial-gradient(#e6d2de 1.2px, transparent 1.2px); }
.plan-feats li::before { background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2380245e' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4 4L18.5 7.5'/%3E%3C/svg%3E") center / 11px no-repeat; }
.plan.best { box-shadow: 0 14px 34px rgba(163, 63, 127, .18); }
.plan.current { outline-color: #e8bfd6; }
.soon { background: #fdefd3; color: #8a5a00; }
.toast { background: var(--case); }
.modal { background: rgba(59, 32, 66, .45); }
.help-link span { background: var(--accent-soft); }
#lessonNav button > span:first-child { background: #f5eaf0; }
.rv.target { background: var(--accent-soft); }
a.btn { text-decoration: none; }
.btn.primary:active { box-shadow: 0 4px 10px rgba(163, 63, 127, .25); }
#lessonNav button.active > span:first-child { box-shadow: 0 2px 6px rgba(163, 63, 127, .2); }
.flash { animation: flashMuse 1.3s ease; }
@keyframes flashMuse { 0%, 100% { box-shadow: 0 10px 26px rgba(58, 33, 64, .06); } 30% { box-shadow: 0 0 0 5px rgba(163, 63, 127, .3), 0 10px 26px rgba(58, 33, 64, .1); } }

/* Help → Privacy: stats switch */
label.check { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 6px 0 2px; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Supplies: little type badge on each color, supply cards in Learn */
.marker .name .kind { margin-right: 4px; font-size: .85em; }
#kindFilter { max-width: 220px; }
details.supply { border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 10px 0; background: var(--card); }
details.supply summary { cursor: pointer; font-weight: 800; }
details.supply summary small { font-weight: 700; color: var(--accent-ink); margin-left: 6px; }
.row > label:has(#scanSupply) { flex-basis: 100%; }

/* Brand logo (The Colorist's Muse app icon) */
.sidebar .logo { width: 56px; height: 56px; flex: 0 0 auto; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .28)); }
.sidebar .logo img { display: block; width: 100%; height: 100%; }
@media (max-width: 960px) { .sidebar .logo { width: 40px; height: 40px; } }

/* Coloring books: shelf of covers, book view with a grid of pages */
.book-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.book-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 26px rgba(110, 60, 110, .07); }
.book-cover { display: block; padding: 0; border: 0; background: #f5eaf0; cursor: pointer; aspect-ratio: 8.5 / 11; overflow: hidden; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.book-cover:hover img { transform: scale(1.03); }
.book-info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.book-info h3 { margin: 0; font-family: var(--display); font-size: 1.15rem; line-height: 1.2; }
.book-info .row { flex-wrap: wrap; gap: 8px; }
.book-badge { align-self: flex-start; font-size: .8rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.book-badge.on { background: #ecf3e3; color: #4c6f2c; }
.book-head { display: flex; gap: 18px; align-items: flex-start; margin-top: 12px; }
.book-head-cover { width: 110px; border-radius: 10px; box-shadow: 0 6px 16px rgba(58, 33, 64, .15); flex: 0 0 auto; }
.book-head > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.book-head .sec { margin: 0; }
.book-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; margin-top: 18px; }
.book-page { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; cursor: pointer; aspect-ratio: 8.5 / 11; transition: transform .15s ease, box-shadow .15s ease; }
.book-page:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(110, 60, 110, .14); }
.book-page img { width: 100%; height: 100%; object-fit: contain; display: block; }
.book-page.locked img { opacity: .35; filter: blur(1.5px); }
.book-page .bp-n { position: absolute; left: 6px; bottom: 6px; font-size: .75rem; font-weight: 800; background: rgba(255, 253, 251, .92); color: var(--ink-2); padding: 1px 7px; border-radius: 999px; }
.book-page .bp-tag { position: absolute; right: 6px; top: 6px; font-size: .72rem; font-weight: 800; background: var(--grad); color: #fff; padding: 2px 8px; border-radius: 999px; }
.book-page .bp-lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem; }
.book-code-card .license-form, .book-head .license-form { margin-top: 4px; }
@media (max-width: 600px) {
  .book-head { flex-direction: column; }
  .book-head-cover { width: 90px; }
  .book-pages { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
}
.book-code-card { margin-top: 22px; }

/* Saved palettes: the name is an editable box that looks like a title */
.saved .saved-name { width: 100%; font: inherit; font-weight: 800; font-size: 1rem; color: var(--ink); border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 2px 6px; margin-left: -6px; }
.saved .saved-name:hover { border-color: var(--line-2); }
.saved .saved-name:focus { border-color: #d99cc0; background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(163, 63, 127, .12); }
