/* Inklingo — warm "paper & ink" UI: cream paper, brown ink, one vermilion accent,
   a serif display face for headings and soft shadows instead of hard outlines. */
:root {
  --paper: #fbf7f1; /* page */
  --side: #f6efe5; /* sidebar */
  --paper2: #f1e9dd; /* tracks, sunken areas */
  --card: #fffdf9; /* raised surfaces */
  --canvas: #fffefb; /* drawing board, photos */
  --ink: #2f241b;
  --ink2: #6a5a4b;
  --muted: #968574;
  --line: rgba(80, 58, 32, .10);
  --line2: rgba(80, 58, 32, .22);
  --accent: #c94f24; /* vermilion */
  --accent-d: #a83f1a;
  --accent-soft: #fbe6da;
  --forest: #1c3a28;
  --good: #2e8b57;
  --good-soft: #e3f2e7;
  --bad: #c0392b;
  --bad-soft: #fbe3df;
  --warn: #d4860f;
  --warn-soft: #fcefd8;
  --info-soft: #efe9df;
  --sh-1: 0 1px 2px rgba(60, 40, 20, .06);
  --sh-2: 0 1px 2px rgba(60, 40, 20, .05), 0 14px 32px -22px rgba(60, 40, 20, .30);
  --sh-3: 0 2px 6px rgba(60, 40, 20, .07), 0 28px 56px -28px rgba(60, 40, 20, .40);
  --sh-btn: 0 1px 2px rgba(60, 40, 20, .18), 0 12px 24px -12px rgba(201, 79, 36, .75);
  --radius: 22px;
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--paper); min-height: 100vh; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-color: rgba(188, 75, 36, .4); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: -.02em; line-height: 1.08; }
h1 em, h2 em, .page-title em { font-style: italic; color: var(--accent); }
.ico { flex-shrink: 0; display: inline-block; vertical-align: middle; }
.with-ic { display: inline-flex; align-items: center; gap: 6px; }
h3.with-ic { display: flex; }
.avatar { display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%; background: var(--av, #6b7a99); color: #fbf3e4; font-weight: 700; line-height: 1; letter-spacing: -.3px; box-shadow: 0 0 0 2px var(--card), var(--sh-1); user-select: none; }
.icon-plain { border: 0; background: none; padding: 4px; color: var(--muted); display: inline-grid; place-items: center; border-radius: 99px; }
.icon-plain:hover { color: var(--bad); background: var(--bad-soft); }

/* ---------- app shell: sidebar + top bar ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--side); padding: 26px 18px 18px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.side-logo { padding: 2px 12px 26px; }
.side-nav { display: grid; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px; color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 500; transition: background .15s, color .15s; }
.nav-link .ico { color: var(--ink2); }
.nav-link:hover { background: rgba(80, 58, 32, .05); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-d); font-weight: 600; }
.nav-link.active .ico { color: var(--accent); }
.side-sep { border: 0; border-top: 1px solid var(--line2); margin: 14px 12px; }
.side-foot { margin-top: auto; font-size: 12px; line-height: 1.45; color: var(--muted); padding: 14px 12px 0; }
.side-foot a { color: var(--ink2); }
.main { min-width: 0; padding: 18px 32px 48px; }
.topbar { position: relative; display: flex; align-items: center; gap: 20px; margin-bottom: 22px; min-height: 52px; }
.topbar-logo { display: none; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.logo-mark { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; box-shadow: var(--sh-btn); flex-shrink: 0; }
.logo-mark svg { width: 18px; height: 18px; fill: #fff7ee; }
.logo-text { font-family: var(--display); font-weight: 600; font-size: 28px; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
.logo-text em { font-style: italic; color: var(--accent); }
.side-logo .logo-mark { display: none; }

.search { position: relative; flex: 1; max-width: 540px; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 11px 18px; color: var(--muted); box-shadow: var(--sh-1); cursor: text; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201, 79, 36, .12); }
.search-input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 16px; color: var(--ink); }
.search-input::-webkit-search-cancel-button { display: none; }
kbd { font: 600 12px ui-monospace, 'SF Mono', Menlo, monospace; background: var(--paper2); border-radius: 6px; padding: 3px 7px; color: var(--ink2); white-space: nowrap; }
.search-toggle { display: none; }
.search-panel { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh-3); padding: 6px; z-index: 60; max-height: 440px; overflow: auto; }
.sr { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
.sr.sel { background: var(--paper); }
.sr.locked { opacity: .55; cursor: default; }
.sr-img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: var(--paper2); flex-shrink: 0; }
.sr-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-d); display: grid; place-items: center; flex-shrink: 0; }
.sr-text { display: grid; min-width: 0; }
.sr-text b { font-weight: 600; }
.sr-text small { color: var(--muted); font-size: 13px; }
.sr-empty { padding: 14px; color: var(--muted); text-align: center; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.streak { display: inline-flex; align-items: center; gap: 6px; color: var(--ink2); font-size: 16px; white-space: nowrap; }
.streak .ico { color: #e8710c; }
.streak b { color: var(--ink); font-weight: 600; }
.streak.zero .ico { color: var(--muted); }
.profile-wrap { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; padding: 4px 8px 4px 4px; border-radius: 99px; color: var(--ink); font-weight: 600; font-size: 16px; }
.profile-btn:hover { background: rgba(80, 58, 32, .06); }
.profile-btn > .ico { color: var(--ink2); }
.profile-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-wrap { position: relative; display: inline-grid; }
.av-wrap .net-dot { position: absolute; right: -1px; bottom: -1px; box-shadow: 0 0 0 2px var(--paper); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh-3); padding: 6px; z-index: 70; display: grid; gap: 2px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: transparent; border: 0; color: var(--ink); text-decoration: none; font-size: 15px; text-align: left; width: 100%; }
.menu-item:hover { background: var(--paper); }
.menu-item .ico { color: var(--ink2); }
.menu-item span { flex: 1; }
.menu-item.on { font-weight: 600; }
.menu-item.on .ico { color: var(--good); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 8px; }
.menu-status { display: flex; gap: 8px; align-items: center; padding: 8px 12px 6px; font-size: 13px; color: var(--muted); }
.tabbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 14px; color: var(--ink2); }
.chip.dark { background: var(--ink); color: var(--card); border-color: transparent; }
.net-dot { width: 9px; height: 9px; border-radius: 50%; background: #aaa; display: inline-block; }
.net-dot.on { background: var(--good); }
.net-dot.off { background: var(--bad); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line2); border-radius: 999px;
  padding: 9px 18px; font-weight: 600; font-size: 15.5px; line-height: 1.2; box-shadow: var(--sh-1);
  transition: transform .1s, box-shadow .15s, background .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #fff; transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: var(--sh-1); }
.btn.primary { background: var(--accent); color: #fbf3e4; border-color: transparent; box-shadow: var(--sh-btn); }
.btn.primary:hover:not(:disabled) { background: var(--accent-d); box-shadow: var(--sh-btn); }
.btn.green { background: var(--forest); color: #fbf3e4; border-color: transparent; box-shadow: 0 1px 2px rgba(20, 40, 28, .25), 0 10px 22px -12px rgba(28, 58, 40, .7); }
.btn.green:hover:not(:disabled) { background: #12291c; }
.btn.blue { background: var(--ink); color: var(--card); border-color: transparent; }
.btn.danger { background: transparent; color: var(--bad); border-color: rgba(168, 53, 42, .35); box-shadow: none; }
.btn.danger:hover:not(:disabled) { background: var(--bad-soft); box-shadow: none; }
.dialog-actions .btn.danger, .btn.danger.solid { background: var(--bad); color: #fbf3e4; border-color: transparent; }
.btn.ghost { background: transparent; color: var(--ink2); border-color: transparent; box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: rgba(80, 58, 32, .06); box-shadow: none; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.big { padding: 13px 24px; font-size: 17px; }
.btn.wide { width: 100%; }
.icon-btn { width: 40px; height: 40px; padding: 0; flex-shrink: 0; }
.btn.disabled, .action-card.disabled { opacity: .45; pointer-events: none; }

/* ---------- cards & text ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--sh-2); padding: 22px; }
.card h2 { margin: 0 0 10px; font-size: 24px; }
.card h3 { margin: 0 0 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink2); }
.card h3 .ico { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.stack > .btn { justify-self: start; }
.stack > .btn.wide, .stack > .play-cta { justify-self: stretch; }
.bar { height: 8px; background: var(--paper2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--info-soft); color: var(--ink2); text-transform: uppercase; letter-spacing: .06em; line-height: 1.2; }
.tag.green { background: var(--good-soft); color: var(--good); }
.tag.yellow { background: var(--warn-soft); color: #7d5410; }
.tag.red { background: var(--bad-soft); color: var(--bad); }
.tag.blue { background: var(--accent-soft); color: var(--accent-d); }
.page-title { font-family: var(--display); font-weight: 600; font-size: 36px; letter-spacing: -.02em; line-height: 1.08; color: var(--ink); margin: 6px 0 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-title > .ico { display: none; }
.page-title .tag { font-family: var(--font); letter-spacing: .06em; }
.empty { text-align: center; display: grid; justify-items: center; gap: 8px; padding: 36px 18px; }
.empty > .ico { color: var(--muted); }
.hint { color: var(--muted); margin-top: 10px; }
.back-link { color: var(--ink2); font-weight: 600; text-decoration: none; font-size: 15px; display: inline-flex; gap: 4px; align-items: center; margin-bottom: 4px; }
.back-link:hover { color: var(--accent); }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; align-items: start; }
.dash-main { display: grid; gap: 30px; min-width: 0; }
.dash-main > *, .dash-side > *, .dash > * { min-width: 0; }
.dash-side { display: grid; gap: 22px; position: sticky; top: 18px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 12px; padding: 34px 40px; overflow: hidden; border-radius: 26px; }
.eyebrow { font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.hero h1 { font-size: clamp(42px, 3.7vw, 68px); line-height: .98; margin: 0; white-space: nowrap; }
.hero-sub { font-size: 19px; color: var(--ink2); margin: 16px 0 26px; max-width: 34ch; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-art { position: relative; height: 290px; min-width: 0; }
.hero-blob { position: absolute; inset: 4% 0; border-radius: 50%; background: radial-gradient(closest-side, #fde0cf, #fdece2 62%, transparent 100%); }
.hero-doodle { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fan-card { position: absolute; top: 50%; left: 50%; width: clamp(92px, 7.6vw, 136px); padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh-3); display: grid; gap: 6px; transition: transform .25s; }
.fan-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; background: var(--paper2); }
.fan-card span { font-family: var(--display); font-weight: 600; font-size: clamp(16px, 1.4vw, 22px); text-align: center; padding: 2px 4px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fan-0 { transform: translate(-128%, -46%) rotate(-12deg); }
.fan-2 { transform: translate(28%, -42%) rotate(11deg); }
.fan-1 { transform: translate(-50%, -54%); z-index: 2; width: clamp(120px, 10vw, 176px); }
.fan-0:hover { transform: translate(-128%, -50%) rotate(-14deg); }
.fan-2:hover { transform: translate(28%, -46%) rotate(13deg); }
.fan-1:hover { transform: translate(-50%, -58%); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-family: var(--font); font-weight: 700; font-size: 24px; letter-spacing: -.01em; }
.link-more { color: var(--ink2); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }
.link-more:hover { color: var(--accent); }
.topic-row { display: grid; grid-auto-flow: column; grid-auto-columns: 168px; gap: 14px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.tcard { scroll-snap-align: start; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: var(--sh-1); transition: transform .15s, box-shadow .15s; }
.tcard:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.tcard.current { border: 2px solid var(--accent); }
.tcard-cover { position: relative; height: 96px; background: var(--paper2); }
.tcard-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tcard.locked img { filter: grayscale(.85) sepia(.15); opacity: .85; }
.tcard-lock { position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 253, 249, .92); display: grid; place-items: center; color: var(--ink2); }
.tcard-body { padding: 10px 12px 12px; display: grid; gap: 3px; }
.tcard-body b { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcard-body small { color: var(--muted); font-size: 13px; }
.tcard-body .bar { height: 5px; margin-top: 4px; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.qtile { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 18px; text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.qtile:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.qtile.disabled { opacity: .5; pointer-events: none; }
.qtile-ic { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .75); flex-shrink: 0; }
.qtile-text { display: grid; min-width: 0; }
.qtile-text b { font-size: 17px; font-weight: 600; }
.qtile-text small { font-size: 14px; color: var(--ink2); }
.q-red { background: #fdecea; } .q-red .qtile-ic, .qtile-ic.q-red { color: #d9452b; }
.q-blue { background: #eaf1fb; } .q-blue .qtile-ic, .qtile-ic.q-blue { color: #2f6fd0; }
.q-green { background: #e7f3ea; } .q-green .qtile-ic, .qtile-ic.q-green { color: #2e8b57; }
.q-yellow { background: #fdf2df; } .q-yellow .qtile-ic, .qtile-ic.q-yellow { color: #e8890c; }
.q-purple { background: #f1ebfa; } .q-purple .qtile-ic, .qtile-ic.q-purple { color: #7a52c7; }

.side-card { padding: 22px 24px; }
.side-card .section-head h2 { font-size: 22px; }
.progress-main { display: flex; align-items: center; gap: 22px; margin: 6px 0 18px; }
.ring { position: relative; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.ring-bg { fill: none; stroke: var(--paper2); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.progress-info { flex: 1; display: grid; gap: 8px; min-width: 0; font-size: 16px; color: var(--ink2); }
.progress-info b { font-size: 18px; color: var(--ink); }
.progress-info .bar { height: 6px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mini-stat { display: flex; align-items: center; gap: 10px; background: var(--paper); border-radius: 14px; padding: 12px; min-width: 0; }
.mini-stat b { display: block; font-size: 19px; line-height: 1.1; }
.mini-stat small { font-size: 12.5px; color: var(--muted); }
.m-red .ico { color: #d9452b; } .m-blue .ico { color: #2f6fd0; } .m-orange .ico { color: #e8710c; } .m-green .ico { color: #2e8b57; } .m-purple .ico { color: #7a52c7; }
.vlist { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 2px; }
.vrow { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 8px; border-radius: 14px; cursor: pointer; transition: background .12s; }
.vrow:hover { background: var(--paper); }
.vrow.active { background: var(--accent-soft); }
.vrow-img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--paper2); display: block; }
.vrow-text { display: grid; min-width: 0; }
.vrow-text b { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow-text small { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vrow-say { color: var(--ink2); }
.check-box { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border: 1.5px solid var(--line2); border-radius: 6px; background: #fff; display: grid; place-items: center; cursor: pointer; margin: 0 4px 0 0; transition: background .12s; }
.check-box:checked { background: var(--good); border-color: var(--good); }
.check-box:checked::after { content: ''; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.side-empty { display: flex; gap: 10px; align-items: center; padding: 16px 8px 20px; color: var(--ink2); }
.side-empty .ico { color: var(--muted); }
.pct { font-weight: 700; color: var(--good); }
.pct.low { color: var(--bad); }

/* ---------- stats & help ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--sh-1); min-width: 0; }
.kpi-ic { width: 46px; height: 46px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; flex-shrink: 0; }
.kpi b { display: block; font-size: 26px; line-height: 1.1; }
.kpi small { color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.tlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.trow { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 46px; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; }
.trow.locked { opacity: .55; }
.trow-ic { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-d); display: grid; place-items: center; }
.trow-main { display: grid; gap: 6px; min-width: 0; }
.trow-main b { font-weight: 600; }
.trow-main .bar { height: 5px; }
.trow-score { text-align: right; font-weight: 600; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; }
.plain-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto 52px; gap: 12px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list b { text-align: right; }
b.ok { color: var(--good); } b.bad { color: var(--bad); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.help-card { display: grid; gap: 10px; align-content: start; }
.help-card .qtile-ic { background: var(--paper); }
.help-card h2 { font-family: var(--font); font-weight: 700; font-size: 20px; margin: 0; }
.help-card ul { margin: 0; padding-left: 18px; color: var(--ink2); display: grid; gap: 4px; }
.help-card dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; align-items: center; }
.help-card dd { margin: 0; color: var(--ink2); }
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 2px 0 22px; }
.page-head .page-title { margin: 0; }

/* legacy home helpers still used by other screens */
.play-cta { justify-content: center; gap: 12px; padding: 16px 30px; font-size: 18px; }
.code-input { text-transform: uppercase; letter-spacing: 3px; font-weight: 700; min-width: 0; padding: 8px 14px; }
.code-input::placeholder { letter-spacing: 0; font-weight: 400; text-transform: none; }
.join-inline { grid-column: 1 / -1; display: flex; gap: 8px; }
.join-inline .btn { padding: 7px 14px; }
.topic-line { display: flex; align-items: center; gap: 12px; }
.topic-line b { font-family: var(--display); font-weight: 600; font-size: 20px; letter-spacing: -.01em; }
.topic-badge { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-d); display: grid; place-items: center; flex-shrink: 0; }
.today-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.mini-word { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--canvas); text-align: center; font-weight: 600; font-size: 14px; cursor: pointer; padding: 0; box-shadow: var(--sh-1); transition: transform .12s, box-shadow .15s; }
.mini-word:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.mini-word .seen, .mini-word .new-dot { position: absolute; top: 6px; right: 6px; border-radius: 99px; font-size: 10.5px; font-weight: 700; line-height: 1; box-shadow: var(--sh-1); }
.mini-word .seen { width: 22px; height: 22px; display: grid; place-items: center; background: var(--good); color: #fbf3e4; padding: 0; }
.mini-word .new-dot { background: var(--accent); color: #fbf3e4; padding: 4px 7px; }
.mini-word img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--paper2); }
.mini-word > span:not(.seen):not(.new-dot) { display: block; padding: 7px 4px 2px; overflow-wrap: break-word; hyphens: auto; line-height: 1.15; }
.mini-word small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; padding: 0 3px 8px; line-height: 1.25; }
.notice { background: var(--warn-soft); border-radius: 14px; padding: 11px 14px; font-size: 14.5px; display: flex; align-items: flex-start; gap: 9px; color: #5e4210; }
.notice > .ico:first-child { margin-top: 2px; }
.notice.blue { background: var(--info-soft); color: var(--ink2); }
.notice.result { align-items: center; font-size: 16px; }
.notice.result.good { background: var(--good-soft); color: #1f4a30; }
.notice.result.good > .ico:first-child { color: var(--good); }
.notice.result.bad { background: var(--bad-soft); color: #6e2219; }
.notice.result.bad > .ico:first-child { color: var(--bad); }
.notice.result > span { flex: 1; }
.ico.ok { color: var(--good); }
.ico.bad { color: var(--bad); }

/* ---------- vocabulary / flashcards ---------- */
.daily { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; align-items: start; }
.word-tabs { display: grid; gap: 8px; }
.word-tab { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; background: transparent; border: 1px solid transparent; border-radius: 16px; text-align: left; transition: background .15s; }
.word-tab:hover { background: rgba(80, 58, 32, .05); }
.word-tab img { width: 48px; height: 48px; object-fit: cover; border-radius: 12px; }
.word-tab b { display: block; font-weight: 600; font-size: 16px; }
.word-tab .small { color: var(--muted); }
.word-tab.active { background: var(--card); border-color: var(--line); box-shadow: var(--sh-2); }
.word-tab.active b { color: var(--accent-d); }
.word-tab .check { margin-left: auto; color: var(--good); display: grid; }
.word-head { flex-wrap: nowrap; }
.nav-row { justify-content: space-between; margin-top: 6px; }
.flashcard { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; }
.photo-frame { position: relative; border-radius: 16px; overflow: hidden; background: var(--paper2); aspect-ratio: 4 / 3; box-shadow: inset 0 0 0 1px var(--line); }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-credit { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.4; overflow-wrap: anywhere; }
.photo-credit a { color: inherit; }
.word-big { font-family: var(--display); font-size: 52px; font-weight: 600; line-height: 1; letter-spacing: -.02em; margin: 4px 0; overflow-wrap: anywhere; }
.ipa { font-size: 18px; color: var(--ink2); font-family: 'Charis SIL', 'Doulos SIL', 'Gentium Plus', 'Lucida Sans Unicode', 'Arial Unicode MS', serif; }
.meaning { font-family: var(--display); font-style: italic; font-size: 24px; font-weight: 600; color: var(--accent); margin: 8px 0; }
.example { background: var(--paper); border-left: 3px solid var(--accent); padding: 12px 14px; border-radius: 4px 14px 14px 4px; margin: 10px 0; font-size: 16.5px; }
.example .vi { color: var(--muted); font-size: 14.5px; margin-top: 4px; }
.speak-btn { width: 46px; height: 46px; border-radius: 50%; padding: 0; color: var(--accent); }
.speak-btn.small { width: 34px; height: 34px; }
.ideas-list { margin: 6px 0 0; padding-left: 20px; color: var(--ink2); }

.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.topic-card { display: grid; grid-template-rows: 150px auto; padding: 0; overflow: hidden; transition: transform .12s, box-shadow .15s; }
.topic-card:not(.locked):hover { transform: translateY(-2px); box-shadow: var(--sh-3); }
.topic-card .cover { position: relative; background: var(--paper2); }
.topic-card .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.topic-card .cover .num { position: absolute; left: 12px; top: 12px; background: var(--card); border-radius: 99px; min-width: 30px; height: 30px; display: grid; place-items: center; padding: 0 9px; font-family: var(--display); font-weight: 600; box-shadow: var(--sh-1); }
.topic-card .body { padding: 14px 18px 18px; display: grid; gap: 10px; }
.topic-card .body b.with-ic { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -.01em; min-width: 0; }
.topic-card .body b.with-ic .ico { color: var(--accent); }
.topic-card.locked .cover img { filter: grayscale(1) sepia(.25) brightness(.85); }
.topic-card.locked { opacity: .8; }
.topic-card .lock { position: absolute; inset: 0; display: grid; place-items: center; color: #fbf3e4; background: rgba(59, 42, 30, .25); }

.quiz { max-width: 760px; margin: 0 auto; }
.quiz .photo-frame { max-width: 440px; margin: 0 auto 12px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.options .btn { font-size: 18px; padding: 15px; white-space: normal; border-radius: 16px; }
.options .btn.right { background: var(--good); color: #fbf3e4; border-color: transparent; }
.options .btn.wrong { background: var(--bad); color: #fbf3e4; border-color: transparent; }
.answer-input { width: 100%; font-size: 22px; font-weight: 600; padding: 13px 16px; border: 1px solid var(--line2); border-radius: 16px; background: #fff; text-align: center; box-shadow: inset 0 1px 2px rgba(60, 40, 20, .06); }
.answer-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(188, 75, 36, .15); }
.answer-input.right { background: var(--good-soft); border-color: var(--good); }
.answer-input.wrong { background: var(--bad-soft); border-color: var(--bad); }
.letter-hint { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 600; letter-spacing: 2px; color: var(--ink2); margin-top: 6px; white-space: pre-wrap; }
.big-score { font-family: var(--display); font-size: 76px; font-weight: 600; text-align: center; line-height: 1; letter-spacing: -.03em; }

.review-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 22px; align-items: start; }
.drawing-frame { border-radius: 16px; overflow: hidden; background: var(--canvas); aspect-ratio: 16 / 10; box-shadow: inset 0 0 0 1px var(--line); }
.drawing-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--canvas); }
.gallery img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; border-bottom: 1px solid var(--line); }
.gallery figcaption { font-size: 13px; font-weight: 600; padding: 5px 8px; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; text-align: center; }
.stat b { display: block; font-family: var(--display); font-weight: 600; font-size: 30px; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: 110px 1fr; gap: 12px 16px; align-items: center; }
.input, select.input { width: 100%; padding: 10px 14px; border: 1px solid var(--line2); border-radius: 12px; background: #fff; font-size: 16px; box-shadow: inset 0 1px 2px rgba(60, 40, 20, .05); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(188, 75, 36, .15); }
.avatars { display: flex; flex-wrap: wrap; gap: 8px; }
.av-swatch { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--av); color: #fbf3e4; padding: 0; display: grid; place-items: center; box-shadow: var(--sh-1); }
.av-swatch.selected { outline: 2px solid var(--ink); outline-offset: 3px; }
.profile-edit { align-items: flex-start; flex-wrap: nowrap; gap: 18px; }
.profile-row { background: transparent; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.profile-row.on { background: #fff; box-shadow: var(--sh-1); }
.credits-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.credits-table td, .credits-table th { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.credits-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink2); }
.credits-table img { width: 56px; height: 42px; object-fit: cover; border-radius: 8px; }
details summary { cursor: pointer; color: var(--ink2); }

/* ---------- lobby ---------- */
.lobby { display: grid; grid-template-columns: 1fr 360px; gap: 22px; align-items: start; }
.room-code { font-family: var(--display); font-size: 44px; font-weight: 600; letter-spacing: 8px; background: var(--paper); border: 1.5px dashed var(--line2); border-radius: 16px; padding: 8px 14px; text-align: center; }
.lobby-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.lobby-player { position: relative; display: grid; justify-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px; background: #fff; text-align: center; font-weight: 600; }
.lobby-player .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lobby-player .crown { position: absolute; top: -10px; right: -6px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fbf3e4; display: grid; place-items: center; box-shadow: var(--sh-1); }
.lobby-player.off { opacity: .45; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--paper2); border-radius: 99px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; font-weight: 600; font-size: 14.5px; color: var(--ink2); border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover:not(:disabled):not(.on) { color: var(--ink); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--sh-1); }
.local-names { display: grid; gap: 10px; }
.local-names > .btn { justify-self: start; }

/* ---------- game ---------- */
.game-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--sh-2); padding: 10px 18px; margin-bottom: 14px; }
.round-info { font-family: var(--display); font-weight: 600; font-size: 18px; }
.round-info .small { font-family: var(--font); color: var(--muted); font-weight: 400; }
.word-display { text-align: center; min-width: 0; }
.word-display .label { font-size: 11.5px; color: var(--muted); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.word-display .word { font-size: 28px; font-weight: 600; letter-spacing: 6px; font-variant-ligatures: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.word-display .word.secret { color: var(--accent); letter-spacing: .02em; font-family: var(--display); font-style: italic; font-size: 32px; }
.word-display .len { font-size: 13px; color: var(--muted); }
.timer-box { justify-self: end; display: flex; align-items: center; gap: 10px; }
.timer { position: relative; width: 56px; height: 56px; }
.timer svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 5; }
.timer .bg { stroke: var(--paper2); }
.timer .fg { stroke: var(--forest); stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .3s; }
.timer.warn .fg { stroke: var(--warn); }
.timer.danger .fg { stroke: var(--accent); }
.timer b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }

.game-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.game-grid > * { min-width: 0; }
.side-panel { padding: 14px; }
.player-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pl { display: grid; grid-template-columns: 22px 34px 1fr auto; align-items: center; gap: 8px; background: transparent; border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px; transition: background .3s; }
.pl .rank { font-family: var(--display); font-weight: 600; color: var(--muted); font-size: 14px; text-align: center; }
.pl .nm { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .pts { font-size: 12.5px; color: var(--muted); }
.pl .badge { display: grid; color: var(--ink2); }
.pl.guessed .badge { color: var(--good); }
.pl.drawing .badge { color: var(--accent); }
.pl.off .badge { color: var(--bad); }
.pl.drawing { background: var(--accent-soft); border-color: transparent; }
.pl.guessed { background: var(--good-soft); border-color: transparent; }
.pl.off { opacity: .5; }
.pl.me .nm::after { content: ' (bạn)'; color: var(--muted); font-weight: 400; font-size: 12px; }

.stage { min-width: 0; }
.canvas-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--sh-3); background: var(--canvas); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.canvas-wrap canvas.board { display: block; width: 100%; aspect-ratio: 16 / 10; touch-action: none; }
.canvas-wrap canvas.ghost { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .38; }
.brush-cursor { position: absolute; left: 0; top: 0; pointer-events: none; border-radius: 50%; border: 1.5px solid rgba(59, 42, 30, .7); box-shadow: 0 0 0 1px rgba(255, 255, 255, .8); z-index: 3; }
.brush-cursor[data-tool='fill'], .brush-cursor[data-tool='picker'] { border-radius: 2px; border-style: dashed; }
.stage-msg { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(251, 247, 236, .94); z-index: 4; text-align: center; padding: 20px; }
.stage-msg .inner { max-width: 460px; display: grid; justify-items: center; }
.stage-msg h2 { font-size: 32px; margin: 8px 0; }
.stage-msg .big:not(.btn) { font-size: 54px; color: var(--accent); }
.stage-msg .btn { margin-top: 10px; }
.assist-badge { position: absolute; right: 12px; top: 12px; z-index: 2; }

.toolbar { margin-top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--sh-2); padding: 10px 14px; display: grid; gap: 10px; }
.toolbar.disabled { filter: grayscale(.6); opacity: .6; }
.toolbar > * { min-width: 0; }
.tb-row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.tool-group { display: flex; gap: 4px; padding-right: 12px; border-right: 1px solid var(--line); }
.tool-group:last-of-type { border-right: 0; }
.tool { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 12px; display: grid; place-items: center; padding: 0; transition: background .12s, transform .12s; }
.tool svg { width: 22px; height: 22px; fill: var(--ink2); }
.tool:hover:not(:disabled):not(.selected) { background: rgba(80, 58, 32, .07); }
.tool.selected { background: var(--accent-soft); transform: translateY(-2px); }
.tool.selected svg { fill: var(--accent-d); }
.tool-status { margin-left: auto; font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; background: var(--paper); border-radius: 99px; padding: 4px 11px; color: var(--ink2); }
.tool-status.floating { position: absolute; left: 10px; bottom: 10px; z-index: 2; margin: 0; pointer-events: none; opacity: .94; font-size: 12.5px; padding: 3px 10px; background: var(--card); box-shadow: var(--sh-1); }
.tool-status .dot { width: 13px; height: 13px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(59, 42, 30, .35); display: inline-block; }
.color-area { display: flex; align-items: center; gap: 12px; }
.current-wrap { position: relative; }
.current-color { width: 44px; height: 44px; border-radius: 50%; border: 0; box-shadow: 0 0 0 3px var(--card), 0 0 0 4px var(--line2), var(--sh-1); padding: 0; position: relative; }
.current-color::after { content: ''; position: absolute; right: -7px; bottom: -7px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b2a1e' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 15l6-6 6 6'/%3E%3C/svg%3E") center / 13px no-repeat; border-radius: 50%; width: 20px; height: 20px; box-shadow: var(--sh-1), inset 0 0 0 1px var(--line); }
.picker-pop { position: absolute; bottom: 58px; left: 0; z-index: 20; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh-3); padding: 12px; display: grid; gap: 8px; }
.picker-pop canvas { display: block; touch-action: none; cursor: crosshair; }
.picker-pop .hex { width: 100px; padding: 4px 8px; border: 1px solid var(--line2); border-radius: 8px; font-family: ui-monospace, monospace; }
.swatches { display: grid; grid-template-columns: repeat(12, 22px); gap: 5px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0; box-shadow: inset 0 0 0 1px rgba(59, 42, 30, .18); transition: transform .1s; }
.swatch:hover { transform: scale(1.12); }
.swatch.selected { outline: 2px solid var(--ink); outline-offset: 2px; }
.sliders { display: grid; gap: 4px; margin-left: auto; }
.ctrl { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--ink2); }
.ctrl > span { width: 52px; }
.ctrl input[type='range'] { width: 120px; accent-color: var(--accent); }
.ctrl .val { width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.size-dots { display: flex; gap: 3px; }
.size-dot { width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; padding: 0; }
.size-dot:hover { background: rgba(80, 58, 32, .07); }
.size-dot i { background: var(--ink); border-radius: 50%; display: block; }
.size-dot.selected { background: var(--accent-soft); }
.size-dot.selected i { background: var(--accent-d); }

.stage-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.chat-panel { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto auto; height: 100%; min-height: 0; padding: 14px; }
.chat-log { height: 380px; overflow-y: auto; background: var(--canvas); border: 1px solid var(--line); border-radius: 14px; padding: 8px; font-size: 14.5px; display: flex; flex-direction: column; gap: 2px; }
.msg { padding: 4px 8px; border-radius: 8px; overflow-wrap: anywhere; }
.msg b { font-weight: 700; }
.msg.system { color: var(--muted); font-style: italic; font-size: 13px; }
.msg.good { background: var(--good-soft); color: #1f4a30; font-weight: 600; }
.msg .ico { vertical-align: -2px; }
.msg.notice { background: var(--warn-soft); color: #6a4a10; font-size: 13px; }
.msg.drawer b { color: var(--accent); }
.guess-form { display: flex; gap: 6px; margin-top: 10px; }
.guess-form input { flex: 1; min-width: 0; padding: 10px 14px; border: 1px solid var(--line2); border-radius: 99px; background: #fff; }
.guess-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(188, 75, 36, .15); }
.guess-form input:disabled { background: var(--paper2); }
.local-guesser { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.local-guesser button { border: 1px solid var(--line2); border-radius: 99px; background: var(--card); padding: 2px 10px 2px 2px; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 5px; }
.local-guesser button.on { background: var(--accent-soft); border-color: transparent; }
.learn-chip { margin-top: 10px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }

.assist { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.assist-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 6px 0; }
.assist-levels button { border: 1px solid var(--line2); border-radius: 12px; background: var(--card); padding: 5px 0 4px; display: grid; justify-items: center; line-height: 1.1; min-width: 0; }
.assist-levels button b { font-family: var(--display); font-size: 15px; font-weight: 600; }
.assist-levels button small { font-size: 9.5px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }
.assist-levels button.used { background: var(--accent-soft); border-color: transparent; }
.assist-levels button.on { background: var(--accent); color: #fbf3e4; border-color: transparent; }
.assist-levels button.on small { color: #fbf3e4; }
.assist-body { background: var(--canvas); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; font-size: 14px; line-height: 1.5; max-height: 300px; overflow: auto; }
.assist-body img { width: 100%; border-radius: 10px; display: block; margin: 6px 0 2px; aspect-ratio: 4/3; object-fit: cover; }
.assist-body ol, .assist-body ul { margin: 4px 0; padding-left: 18px; }
.assist-body .lvl { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin-top: 8px; }
.assist-mult { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ghost-ctl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 13px; font-weight: 600; }

/* ---------- study group ---------- */
.group-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 20px; align-items: start; }
.member-today { display: flex; flex-wrap: wrap; gap: 12px 14px; }
.mt { display: grid; justify-items: center; gap: 4px; width: 60px; text-align: center; opacity: .5; }
.mt.done { opacity: 1; }
.mt-av { position: relative; display: inline-grid; }
.mt-check { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--good); color: #fbf3e4; box-shadow: 0 0 0 2px var(--card); display: grid; place-items: center; }
.mt-check.playing { background: var(--warn); }
.mt-name { font-size: 12.5px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-streak { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; color: var(--accent); }
.count-badge { background: var(--accent); color: #fbf3e4; border-radius: 99px; font-size: 12px; font-weight: 700; padding: 1px 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.word-chip { font-size: 13.5px; color: var(--ink); }
.word-chip b { background: var(--accent); color: #fbf3e4; border-radius: 99px; padding: 0 6px; font-size: 11.5px; }
.recovery { display: block; background: var(--paper); border: 1.5px dashed var(--line2); border-radius: 12px; padding: 12px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; user-select: all; }
.leaderboard { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.leaderboard li { display: grid; grid-template-columns: 22px auto 1fr auto auto; align-items: center; gap: 10px; background: transparent; border: 1px solid var(--line); border-radius: 14px; padding: 7px 12px; }
.leaderboard li.me, .ranking li.me { background: #fff; box-shadow: var(--sh-1); border-color: var(--line2); }
.leaderboard li:nth-child(1) .lb-rank { color: var(--accent); }
.lb-rank { font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--muted); text-align: center; }
.lb-name { min-width: 0; display: grid; }
.lb-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-name > div { display: flex; align-items: center; min-width: 0; }
.lb-name small { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lb-name .tag { font-size: 9.5px; padding: 1px 6px; }
.lb-crown { color: var(--warn); display: inline-grid; margin-left: 5px; }
.lb-pts { font-family: var(--display); font-weight: 600; font-size: 21px; font-variant-numeric: tabular-nums; }
.leaderboard.compact li { padding: 5px 10px; }
.room-row { background: var(--canvas); border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.quiz-card .btn.big { padding: 12px 20px; font-size: 16px; }

/* ---------- group mini-game ---------- */
.quiz-stage { max-width: 720px; margin: 0 auto; }
.quiz-stage h2 { font-size: 32px; margin: 0; }
.quiz-topic { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--accent); }
.round-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.round-chips .chip .ico { color: var(--accent); }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.q-timer { height: 6px; border-radius: 99px; background: var(--paper2); overflow: hidden; }
.q-timer i { display: block; height: 100%; background: var(--forest); transition: width .2s linear; }
.q-timer.warn i { background: var(--accent); }
.q-body { display: grid; gap: 14px; }
.q-photo { max-width: 460px; width: 100%; margin: 0 auto; }
.q-photo img { pointer-events: none; }
.q-listen, .q-meaning { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 8px 0; }
.big-speak { width: 80px; height: 80px; }
.q-sentence { font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1.35; margin: 4px 0; text-align: center; letter-spacing: -.01em; }
.q-status { min-height: 20px; text-align: center; }
.options .btn.chosen { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-d); }
.answered-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 28px; }
.reveal-word { text-align: center; display: grid; justify-items: center; gap: 4px; }

/* ---------- dialogs / results ---------- */
.dialog-layer { position: fixed; inset: 0; z-index: 100; background: rgba(59, 42, 30, .38); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; overflow-y: auto; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.dialog { background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--sh-3); padding: 26px; max-width: 460px; width: 100%; animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.dialog h2 { margin: 0 0 10px; font-size: 28px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.dialog.wide { max-width: 900px; }
.reveal { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.reveal .drawing-frame { aspect-ratio: 16/10; }
.reveal-head { text-align: center; margin-bottom: 14px; }
.reveal-head h2 { font-size: 48px !important; }
.reveal-head .reason { font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 13px; }
.deltas { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 5px; }
.deltas li { display: flex; align-items: center; justify-content: space-between; background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; font-weight: 600; font-size: 15px; }
.deltas .plus { color: var(--good); font-family: var(--display); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin: 12px 0 18px; }
.podium .p { display: grid; justify-items: center; gap: 4px; text-align: center; font-weight: 600; }
.final-head { display: grid; justify-items: center; gap: 4px; color: var(--accent); }
.final-head h2 { color: var(--ink); }
.podium .p .block { border-radius: 14px 14px 4px 4px; background: var(--accent); color: #fbf3e4; width: 96px; display: grid; place-items: center; font-family: var(--display); font-size: 28px; font-weight: 600; }
.podium .p.r1 .block { height: 110px; }
.podium .p.r2 .block { height: 80px; background: var(--forest); }
.podium .p.r3 .block { height: 60px; background: #a07a4e; }
.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ranking li { align-items: center; display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; font-weight: 600; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); background: var(--ink); color: var(--card); padding: 11px 20px; border-radius: 99px; font-weight: 600; opacity: 0; transition: .2s; z-index: 200; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; box-shadow: var(--sh-3); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); }
#toast.good { background: var(--forest); }

.footer { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 40px; line-height: 1.5; }
.footer a { color: var(--ink2); }

/* ---------- responsive ---------- */
body.in-room .shell { grid-template-columns: minmax(0, 1fr); }
body.in-room .sidebar { display: none; }
body.in-room .topbar-logo { display: block; }
@media (max-width: 1360px) {
  .dash { grid-template-columns: minmax(0, 1fr) 360px; }
  .hero { padding: 30px 32px; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .game-grid { grid-template-columns: 196px minmax(0, 1fr) 236px; }
  .pl { grid-template-columns: 34px 1fr auto; }
  .pl .rank { display: none; }
  .assist-levels button small { display: none; }
  .assist-levels button { padding: 6px 0; }
  .swatches { grid-template-columns: repeat(8, 22px); }
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash-side { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 1100px) {
  .shell { grid-template-columns: 84px minmax(0, 1fr); }
  .sidebar { padding: 20px 12px; align-items: center; }
  .side-logo { padding: 0 0 18px; }
  .side-logo .logo-text, .side-foot, .nav-link span { display: none; }
  .side-logo .logo-mark { display: grid; }
  .nav-link { padding: 12px; justify-content: center; }
  .side-sep { width: 40px; }
  .main { padding: 16px 24px 40px; }
}
@media (max-width: 960px) {
  .home, .daily, .lobby, .review-grid, .flashcard, .reveal, .group-grid, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .lobby > *, .review-grid > *, .flashcard > *, .reveal > *, .group-grid > *, .grid2 > * { min-width: 0; }
  .home { gap: 24px; }
  .game-grid { grid-template-columns: 1fr; }
  .pl { grid-template-columns: 22px 34px 1fr auto; }
  .pl .rank { display: block; }
  .assist-levels button small { display: block; }
  .stage { order: 1; }
  .players-panel { order: 2; }
  .chat-panel { order: 3; }
  .player-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .chat-log { height: 200px; }
  .sliders { margin-left: 0; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar-logo { display: block; }
  .topbar-logo .logo-text { font-size: 22px; }
  .topbar { gap: 10px; }
  .search { position: static; flex: 0; max-width: none; }
  .search-box, .search .search-panel { display: none; }
  .search-toggle { display: grid; }
  .search.open { position: absolute; left: 0; right: 0; top: 0; z-index: 80; }
  .search.open .search-box { display: flex; }
  .search.open .search-panel:not([hidden]) { display: block; }
  .search.open .search-toggle { display: none; }
  .search kbd { display: none; }
  .header-right { gap: 10px; }
  .streak-label, .profile-name, .profile-btn > .ico { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(255, 253, 249, .96); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); }
  .tab { display: grid; justify-items: center; gap: 2px; padding: 5px 2px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; border-radius: 12px; }
  .tab.active { color: var(--accent); }
  .main { padding: 12px 16px 24px; }
  body:not(.in-room) .main { padding-bottom: 90px; }
  body.in-room .tabbar { display: none; }
  #toast { bottom: 84px; }
  body.in-room #toast { bottom: 26px; }
  .page-title { font-size: 30px; }
  .hero { grid-template-columns: 1fr; padding: 26px 22px; }
  .hero-art { height: 210px; order: -1; }
  .fan-card { width: 104px; }
  .fan-1 { width: 132px; }
  .fan-card span { font-size: 18px; }
  .dash-side { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .card { padding: 18px; }
  .actions-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 44px; }
  .hero-sub { font-size: 17px; }
  .hero-actions .btn { flex: 1; }
  .quick-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .qtile { padding: 14px; gap: 10px; }
  .qtile-ic { width: 42px; height: 42px; }
  .profile-edit { flex-wrap: wrap; }
  .game-top { grid-template-columns: 1fr auto; }
  .word-display { grid-column: 1 / -1; order: 3; }
  .word-display .word { font-size: 22px; letter-spacing: 4px; }
  .today-mini { grid-template-columns: repeat(3, 1fr); }
  .options { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .profile-name { max-width: 90px; }
  .tool { width: 36px; height: 36px; }
  .tool-group { padding-right: 6px; }
  .tool-status { margin-left: 0; }
  .word-big { font-size: 40px; }
  .big-score { font-size: 60px; }
  .sliders { width: 100%; }
  .ctrl input[type='range'] { flex: 1; width: 0; min-width: 0; } /* width 0: Chrome keeps a 129px intrinsic width otherwise */
  .swatches { grid-template-columns: repeat(8, 1fr); }
  .swatch { width: 100%; height: auto; aspect-ratio: 1; }
  .color-area { width: 100%; }
}

/* ---------- phone layout ---------- */
@media (max-width: 760px) {
  /* dashboard: today's words right after the hero */
  .dash { display: flex; flex-direction: column; align-items: stretch; gap: 22px; }
  .dash-main, .dash-side { display: contents; }
  .hero { order: 1; }
  .vocab-card { order: 2; }
  .progress-card { order: 3; }
  .topics-sec { order: 4; }
  .quick-sec { order: 5; }
  .topic-row { grid-auto-columns: 148px; }
  /* daily: word strip + sticky next/previous */
  .daily { gap: 14px; grid-template-columns: minmax(0, 1fr); }
  .daily > * { min-width: 0; }
  .daily-list { padding: 12px 12px 8px; }
  .daily-list .section-head { margin-bottom: 8px; }
  .daily-list .section-head h2 { font-size: 17px; }
  .daily-list .vlist { grid-auto-flow: column; grid-auto-columns: 84px; overflow-x: auto; gap: 8px; margin: 0; padding-bottom: 4px; scrollbar-width: none; }
  .daily-list .vrow { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 4px; padding: 6px 4px; position: relative; }
  .daily-list .vrow-img { width: 64px; height: 64px; }
  .daily-list .vrow-text b { font-size: 13.5px; max-width: 76px; }
  .daily-list .vrow-text small, .daily-list .vrow-say { display: none; }
  .daily-list .check-box { position: absolute; top: 2px; right: 6px; width: 18px; height: 18px; pointer-events: none; }
  .daily-list .check-box:not(:checked) { display: none; }
  .nav-row { position: sticky; bottom: 78px; z-index: 5; background: var(--card); margin: 4px -6px -6px; padding: 10px 6px; border-top: 1px solid var(--line); flex-wrap: nowrap; }
  .nav-row .btn { flex: 1; }
  /* topics: compact two-column grid */
  .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .topic-card { grid-template-rows: 92px auto; }
  .topic-card .body { padding: 10px 12px 12px; gap: 6px; }
  .topic-card .body b.with-ic { font-size: 15px; }
  .topic-card .body b.with-ic .ico { display: none; }
  .topic-card .body .row.between { display: grid; gap: 4px; justify-items: start; }
  .topic-card .body .tag { white-space: nowrap; font-size: 10px; letter-spacing: .04em; }
  .topic-card .body .btn { padding: 6px 10px; font-size: 13px; white-space: normal; text-align: center; }
  .topic-card .cover .num { min-width: 24px; height: 24px; font-size: 13px; left: 8px; top: 8px; }
  .topic-card .lock .ico { width: 24px; height: 24px; }
  /* stats */
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpi { flex-direction: column; text-align: center; gap: 6px; padding: 12px 6px; }
  .kpi-ic { width: 34px; height: 34px; }
  .kpi b { font-size: 21px; }
  .kpi small { font-size: 12px; line-height: 1.2; display: block; }
  .trow { grid-template-columns: 32px minmax(0, 1fr) 40px; gap: 10px; }
  .trow .tag { display: none; }
  .trow-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* create room: seat rows */
  .local-names .row { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; }
  .local-names .row > .input, .local-names .row > select.input { width: 100% !important; }
  .local-names .row > .input { grid-column: 2; }
  .local-names .row > .btn { grid-column: 2; justify-self: start; }
}
@media (max-width: 600px) {
  .qtile { flex-direction: column; align-items: flex-start; gap: 8px; }
  .qtile-text small { display: none; }
  .mini-stat { flex-direction: column; text-align: center; gap: 4px; padding: 10px 6px; }
  .mini-stat small { display: block; line-height: 1.2; }
  .color-area .swatches { flex: 1; min-width: 0; }
  .ctrl > span { width: 44px; }
  .ctrl .val { width: 36px; }
  .tool-group { border-right: 0; padding-right: 0; }
}
