/* Amigo dashboard styles (moved out of dashboard.html) */
:root {
  --bg: #fafafa; --card: #fff; --ink: #09090b; --body: #3f3f46; --muted: #71717a; --line: #e4e4e7; --soft: #f4f4f5;
  --p1: #4f6bff; --p2: #3b82f6; --p-soft: #dbeafe;
  --ease: cubic-bezier(.22, 1, .36, 1); --spring: cubic-bezier(.34, 1.4, .64, 1);
  --display: "Plus Jakarta Sans", sans-serif; --text: "Inter Tight", sans-serif;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px -12px rgba(0,0,0,.12);
  /* question-type colours */
  --mc: #9b6cf0; --tf: #4f6bff; --mt: #ff8a1f; --sa: #8cc20e; --es: #ec3d8a;
  /* status + surface tokens (dark values below) */
  --ok-bg: #dcfce7; --ok-soft: #f0fdf4; --ok-ink: #14532d; --ok-text: #15803d;
  --bad-bg: #fee2e2; --bad-soft: #fef2f2; --bad-ink: #7f1d1d; --bad-text: #b91c1c; --bad-line: #fca5a5;
  --warn-bg: #fef3c7; --warn-ink: #92400e;
  --raised: #fcfcfd; --shimmer: #ececef; --line-strong: #d4d4d8; --placeholder: #a1a1aa;
  --glow1: #dbeafe; --glow2: #e0f2fe;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c0c10; --card: #16161c; --ink: #f4f4f5; --body: #d4d4d8; --muted: #a1a1aa; --line: #2a2a33; --soft: #1f1f27;
  --p1: #3b82f6; --p2: #60a5fa; --p-soft: #172a4d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.6);
  --ok-bg: #12351f; --ok-soft: #0e2918; --ok-ink: #bbf7d0; --ok-text: #4ade80;
  --bad-bg: #3a1414; --bad-soft: #2a1010; --bad-ink: #fecaca; --bad-text: #f87171; --bad-line: #7f1d1d;
  --warn-bg: #3a2a0a; --warn-ink: #fcd34d;
  --raised: #1a1a21; --shimmer: #2a2a33; --line-strong: #3f3f48; --placeholder: #71717a;
  --glow1: #0f2140; --glow2: #0b2433;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { transition: background-color .3s, color .3s; }
body { background: var(--bg); color: var(--ink); font-family: var(--text); font-weight: 500; font-size: 14px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
#newView[hidden], #topbar[hidden] { display: none !important; }

/* ---------- Layout + sidebar navigation ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); background: var(--bg); z-index: 40; }
.logo { display: block; padding: 4px 8px 26px; }
.logo .logo-img { display: block; width: 135px; max-width: 100%; height: auto; margin: 0 auto; }
:root[data-theme="dark"] .logo-img.light, .logo-img.dark { display: none; }
:root[data-theme="dark"] .logo-img.dark { display: block; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--muted); transition: background .2s, color .2s; }
.nav-item:hover { background: var(--soft); color: var(--ink); }
.nav-item.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.side-label { font-size: 11px; letter-spacing: .1em; color: var(--muted); padding: 20px 10px 8px; }
.types-list .nav-item .mascot { width: 26px; }
/* Sidebar characters: only the eyes move (a look left and right, then a blink), each on its own beat */
.types-list .mascot .eyes { animation: idleEyes 6s ease-in-out infinite; }
.types-list .nav-item:nth-child(2) .mascot .eyes { animation-delay: -1.2s; }
.types-list .nav-item:nth-child(3) .mascot .eyes { animation-delay: -2.4s; }
.types-list .nav-item:nth-child(4) .mascot .eyes { animation-delay: -3.6s; }
.types-list .nav-item:nth-child(5) .mascot .eyes { animation-delay: -4.8s; }
@keyframes idleEyes { 0%, 18% { transform: none; } 24%, 40% { transform: translateX(2.5px); } 46%, 62% { transform: translateX(-2.5px); } 68%, 88% { transform: none; } 91% { transform: scaleY(.1); } 94%, 100% { transform: none; } }
/* Question-type mascots: Mochi, Gibo, Iko, Ari, Oli */
.mascot { display: inline-block; flex: none; width: 34px; line-height: 0; }
.mascot svg { width: 100%; height: auto; display: block; overflow: visible; }
.mascot .eyes { transform-box: fill-box; transform-origin: center; }
.nav-item:hover .mascot .eyes, .qsec-h:hover .mascot .eyes, .count:hover .mascot .eyes, .chip:hover .mascot .eyes, .sc-row:hover .mascot .eyes { animation: blink .5s ease-in-out; }
.mascot.bob svg { animation: bob 3.6s ease-in-out infinite; }
@keyframes blink { 40%, 60% { transform: scaleY(.15); } }
@keyframes bob { 50% { translate: 0 -2px; } }
.m-name { flex: none; padding: 2px 9px; border-radius: 20px; font-family: var(--display); font-size: 10px; font-weight: 700; letter-spacing: .06em; color: #111; }
.upgrade { margin-top: auto; padding: 16px; border-radius: 16px; color: #fff; background: radial-gradient(circle at 30% 0%, var(--p2), var(--p1) 70%); }
.upgrade p { font-size: 13px; opacity: .85; margin: 6px 0 12px; }
.upgrade button { width: 100%; height: 34px; border-radius: 100px; background: #4f6bff; color: #fff; font-weight: 600; font-size: 13px; transition: transform .4s var(--spring); }
.upgrade button:hover { transform: scale(1.04); }
main { padding: 40px 32px 64px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; justify-items: center; align-content: start; }
.menu-btn { display: none; position: fixed; top: 16px; left: 16px; z-index: 30; width: 40px; height: 40px; border-radius: 50%; place-items: center; background: var(--card); border: 1px solid var(--line); }

/* ---------- Cards ---------- */
.card { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.form-card { max-width: 1080px; }
.form-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; } /* minmax(0) stops a long file name from widening the page on phones */
.form-body .field-label:first-child { margin-top: 0; }
@media (min-width: 1000px) {
  .form-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
  .form-body .drop { min-height: 260px; }
  .form-right { padding-left: 32px; border-left: 1px solid var(--line); }
}
.rise { opacity: 0; transform: translateY(18px); filter: blur(8px); animation: rise .9s var(--ease) forwards; }
@keyframes rise { to { opacity: 1; transform: none; filter: none; } }
h1 { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -0.04em; }
h2 { font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -0.03em; }
.sub { color: var(--muted); margin: 4px 0 20px; }
.notice { max-width: 1080px; width: 100%; padding: 12px 16px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; }
.notice code { font-family: ui-monospace, monospace; background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; }

/* Dropzone */
.drop { position: relative; display: grid; place-items: center; text-align: center; gap: 6px; padding: 28px 16px; border: 1.5px dashed var(--line);
  border-radius: 14px; background: var(--soft); color: var(--muted); cursor: pointer; transition: border-color .25s, background .25s, transform .4s var(--spring); }
.drop:hover, .drop:focus-within { border-color: var(--p2); }
.drop.over { border-color: var(--p1); background: var(--p-soft); transform: scale(1.02); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.d-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--card); color: var(--p1); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.drop b { color: var(--ink); font-weight: 500; }
.drop b u { color: var(--p1); text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat; transition: background-size .35s var(--ease); }
.drop:hover b u { background-size: 100% 1.5px; }

/* Upload area animation: floating icon, pulsing rings, arrow nudging up */
.drop .d-ico { position: relative; z-index: 0; overflow: visible; animation: dFloat 3.2s ease-in-out infinite; transition: transform .45s var(--spring), box-shadow .3s; }
.drop .d-ico::before, .drop .d-ico::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 14px; border: 1.5px solid var(--p2); opacity: 0; animation: dRing 2.8s var(--ease) infinite; pointer-events: none; }
.drop .d-ico::after { animation-delay: 1.4s; }
.drop .d-arrow { animation: dArrow 1.8s var(--ease) infinite; transform-box: fill-box; transform-origin: center; }
.drop:hover .d-ico { transform: translateY(-4px) scale(1.06); box-shadow: 0 10px 24px -10px rgba(37, 99, 235, .55); }
.drop .d-text { display: grid; }
.drop .d-text > span { grid-area: 1 / 1; transition: opacity .25s, transform .35s var(--ease); }
.drop .d-over { opacity: 0; transform: translateY(6px); color: var(--p1); }
/* While a file is dragged over the box */
.drop.over .d-ico { transform: translateY(-6px) scale(1.18); box-shadow: 0 14px 30px -10px rgba(37, 99, 235, .7); animation-play-state: paused; }
.drop.over .d-ico::before, .drop.over .d-ico::after { animation-duration: 1.2s; }
.drop.over .d-arrow { animation: dBounce .6s ease-in-out infinite; }
.drop.over .d-idle { opacity: 0; transform: translateY(-6px); }
.drop.over .d-over { opacity: 1; transform: none; }
.drop.over small { opacity: .5; }
.drop.over { box-shadow: 0 0 0 4px var(--p-soft); }
@keyframes dFloat { 50% { translate: 0 -5px; } }
@keyframes dRing { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(1.9); opacity: 0; } }
@keyframes dArrow { 0%, 100% { transform: translateY(0); opacity: 1; } 45% { transform: translateY(-3px); opacity: 1; } 55% { transform: translateY(-4px); opacity: .2; } 56% { transform: translateY(3px); opacity: 0; } 75% { transform: translateY(0); opacity: 1; } }
@keyframes dBounce { 50% { transform: translateY(-4px); } }
.drop small { font-size: 12px; }

.files { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; }
.files:empty { display: none; }
.files li.preparing { color: var(--muted); font-size: 13px; border-style: dashed; }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; animation: rowIn .4s var(--ease) both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } }
.thumb { width: 40px; height: 40px; flex: none; border-radius: 8px; object-fit: cover; background: var(--soft); display: grid; place-items: center; font-size: 10px; font-weight: 600; color: var(--p1); text-transform: uppercase; }
.meta { min-width: 0; flex: 1; }
.meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta small { color: var(--muted); font-size: 12px; }
.rm { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); transition: background .2s, color .2s; }
.rm:hover { background: var(--bad-bg); color: var(--bad-text); }
.rm svg { width: 14px; height: 14px; }
.err { color: var(--bad-text); font-size: 13px; margin-top: 10px; }
.err:empty { display: none; }

/* Question counts */
.field-label { display: block; font-size: 12px; color: var(--muted); margin: 20px 0 8px; }
.counts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.count { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 6px; }
.count span { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; line-height: 1.2; min-height: 30px; }
.count > span { flex-direction: column; align-items: flex-start; gap: 5px; }
.count span.mascot { width: 24px; display: inline-block; min-height: 0; line-height: 0; }
.count input { width: 100%; height: 32px; border: 0; border-radius: 8px; background: var(--soft); padding: 0 8px; font-size: 15px; font-weight: 600; outline: 0; }
.count input:focus { box-shadow: 0 0 0 1.5px var(--p2); }
.count small { font-size: 11px; color: var(--muted); line-height: 1.2; transition: color .2s; }
.count.over { border-color: var(--bad-line); }
.count.over input { box-shadow: 0 0 0 1.5px #ef4444; }
.count.over small { color: var(--bad-text); font-weight: 600; }
.count-note { display: flex; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.count-note svg { width: 15px; height: 15px; color: var(--p1); margin-top: 1px; }
.count-note b { color: var(--ink); font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 100px; color: #fff; font-size: 14px; font-weight: 600;
  background: linear-gradient(180deg, #7389ff, #4f6bff); box-shadow: inset 0 1px 1px rgba(255,255,255,.4), 0 2px 6px rgba(79,107,255,.3);
  transition: transform .4s var(--spring), box-shadow .3s, opacity .2s; }
.btn:hover:not(:disabled) { transform: scale(1.02); box-shadow: inset 0 1px 1px rgba(255,255,255,.4), 0 8px 20px -4px rgba(79,107,255,.5); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.wide { width: 100%; margin-top: 20px; }
.quota { text-align: center; font-size: 12px; color: var(--muted); margin-top: 10px; }
.quota b { color: var(--ink); font-weight: 600; }
.quota.out b { color: var(--bad-text); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ghost { height: 36px; padding: 0 14px; border-radius: 100px; border: 1px solid var(--line); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; transition: background .2s; }
.ghost:hover { background: var(--soft); }

/* ---------- Results ---------- */
.results { width: 100%; max-width: 1080px; display: grid; gap: 24px; }
.summary-card h1 { margin-bottom: 4px; }
.summary-text { color: var(--body); font-size: 15px; line-height: 1.6; margin-top: 12px; white-space: pre-line; }
.points { list-style: none; display: grid; gap: 8px; margin-top: 16px; }
.points li { position: relative; padding-left: 22px; color: var(--body); }
.points li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--p1); }
.eyebrow { font-size: 11px; letter-spacing: .12em; color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar h2 { margin-right: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 100px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); transition: .25s; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip em { font-style: normal; opacity: .6; }
.chip .mascot { width: 20px; margin-left: -4px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 20px; background: var(--line); position: relative; cursor: pointer; transition: background .25s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .3s var(--spring); }
.switch input:checked { background: var(--p1); }
.switch input:checked::after { transform: translateX(14px); }

.coverage { display: flex; gap: 10px; padding: 12px 14px; margin-bottom: 16px; border-radius: 12px; background: var(--p-soft); color: var(--ink); font-size: 13px; line-height: 1.5; }
.coverage svg { color: var(--p1); margin-top: 1px; }
.coverage p + p { margin-top: 4px; color: var(--body); }
/* ---------- Interactive quiz ---------- */
/* Score analytics: overall ring + per-section bars + insight */
.scoreboard { margin-bottom: 16px; border-radius: 16px; border: 1px solid var(--line);
  background: radial-gradient(120% 140% at 0% 0%, var(--glow1), transparent 55%), var(--raised); }
.scoreboard:empty { display: none; }
/* Summary row (always visible) */
.sc-sum { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 18px; text-align: left; border-radius: 16px; }
.sc-sum:focus-visible { outline: 2px solid var(--p2); outline-offset: -2px; }
.sc-mring { position: relative; width: 48px; height: 48px; flex: none; transition: opacity .3s, width .4s var(--ease), margin .4s var(--ease); }
.sc-mring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sc-mring circle { fill: none; stroke-width: 6; }
.sc-mring .track { stroke: var(--line); }
.sc-mring .seg { stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.sc-mring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 13px; font-weight: 700; letter-spacing: -0.03em; }
.sc-sum-txt { min-width: 0; flex: 1; display: grid; gap: 3px; }
.sc-sum-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sc-sum-top h3 { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.sc-sum-top .sc-grade { padding: 2px 9px; font-size: 11px; }
.sc-sum-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-sum-sub b { color: var(--ink); font-weight: 600; }
.sc-minis { display: flex; align-items: flex-end; gap: 4px; height: 30px; flex: none; transition: opacity .3s; }
.sc-minis i { position: relative; width: 8px; height: 100%; border-radius: 4px; background: var(--line); overflow: hidden; }
.sc-minis i.todo { background: repeating-linear-gradient(-45deg, var(--line) 0 3px, transparent 3px 5px); }
.sc-minis i::after { content: ""; position: absolute; inset: auto 0 0; height: var(--h); background: var(--c); border-radius: inherit; transition: height 1s var(--ease); }
.sc-toggle { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 20px; font-size: 12px; color: var(--ink); background: var(--card); border: 1px solid var(--line); transition: border-color .2s; }
.sc-sum:hover .sc-toggle { border-color: var(--line-strong); }
.sc-toggle svg { width: 14px; height: 14px; transition: transform .4s var(--ease); }
.scoreboard.open .sc-toggle svg { transform: rotate(180deg); }
.scoreboard.open .sc-mring { opacity: 0; width: 0; margin-right: -14px; }
.scoreboard.open .sc-minis { opacity: 0; pointer-events: none; }
/* Details (expand / collapse) */
.sc-details { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s var(--ease); }
.scoreboard.open .sc-details { grid-template-rows: 1fr; }
.sc-clip { overflow: hidden; min-height: 0; }
.sc-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; padding: 4px 18px 18px; opacity: 0; transform: translateY(-6px); transition: opacity .35s, transform .5s var(--ease); }
.scoreboard.open .sc-body { opacity: 1; transform: none; transition-delay: .08s; }
.sc-overall { display: grid; justify-items: center; align-content: center; gap: 10px; text-align: center; padding-right: 20px; border-right: 1px solid var(--line); }
.sc-ring { position: relative; width: 132px; height: 132px; }
.sc-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sc-ring circle { fill: none; stroke-width: 10; }
.sc-ring .track { stroke: var(--line); }
.sc-ring .seg { stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease), stroke .4s; }
.sc-ring .mid { position: absolute; inset: 0; display: grid; place-content: center; }
.sc-ring .mid b { font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -0.04em; line-height: 1; }
.sc-ring .mid small { font-size: 11px; color: var(--muted); margin-top: 4px; }
.sc-grade { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.sc-sub { font-size: 12px; color: var(--muted); }
.sc-main { display: grid; gap: 14px; align-content: start; min-width: 0; }
.sc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sc-head h3 { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.sc-head span { font-size: 12px; color: var(--muted); }
.sc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sc-stat { padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); min-width: 0; }
.sc-stat small { display: block; font-size: 11px; color: var(--muted); }
.sc-stat b { display: block; margin-top: 2px; font-family: var(--display); font-size: 17px; letter-spacing: -0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-stat em { font-style: normal; font-size: 11px; color: var(--muted); font-family: var(--text); font-weight: 500; letter-spacing: 0; }
.sc-rows { display: grid; gap: 4px; }
.sc-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 54px 64px; align-items: center; gap: 12px; padding: 7px 8px; margin: 0 -8px; border-radius: 10px; text-align: left; transition: background .2s; }
.sc-row:hover { background: var(--soft); }
.sc-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.sc-name span.mascot { width: 26px; overflow: visible; }
.sc-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-name small { color: var(--muted); font-size: 11px; flex: none; }
.sc-bar { position: relative; height: 10px; border-radius: 10px; background: var(--line); }
.sc-bar.todo { background: repeating-linear-gradient(-45deg, var(--line) 0 6px, transparent 6px 10px); }
.sc-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; transition: width 1s var(--ease), background .4s; }
.sc-bar .last { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--ink); opacity: .35; }
.sc-pct { font-family: var(--display); font-weight: 700; font-size: 15px; text-align: right; letter-spacing: -0.02em; }
.sc-pct.todo { font-family: var(--text); font-weight: 500; font-size: 12px; color: var(--muted); }
.sc-delta { justify-self: start; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 20px; white-space: nowrap; }
.sc-delta.up { background: var(--ok-bg); color: var(--ok-text); }
.sc-delta.down { background: var(--bad-bg); color: var(--bad-text); }
.sc-delta.same, .sc-delta.prev { background: var(--soft); color: var(--muted); }
.sc-tip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--p-soft); color: var(--ink); font-size: 13px; line-height: 1.45; }
.sc-tip svg { color: var(--p1); margin-top: 1px; }
.sc-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.sc-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sc-legend i { width: 8px; height: 8px; border-radius: 50%; }
.sc-legend .tick { width: 2px; height: 10px; border-radius: 2px; background: var(--ink); opacity: .35; }
@media (max-width: 760px) {
  .sc-body { grid-template-columns: 1fr; }
  .sc-minis { display: none; }
  .sc-sum { padding: 12px 14px; gap: 12px; }
  .sc-toggle span { display: none; }
  .sc-sum-sub { white-space: normal; line-height: 1.35; }
  .sc-toggle { width: 32px; padding: 0; justify-content: center; }
  .sc-overall { padding: 0 0 16px; border-right: 0; border-bottom: 1px solid var(--line); grid-template-columns: auto 1fr; justify-items: start; text-align: left; column-gap: 16px; }
  .sc-ring { width: 104px; height: 104px; grid-row: span 3; }
  .sc-ring .mid b { font-size: 24px; }
  .sc-row { grid-template-columns: minmax(0, 1fr) 46px 58px; row-gap: 6px; }
  .sc-row .sc-bar { grid-column: 1 / -1; grid-row: 2; }
  .sc-stat b { white-space: normal; }
  .sc-stat em { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

.qsec { border: 1px solid var(--line); border-radius: 16px; margin-top: 16px; overflow: hidden; background: var(--card); animation: rowIn .5s var(--ease) both; }
.qsec-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--soft); border-bottom: 1px solid var(--line); }
.qsec-h .mascot { width: 40px; }
.qsec-h h3 { font-family: var(--display); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.qsec-h small { color: var(--muted); margin-left: auto; font-size: 12px; text-align: right; }
.qitem { padding: 18px; border-top: 1px solid var(--line); }
.qitem:first-of-type { border-top: 0; }
.qtext { color: var(--ink); font-size: 15px; line-height: 1.45; display: flex; gap: 8px; }
.qnum { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; min-width: 22px; }

.opts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 0 30px; }
.opts-grid.tf { grid-template-columns: repeat(2, minmax(0, 160px)); }
.opt { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--body); transition: border-color .2s, background .2s, transform .3s var(--spring); }
.opt:hover { border-color: var(--p2); }
.opt:active { transform: scale(.98); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt b { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--soft); color: var(--muted); transition: .2s; }
.opt:has(input:checked) { border-color: var(--p1); background: var(--p-soft); color: var(--ink); }
.opt:has(input:checked) b { background: var(--p1); color: #fff; }
.opt:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--p-soft); }
.opt.right { border-color: #22c55e !important; background: var(--ok-bg) !important; color: var(--ok-ink); }
.opt.right b { background: #22c55e !important; color: #fff !important; }
.opt.wrong { border-color: #ef4444 !important; background: var(--bad-bg) !important; color: var(--bad-ink); }
.opt.wrong b { background: #ef4444 !important; color: #fff !important; }
.done .opt { cursor: default; }
.show-key .qsec:not(.done) .opt.is-key { border-style: dashed; border-color: #22c55e; }

.key { display: none; margin: 10px 0 0 30px; padding: 10px 12px; border-radius: 10px; background: var(--ok-soft); color: var(--ok-ink); font-size: 13px; line-height: 1.5; }
.key b { font-weight: 600; }
.show-key .key, .done .key { display: block; }
.verdict { margin: 8px 0 0 30px; font-size: 13px; font-weight: 600; }
.verdict:empty { display: none; }
.verdict.ok { color: var(--ok-text); } .verdict.bad { color: var(--bad-text); } .verdict.none { color: var(--muted); }

/* Matching: draw strings between columns */
.mset { padding: 18px; border-top: 1px solid var(--line); }
.mset:first-of-type { border-top: 0; }
.mhint { margin: 6px 0 0 30px; font-size: 12px; color: var(--muted); }
.mboard { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr); margin: 14px 0 0 30px; user-select: none; -webkit-user-select: none; touch-action: none; }
.mcol { display: grid; gap: 10px; align-content: start; }
.mcol.left { grid-column: 1; } .mcol.right { grid-column: 3; }
.mhead { font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.mitem { position: relative; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: grab; color: var(--body); font-size: 14px; line-height: 1.35; transition: border-color .2s, box-shadow .2s, transform .3s var(--spring); }
.mitem b { color: var(--muted); font-weight: 600; margin-right: 4px; }
.mitem:hover { border-color: var(--p2); }
.mitem.sel { border-color: var(--p1); box-shadow: 0 0 0 3px var(--p-soft); transform: scale(1.02); }
.mitem.linked { border-color: var(--c); }
.mitem .mdot { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 2px solid var(--placeholder); transform: translateY(-50%); transition: background .2s, border-color .2s; }
.mcol.left .mdot { right: -8px; } .mcol.right .mdot { left: -8px; }
.mitem.linked .mdot { background: var(--c); border-color: var(--c); }
.done .mitem { cursor: default; }
.mitem.right-pair { border-color: #22c55e; background: var(--ok-soft); }
.mitem.wrong-pair { border-color: #ef4444; background: var(--bad-soft); }
svg.mlines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
svg.mlines path { fill: none; stroke-width: 2.5; stroke-linecap: round; }
svg.mlines path.link { animation: draw .45s var(--ease) both; }
svg.mlines path.temp { stroke: var(--p2); stroke-dasharray: 6 6; }
svg.mlines path.ok { stroke: #22c55e; }
svg.mlines path.bad { stroke: #ef4444; stroke-dasharray: 2 6; }
svg.mlines path.key { stroke: #22c55e; stroke-dasharray: 7 6; opacity: .75; }
@keyframes draw { from { stroke-dasharray: 1 600; } }

/* Written answers */
.answer { display: block; width: calc(100% - 30px); margin: 12px 0 0 30px; min-height: 76px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font: inherit; font-weight: 400; font-size: 14px; line-height: 1.5; color: var(--ink); resize: vertical; outline: 0; transition: border-color .2s, box-shadow .2s; }
.answer.essay { min-height: 180px; }
.answer:focus { border-color: var(--p2); box-shadow: 0 0 0 3px var(--p-soft); }
.answer:disabled { background: var(--soft); color: var(--body); }
.chars { margin: 4px 0 0 30px; font-size: 11px; color: var(--muted); text-align: right; }
.grade { display: none; gap: 12px; margin: 10px 0 0 30px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); }
.grade.show { display: flex; animation: rowIn .45s var(--ease) both; }
.gscore { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 15px; color: #fff; }
.grade p { font-size: 13px; line-height: 1.5; color: var(--body); }
.grade p + p { margin-top: 4px; }

/* Section footer + results */
.qsec-f { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--raised); }
.btn.sm { height: 38px; padding: 0 16px; font-size: 13px; }
.result { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; }
.result:empty { display: none; }
.rscore { font-family: var(--display); font-weight: 700; font-size: 24px; letter-spacing: -0.03em; }
.rbar { flex: 1; height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; max-width: 260px; }
.rbar i { display: block; height: 100%; width: 0; border-radius: 8px; transition: width 1s var(--ease); }
.rtext { font-size: 13px; color: var(--body); }
.rerr { color: var(--bad-text); font-size: 13px; }
.spin.dark { border-color: var(--p-soft); border-top-color: var(--p1); }

@media (max-width: 700px) {
  .opts-grid { grid-template-columns: 1fr; margin-left: 0; }
  .opts-grid.tf { grid-template-columns: 1fr 1fr; }
  .key, .verdict, .mhint, .grade, .chars { margin-left: 0; }
  .answer { width: 100%; margin-left: 0; }
  .mboard { grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); margin-left: 0; }
  .mitem { font-size: 13px; padding: 9px 10px; }
  .qsec-h small { display: none; }
}

/* ---------- Account: log in / sign up ---------- */
.auth-bg { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px 16px; overflow-y: auto;
  background: radial-gradient(circle at 20% 0%, var(--glow1) 0%, transparent 45%), radial-gradient(circle at 90% 100%, var(--glow2) 0%, transparent 40%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo { display: block; padding: 4px 0 20px; }
.auth-card .logo .logo-img { width: 150px; margin: 0 auto; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 100px; background: var(--soft); margin: 18px 0 20px; }
.auth-tabs button { height: 34px; border-radius: 100px; font-size: 13px; color: var(--muted); transition: background .25s, color .25s; }
.auth-tabs button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.auth-field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.auth-field input { height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 15px; outline: 0; transition: border-color .2s, box-shadow .2s; }
.auth-field input:focus { border-color: var(--p2); box-shadow: 0 0 0 3px var(--p-soft); }
.auth-msg { padding: 10px 12px; border-radius: 10px; background: var(--ok-soft); color: var(--ok-ink); font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.auth-links { display: flex; justify-content: center; margin-top: 12px; }
.linkbtn { color: var(--p1); font-size: 13px; padding: 4px 8px; border-radius: 6px; }
.linkbtn:hover { background: var(--p-soft); }
.auth-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; line-height: 1.5; }

/* Signed-in user in the sidebar */
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); margin-bottom: 10px; }
.me .av { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 600; background: linear-gradient(135deg, var(--p2), var(--p1)); }
.me span { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me button { font-size: 12px; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.me button:hover { color: var(--bad-text); background: var(--bad-bg); }
.side .upgrade { margin-top: 0; }
.nav-item .badge { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 20px; background: var(--p-soft); color: var(--p1); }

/* ---------- History ---------- */
.history { width: 100%; max-width: 1080px; }
/* ---------- Ask Amigo ---------- */
.ask { width: 100%; max-width: 1080px; }
.ask-box { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--raised); }
.ask-log { height: min(58vh, 560px); overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.ask-msg { display: flex; gap: 10px; align-items: flex-end; max-width: 92%; animation: rowIn .35s var(--ease) both; }
.ask-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.ask-msg .mascot { width: 38px; flex: none; margin-bottom: 2px; }
.ask-msg .mascot .eyes { animation: idleEyes 6s ease-in-out infinite; }
.ask-bubble { padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--card); border: 1px solid var(--line); font-size: 14px; line-height: 1.5; min-width: 0; }
.ask-msg.user .ask-bubble { border-radius: 16px 16px 4px 16px; background: #4f6bff; border-color: transparent; color: #fff; font-weight: 500; }
.ask-bubble p + p { margin-top: 6px; }
.ask-bubble mark { background: color-mix(in srgb, #ff8a1f 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.ask-cards { display: grid; gap: 8px; margin-top: 10px; }
.ask-card { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--raised); }
.ask-card .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--ac, #4f6bff); font-size: 15px; }
.ask-card .tx { min-width: 0; display: grid; gap: 2px; }
.ask-card .tx small { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ask-card .tx b { font-size: 13.5px; font-weight: 600; }
.ask-card .tx span { font-size: 12.5px; color: var(--body); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ask-card button { height: 30px; padding: 0 12px; border-radius: 15px; font-size: 12px; font-weight: 600; color: #fff; background: #4f6bff; white-space: nowrap; }
.ask-card button:hover { background: #7389ff; }
.ask-more { font-size: 12px; color: var(--muted); margin-top: 6px; }
.ask-time { font-size: 10.5px; color: var(--placeholder); margin-top: 4px; }
.ask-mode { display: flex; align-items: center; gap: 6px; padding: 10px 14px 0; border-top: 1px solid var(--line); background: var(--card); }
.ask-mode button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; font-size: 12.5px; border: 1px solid var(--line); color: var(--muted); transition: .2s; }
.ask-mode button small { font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 8px; background: var(--soft); color: var(--muted); }
.ask-mode button.on { color: var(--ink); border-color: var(--ink); }
.ask-mode button[data-mode=ai].on { border-color: #4f6bff; background: color-mix(in srgb, #4f6bff 10%, var(--card)); }
.ask-mode button[data-mode=ai] small.lock { background: linear-gradient(135deg, var(--p2), var(--p1)); color: #fff; }
.ask-left { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.ask-bubble.ai { border-color: color-mix(in srgb, #4f6bff 40%, var(--line)); }
.ask-bubble .ai-tag { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; font-size: 10px; font-weight: 700; letter-spacing: .06em; color: #4f6bff; }
.ask-bubble .cite { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; margin: 0 1px; border-radius: 9px; font-size: 10px; font-weight: 700; vertical-align: 1px; color: #fff; background: color-mix(in srgb, #4f6bff 35%, var(--card)); }
.ask-bubble ul { margin: 6px 0 2px 18px; display: grid; gap: 3px; }
.ask-sugg { border-top: 0 !important; }
.ask-sugg { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; border-top: 1px solid var(--line); background: var(--card); }
.ask-sugg button { padding: 5px 12px; border-radius: 20px; font-size: 12px; border: 1px solid var(--line); color: var(--body); background: var(--raised); transition: border-color .2s; }
.ask-sugg button:hover { border-color: #4f6bff; color: var(--ink); }
.ask-form { display: flex; gap: 8px; padding: 10px 14px 14px; background: var(--card); }
.ask-form input { flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font: inherit; font-size: 14px; outline: 0; }
.ask-form input:focus { border-color: #4f6bff; box-shadow: 0 0 0 3px color-mix(in srgb, #4f6bff 20%, transparent); }
.ask-form .btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.ask-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.ask-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: askDot 1s infinite; }
.ask-typing i:nth-child(2) { animation-delay: .15s; } .ask-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes askDot { 50% { transform: translateY(-4px); opacity: .4; } }
@media (max-width: 600px) { .ask-card { grid-template-columns: 30px 1fr; } .ask-card button { grid-column: 1 / -1; justify-self: start; } .ask-log { height: 60vh; padding: 12px; } }
/* ---------- Journal tabs ---------- */
.j-tabs { display: inline-flex; gap: 4px; padding: 4px; margin: 6px 0 4px; border-radius: 12px; background: var(--soft); }
.j-tabs button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13px; color: var(--muted); transition: background .2s, color .2s; }
.j-tabs button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.j-tabs svg { width: 16px; height: 16px; }
.j-tabs .badge { margin-left: 2px; font-size: 10.5px; padding: 0 6px; border-radius: 10px; background: #ec3d8a; color: #fff; }
.j-pro { margin-left: 2px; padding: 1px 6px; border-radius: 10px; font-size: 9px; font-weight: 700; letter-spacing: .06em; color: #fff; background: linear-gradient(135deg, var(--p2), var(--p1)); }
.j-pro.big { font-size: 11px; padding: 2px 9px; }
.db-locked { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: center; padding: 32px; border: 1px solid var(--line); border-radius: 16px;
  background: radial-gradient(120% 120% at 0% 0%, var(--glow1), transparent 60%), var(--raised); }
.db-locked h2 { font-size: 22px; letter-spacing: -0.03em; margin: 10px 0 12px; }
.db-locked ul { list-style: none; display: grid; gap: 8px; margin-bottom: 20px; }
.db-locked li { position: relative; padding-left: 24px; font-size: 14px; color: var(--body); }
.db-locked li::before { content: "✓"; position: absolute; left: 0; color: #4f6bff; font-weight: 700; }
.db-locked-art { position: relative; justify-self: center; }
.mini-cal { width: 180px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mini-cal b { grid-column: 1 / -1; font: 700 12px var(--display); letter-spacing: .1em; color: var(--muted); margin-bottom: 4px; }
.mini-cal i { aspect-ratio: 1; border-radius: 6px; background: var(--soft); }
.mini-cal i.e { background: #ec3d8a; } .mini-cal i.m { background: #4f6bff; } .mini-cal i.d { background: #ff8a1f; }
.db-locked-art .mascot { position: absolute; right: -18px; bottom: -16px; width: 60px; }
.db-locked-art .mascot .eyes { animation: idleEyes 6s ease-in-out infinite; }
@media (max-width: 700px) { .db-locked { grid-template-columns: 1fr; padding: 22px; gap: 24px; } }
/* ---------- Daybook ---------- */
.db-wrap { display: grid; grid-template-columns: 340px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; min-height: 480px; }
.db-left { border-right: 1px solid var(--line); background: var(--raised); padding: 14px; display: grid; gap: 16px; align-content: start; }
.db-cal-h { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.db-cal-h b { font-family: var(--display); font-size: 15px; min-width: 128px; text-align: center; }
.db-nav { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.db-nav:hover { background: var(--soft); color: var(--ink); }
.db-today { margin-left: auto; height: 30px; }
.db-week, .db-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.db-week span { text-align: center; font-size: 10.5px; color: var(--muted); padding-bottom: 4px; }
.db-grid button { position: relative; aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; align-content: center; gap: 3px; font-size: 13px; color: var(--ink); transition: background .2s; }
.db-grid button:hover { background: var(--soft); }
.db-grid button.out { color: var(--placeholder); }
.db-grid button.past:not(.today):not(.sel) { color: var(--muted); }
.db-grid button.today { box-shadow: inset 0 0 0 1.5px #4f6bff; font-weight: 700; }
.db-grid button.sel { background: #4f6bff; color: #fff; font-weight: 700; }
.db-grid button.page::after { content: ""; position: absolute; top: 5px; right: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); opacity: .6; }
.db-dots { display: flex; gap: 2px; height: 5px; }
.db-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--kc); }
.db-grid button.sel .db-dots i { box-shadow: 0 0 0 1px #fff; }
.db-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 10px; font-size: 10.5px; color: var(--muted); }
.db-legend span { display: inline-flex; align-items: center; gap: 4px; }
.db-legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--kc); }
.db-up { display: grid; gap: 6px; }
.db-up > b { font-family: var(--display); font-size: 14px; }
.db-up > small { font-size: 11px; color: var(--muted); margin-top: -4px; }
.db-up ul { list-style: none; display: grid; gap: 4px; }
.db-up li.empty { font-size: 12px; color: var(--muted); padding: 6px 0; }
.db-up button { width: 100%; display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 10px; text-align: left; background: var(--card); border: 1px solid var(--line); transition: border-color .2s; }
.db-up button:hover { border-color: var(--line-strong); }
.db-up .when { display: grid; justify-items: center; line-height: 1.05; padding: 3px 0; border-radius: 8px; background: color-mix(in srgb, var(--kc) 22%, var(--card)); }
.db-up .when small { font-size: 9.5px; text-transform: uppercase; color: var(--muted); }
.db-up .when b { font: 700 16px var(--display); }
.db-up .what { min-width: 0; display: grid; }
.db-up .what b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-up .what small { font-size: 11px; color: var(--muted); }
.db-day { padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.db-day-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.db-day-h .mascot { width: 52px; }
.db-day-h .mascot .eyes { animation: idleEyes 6s ease-in-out infinite; }
.db-rel { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #4f6bff; }
.db-day-h h2 { font-size: 26px; letter-spacing: -0.04em; }
.db-date { color: var(--muted); font-size: 13px; }
.db-entries { list-style: none; display: grid; gap: 6px; }
.db-entries li.empty { padding: 14px; border: 1px dashed var(--line-strong); border-radius: 12px; text-align: center; font-size: 13px; color: var(--muted); }
.db-entry { display: grid; grid-template-columns: auto 64px 1fr auto; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; border-radius: 12px; border: 1px solid var(--line);
  border-left: 4px solid var(--kc); background: var(--card); animation: rowIn .3s var(--ease) both; }
.db-entry input[type=checkbox] { width: 17px; height: 17px; accent-color: #22c55e; cursor: pointer; }
.db-entry .t { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.db-entry .m { min-width: 0; display: grid; gap: 2px; cursor: pointer; }
.db-entry .m b { font-size: 14px; font-weight: 600; }
.db-entry .m small { font-size: 12px; color: var(--muted); white-space: pre-wrap; }
.db-entry .k { justify-self: start; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 1px 7px; border-radius: 10px; color: #08131c; background: var(--kc); }
.db-entry.done .m b { text-decoration: line-through; color: var(--muted); }
.db-entry.done { opacity: .7; }
.db-entry.editing { outline: 2px solid #4f6bff; }
.db-entry .x { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.db-entry .x:hover { background: var(--bad-bg); color: var(--bad-text); }
.db-entry .x svg { width: 15px; height: 15px; }
.db-form { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: var(--soft); }
.db-form input, .db-form select, .db-form textarea { font: inherit; font-size: 13px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; outline: 0; }
.db-form input:focus, .db-form select:focus, .db-form textarea:focus { border-color: var(--p2); }
#dbTitle { height: 40px; padding: 0 12px; font-size: 14px; }
.db-form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.db-form-row select, .db-form-row input { height: 36px; padding: 0 10px; }
.db-form-row .btn { margin-left: auto; }
#dbDetails { min-height: 64px; padding: 8px 12px; resize: vertical; }
.db-page-l { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-top: 4px; }
.db-page-l small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.db-page { flex: 1; min-height: 140px; resize: vertical; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  background-image: repeating-linear-gradient(transparent 0 27px, var(--line) 27px 28px); background-attachment: local; color: var(--ink); font: 14px/28px var(--text); outline: 0; }
.db-page:focus { border-color: var(--p2); }
@media (max-width: 860px) { .db-wrap { grid-template-columns: 1fr; } .db-left { border-right: 0; border-bottom: 1px solid var(--line); } }
@media (max-width: 520px) { .db-entry { grid-template-columns: auto 1fr auto; } .db-entry .t { display: none; } .db-day { padding: 14px; } }
/* ---------- Notes ---------- */
.notes { width: 100%; max-width: 1080px; }
#noteNew svg { width: 16px; height: 16px; }
.notes-wrap { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 0; min-height: 460px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.notes-side { border-right: 1px solid var(--line); background: var(--raised); display: flex; flex-direction: column; min-height: 0; }
.notes-search { display: flex; align-items: center; gap: 8px; margin: 12px; padding: 0 12px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted); }
.notes-search:focus-within { border-color: var(--p2); }
.notes-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 13px; }
.notes-list { list-style: none; overflow-y: auto; max-height: 560px; padding: 0 8px 8px; display: grid; gap: 2px; align-content: start; }
.notes-list button { width: 100%; text-align: left; display: grid; gap: 3px; padding: 10px 12px; border-radius: 10px; transition: background .2s; }
.notes-list button:hover { background: var(--soft); }
.notes-list button.on { background: var(--card); box-shadow: var(--shadow); }
.notes-list b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-list span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-list small { font-size: 11px; color: var(--placeholder); }
.notes-list .empty { padding: 16px 12px; font-size: 13px; color: var(--muted); }
.notes-editor { display: flex; flex-direction: column; min-width: 0; padding: 18px 22px 14px; }
.notes-back { display: none; align-self: flex-start; margin-bottom: 8px; }
.note-cat { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.note-cat > svg { width: 16px; height: 16px; flex: none; }
.note-cat input { flex: 1; min-width: 180px; border: 0; outline: 0; background: none; font-size: 13px; color: var(--ink); }
.note-cat input::placeholder { color: var(--placeholder); }
.note-cat-sugg { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; padding-left: 24px; }
.note-cat-sugg:empty { display: none; }
.note-cat-sugg button { padding: 3px 10px; border-radius: 20px; font-size: 11.5px; border: 1px dashed var(--line-strong); color: var(--muted); transition: border-color .2s, color .2s; }
.note-cat-sugg button:hover { border-style: solid; border-color: var(--cc); color: var(--ink); }
.cat-tag { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 1px 8px 1px 6px; border-radius: 20px; font-size: 10.5px; font-weight: 600; color: var(--ink);
  background: color-mix(in srgb, var(--cc) 22%, var(--card)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-tag::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--cc); }
.note-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.note-filters:empty { display: none; }
.note-filters button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11.5px; border: 1px solid var(--line); color: var(--muted); background: var(--card); transition: .2s; }
.note-filters button i { width: 7px; height: 7px; border-radius: 50%; background: var(--cc); }
.note-filters button em { font-style: normal; opacity: .6; }
.note-filters button.on { border-color: var(--ink); color: var(--ink); }
.notes-list .cat-tag { justify-self: start; margin-top: 2px; }
.note-title { border: 0; outline: 0; background: none; font: 600 22px var(--display); letter-spacing: -0.03em; color: var(--ink); padding: 4px 0 6px; }
.note-title::placeholder, .note-body::placeholder { color: var(--placeholder); }
.note-body { flex: 1; min-height: 340px; resize: none; border: 0; outline: 0; background: none; color: var(--ink); font: 15px/1.65 var(--text); padding: 14px 0; }
.from-notes { margin-top: 10px; width: 100%; justify-content: center; }
.fn-pick { margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); overflow: hidden; animation: rowIn .3s var(--ease) both; }
.fn-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.fn-list { list-style: none; max-height: 260px; overflow-y: auto; padding: 6px; display: grid; gap: 4px; }
.fn-list li.empty { padding: 12px; font-size: 13px; color: var(--muted); }
.fn-list button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; text-align: left; transition: background .2s; }
.fn-list button:hover:not(:disabled) { background: var(--soft); }
.fn-list button:disabled { opacity: .45; cursor: not-allowed; }
.fn-list .nf-meta small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nf-item .nf-rev { width: auto; height: 30px; padding: 0 12px 0 9px; gap: 5px; display: inline-flex; align-items: center; margin-right: auto; border-radius: 15px; font-size: 12px; font-weight: 600; color: #fff; background: #4f6bff; }
.nf-item .nf-rev:hover { background: #7389ff; color: #fff; }
.note-files { padding: 12px 0; border-top: 1px solid var(--line); }
.nf-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nf-head b { font-size: 13px; }
.nf-pro { padding: 1px 7px; border-radius: 10px; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; color: #fff; background: linear-gradient(135deg, var(--p2), var(--p1)); }
.note-files.locked .nf-add { opacity: .75; }
.nf-head small { font-size: 11px; color: var(--muted); margin-right: auto; }
.nf-add { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.nf-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.nf-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-top: 10px; }
.nf-list:empty { display: none; }
.nf-item { display: grid; gap: 8px; padding: 10px 10px 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); min-width: 0; animation: rowIn .35s var(--ease) both; }
.nf-item.busy { opacity: .6; border-style: dashed; }
.nf-ext { width: 34px; height: 34px; flex: none; border-radius: 8px; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: #fff; background: #4f6bff; }
.nf-ext.pdf { background: #ec3d8a; } .nf-ext.img { background: #8cc20e; } .nf-ext.doc { background: #4f6bff; } .nf-ext.sheet { background: #22c55e; } .nf-ext.slide { background: #ff8a1f; } .nf-ext.txt { background: #9b6cf0; }
.nf-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nf-actions { display: flex; align-items: center; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.nf-note { margin-right: auto; font-size: 11px; color: var(--muted); }
.nf-meta { min-width: 0; flex: 1; display: grid; gap: 1px; }
.nf-meta b { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nf-meta small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nf-item button { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--muted); transition: background .2s, color .2s; }
.nf-item button:hover { background: var(--soft); color: var(--ink); }
.nf-item button.nf-rm:hover { background: var(--bad-bg); color: var(--bad-text); }
.nf-item button svg { width: 15px; height: 15px; }
.nf-drop { margin-top: 8px; font-size: 11px; color: var(--placeholder); }
.notes-editor.dragging { outline: 2px dashed #4f6bff; outline-offset: -8px; border-radius: 12px; background: color-mix(in srgb, #4f6bff 5%, transparent); }
.note-foot { display: flex; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.note-status.saving { color: var(--muted); } .note-status.saved { color: var(--ok-text); } .note-status.err { color: var(--bad-text); }
.note-count { margin-left: auto; }
.note-del:hover { color: var(--bad-text); border-color: var(--bad-line); }
.notes-empty { display: grid; place-content: center; justify-items: center; gap: 8px; padding: 40px 20px; text-align: center; color: var(--muted); }
.notes-empty .mascot { width: 72px; }
.notes-empty .mascot .eyes { animation: idleEyes 6s ease-in-out infinite; }
.notes-empty b { color: var(--ink); font-family: var(--display); font-size: 16px; }
@media (max-width: 760px) {
  .notes-wrap { grid-template-columns: 1fr; min-height: 0; }
  .notes-side { border-right: 0; }
  .notes-wrap.editing .notes-side, .notes-wrap.editing .notes-empty { display: none; }
  .notes-wrap:not(.editing) .notes-empty { display: none; }
  .notes-back { display: inline-flex; }
  .notes-editor { padding: 14px 16px; }
  .note-body { min-height: 40vh; }
  .nf-drop { display: none; }
}

/* ---------- Mind Games ---------- */
.games { width: 100%; max-width: 1080px; }
.tools, .rooms { width: 100%; max-width: 1080px; } /* same width as the other tabs */
.g-pickrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: -6px 0 18px; }
.g-srclabel { font-size: 13px; color: var(--muted); }
#gSrc { height: 36px; max-width: 100%; min-width: 220px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 13px; }
#gSrc:focus { outline: 0; border-color: var(--p2); box-shadow: 0 0 0 3px var(--p-soft); }
.g-source { font-size: 12px; color: var(--muted); }
.g-source b { color: var(--ink); }
.g-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.g-card { display: grid; gap: 8px; justify-items: start; text-align: left; padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--raised);
  transition: transform .4s var(--spring), border-color .2s, box-shadow .3s; }
.g-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.g-card b { font-family: var(--display); font-size: 17px; letter-spacing: -0.02em; }
.g-card span:not(.mascot) { color: var(--muted); font-size: 13px; line-height: 1.4; }
.g-card em { font-style: normal; font-size: 13px; font-weight: 600; color: #4f6bff; margin-top: 4px; }
.g-ico .mascot { width: 52px; }
.g-ico .mascot .eyes { animation: idleEyes 6s ease-in-out infinite; }
.g-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.g-bar > b { font-family: var(--display); font-size: 16px; margin-right: auto; }
.g-stat { font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 20px; background: var(--soft); }
.g-stat b { color: var(--ink); }
.g-clue { display: grid; gap: 4px; margin: 22px auto 18px; max-width: 620px; text-align: center; font-size: 16px; line-height: 1.45; }
.g-clue small { font-size: 11px; letter-spacing: .12em; color: var(--muted); }
.g-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 auto 18px; max-width: 720px; }
.g-slot { width: 40px; height: 48px; border-radius: 10px; display: grid; place-items: center; font: 700 20px var(--display); border: 1.5px solid var(--line); background: var(--card); transition: border-color .2s, background .2s, transform .3s var(--spring); }
.g-slot.filled { border-color: #4f6bff; }
.g-slot.space { width: 16px; border: 0; background: none; }
.g-slot.hint { color: #4f6bff; }
.g-slots.win .g-slot { border-color: #22c55e; background: var(--ok-bg); color: var(--ok-ink); animation: gWin .5s var(--spring) both; }
.g-slots.win .g-slot:nth-child(2n) { animation-delay: .05s; } .g-slots.win .g-slot:nth-child(3n) { animation-delay: .1s; }
.g-slots.lose .g-slot { border-color: var(--bad-line); background: var(--bad-soft); }
.g-slots.shake { animation: gShake .4s; }
@keyframes gWin { 40% { transform: translateY(-8px) scale(1.08); } }
@keyframes gShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.g-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 18px; }
.g-tile { width: 44px; height: 48px; border-radius: 12px; font: 700 20px var(--display); color: #08131c; background: linear-gradient(180deg, #ffb366, #ff8a1f);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); transition: transform .3s var(--spring), opacity .2s; }
.g-tile:hover { transform: translateY(-3px); }
.g-tile.used { opacity: .2; transform: scale(.85); pointer-events: none; }
.g-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.g-host { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 14px; }
.g-host-face .mascot { width: 76px; transition: filter .3s; }
.g-host-face .mascot img { animation: bob 3.6s ease-in-out infinite; }
.g-host-say { position: relative; padding: 8px 14px; border-radius: 14px; background: var(--card); color: var(--ink); font-weight: 700; font-size: 14px;
  box-shadow: 0 6px 16px -6px rgba(15,15,18,.28), inset 0 0 0 1px var(--line); }
.g-host-say::before { content: ""; position: absolute; left: -4px; top: calc(50% - 5px); width: 10px; height: 10px; background: inherit; border-radius: 2px; transform: rotate(45deg); box-shadow: -1px 1px 0 0 var(--line); }
.g-host-say:empty { display: none; }
.g-host.say-pop .g-host-say { animation: hostSay .45s cubic-bezier(.34,1.5,.64,1); }
@keyframes hostSay { from { opacity: 0; transform: translateX(-6px) scale(.7); } }
.g-host.yay .g-host-face .mascot { animation: hostHop .6s cubic-bezier(.34,1.4,.64,1); }
@keyframes hostHop { 30% { transform: translateY(-16px) rotate(-6deg); } 60% { transform: translateY(0); } 80% { transform: translateY(-6px); } }
.g-host.oops .g-host-face .mascot { animation: gShake .4s; }
.g-host.sad .g-host-face .mascot { filter: grayscale(.6); }
.g-gibo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 16px; }
.g-gibo .mascot { width: 84px; }
.g-gibo.sad .mascot { filter: grayscale(.6); }
.g-gibo.oops .mascot { animation: gShake .4s; }
.g-keys { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 6px; max-width: 640px; margin: 0 auto; }
.g-key { height: 40px; border-radius: 9px; font-weight: 600; background: var(--soft); border: 1px solid var(--line); transition: background .2s, transform .2s; }
.g-key:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--line-strong); }
.g-key.hit { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.g-key.miss { background: var(--bad-bg); color: var(--bad-text); border-color: transparent; }
.g-key:disabled { cursor: default; }
.g-timer { max-width: 520px; height: 8px; margin: 0 auto 18px; border-radius: 8px; background: var(--line); overflow: hidden; }
.g-timer i { display: block; height: 100%; width: 100%; border-radius: inherit; background: #9b6cf0; transform-origin: left; }
.g-timer i.run { animation: gTime var(--t, 12s) linear forwards; }
@keyframes gTime { to { transform: scaleX(0); background: #ef4444; } }
.g-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 560px; margin: 0 auto; }
.g-choice { min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font: 700 16px var(--display); letter-spacing: .02em;
  transition: transform .3s var(--spring), border-color .2s, background .2s; }
.g-choice:hover:not(:disabled) { transform: translateY(-2px); border-color: #9b6cf0; }
.g-choice.right { border-color: #22c55e; background: var(--ok-bg); color: var(--ok-ink); }
.g-choice.wrong { border-color: #ef4444; background: var(--bad-bg); color: var(--bad-ink); animation: gShake .4s; }
.g-choice:disabled { cursor: default; }
.g-slot.gap { border-style: dashed; border-color: #8cc20e; background: color-mix(in srgb, #8cc20e 10%, var(--card)); }
.g-type { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 520px; margin: 0 auto; }
.g-type input { flex: 1; min-width: 200px; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: 600 16px var(--text); letter-spacing: .08em; text-transform: uppercase; outline: 0; }
.g-type input:focus { border-color: #8cc20e; box-shadow: 0 0 0 3px color-mix(in srgb, #8cc20e 25%, transparent); }
.g-type.shake { animation: gShake .4s; }
.g-line { min-height: 64px; max-width: 720px; margin: 0 auto 16px; padding: 12px; border-radius: 14px; border: 1.5px dashed var(--line-strong);
  display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; justify-content: center; }
.g-line:empty::before { content: "Tap the words below in order"; color: var(--placeholder); font-size: 13px; align-self: center; }
.g-line.win { border-style: solid; border-color: #22c55e; background: var(--ok-soft); }
.g-line.lose { border-style: solid; border-color: var(--bad-line); background: var(--bad-soft); }
.g-line.shake { animation: gShake .4s; }
.g-words { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 720px; margin: 0 auto 16px; }
.g-word { padding: 8px 12px; border-radius: 10px; font-size: 15px; font-weight: 600; color: #fff; background: linear-gradient(180deg, #f46aa6, #ec3d8a);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); transition: transform .3s var(--spring), opacity .2s; }
.g-word:hover { transform: translateY(-2px); }
.g-word.used { opacity: .2; transform: scale(.9); pointer-events: none; }
.g-line .g-word { animation: rowIn .3s var(--ease) both; }
.g-msg { min-height: 22px; margin: 16px 0 10px; text-align: center; font-weight: 600; }
.g-msg.ok { color: var(--ok-text); } .g-msg.bad { color: var(--bad-text); }
.g-done { text-align: center; padding: 20px 0; display: grid; gap: 10px; }
.g-big { font: 700 44px/1 var(--display); letter-spacing: -0.04em; color: #4f6bff; }
@media (max-width: 700px) { .g-choices { grid-template-columns: 1fr; } .g-keys { grid-template-columns: repeat(7, minmax(0, 1fr)); } .g-slot { width: 32px; height: 40px; font-size: 17px; } .g-tile { width: 38px; height: 42px; } }
.history-h { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.history-h h1 { margin-right: auto; }
.hist-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 20px; }
.hist-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); transition: border-color .2s, box-shadow .2s; animation: rowIn .45s var(--ease) both; }
.hist-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.hist-item h3 { overflow-wrap: anywhere; font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
.hist-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.hist-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hist-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; text-align: left; overflow-wrap: anywhere; padding: 4px 10px; border-radius: 20px; background: var(--soft); font-size: 12px; color: var(--body); transition: background .2s, color .2s; }
.hist-file:hover { background: var(--p-soft); color: var(--p1); }
.hist-file svg { width: 13px; height: 13px; flex: none; }
.hist-side { display: flex; align-items: center; gap: 10px; }
.hist-score { text-align: center; min-width: 76px; }
.hist-score b { display: block; font-family: var(--display); font-size: 20px; letter-spacing: -0.03em; }
.hist-score small { font-size: 11px; color: var(--muted); }
.icon-del { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); transition: background .2s, color .2s; }
.icon-del:hover { background: var(--bad-bg); color: var(--bad-text); }
.hist-empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.hist-empty .d-ico { margin: 0 auto 12px; }
.hist-empty b { display: block; color: var(--ink); font-family: var(--display); font-size: 16px; margin-bottom: 4px; }
.saved-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ok-text); margin-top: 10px; }
@media (max-width: 700px) {
  .hist-item { grid-template-columns: minmax(0, 1fr); }
  .hist-side { justify-content: space-between; }
}

/* ---------- Top bar: profile avatar + menu ---------- */
.topbar { width: 100%; max-width: 1080px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: -8px; position: relative; z-index: 45; }
.avatar { display: grid; place-items: center; border-radius: 50%; overflow: hidden; flex: none; color: #fff; font-weight: 600; background: linear-gradient(135deg, var(--p2), var(--p1)); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 38px; height: 38px; font-size: 15px; }
.avatar.md { width: 48px; height: 48px; font-size: 18px; }
.avatar.lg { width: 96px; height: 96px; font-size: 34px; }
.avatar-btn { border-radius: 50%; padding: 3px; border: 1px solid var(--line); background: var(--card); transition: box-shadow .25s, transform .4s var(--spring); }
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--p-soft); transform: scale(1.04); }
.profile-menu { position: relative; }
.top-actions { display: flex; align-items: center; gap: 10px; }
/* ---------- Notifications (Daybook reminders) ---------- */
.notif { position: relative; }
.bell-btn { position: relative; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--body); display: grid; place-items: center; cursor: pointer; transition: box-shadow .25s, transform .4s var(--spring), color .2s; }
.bell-btn:hover, .bell-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--p-soft); color: var(--ink); transform: scale(1.04); }
.bell-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell-btn.ring svg { animation: bellRing 1.1s var(--ease) 1; transform-origin: 50% 10%; }
@keyframes bellRing { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 75% { transform: rotate(2deg); } }
.bell-count { position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #ec3d8a; color: #fff; font: 700 11px/19px var(--text); text-align: center; box-shadow: 0 0 0 2px var(--bg); font-variant-numeric: tabular-nums; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 10px); width: min(360px, calc(100vw - 32px)); border-radius: 18px; border: 1px solid var(--line); background: var(--card); box-shadow: 0 24px 48px -16px rgba(0,0,0,.35); transform-origin: top right; animation: menuIn .25s var(--ease) both; overflow: hidden; display: flex; flex-direction: column; max-height: min(560px, calc(100vh - 120px)); }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.notif-head b { font-family: var(--display); font-size: 16px; color: var(--ink); }
.notif-head small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.notif-head button { border: 0; background: none; color: var(--p1); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.notif-head button:hover { background: var(--p-soft); }
.notif-body { overflow-y: auto; padding: 6px 8px 8px; }
.notif-group { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 10px 6px; }
.notif-item { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: left; padding: 10px; border: 0; border-radius: 12px; background: transparent; color: var(--body); cursor: pointer; transition: background .15s; }
.notif-item:hover { background: var(--soft); }
.notif-item.unread { background: color-mix(in srgb, var(--p-soft) 55%, transparent); }
.notif-item.unread:hover { background: var(--p-soft); }
.notif-date { width: 42px; height: 46px; border-radius: 11px; display: grid; place-content: center; text-align: center; line-height: 1.05; background: color-mix(in srgb, var(--kc) 14%, var(--card)); color: var(--kc); border: 1px solid color-mix(in srgb, var(--kc) 30%, transparent); }
.notif-date small { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.notif-date b { font: 800 17px var(--display); }
.notif-what { min-width: 0; display: grid; gap: 2px; }
.notif-what b { color: var(--ink); font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-what small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-when { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.notif-when.soon { color: #ec3d8a; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--p1); flex: none; }
.notif-empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 28px 18px 24px; color: var(--muted); font-size: 13.5px; }
.notif-empty .face { width: 64px; height: 64px; }
.notif-empty b { color: var(--ink); font-size: 15px; }
.notif-foot { border-top: 1px solid var(--line); padding: 8px; }
.notif-foot button { width: 100%; border: 0; background: var(--soft); color: var(--ink); font-weight: 600; font-size: 13.5px; padding: 10px; border-radius: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.notif-foot button:hover { background: var(--p-soft); color: var(--p1); }
.notif-foot button.pro { background: var(--p1); color: #fff; }
@media (prefers-reduced-motion: reduce) { .bell-btn.ring svg { animation: none; } }
.menu { position: absolute; right: 0; top: calc(100% + 10px); width: 280px; padding: 8px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); box-shadow: 0 24px 48px -16px rgba(0,0,0,.35); transform-origin: top right; animation: menuIn .25s var(--ease) both; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head div { min-width: 0; }
.menu-head b, .menu-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; font-size: 14px; color: var(--body); text-align: left; transition: background .2s, color .2s; }
a.menu-item { text-decoration: none; box-sizing: border-box; }
.menu-item:hover { background: var(--soft); color: var(--ink); }
.menu-item.danger:hover { background: var(--bad-bg); color: var(--bad-text); }
.menu-label { font-size: 11px; letter-spacing: .1em; color: var(--muted); padding: 10px 10px 6px; }
.theme-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin: 0 6px 6px; border-radius: 12px; background: var(--soft); }
.theme-seg button { display: grid; justify-items: center; gap: 3px; padding: 7px 4px; border-radius: 9px; font-size: 11px; color: var(--muted); transition: background .2s, color .2s; }
.theme-seg button svg { width: 16px; height: 16px; }
.theme-seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------- Study streak button + progress dialog ---------- */
.streak-btn { height: 46px; padding: 0 14px 0 11px; border-radius: 100px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); font: 800 16px var(--display); font-variant-numeric: tabular-nums; transition: box-shadow .25s, transform .4s var(--spring), color .2s; }
.streak-btn:hover { box-shadow: 0 0 0 3px var(--p-soft); transform: scale(1.04); }
.streak-btn svg { width: 22px; height: 22px; }
.streak-btn .flame-fill { fill: var(--line-strong); } .streak-btn .flame-core { fill: var(--card); }
.streak-btn.lit { color: var(--ink); }
.streak-btn.lit .flame-fill { fill: url(#flameGrad); } .streak-btn.lit .flame-core { fill: #ffd76a; }
.streak-btn.pop svg { animation: flamePop .7s var(--spring); }
@keyframes flamePop { 40% { transform: scale(1.35) rotate(-6deg); } }
.progress-dialog { max-width: 600px; }
.streak-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; padding: 18px; border-radius: 18px; background: linear-gradient(135deg, color-mix(in srgb, #ff8a3d 16%, var(--card)), color-mix(in srgb, #ffd76a 14%, var(--card))); border: 1px solid color-mix(in srgb, #ff8a3d 25%, var(--line)); }
.streak-hero svg { width: 64px; height: 64px; }
.streak-hero .big { font: 800 40px/1 var(--display); color: var(--ink); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.streak-hero .big small { font-size: 16px; font-weight: 700; color: var(--body); letter-spacing: 0; margin-left: 6px; }
.streak-hero p { margin: 6px 0 0; color: var(--body); font-size: 14px; }
.streak-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 6px; }
.streak-stats div { background: var(--soft); border-radius: 14px; padding: 12px; display: grid; gap: 2px; }
.streak-stats b { font: 800 20px var(--display); color: var(--ink); font-variant-numeric: tabular-nums; }
.streak-stats span { font-size: 12px; color: var(--muted); }
.p-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 16px 0 8px; display: flex; justify-content: space-between; gap: 10px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week div { display: grid; justify-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.week i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); border: 2px solid transparent; font-style: normal; }
.week i svg { width: 18px; height: 18px; }
.week .on i { background: linear-gradient(135deg, #ff8a3d, #ffb547); color: #fff; }
.week .today i { border-color: var(--p1); }
.heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; }
.heat i { height: 11px; border-radius: 3px; background: var(--soft); }
.heat i.on { background: #ff8a3d; } .heat i.on2 { background: #f26a1b; } .heat i.future { background: transparent; }
.badges { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .badges { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.badge-tile { border: 1px solid var(--line); border-radius: 14px; padding: 12px 6px 10px; display: grid; justify-items: center; gap: 5px; text-align: center; background: var(--card); }
.badge-tile .medal { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, var(--card)); border: 2px solid color-mix(in srgb, var(--c) 55%, transparent); }
.badge-tile .medal .mascot { width: 30px; }
.badge-tile b { font-size: 12.5px; color: var(--ink); line-height: 1.2; }
.badge-tile small { font-size: 11px; color: var(--muted); line-height: 1.25; }
.badge-tile.locked { background: var(--soft); border-style: dashed; }
.badge-tile.locked .medal { filter: grayscale(1); opacity: .45; }
.badge-tile.locked b { color: var(--muted); }
.p-foot { font-size: 12px; color: var(--muted); margin: 14px 0 0; }

/* ---------- Review actions (flashcards, share) ---------- */
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.review-actions .ghost { height: 38px; background: var(--card); }
.review-actions .ghost b { font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--p-soft); color: var(--p1); }

/* ---------- Flashcards ---------- */
.flash-dialog { max-width: 640px; }
.fc-sub { color: var(--muted); font-size: 13px; margin-top: -12px; margin-bottom: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-progress { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fc-progress .bar { flex: 1; height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.fc-progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, #7389ff, #4f6bff); border-radius: 99px; transition: width .4s var(--ease); }
.fc-stage { perspective: 1400px; margin: 16px 0; }
.fc-card { position: relative; width: 100%; min-height: 260px; border: 0; padding: 0; background: none; cursor: pointer; transform-style: preserve-3d; transition: transform .55s var(--ease); display: block; }
.fc-card.flipped { transform: rotateY(180deg); }
.fc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 20px; border: 1px solid var(--line); background: var(--card); box-shadow: 0 14px 40px -22px rgba(0,0,0,.45); display: grid; grid-template-rows: auto 1fr auto; padding: 18px 22px; text-align: center; }
.fc-face.back { transform: rotateY(180deg); background: linear-gradient(160deg, color-mix(in srgb, var(--tf) 9%, var(--card)), var(--card)); }
.fc-kind { justify-self: center; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.fc-text { align-self: center; color: var(--ink); font: 700 clamp(18px, 3.4vw, 24px)/1.35 var(--display); overflow-wrap: anywhere; padding: 12px 0; max-height: 210px; overflow-y: auto; }
.fc-face.back .fc-text { font: 500 clamp(15px, 2.6vw, 18px)/1.55 var(--text); color: var(--body); }
.fc-hint { font-size: 12px; color: var(--muted); }
.fc-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fc-controls button { height: 50px; border-radius: 14px; font-weight: 700; font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); transition: transform .3s var(--spring), background .2s; }
.fc-controls button:active { transform: scale(.97); }
.fc-again { background: var(--bad-soft); color: var(--bad-text); border-color: color-mix(in srgb, var(--bad-text) 25%, transparent) !important; }
.fc-know { background: var(--ok-soft); color: var(--ok-text); border-color: color-mix(in srgb, var(--ok-text) 25%, transparent) !important; }
.fc-flip { grid-column: 1 / -1; background: linear-gradient(180deg, #7389ff, #4f6bff); color: #fff; border: 0 !important; }
.fc-opts { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.fc-opts label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.fc-done { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 12px 0 4px; }
.fc-done .mascot { width: 72px; }
.fc-done h2 { font: 800 26px var(--display); color: var(--ink); margin: 0; }
.fc-done p { margin: 0; color: var(--body); }
.fc-done .row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .fc-card { transition: none; } }

/* ---------- Share quiz ---------- */
.share-dialog { max-width: 500px; }
.share-link { display: flex; gap: 8px; margin: 14px 0 10px; }
.share-link input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); color: var(--ink); font: 500 13.5px var(--text); }
.share-stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; }
.share-stats span { font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--soft); color: var(--body); }
.share-note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
.share-warn { font-size: 12.5px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); margin-top: 12px; }

/* ---------- Study Tools ---------- */
.st-tabs { flex-wrap: wrap; }
.st-save { font-size: 12px; color: var(--muted); }
.st-eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0; }
.st-note { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; line-height: 1.55; }
.st-empty { font-size: 13px; color: var(--muted); margin: 6px 0; }
.st-field { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.st-field input, .st-scale select, .gwa-row input[type=text], .gwa-row input[type=number], .part-row input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); color: var(--ink); font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; outline: 0; transition: border-color .2s, box-shadow .2s; }
.st-field input:focus, .st-scale select:focus, .gwa-row input:focus, .part-row input:focus { border-color: var(--p2); box-shadow: 0 0 0 3px var(--p-soft); }
.st-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.st-fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .st-fields, .st-fields.three { grid-template-columns: minmax(0, 1fr); } }
.st-seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 12px; background: var(--soft); margin-bottom: 18px; }
.st-seg button { height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--muted); }
.st-seg button[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.st-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.st-chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--body); }
.st-chip.good { background: var(--ok-bg); color: var(--ok-text); } .st-chip.honor { background: color-mix(in srgb, #ff8a1f 22%, var(--card)); color: color-mix(in srgb, #b7791f 80%, var(--ink)); } .st-chip.bad { background: var(--bad-bg); color: var(--bad-text); }

/* GWA */
.st-hero { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: flex-start; padding: 20px; border-radius: 18px; margin-bottom: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--p1) 12%, var(--card)), color-mix(in srgb, var(--tf) 10%, var(--card))); border: 1px solid color-mix(in srgb, var(--p1) 22%, var(--line)); }
.st-hero-main { min-width: 0; }
.st-big { font: 800 clamp(40px, 7vw, 56px)/1 var(--display); color: var(--ink); letter-spacing: -.03em; margin: 6px 0 6px; font-variant-numeric: tabular-nums; }
.st-hero-sub { margin: 0; color: var(--body); font-size: 14px; }
.st-equiv { margin: 0 0 8px; font: 700 18px var(--display); color: var(--p1); font-variant-numeric: tabular-nums; }
.st-equiv small { font: 500 12.5px var(--text); color: var(--muted); margin-left: 4px; }
.st-scale { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; min-width: 220px; }
.st-scale select { appearance: auto; cursor: pointer; }
.gwa-term { border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; background: var(--card); }
.gwa-term-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.gwa-term-h input { flex: 1; min-width: 160px; border: 0; background: transparent; font: 700 16px var(--display); color: var(--ink); padding: 4px 6px; border-radius: 8px; outline: 0; }
.gwa-term-h input:focus { background: var(--soft); }
.gwa-term-h .st-chip { font-size: 12.5px; }
.gwa-head, .gwa-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 96px 56px 36px; gap: 8px; align-items: center; }
.gwa-head { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 2px 6px; }
.gwa-head span:nth-child(4) { text-align: center; }
.gwa-row { margin-bottom: 8px; }
.gwa-row.off input[type=text], .gwa-row.off input[type=number] { opacity: .5; }
.gwa-row input.fail { border-color: var(--bad-line); color: var(--bad-text); background: var(--bad-soft); }
.gwa-row .count { display: grid; place-items: center; }
.gwa-row .count input { width: 18px; height: 18px; accent-color: var(--p1); cursor: pointer; }
.icon-x { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); transition: background .2s, color .2s; }
.icon-x:hover { background: var(--bad-soft); color: var(--bad-text); }
@media (max-width: 560px) {
  .gwa-head { display: none; }
  .gwa-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto 36px; grid-template-areas: "name name name x" "units grade count count"; padding-bottom: 10px; border-bottom: 1px dashed var(--line); margin-bottom: 10px; }
  .gwa-row > :nth-child(1) { grid-area: name; } .gwa-row > :nth-child(2) { grid-area: units; } .gwa-row > :nth-child(3) { grid-area: grade; } .gwa-row > :nth-child(4) { grid-area: count; justify-items: start; } .gwa-row > :nth-child(5) { grid-area: x; }
  .gwa-row .count::after { content: "Count"; font-size: 12px; color: var(--muted); margin-left: 6px; }
  .gwa-row .count { display: flex; align-items: center; }
}
.st-row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ghost.sm { height: 34px; font-size: 12.5px; }

/* Final grade */
.st-final { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .st-final { grid-template-columns: minmax(0, 1fr); } }
.st-final-in { display: grid; gap: 14px; }
.st-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.st-quick button { height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); font-size: 12.5px; color: var(--body); }
.st-quick button.on { background: var(--p-soft); border-color: var(--p2); color: var(--p1); font-weight: 600; }
.st-parts-head, .part-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr) minmax(0, .9fr) 36px; gap: 8px; align-items: center; }
.st-parts-head { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding-bottom: 6px; }
.part-row { margin-bottom: 8px; }
.st-final-out { border-radius: 18px; padding: 22px; border: 1px solid var(--line); background: var(--soft); display: grid; gap: 12px; }
.st-final-out.good { background: color-mix(in srgb, var(--ok-bg) 70%, var(--card)); border-color: color-mix(in srgb, var(--ok-text) 25%, transparent); }
.st-final-out.warn { background: color-mix(in srgb, var(--warn-bg) 70%, var(--card)); border-color: color-mix(in srgb, var(--warn-ink) 25%, transparent); }
.st-final-out.bad { background: color-mix(in srgb, var(--bad-bg) 70%, var(--card)); border-color: var(--bad-line); }
.st-need { font: 800 clamp(38px, 6vw, 50px)/1 var(--display); color: var(--ink); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.st-need-msg { margin: 0; color: var(--body); font-size: 14.5px; }
.st-meter { height: 10px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; }
.st-meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #7389ff, #4f6bff); transition: width .4s var(--ease); }
.st-ifs { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.st-ifs td { padding: 5px 0; border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); }
.st-ifs td:last-child { text-align: right; font-weight: 600; color: var(--ink); }
.st-ifs tr.hit td { color: var(--p1); }

/* Calculator */
.st-calc-wrap { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { .st-calc-wrap { grid-template-columns: minmax(0, 1fr); } }
.st-calc { border: 1px solid var(--line); border-radius: 20px; padding: 14px; background: var(--soft); }
.st-display { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; text-align: right; min-height: 92px; display: grid; align-content: end; gap: 4px; overflow: hidden; }
.st-expr { font-size: 15px; color: var(--muted); overflow-x: auto; white-space: nowrap; font-variant-numeric: tabular-nums; scrollbar-width: none; }
.st-result { font: 700 clamp(28px, 5vw, 36px)/1.1 var(--display); color: var(--ink); overflow-x: auto; white-space: nowrap; font-variant-numeric: tabular-nums; scrollbar-width: none; }
.st-result.preview { color: var(--muted); font-weight: 600; }
.st-result.err { color: var(--bad-text); font-size: 20px; }
.st-keys { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.k { height: 50px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font: 600 17px var(--text); transition: transform .15s, background .15s; font-variant-numeric: tabular-nums; }
.k:hover { background: color-mix(in srgb, var(--p-soft) 50%, var(--card)); }
.k:active, .k.press { transform: scale(.94); }
.k.fn { font-size: 14px; color: var(--body); background: color-mix(in srgb, var(--soft) 40%, var(--card)); }
.k.op { background: var(--p-soft); color: var(--p1); font-size: 20px; }
.k.clr { background: var(--bad-soft); color: var(--bad-text); font-size: 14px; }
.k.eq { background: linear-gradient(180deg, #7389ff, #4f6bff); color: #fff; border: 0; font-size: 20px; }
.k[data-k=mode] { font-size: 12px; letter-spacing: .05em; }
.st-history { min-width: 0; }
.c-hist { width: 100%; text-align: right; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; display: grid; gap: 2px; transition: background .15s; }
.c-hist:hover { background: var(--soft); border-color: var(--line); }
.c-hist small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-hist b { color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }

/* Focus timer */
.st-timer { display: grid; justify-items: center; text-align: center; gap: 6px; max-width: 520px; margin: 0 auto; }
.st-ring { position: relative; width: min(260px, 70vw); aspect-ratio: 1; margin: 6px 0 4px; }
.st-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.st-ring .ring-bg { fill: none; stroke: var(--soft); stroke-width: 12; }
.st-ring .ring-fg { fill: none; stroke: var(--tc, var(--p1)); stroke-width: 12; stroke-linecap: round; stroke-dasharray: 603.2; stroke-dashoffset: 0; transition: stroke-dashoffset .5s linear, stroke .3s; }
.st-ring-in { position: absolute; inset: 0; display: grid; place-content: center; gap: 4px; }
.st-ring-in b { font: 800 clamp(44px, 9vw, 58px)/1 var(--display); color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.st-ring-in span { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.st-timer.run .st-ring-in b { color: var(--tc, var(--p1)); }
.st-dots { display: flex; gap: 8px; justify-content: center; min-height: 12px; }
.st-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--soft); border: 1.5px solid var(--line-strong); }
.st-dots i.on { background: var(--p1); border-color: var(--p1); }
.st-timer-btns { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.st-timer-btns .btn { min-width: 140px; height: 50px; font-size: 16px; }
.st-tip { min-height: 1.5em; color: var(--body); font-size: 14px; margin: 10px 0 0; }
.st-today { font-size: 13px; color: var(--muted); }
.st-today b { color: var(--ink); }
.st-settings { width: 100%; margin-top: 14px; text-align: left; border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.st-settings summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.st-settings[open] summary { margin-bottom: 12px; }
.st-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--body); margin-top: 12px; }
.nav-item .badge.timer { background: var(--p1); color: #fff; font-variant-numeric: tabular-nums; }

/* ---------- Study Rooms ---------- */
.rm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.rm-card { display: grid; gap: 10px; text-align: left; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); transition: transform .35s var(--spring), box-shadow .3s, border-color .2s; cursor: pointer; }
.rm-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--p2) 45%, var(--line)); }
.rm-card-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rm-card-top b { color: var(--ink); font: 700 15.5px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-card small { display: block; color: var(--muted); font-size: 12.5px; }
.rm-card-top b { display: block; }
.rm-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.rm-stats span { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--soft); color: var(--body); }
.rm-stats span.rm-own { background: var(--p-soft); color: var(--p1); }
.rm-badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; font: 800 17px var(--display); background: linear-gradient(135deg, var(--rc, #4f6bff), color-mix(in srgb, var(--rc, #4f6bff) 60%, #4f6bff)); }
.rm-empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 34px 20px; border: 1.5px dashed var(--line); border-radius: 18px; color: var(--muted); }
.rm-empty .mascots { display: flex; gap: 6px; } .rm-empty .mascot { width: 40px; }
.rm-empty b { color: var(--ink); font: 700 17px var(--display); }
.rm-empty p { margin: 0; max-width: 46ch; font-size: 14px; }
.rm-empty .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.rm-back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); padding: 4px 8px 4px 2px; border-radius: 8px; margin-bottom: 8px; }
.rm-back:hover { color: var(--ink); }
.rm-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.rm-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rm-title .rm-badge { width: 48px; height: 48px; font-size: 20px; border-radius: 14px; }
.rm-title h1 { margin: 0; overflow-wrap: anywhere; }
.rm-meta { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.rm-actions { display: flex; gap: 8px; align-items: center; position: relative; }
.rm-actions a.ghost { text-decoration: none; color: var(--ink); }
.rm-more-wrap { position: relative; }
.rm-more { border: 1px solid var(--line); }
.rm-menu { right: 0; width: 230px; z-index: 30; }
.rm-pane { margin-top: 16px; animation: fadeIn .25s both; }
.rm-split { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .rm-split { grid-template-columns: minmax(0, 1fr); } }
.rm-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.rm-label { margin: 0; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.rm-quiz { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; background: var(--card); }
.rm-quiz b { color: var(--ink); font-size: 15px; overflow-wrap: anywhere; }
.rm-quiz small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.rm-quiz .rm-stats { grid-column: 1 / -1; }
.rm-quiz .btns { display: flex; gap: 6px; align-items: center; }
.rm-quiz .score { font-weight: 700; }
.rm-quiz .score.good { background: var(--ok-bg); color: var(--ok-text); } .rm-quiz .score.mid { background: var(--warn-bg); color: var(--warn-ink); } .rm-quiz .score.low { background: var(--bad-bg); color: var(--bad-text); }
.rm-feed { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: color-mix(in srgb, var(--soft) 50%, var(--card)); }
.rm-feed .rm-label { margin-bottom: 8px; }
.rm-act { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--body); padding: 7px 0; border-top: 1px solid var(--line); }
.rm-act:first-of-type { border-top: 0; }
.rm-act .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; font: 700 11px var(--display); background: linear-gradient(135deg, var(--p2), var(--p1)); }
.rm-act small { display: block; color: var(--muted); font-size: 11.5px; }
.rm-none { color: var(--muted); font-size: 13.5px; padding: 14px 0; }
.rm-board-note { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.rm-board { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.rm-board th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: right; padding: 8px 8px; border-bottom: 1px solid var(--line); }
.rm-board th:nth-child(-n+2) { text-align: left; }
.rm-board th:first-child, .rm-board td:first-child { width: 48px; }
.rm-board td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.rm-board td:nth-child(-n+2) { text-align: left; }
.rm-board tr.rm-me td { background: color-mix(in srgb, var(--p-soft) 55%, transparent); }
.rm-board .rank { font: 800 16px var(--display); width: 44px; }
.rm-board .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rm-board .who b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-board .pts { font: 800 16px var(--display); color: var(--ink); }
.rm-you { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--p1); color: #fff; }
.rm-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; align-items: end; }
.rm-pod { text-align: center; padding: 14px 8px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); display: grid; gap: 4px; justify-items: center; }
.rm-pod .medal { font-size: 26px; line-height: 1; }
.rm-pod b { color: var(--ink); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.rm-pod span { font: 800 18px var(--display); color: var(--ink); }
.rm-pod small { color: var(--muted); font-size: 11.5px; }
.rm-pod.p1 { padding-top: 22px; border-color: color-mix(in srgb, #ff8a1f 60%, var(--line)); background: color-mix(in srgb, #ff8a1f 10%, var(--card)); }
.rm-ev-form { display: grid; grid-template-columns: minmax(0, 1fr) 150px 120px 120px auto; gap: 8px; }
.rm-ev-form input, .rm-ev-form select { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); color: var(--ink); font: inherit; font-size: 14px; min-width: 0; }
@media (max-width: 760px) { .rm-ev-form { grid-template-columns: 1fr 1fr; } .rm-ev-form #rmEvTitle { grid-column: 1 / -1; } }
.rm-hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 14px; }
.rm-ev { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.rm-ev b { color: var(--ink); font-size: 14px; }
.rm-ev small { display: block; color: var(--muted); font-size: 12.5px; }
.rm-member { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.rm-member b { color: var(--ink); font-size: 14px; }
.rm-member small { display: block; color: var(--muted); font-size: 12px; }
.rm-member .tag { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.rm-member .tag.owner { background: color-mix(in srgb, #ff8a1f 22%, var(--card)); color: var(--ink); }
.rm-ask { max-width: 440px; }
.rm-ask-text { margin: -6px 0 14px; color: var(--body); font-size: 14px; }
.rm-ask-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }
.rm-err { color: var(--bad-text); font-size: 13px; margin: -6px 0 10px; }
.rm-code { font: 800 34px var(--display); letter-spacing: .18em; color: var(--ink); text-align: center; padding: 14px; margin: 14px 0 4px; border-radius: 14px; background: var(--soft); border: 1.5px dashed var(--line-strong); font-variant-numeric: tabular-nums; }
.rm-post { max-width: 560px; }
.rm-pick { display: grid; gap: 8px; max-height: 55vh; overflow-y: auto; }
.rm-pick button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); transition: border-color .2s, background .2s; }
.rm-pick button:hover:not(:disabled) { border-color: var(--p2); background: color-mix(in srgb, var(--p-soft) 40%, var(--card)); }
.rm-pick button:disabled { opacity: .55; cursor: default; }
.rm-pick b { color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.rm-pick small { display: block; color: var(--muted); font-size: 12px; }
.rm-pick em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--p1); white-space: nowrap; }

/* ---------- Study room chat ---------- */
#rmRoom .j-tabs { flex-wrap: wrap; max-width: 100%; }
.rm-tabdot { width: 7px; height: 7px; border-radius: 50%; background: #ec3d8a; display: inline-block; margin-left: 2px; }
.rm-card .unread { width: 9px; height: 9px; border-radius: 50%; background: #ec3d8a; margin-left: auto; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, #ec3d8a 25%, transparent); }
.ch-wrap { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--card); display: flex; flex-direction: column; }
.ch-log { height: min(56vh, 520px); overflow-y: auto; padding: 14px 14px 6px; background: color-mix(in srgb, var(--soft) 55%, var(--card)); display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; }
.ch-day { align-self: center; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 3px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); margin: 10px 0 6px; }
.ch-more { align-self: center; font-size: 12.5px; color: var(--p1); font-weight: 600; padding: 4px 10px; border-radius: 99px; margin-bottom: 6px; }
.ch-more:hover { background: var(--p-soft); }
.ch-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 82%; position: relative; align-self: flex-start; }
.ch-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.ch-msg.cont { margin-top: -0px; }
.ch-msg .av { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font: 700 12px var(--display); background: linear-gradient(135deg, var(--p2), var(--p1)); }
.ch-msg.cont .av { visibility: hidden; }
.ch-msg.mine .av { display: none; }
.ch-col { display: grid; gap: 2px; min-width: 0; }
.ch-name { font-size: 11.5px; font-weight: 600; color: var(--muted); margin: 8px 0 1px 10px; }
.ch-msg.mine .ch-name, .ch-msg.cont .ch-name { display: none; }
.ch-bubble { position: relative; padding: 8px 12px 6px; border-radius: 16px 16px 16px 5px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.ch-msg.mine .ch-bubble { border-radius: 16px 16px 5px 16px; background: linear-gradient(180deg, #7389ff, #4f6bff); border-color: transparent; color: #fff; }
.ch-msg.mention .ch-bubble { box-shadow: 0 0 0 2px #ff8a1f; }
.ch-bubble a { color: inherit; text-decoration: underline; }
.ch-bubble .at { font-weight: 700; color: var(--p1); }
.ch-msg.mine .ch-bubble .at { color: #fff; }
.ch-time { display: block; font-size: 10.5px; color: var(--muted); text-align: right; margin-top: 2px; white-space: nowrap; }
.ch-msg.mine .ch-time { color: rgba(8,19,28,.65); }
.ch-removed .ch-bubble { background: transparent; border-style: dashed; color: var(--muted); font-style: italic; font-size: 13px; }
.ch-msg.mine.ch-removed .ch-bubble { background: transparent; color: var(--muted); border-color: var(--line); }
.ch-rq { display: block; font-size: 12px; padding: 4px 8px; margin-bottom: 5px; border-left: 3px solid var(--p2); border-radius: 6px; background: color-mix(in srgb, var(--ink) 5%, transparent); opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.ch-msg.mine .ch-rq { border-left-color: #fff; background: rgba(255,255,255,.25); }
.ch-quizcard { display: grid; gap: 6px; padding: 10px; margin-top: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--ink); white-space: normal; min-width: 200px; }
.ch-quizcard small { font-size: 10.5px; letter-spacing: .08em; font-weight: 700; color: var(--muted); }
.ch-quizcard b { font-size: 14px; }
.ch-quizcard .btn { height: 32px; justify-self: start; font-size: 12.5px; }
.ch-dots { position: absolute; top: 2px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); background: var(--card); border: 1px solid var(--line); opacity: 0; transition: opacity .15s; }
.ch-msg:not(.mine) .ch-dots { right: -32px; } .ch-msg.mine .ch-dots { left: -32px; }
.ch-msg:hover .ch-dots, .ch-dots:focus-visible, .ch-dots[aria-expanded=true] { opacity: 1; }
@media (hover: none) { .ch-dots { opacity: .7; } }
.ch-flag { font-size: 10.5px; font-weight: 700; color: var(--bad-text); margin-left: 6px; }
.ch-menu { position: fixed; z-index: 95; width: 210px; }
.ch-empty { margin: auto; text-align: center; color: var(--muted); font-size: 13.5px; display: grid; gap: 8px; justify-items: center; padding: 20px; }
.ch-empty .mascot { width: 48px; }
.ch-reply { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 12.5px; color: var(--body); border-top: 1px solid var(--line); background: var(--soft); }
.ch-reply span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-reply .x-btn { width: 26px; height: 26px; }
.ch-muted { margin: 0; padding: 10px 14px; font-size: 13px; background: var(--warn-bg); color: var(--warn-ink); border-top: 1px solid var(--line); }
.ch-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid var(--line); position: relative; }
.ch-form textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--soft); color: var(--ink); font: inherit; font-size: 14px; line-height: 1.4; outline: 0; }
.ch-form textarea:focus { border-color: var(--p2); box-shadow: 0 0 0 3px var(--p-soft); background: var(--card); }
.ch-form textarea:disabled { opacity: .5; }
.ch-icon, .ch-send { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ch-icon { color: var(--muted); border: 1px solid var(--line); background: var(--card); }
.ch-icon:hover { color: var(--p1); border-color: var(--p2); }
.ch-send { background: linear-gradient(180deg, #7389ff, #4f6bff); color: #fff; }
.ch-send:disabled { opacity: .45; }
.ch-count { position: absolute; right: 64px; bottom: 16px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ch-quiz-wrap { position: relative; }
.ch-quiz-menu { left: 0; right: auto; top: auto; bottom: calc(100% + 8px); width: 280px; max-height: 300px; overflow-y: auto; transform-origin: bottom left; }
.ch-rules { margin: 0; padding: 0 14px 10px; font-size: 11.5px; color: var(--muted); }
.ch-quote { margin: 0 0 14px; padding: 10px 12px; border-left: 3px solid var(--line-strong); background: var(--soft); border-radius: 8px; font-size: 13.5px; color: var(--body); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 120px; overflow: auto; }
.ch-reasons { display: grid; gap: 8px; margin-bottom: 16px; font-size: 14px; color: var(--ink); }
.ch-reasons label { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.ch-reasons label:has(input:checked) { border-color: var(--p2); background: color-mix(in srgb, var(--p-soft) 45%, var(--card)); }
.ch-reasons input { accent-color: var(--p1); }
.rm-member .muted-tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--warn-bg); color: var(--warn-ink); }

/* ---------- Edit profile dialog ---------- */
.dialog-bg { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; background: rgba(9,9,11,.45); backdrop-filter: blur(4px); animation: fadeIn .2s both; }
@keyframes fadeIn { from { opacity: 0; } }
.dialog { width: 100%; max-width: 520px; animation: rise .5s var(--ease) both; }
.dialog-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.x-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); transition: background .2s; }
.x-btn:hover { background: var(--soft); color: var(--ink); }
.photo-row { display: flex; align-items: center; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.photo-row .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-row small { display: block; width: 100%; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.field input, .field textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font: inherit; font-size: 14px; color: var(--ink); outline: 0; transition: border-color .2s, box-shadow .2s; }
.field textarea { min-height: 86px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus { border-color: var(--p2); box-shadow: 0 0 0 3px var(--p-soft); }
.field input[readonly] { background: var(--soft); color: var(--muted); }
.field .count-hint { text-align: right; }
.section-sep { font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--ink); margin: 6px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.dialog-f { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.dialog-f .msg { margin-right: auto; font-size: 13px; }
.dialog-f .msg.ok { color: var(--ok-text); }
.dialog-f .msg.bad { color: var(--bad-text); }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } .photo-row { flex-direction: column; align-items: flex-start; } }
@media (max-width: 860px) { .topbar { margin-top: -56px; } .topbar, .greet { pointer-events: none; } .greet { padding-left: 52px; } .top-actions { pointer-events: auto; } } /* the top bar sits over the ☰ button; only its own buttons take taps */
.greet { display: flex; align-items: center; gap: 12px; min-width: 0; }
.greet h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.greet h1 span { color: #4f6bff; }
.greet p { font-size: 13px; color: var(--muted); margin-top: 2px; }
@media (max-width: 520px) { .greet h1 { font-size: 16px; } .greet p { display: none; } }

/* ---------- Plans: Free / Pro ---------- */
.count.pro { border-color: var(--p2); background: var(--p-soft); }
.count.pro input { box-shadow: 0 0 0 1.5px var(--p2); }
.count.pro small { color: var(--p1); font-weight: 600; }
.count small .star { margin-right: 2px; }
.linkbtn.inline { padding: 0 2px; font-size: inherit; font-weight: 600; }
.page-meter { display: grid; gap: 6px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.page-meter[hidden] { display: none; }
.page-meter .row { display: flex; align-items: center; gap: 8px; }
.page-meter .row b { color: var(--ink); }
.page-meter .bar { height: 6px; border-radius: 6px; background: var(--soft); overflow: hidden; }
.page-meter .bar i { display: block; height: 100%; border-radius: 6px; background: var(--p1); transition: width .5s var(--ease), background .3s; }
.page-meter.over { border-color: var(--p2); background: var(--p-soft); }
.page-meter.over .bar i { background: var(--bad-text); }
.page-meter.hard { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad-text); }
.plan-badge { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--soft); color: var(--muted); }
.plan-badge.pro { background: linear-gradient(135deg, var(--p2), var(--p1)); color: #fff; }
.menu-item.pro-item { color: var(--p1); }
.upgrade .pro-on { display: none; }
.upgrade.is-pro .pro-on { display: block; }
.upgrade.is-pro .pro-off { display: none; }

/* Upgrade dialog */
.upgrade-dialog { max-width: 560px; }
.upgrade-hero { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--p-soft); margin-bottom: 18px; }
.upgrade-hero .d-ico { flex: none; color: var(--p1); }
.upgrade-hero p { font-size: 14px; color: var(--ink); line-height: 1.5; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare-table th, .compare-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.compare-table th { font-size: 11px; letter-spacing: .08em; color: var(--muted); font-weight: 500; }
.compare-table td:not(:first-child), .compare-table th:not(:first-child) { text-align: center; width: 90px; }
.compare-table .pro-col { color: var(--p1); font-weight: 700; }
.compare-table tr.hit td { background: var(--p-soft); }
.upgrade-note { margin-top: 14px; font-size: 13px; color: var(--muted); }
.upgrade-note[hidden] { display: none; }

/* Pro options in the upgrade dialog */
.passes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.passes .pass.plus { grid-column: 1 / -1; }
.pass { position: relative; display: grid; gap: 2px; justify-items: start; text-align: left; padding: 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); transition: border-color .2s, box-shadow .2s, transform .35s var(--spring); }
.passes .pass.plus { border-color: #4f6bff; background: radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, #4f6bff 14%, var(--card)), var(--card) 70%); }
.passes .pass.plus .tag { background: #4f6bff; color: #fff; }
.compare-table .plus-col { color: #4f6bff; font-weight: 700; }
.pass:hover { border-color: var(--p2); box-shadow: 0 10px 24px -14px rgba(37,99,235,.5); transform: translateY(-2px); }
.pass:disabled { opacity: .6; cursor: wait; transform: none; }
.pass b { font-family: var(--display); font-size: 24px; letter-spacing: -0.03em; color: var(--ink); }
.pass span { font-size: 13px; color: var(--body); }
.pass small { font-size: 12px; color: var(--muted); margin-top: 6px; }
.pass.best { border-color: var(--p1); background: var(--p-soft); }
.pass .tag { position: absolute; top: -10px; right: 12px; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--p2), var(--p1)); }
.pay-methods { margin-top: 10px; font-size: 12px; color: var(--muted); }
@media (max-width: 520px) { .passes { grid-template-columns: 1fr; } }

/* Upgrade dialog, landing-page look */
.dialog.upgrade-dialog { max-width: 600px; border-radius: 28px; padding: 26px 26px 20px;
  background:
    radial-gradient(60% 34% at 8% 0%, color-mix(in srgb, #8fa8ff 30%, transparent), transparent 70%),
    radial-gradient(50% 30% at 100% 2%, color-mix(in srgb, #ffb3d6 26%, transparent), transparent 70%),
    radial-gradient(60% 30% at 100% 100%, color-mix(in srgb, #9ef0d2 22%, transparent), transparent 70%), #fff;
  box-shadow: inset 0 0 0 1px rgba(15,15,18,.05), 0 2px 6px rgba(15,15,18,.04), 0 40px 80px -30px rgba(15,15,18,.35); }
.upgrade-dialog .dialog-h h1 { font-size: 30px; font-weight: 800; letter-spacing: -.045em; color: var(--ink); }
.upgrade-dialog .dialog-h h1 em { font-style: normal; background: linear-gradient(90deg, #4f6bff, #9b6cf0 55%, #ec3d8a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.upgrade-dialog .x-btn { border-radius: 999px; background: rgba(255,255,255,.7); box-shadow: inset 0 0 0 1px var(--line); }
.upgrade-dialog .upgrade-hero { position: relative; align-items: center; gap: 14px; padding: 14px 16px 14px 92px; min-height: 84px; border-radius: 20px; margin: 4px 0 18px;
  background: linear-gradient(120deg, #eef1ff, #f6efff 60%, #fff0f7); box-shadow: inset 0 0 0 1px rgba(79,107,255,.12); }
.upgrade-dialog .upgrade-hero .up-mate { position: absolute; left: 10px; bottom: 0; height: 104px; width: auto; filter: drop-shadow(0 10px 10px rgba(15,15,18,.18)); animation: upMate 3.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes upMate { 50% { transform: translateY(-3px) rotate(-2deg); } }
.upgrade-dialog .upgrade-hero p { font-size: 15px; font-weight: 600; line-height: 1.45; letter-spacing: -.01em; }
.upgrade-dialog .cmp-wrap { border-radius: 20px; background: #fff; box-shadow: inset 0 0 0 1px var(--line), 0 18px 36px -26px rgba(15,15,18,.25); overflow: hidden; }
.upgrade-dialog .compare-table { font-size: 14px; }
.upgrade-dialog .compare-table th, .upgrade-dialog .compare-table td { padding: 11px 14px; border-bottom: 1px solid rgba(15,15,18,.06); }
.upgrade-dialog .compare-table tbody tr:last-child td { border-bottom: 0; }
.upgrade-dialog .compare-table thead th { padding: 14px 8px 12px; background: #fafbff; border-bottom: 1px solid var(--line); }
.upgrade-dialog .compare-table td:first-child { font-weight: 600; color: var(--ink); }
.upgrade-dialog .compare-table td:not(:first-child) { font-variant-numeric: tabular-nums; color: var(--body); font-weight: 600; }
.upgrade-dialog .compare-table td.pro-col { color: #4f6bff; font-weight: 800; }
.upgrade-dialog .compare-table td.plus-col { color: #9b6cf0; font-weight: 800; background: color-mix(in srgb, #9b6cf0 5%, transparent); }
.upgrade-dialog .compare-table tbody tr { transition: background .2s; }
.upgrade-dialog .compare-table tbody tr:hover td { background: #f7f8ff; }
.upgrade-dialog .compare-table tr.hit td { background: #eef1ff; }
.upgrade-dialog .compare-table tr.hit td:first-child { box-shadow: inset 3px 0 0 #4f6bff; }
.plan-pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: #f0f0f3; color: var(--muted); }
.plan-pill.pro { background: #e8ecff; color: #4f6bff; }
.plan-pill.plus { background: linear-gradient(135deg, #4f6bff, #9b6cf0); color: #fff; box-shadow: 0 6px 14px -8px rgba(79,107,255,.8); }
.upgrade-dialog .ck { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: currentColor; }
.upgrade-dialog .ck svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.upgrade-dialog .no { color: #c7c7cc; font-weight: 500; }
.upgrade-dialog .upgrade-note { font-size: 12.5px; }
.upgrade-dialog .passes { gap: 14px; margin-top: 20px; }
.upgrade-dialog .pass { padding: 18px 18px 16px; border: 0; border-radius: 22px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line), 0 2px 6px rgba(15,15,18,.03);
  transition: box-shadow .3s, transform .35s cubic-bezier(.22,1,.36,1); }
.upgrade-dialog .pass:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1.5px #4f6bff, 0 18px 34px -18px rgba(79,107,255,.55); }
.upgrade-dialog .pass b { font-size: 32px; font-weight: 800; letter-spacing: -.045em; line-height: 1.1; }
.upgrade-dialog .pass span { font-weight: 600; color: var(--ink); }
.upgrade-dialog .pass.best { background: linear-gradient(160deg, #f3f5ff, #fff 70%); box-shadow: inset 0 0 0 1.5px #4f6bff, 0 2px 6px rgba(15,15,18,.03); }
.upgrade-dialog .pass .tag { top: -11px; right: 14px; padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .02em; background: #4f6bff; box-shadow: 0 6px 14px -8px rgba(79,107,255,.9); }
.upgrade-dialog .passes .pass.plus { padding-right: 120px; min-height: 128px; overflow: visible;
  background: radial-gradient(90% 140% at 100% 0%, #efe7ff, transparent 60%), radial-gradient(70% 120% at 0% 100%, #e8ecff, transparent 60%), #fff;
  box-shadow: inset 0 0 0 2px transparent, 0 0 0 1.5px #9b6cf0, 0 22px 40px -22px rgba(155,108,240,.6); }
.upgrade-dialog .passes .pass.plus:hover { box-shadow: 0 0 0 2px #9b6cf0, 0 26px 44px -20px rgba(155,108,240,.7); }
.upgrade-dialog .passes .pass.plus .tag { background: linear-gradient(135deg, #4f6bff, #9b6cf0); }
.upgrade-dialog .pass .pass-mate { position: absolute; right: 14px; bottom: 0; height: 120px; width: auto; pointer-events: none; filter: drop-shadow(0 10px 10px rgba(15,15,18,.18)); transition: transform .4s cubic-bezier(.34,1.5,.64,1); transform-origin: 50% 100%; }
.upgrade-dialog .pass:hover .pass-mate { transform: translateY(-4px) rotate(-3deg); }
.upgrade-dialog .pay-methods { margin-top: 14px; text-align: center; line-height: 1.5; }
.upgrade-dialog .dialog-f { justify-content: center; }
.upgrade-dialog .dialog-f .ghost { border-radius: 999px; padding: 10px 22px; font-weight: 700; }
@media (max-width: 520px) {
  .dialog.upgrade-dialog { padding: 20px 16px 16px; border-radius: 24px; }
  .upgrade-dialog .dialog-h h1 { font-size: 24px; }
  .upgrade-dialog .upgrade-hero { padding-left: 78px; }
  .upgrade-dialog .upgrade-hero .up-mate { height: 88px; }
  .upgrade-dialog .compare-table th, .upgrade-dialog .compare-table td { padding: 10px 6px; font-size: 13px; }
  .upgrade-dialog .compare-table td:first-child { padding-left: 12px; }
  .upgrade-dialog .compare-table td:not(:first-child), .upgrade-dialog .compare-table th:not(:first-child) { width: 58px; }
  .plan-pill { padding: 3px 7px; font-size: 10px; }
  .upgrade-dialog .passes .pass.plus { padding-right: 96px; }
  .upgrade-dialog .pass .pass-mate { height: 96px; right: 8px; }
}
@media (prefers-reduced-motion: reduce) { .upgrade-dialog .upgrade-hero .up-mate { animation: none; } }

/* Toast notifications */
/* ---------- Floating study tips ---------- */
.tipper { position: fixed; right: 20px; bottom: 20px; z-index: 94; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
/* Just Gibo, no square frame behind it */
.tip-fab { position: relative; display: grid; place-items: center; padding: 4px; background: none; border: 0;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.28)); transition: transform .4s var(--spring), filter .3s; animation: tipBob 3.4s ease-in-out infinite; }
.tip-fab:hover { transform: translateY(-3px) scale(1.08); filter: drop-shadow(0 14px 18px rgba(79,107,255,.45)); }
.tip-fab:focus-visible { outline: 2px solid var(--p2); outline-offset: 2px; border-radius: 12px; }
.tip-fab .mascot { width: 64px; }
.tip-fab .mascot .eyes { animation: idleEyes 6s ease-in-out infinite; }
.tip-dot { position: absolute; top: -2px; right: -2px; width: 16px; height: 16px; border-radius: 50%; background: #4f6bff; border: 3px solid var(--bg); }
.tip-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid #4f6bff; animation: dRing 2s var(--ease) infinite; }
.tip-fab[aria-expanded="true"] .tip-dot { display: none; }
@keyframes tipBob { 50% { translate: 0 -4px; } }
.tip-card { width: min(320px, calc(100vw - 40px)); padding: 14px 16px 14px; border-radius: 18px 18px 6px 18px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow); transform-origin: 100% 100%; animation: tipIn .45s var(--spring); }
@keyframes tipIn { from { opacity: 0; transform: translateY(10px) scale(.85); } }
.tip-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tip-head .mascot { width: 30px; }
.tip-head b { font-family: var(--display); font-size: 14px; }
.tip-head small { color: var(--muted); font-size: 12px; }
.tip-head .x-btn { margin-left: auto; }
#tipText { font-size: 14px; line-height: 1.5; color: var(--body); }
#tipText.swap { animation: tipSwap .35s var(--ease); }
@keyframes tipSwap { from { opacity: 0; transform: translateY(6px); } }
.tip-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.tip-foot span { font-size: 11px; color: var(--muted); }
.tip-auto { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); cursor: pointer; }
.tip-auto input { accent-color: #4f6bff; }
.tip-card { position: relative; overflow: hidden; }
.tip-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #4f6bff; transform-origin: left; transform: scaleX(0); }
.tip-timer.run { animation: tipTime var(--t, 14s) linear forwards; }
.tip-card:hover .tip-timer.run { animation-play-state: paused; }
@keyframes tipTime { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media print { .tipper { display: none !important; } }
@media (max-width: 600px) {
  .tipper { right: 12px; bottom: 12px; gap: 10px; }
  .tip-fab .mascot { width: 52px; }
  .tip-card { width: calc(100vw - 24px); }
  .toasts { bottom: 74px; right: 12px; }
}
.toasts { position: fixed; right: 20px; bottom: 96px; z-index: 95; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); box-shadow: 0 20px 40px -16px rgba(0,0,0,.35); font-size: 13px; color: var(--body); line-height: 1.45; animation: toastIn .4s var(--spring) both; }
.toast.leaving { animation: toastOut .3s var(--ease) both; }
.toast .t-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--p2), var(--p1)); }
.toast .t-ico svg { width: 16px; height: 16px; }
.toast b { display: block; color: var(--ink); margin-bottom: 2px; }
.toast .t-actions { display: flex; gap: 8px; margin-top: 8px; }
.toast .x-btn { width: 26px; height: 26px; margin-left: auto; flex: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* Loading skeleton */
.skel { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--soft) 0%, var(--shimmer) 50%, var(--soft) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-status { color: var(--muted); display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.loading-status .spin { border-color: var(--p-soft); border-top-color: var(--p1); }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; width: 260px; transform: translateX(-100%); transition: transform .45s var(--ease); box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .menu-btn { display: grid; }
  main { padding: 72px 16px 48px; }
  .card { padding: 20px; }
  .counts { grid-template-columns: repeat(3, 1fr); }
}
@media print {
  .side, .menu-btn, .form-card, .notice, .toolbar .chips, .toolbar .switch, .toolbar .ghost { display: none !important; }
  .app { display: block; } main { padding: 0; } .card { box-shadow: none; border: 0; padding: 0; }
  .qsec-f, .mhint, .chars, .scoreboard { display: none !important; }
  .qsec { break-inside: avoid; }
}
/* ---------- Install Amigo ---------- */
.install-dialog { max-width: 440px; }
.in-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.in-hero img { width: 64px; height: 64px; border-radius: 16px; flex: none; box-shadow: 0 8px 20px -10px rgba(0,0,0,.5); }
.in-hero b { display: block; color: var(--ink); font-size: 15px; }
.in-hero p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.in-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.in-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--soft); color: var(--body); font-size: 14px; line-height: 1.5; }
.in-steps b { color: var(--ink); }
.in-n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--p2), var(--p1)); }
.in-ico { display: inline-grid; place-items: center; width: 24px; height: 24px; vertical-align: -6px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); color: var(--p1); }
.in-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.in-steps .in-note { background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; }
.in-steps .in-note b { color: inherit; }
.in-done { display: flex; gap: 10px; align-items: center; padding: 14px; border-radius: 14px; background: var(--ok-bg); color: var(--ok-ink); font-size: 14px; }
.install-bar { position: fixed; z-index: 93; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); box-shadow: 0 20px 40px -16px rgba(0,0,0,.45); animation: toastIn .4s var(--spring) both; }
.install-bar[hidden] { display: none; }
.install-bar img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.install-bar div { flex: 1; min-width: 0; }
.install-bar b { display: block; color: var(--ink); font-size: 14px; }
.install-bar small { display: block; color: var(--muted); font-size: 12px; }
.install-bar .x-btn { width: 32px; height: 32px; flex: none; }
@media (min-width: 861px) { .install-bar { left: auto; width: 380px; } }
body.has-install-bar .tipper { bottom: calc(84px + env(safe-area-inset-bottom)); }
/* Already running as the installed app: no need to offer installing. */
@media (display-mode: standalone) { .install-item { display: none !important; } }

/* ---------- Phones & the home-screen app (iPhone and Android) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, label, summary, [role="button"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@supports (height: 100dvh) {
  .app { min-height: 100dvh; }
  .side { height: 100dvh; }
  .notif-panel { max-height: min(560px, calc(100dvh - 120px)); }
  .ask-log { height: min(58dvh, 560px); }
  .ch-log { height: min(56dvh, 520px); }
  .rm-pick { max-height: 55dvh; }
}
.dialog-bg { overscroll-behavior: contain; padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.tipper { right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); }
@media (max-width: 860px) {
  /* iPhone zooms into any text box under 16px; keep them at 16px on phones and tablets. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea, [contenteditable="true"] { font-size: 16px !important; }
  main { padding: calc(72px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .menu-btn { top: calc(16px + env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); width: 44px; height: 44px; }
  .side { padding-top: calc(24px + env(safe-area-inset-top)); padding-bottom: calc(16px + env(safe-area-inset-bottom)); padding-left: max(16px, env(safe-area-inset-left)); overflow-y: auto; overscroll-behavior: contain; }
  .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  .tipper { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(74px + env(safe-area-inset-bottom)); }
  /* Page headers with buttons: the title gets its own line, the buttons share the next one. */
  .history-h { flex-wrap: wrap; row-gap: 10px; }
  .history-h h1 { min-width: 0; }
  #rmList .history-h h1 { flex: 1 0 100%; }
  #rmList .history-h > button { flex: 1 1 0; justify-content: center; white-space: nowrap; }
  .greet h1 { font-size: 15px; line-height: 1.25; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .top-actions { gap: 8px; }
  .dialog-bg { place-items: end center; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .dialog-bg > .dialog { max-height: calc(100dvh - 24px - env(safe-area-inset-top)); overflow-y: auto; overscroll-behavior: contain; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .rise { opacity: 1; transform: none; filter: none; } }

/* =====================================================================
   APPLE-STYLE THEME + NEW AMIGOS (remove this block to go back)
   ===================================================================== */
:root {
  --bg: #f5f5f7; --card: #ffffff; --ink: #1d1d1f; --body: #424245; --muted: #6e6e73; --line: #e5e5ea; --soft: #f2f2f7;
  --p1: #4f6bff; --p2: #3f5af0; --p-soft: #e8ecff; --raised: #fbfbfd; --line-strong: #d2d2d7; --placeholder: #a1a1a6;
  --display: "DM Sans", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --text: "DM Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px -8px rgba(0,0,0,.08);
  --mc: #9b6cf0; --tf: #1f62f0; --mt: #ff8a1f; --sa: #8cc20e; --es: #ec3d8a;
  --glow1: #e8eefc; --glow2: #eef6f3;
}
:root[data-theme="dark"] {
  --bg: #000000; --card: #1c1c1e; --ink: #f5f5f7; --body: #d1d1d6; --muted: #98989d; --line: #2c2c2e; --soft: #2c2c2e;
  --p1: #6b82ff; --p2: #409cff; --p-soft: #0a2a4d; --raised: #232325; --line-strong: #3a3a3c; --placeholder: #6e6e73;
  --shadow: 0 0 0 1px rgba(255,255,255,.06), 0 8px 24px -10px rgba(0,0,0,.7);
  --glow1: #0b1730; --glow2: #071f1a;
}
body { font-weight: 400; font-size: 15px; letter-spacing: -.01em; }
h1 { font-weight: 700; font-size: 28px; letter-spacing: -.025em; }
h2 { font-weight: 600; font-size: 20px; letter-spacing: -.02em; }
.sub { font-size: 15px; }

/* Sidebar: frosted, with grey selection like macOS */
.side { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-right: 1px solid var(--line); }
.nav-item { border-radius: 8px; padding: 8px 10px; font-size: 14px; color: var(--body); }
.nav-item:hover { background: rgba(0,0,0,.04); }
.nav-item.active { background: rgba(0,0,0,.06); box-shadow: none; color: var(--ink); font-weight: 600; }
:root[data-theme="dark"] .nav-item:hover { background: rgba(255,255,255,.06); }
:root[data-theme="dark"] .nav-item.active { background: rgba(255,255,255,.1); }
.upgrade { border-radius: 14px; background: linear-gradient(160deg, #6b82ff, #3a4fd6); }
.upgrade button { background: #fff; color: #4f6bff; }

/* Cards: no outlines, soft depth */
.card { border: 0; border-radius: 18px; box-shadow: var(--shadow); }
.badge-tile, .page-meter { border-color: var(--line); }

/* Buttons: solid Apple blue pills */
.btn { background: var(--p1); color: #fff; box-shadow: none; font-weight: 500; font-size: 15px; letter-spacing: -.01em; transition: background .2s, transform .2s, opacity .2s; }
.btn:hover:not(:disabled) { background: var(--p2); transform: none; box-shadow: none; }
.btn:active:not(:disabled) { transform: scale(.98); }

/* Inputs: filled, rounded, blue focus ring */
.auth-field input, .field input, .field textarea, .st-field input, .rm-ev-form input, .rm-ev-form select, .db-form input, .db-form select, .db-form textarea {
  border-color: transparent; background: var(--soft); border-radius: 10px; }
.auth-field input:focus, .field input:focus, .field textarea:focus { border-color: var(--p1); background: var(--card); box-shadow: 0 0 0 4px var(--p-soft); }

/* Log-in screen */
.auth-bg { background: radial-gradient(60% 50% at 15% 0%, var(--glow1), transparent 70%), radial-gradient(50% 45% at 90% 100%, var(--glow2), transparent 70%), var(--bg); }
.auth-tabs { border-radius: 9px; padding: 2px; background: rgba(118,118,128,.12); }
.auth-tabs button { border-radius: 7px; height: 32px; font-weight: 500; color: var(--ink); }
.auth-tabs button.on { box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); }
:root[data-theme="dark"] .auth-tabs button.on { background: #636366; }

/* New amigo characters (images instead of the old square faces) */
.mascot img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.12)); }
.mascot.bob img { animation: bob 3.6s ease-in-out infinite; }
.m-name { color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.15); }
  
img[src*="oli.png"] { transform: perspective(700px) rotateY(26deg); }
  
/* =====================================================================
   MATCH THE LANDING PAGE (index.html): blue, shapes, type, crew
   ===================================================================== */
:root {
  --p1: #4f6bff; --p2: #3f5af0; --p-soft: #e8ecff;
  --shadow: 0 2px 6px rgba(15,15,18,.04), 0 24px 48px -24px rgba(15,15,18,.22);
  --shadow-sm: 0 1px 2px rgba(15,15,18,.05), 0 4px 14px -6px rgba(15,15,18,.12);
  --mesh-a: #8fa8ff; --mesh-b: #c6a6ff; --mesh-c: #ffb3d6; --mesh-d: #9ef0d2;
  --glow1: #e3e8ff; --glow2: #f6e6ff;
}

/* Type: heavy, tight headings like the landing page */
h1 { font-weight: 800; letter-spacing: -.045em; }
h2 { font-weight: 700; letter-spacing: -.035em; }
.sc-head h3, .sc-sum-top h3, .qsec-h h3 { font-weight: 700; letter-spacing: -.025em; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .22em; color: var(--muted); }

/* Shapes: pills and soft 22px cards */
.card { border-radius: 22px; box-shadow: inset 0 0 0 1px rgba(15,15,18,.04), var(--shadow); }
.btn { border-radius: 999px; font-weight: 700; background: var(--p1); color: #fff;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--p1) 70%, transparent);
  transition: transform .3s var(--ease), box-shadow .3s, background .3s; }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 30px -14px color-mix(in srgb, var(--p1) 75%, transparent); }
.btn:active:not(:disabled) { transform: scale(.97); }
.ghost, .chip { border-radius: 999px; }
.ghost { background: var(--card); border-color: transparent; box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm); font-weight: 600; }
.ghost:hover { transform: translateY(-1px); }
.auth-field input, .field input, .field textarea, .st-field input, .db-form input, .db-form select, .db-form textarea { border-radius: 12px; }
.drop { border-radius: 18px; }
.upgrade { border-radius: 20px; background: linear-gradient(160deg, #7389ff, #4f6bff 55%, #6b4fe8); }
.upgrade button { border-radius: 999px; font-weight: 700; color: #4f6bff; }
.nav-item { border-radius: 12px; }
.nav-item.active { background: color-mix(in srgb, var(--p1) 10%, transparent); color: var(--p1); }
.nav-item.active svg { color: var(--p1); }

/* Background: the landing page's soft colour wash behind the top of the page */
main { position: relative; isolation: isolate; }
main::before { content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: 0; height: 520px; pointer-events: none;
  background:
    radial-gradient(38% 60% at 12% 0%, color-mix(in srgb, var(--mesh-a) 30%, transparent), transparent 70%),
    radial-gradient(32% 55% at 55% -10%, color-mix(in srgb, var(--mesh-b) 26%, transparent), transparent 70%),
    radial-gradient(30% 50% at 92% 8%, color-mix(in srgb, var(--mesh-c) 24%, transparent), transparent 70%);
  -webkit-mask-image: linear-gradient(#000 40%, transparent); mask-image: linear-gradient(#000 40%, transparent); }

/* Greeting: a crew member says hi */
.greet h1 { font-size: 24px; font-weight: 800; letter-spacing: -.045em; }
.greet h1 span { color: var(--p1); }
.greet-mate { position: relative; flex: none; width: 56px; height: 56px; margin: -6px 0 -6px; }
.greet-mate img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 6px rgba(15,15,18,.16));
  transform-origin: 50% 90%; animation: bob 3.6s ease-in-out infinite; transition: translate .16s cubic-bezier(.2,.8,.3,1); }
.greet-mate.hop img { translate: 0 -12px; }
.greet-say { position: absolute; z-index: 3; left: calc(100% - 10px); top: -16px; padding: 5px 10px; border-radius: 12px; white-space: nowrap;
  background: var(--card); box-shadow: 0 6px 16px -6px rgba(15,15,18,.28), inset 0 0 0 1px var(--line);
  font-size: 12px; font-weight: 700; color: var(--ink); pointer-events: none; animation: greetSay 3.4s cubic-bezier(.34,1.5,.64,1) forwards; }
.greet-say::after { content: ""; position: absolute; left: 8px; bottom: -4px; width: 9px; height: 9px; background: inherit; border-radius: 2px; transform: rotate(45deg); box-shadow: 1px 1px 0 0 var(--line); }
@keyframes greetSay { 0% { opacity: 0; transform: translateY(8px) scale(.5); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px) scale(.9); } }
@media (max-width: 860px) { .greet-mate { display: none; } }

/* Question-type cards: each character peeks over its own card */
.counts { padding-top: 18px; }
.count:nth-child(1) { --c: var(--mc); } .count:nth-child(2) { --c: var(--tf); } .count:nth-child(3) { --c: var(--mt); }
.count:nth-child(4) { --c: var(--sa); } .count:nth-child(5) { --c: var(--es); }
.count { position: relative; border: 0; border-radius: 16px; padding: 12px; overflow: visible;
  background: color-mix(in srgb, var(--c) 7%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent);
  transition: transform .3s var(--ease), box-shadow .3s; }
.count:hover, .count:focus-within { transform: translateY(-2px); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, transparent), var(--shadow-sm); }
.counts { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .counts { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 26px; } }
.count { padding-top: 30px; }
.count > span:first-child { font-weight: 600; color: var(--ink); }
.count > span:first-child .mascot { position: absolute; top: -20px; left: 8px; width: 44px; height: 44px; margin: 0; transition: transform .35s var(--spring); }
.count:hover > span:first-child .mascot, .count:focus-within > span:first-child .mascot { transform: translateY(-5px) rotate(-6deg); }

/* Empty states: a sleepy crew member instead of a plain icon */
.empty-mate { display: block; width: 92px; height: auto; margin: 0 auto 10px; filter: drop-shadow(0 12px 12px rgba(15,15,18,.16)); animation: doze 3.6s ease-in-out infinite; }
@keyframes doze { 50% { transform: translateY(-5px) rotate(-2deg); } }
.notes-empty .mascot { width: 84px; } .notes-empty .mascot img, .rm-empty .mascot img, .ch-empty .mascot img { animation: doze 3.6s ease-in-out infinite; }
.rm-empty .mascot { width: 52px; } .rm-empty .mascot:nth-child(2) img { animation-delay: -1.2s; } .rm-empty .mascot:nth-child(3) img { animation-delay: -2.4s; }
.ch-empty .mascot { width: 60px; }
.rm-empty, .hist-empty { border-radius: 22px; }

/* Log-in screen: crew-coloured glow and two friends peeking at the card */
.auth-bg { background:
    radial-gradient(40% 45% at 12% 8%, color-mix(in srgb, var(--mesh-a) 45%, transparent), transparent 70%),
    radial-gradient(36% 42% at 88% 14%, color-mix(in srgb, var(--mesh-c) 38%, transparent), transparent 70%),
    radial-gradient(40% 45% at 80% 95%, color-mix(in srgb, var(--mesh-d) 40%, transparent), transparent 70%),
    radial-gradient(36% 40% at 10% 90%, color-mix(in srgb, var(--mesh-b) 40%, transparent), transparent 70%), var(--bg); }
.auth-wrap { position: relative; width: 100%; max-width: 400px; }
.auth-card { position: relative; z-index: 1; border-radius: 26px; }
.auth-peek { position: absolute; z-index: 0; width: 92px; pointer-events: none; filter: drop-shadow(0 10px 10px rgba(15,15,18,.15)); transition: transform .5s var(--spring); }
.auth-peek.l { left: -58px; top: 34%; transform: rotate(-12deg); }
.auth-peek.r { right: -56px; top: 12%; transform: rotate(10deg); }
.auth-wrap:focus-within .auth-peek.l { transform: translateX(-8px) rotate(-16deg); }
.auth-wrap:focus-within .auth-peek.r { transform: translateX(8px) rotate(14deg); }
@media (max-width: 520px) { .auth-peek { display: none; } }

@media (prefers-reduced-motion: reduce) { .greet-mate img, .empty-mate, .greet-say { animation: none !important; } }

/* Delete confirmation pop-up */
.confirm-bg { z-index: 120; }
.confirm-pop { position: relative; max-width: 380px; margin-top: 46px; padding: 30px 26px 24px; text-align: center; display: grid; justify-items: center; gap: 6px; border-radius: 26px; animation: cfIn .45s cubic-bezier(.34,1.4,.64,1) both; }
@keyframes cfIn { from { opacity: 0; transform: translateY(14px) scale(.94); } }
.cf-mate { position: absolute; top: -66px; right: 22px; width: 86px; pointer-events: none; filter: drop-shadow(0 10px 10px rgba(15,15,18,.18)); transform-origin: 50% 90%; animation: cfWorry 2.4s ease-in-out infinite; }
@keyframes cfWorry { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-3px); } }
.cf-ico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px; color: var(--bad-text); background: var(--bad-bg); box-shadow: 0 0 0 8px var(--bad-soft); }
.cf-ico svg { width: 24px; height: 24px; }
.confirm-pop h1 { font-size: 22px; }
.cf-text { margin: 0; color: var(--body); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.cf-text b { color: var(--ink); }
.cf-note { margin: 4px 0 0; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--bad-text); background: var(--bad-soft); }
.cf-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 16px; }
.confirm-pop.single .cf-btns { grid-template-columns: 1fr; }
.cf-btns > [hidden] { display: none; }
.cf-btns > * { height: 46px; justify-content: center; font-size: 15px; }
.cf-ok { background: #ef4444 !important; box-shadow: 0 10px 24px -12px rgba(239,68,68,.75) !important; }
.cf-ok:hover:not(:disabled) { background: #dc2626 !important; }
.confirm-pop.calm .cf-ico { color: var(--p1); background: var(--p-soft); box-shadow: 0 0 0 8px color-mix(in srgb, var(--p-soft) 50%, transparent); }
.confirm-pop.calm .cf-note { color: var(--p1); background: var(--p-soft); }
.confirm-pop.calm .cf-ok { background: var(--p1) !important; box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--p1) 70%, transparent) !important; }
.confirm-pop.calm .cf-ok:hover:not(:disabled) { background: var(--p2) !important; }
@media (max-width: 600px) { .confirm-bg { place-items: center !important; } }
@media (prefers-reduced-motion: reduce) { .cf-mate, .confirm-pop { animation: none; } }

/* Embedded in the landing page pop-up: just the card, on a see-through page */
html.embed, html.embed body { background: transparent !important; }
html.embed body * { visibility: hidden !important; }
html.embed #auth, html.embed #auth * { visibility: visible !important; }
html.embed #auth [hidden] { display: none !important; }
html.embed body { overflow: hidden; }
html.embed .auth-bg { background: transparent !important; }
html.embed .auth-card { box-shadow: 0 30px 80px -20px rgba(0,0,0,.35), 0 0 0 1px rgba(0,0,0,.04); }

/* ---------- Manage plan (downgrade) inside the upgrade dialog ---------- */
.manage-plan { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px; border-radius: 18px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); }
.manage-plan[hidden] { display: none; }
.mp-info { display: grid; gap: 2px; min-width: 0; }
.mp-info b { font-size: 14px; color: var(--ink); }
.mp-info small { font-size: 12.5px; color: var(--muted); }
.mp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-btn { height: 36px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--card); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s, background .2s; }
.mp-btn:hover { box-shadow: inset 0 0 0 1px var(--line-strong, #a1a1aa); }
.mp-btn.danger { color: #dc2626; }
.mp-btn:disabled { opacity: .55; cursor: default; }
@media (max-width: 520px) { .manage-plan { flex-direction: column; align-items: stretch; } .mp-actions .mp-btn { flex: 1; } }

/* ---------- Phone fixes ---------- */
@media (max-width: 600px) {
  /* the crew member peeks over the top of confirm pop-ups; don't clip their head (these pop-ups are short) */
  .dialog-bg > .dialog.confirm-pop { overflow: visible; max-height: none; }
}
@media (max-width: 860px) {
  /* the floating menu button tucks away while scrolling down so it doesn't sit on page titles */
  .menu-btn { transition: transform .35s var(--ease), opacity .25s; }
  .menu-btn.tuck { transform: translateY(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
}


/* ---------- Upgrade card (sidebar) and toasts: landing-page look ---------- */
.upgrade { position: relative; overflow: visible; isolation: isolate; margin-top: auto; padding: 18px 16px 16px; border-radius: 22px; color: var(--ink);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line), 0 18px 40px -24px rgba(79, 107, 255, .55); }
.upgrade .up-mesh { position: absolute; inset: 0; z-index: -1; border-radius: inherit; overflow: hidden; pointer-events: none;
  background: radial-gradient(70% 60% at 0% 0%, rgba(143,168,255,.45), transparent 70%), radial-gradient(60% 60% at 100% 10%, rgba(198,166,255,.45), transparent 70%),
              radial-gradient(70% 60% at 100% 100%, rgba(255,179,214,.35), transparent 70%), radial-gradient(60% 50% at 0% 100%, rgba(158,240,210,.35), transparent 70%); }
.upgrade .up-peek { position: absolute; top: -34px; right: 6px; width: 58px; height: auto; pointer-events: none; filter: drop-shadow(0 8px 8px rgba(15,15,18,.18)); animation: upPeek 3.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes upPeek { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-4px) rotate(3deg); } }
.upgrade .up-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: linear-gradient(90deg, #4f6bff, #9b6cf0); }
.upgrade .up-tag.on { background: linear-gradient(90deg, #22a06b, #8cc20e); }
.upgrade b { display: block; margin: 10px 0 0; font-family: var(--display); font-size: 17px; font-weight: 800; line-height: 1.2; letter-spacing: -.03em; color: var(--ink); }
.upgrade b em { font-style: normal; background: linear-gradient(90deg, #4f6bff, #9b6cf0 60%, #ec3d8a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.upgrade p { margin: 6px 0 14px; font-size: 12.5px; line-height: 1.45; color: var(--muted); opacity: 1; }
.upgrade .up-perks { list-style: none; display: grid; gap: 6px; margin: 10px 0 14px; padding: 0; }
.upgrade .up-perks li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--body); }
.upgrade .up-perks li::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%;
  background: #4f6bff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 10px no-repeat; }
.upgrade button { width: 100%; height: 40px; border-radius: 999px; border: 0; background: var(--ink); color: var(--card); font: inherit; font-size: 13.5px; font-weight: 700;
  box-shadow: 0 10px 22px -12px rgba(15,15,18,.6); transition: transform .4s var(--spring), box-shadow .3s; }
.upgrade button:hover { transform: translateY(-1px) scale(1.02); box-shadow: 0 14px 26px -12px rgba(15,15,18,.7); }

.toast { gap: 14px; padding: 16px 14px 16px 16px; border-radius: 22px; border: 0; background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line), 0 24px 48px -20px rgba(15,15,18,.35); font-size: 13.5px; line-height: 1.5; overflow: hidden; position: relative; isolation: isolate; }
.toast.pro::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 80% at 0% 0%, rgba(143,168,255,.30), transparent 70%), radial-gradient(50% 70% at 100% 100%, rgba(198,166,255,.30), transparent 70%); }
.toast .t-mate { flex: none; width: 44px; height: 44px; object-fit: contain; object-position: bottom; filter: drop-shadow(0 6px 6px rgba(15,15,18,.18)); }
.toast .t-body { min-width: 0; flex: 1; }
.toast .t-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 9px; margin-bottom: 6px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: linear-gradient(90deg, #4f6bff, #9b6cf0); }
.toast b { font-family: var(--display); font-size: 15px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 3px; }
.toast .t-actions { margin-top: 12px; }
.toast .t-cta { height: 38px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--ink); color: var(--card); font: inherit; font-size: 13px; font-weight: 700;
  box-shadow: 0 10px 22px -12px rgba(15,15,18,.6); transition: transform .4s var(--spring); cursor: pointer; }
.toast .t-cta:hover { transform: translateY(-1px) scale(1.03); }
.toast .x-btn { border-radius: 999px; }
@media (prefers-reduced-motion: reduce) { .upgrade .up-peek { animation: none; } }
/* No character on the sidebar upgrade card, for Free or Pro. */
.upgrade .up-peek { display: none; }
/* compact version so the sidebar card fits short laptop screens */
.upgrade { padding: 14px 14px 14px; }
.upgrade .up-peek { top: -26px; width: 46px; }
.upgrade b { margin-top: 8px; font-size: 15.5px; }
.upgrade .up-perks { gap: 4px; margin: 8px 0 12px; }
.upgrade .up-perks li { font-size: 12px; }
.upgrade p { margin: 4px 0 12px; font-size: 12px; }
.upgrade button { height: 36px; font-size: 13px; }
/* sidebar: scroll on short screens instead of cutting off the bottom card; the spacer pushes the card down on tall screens
   and always leaves room for Gibo to peek over it */
.side { overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.side::-webkit-scrollbar { display: none; }
.side-spacer { flex: 1 0 12px; }
.side .upgrade, .side > .upgrade { flex: none; margin-top: 0; }
.upgrade b { padding-right: 0; }

/* "New questions": shows how many reviews are left today, since each press uses one. */
.ghost.more .more-left { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--p-soft); color: var(--p1); }
.ghost.more .more-left.out { background: #fde2e2; color: #b91c1c; }
.set-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.set-pick select { height: 32px; border: 1px solid var(--line); border-radius: 100px; padding: 0 10px; background: var(--card); color: var(--ink); font: inherit; }

/* Study Rooms: "Most missed" questions for a quiz (room totals only, never names). */
.rm-stats .rm-missed-btn { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.rm-stats .rm-missed-btn[aria-expanded="true"] { background: var(--p-soft); color: var(--p1); border-color: transparent; }
.rm-quiz .rm-missed { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 10px; }
.rm-missed .rm-missed-h { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.rm-missed ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.rm-missed li { font-size: 13.5px; color: var(--ink); }
.rm-missed .rm-mq { display: block; overflow-wrap: anywhere; }
.rm-missed .rm-mn { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.rm-missed .rm-mn b { color: var(--bad-text); }

/* New questions on quizzes without their own file (room or shared-link copies): shown greyed out with a short reason. */
.ghost.more.off { opacity: .5; cursor: not-allowed; }
.ghost.more.off:hover { background: transparent; }
.qsec-f .more-note { font-size: 12px; color: var(--muted); max-width: 300px; line-height: 1.35; }

/* Sign-up confirmation code */
#authCode { font-size: 22px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.auth-links { gap: 18px; }
#resendLink[disabled] { opacity: .55; cursor: default; }
#codeField { margin-top: 18px; }
