@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(/fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(/fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url(/fonts/poppins-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; src: url(/fonts/poppins-latin-600-normal.woff2) format("woff2"); }

:root {
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --heading: Poppins, var(--sans);
  --bg: #070b12;
  --ink: #e8f0f7;
  --muted: #93a6b8;
  --faint: #6c8196;
  --gold: #38bdf8;
  --gold-pale: #bae6fd;
  --amber: #0284c7;
  --gold-line: #38bdf838;
  --panel: #0e1520;
  --pass: #34d399;
  --fail: #fb7373;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 15px/1.65 var(--sans);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 740px 360px at 50% 0%, rgba(56, 189, 248, .25), transparent 72%),
    radial-gradient(ellipse 1150px 670px at 50% -5%, rgba(2, 132, 199, .20), transparent 75%);
  background-repeat: no-repeat;
}
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.faint { color: var(--faint); }
.center { text-align: center; justify-content: center; }

/* Header */
.top {
  position: fixed; inset: 0 0 auto; z-index: 5; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 12px;
  padding: 16px 22px 26px; background: linear-gradient(#070b12e6 0%, #070b12b0 60%, #070b1200); backdrop-filter: blur(10px);
}
.wordmark {
  border: 0; background: none; padding: 4px 2px; cursor: pointer; font: 600 19px/1 var(--heading); letter-spacing: -.5px; text-decoration: none;
  background: linear-gradient(115deg, #e0f2fe 10%, var(--gold) 55%, var(--amber) 95%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.wordmark span { font-weight: 500; }
.wordmark, .download a { white-space: nowrap; }
.top-end { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 10px; min-width: 0; flex: 1 1 0; }
.download { display: inline-flex; align-items: baseline; gap: 6px; margin-right: 6px; }
.download a { color: var(--muted); font-size: 13px; text-decoration: none; }
.download a:hover { color: var(--gold-pale); text-decoration: underline; }
.chip { padding: 7px 12px; border: 1px solid var(--gold-line); border-radius: 10px; background: #0c182699; color: #cce3f5; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.chip:hover { background: #38bdf822; color: #f0f9ff; }
#countLabel, #quotaLabel, #accountIdentity { color: var(--gold-pale); font-variant-numeric: tabular-nums; font-weight: 500; }
.chip-label { color: var(--muted); margin-right: 4px; }
.quota-chip { cursor: pointer; }
#itemsFilter { margin-left: 8px; padding: 6px 10px; border: 1px solid var(--gold-line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; }
.account-chip { max-width: min(180px, 42vw); text-align: left; }
.account-kicker { display: block; }
.account-chip.is-signed .account-kicker { display: none; }
#accountIdentity { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: normal; }
.quota-chip.quota-low #quotaLabel { color: #fcd34d; }
.quota-chip.quota-empty #quotaLabel { color: var(--fail); }

/* Layout */
.shell { max-width: 772px; margin: 0 auto; padding: clamp(120px, 24vh, 260px) 26px 90px; }
.view.answered { padding-top: 0; }
.brand { text-align: center; margin: 0 0 40px; }
.brand h1 {
  margin: 0; font: 600 clamp(44px, 7vw, 76px)/1.2 var(--heading); letter-spacing: -3px; text-wrap: balance;
  background: linear-gradient(115deg, #f0f9ff 8%, var(--gold-pale) 30%, var(--gold) 65%, var(--amber) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .85)) drop-shadow(0 8px 14px rgba(0, 0, 0, .7));
}
.brand h1 .beta {
  display: inline-block; font-family: inherit; font-weight: 600; font-size: 0.18em; letter-spacing: -0.04em;
  vertical-align: baseline; position: relative; top: -0.08em; margin-left: 0.35em;
  color: #fff; background: none; -webkit-text-fill-color: #fff;
}
.brand p { margin: 16px 0 0; font: 400 14px/1.5 var(--sans); letter-spacing: .025em; color: #829ab1; }
body.has-exchange .shell { padding-top: 148px; }
body.has-exchange .brand, body.has-exchange .examples { display: none; }

/* Ask */
.ask-form textarea {
  display: block; width: 100%; min-height: 76px; max-height: 252px; resize: vertical; padding: 24px 26px; border-radius: 25px;
  background: linear-gradient(125deg, #101926, #0c131d); border: 1px solid #38bdf826; box-shadow: 0 14px 45px #00000038;
  font: 400 16px/26px var(--sans); color: #eef6fc; transition: border-color .2s, box-shadow .2s;
}
.ask-form textarea::placeholder { color: #6e849b; }
.ask-form textarea:focus { outline: none; border-color: #38bdf880; box-shadow: 0 0 0 4px #38bdf818, 0 14px 45px #00000038; }
.row { display: flex; justify-content: center; gap: 12px; margin-top: 22px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px; border-radius: 13px; border: 1px solid #ffffff1a; background: #131c29; color: #e2eef8; font: 500 14px var(--sans); cursor: pointer; text-decoration: none; transition: filter .2s, transform .2s; }
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .55; cursor: wait; filter: none; }
.btn.send, .btn.gold { background: linear-gradient(135deg, #38bdf8, #0284c7); border-color: #7dd3fc; color: #041320; font-weight: 600; box-shadow: 0 4px 18px #0ea5e928; }
.btn.send, .btn.learn { min-width: 112px; padding: 0 27px; }
.btn.learn { background: #0d1826; border-color: #38bdf845; color: var(--gold-pale); }
.btn.quiet { background: #131c29; }
.btn.danger { background: #3a1717; border-color: #fb737355; color: #ffd0d0; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn.wide { width: 100%; }
.badge { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--gold); color: #041320; font: 600 12px/18px var(--sans); }
.link { border: 0; background: none; padding: 6px 2px; color: var(--gold-pale); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: #fff; }
.status { min-height: 1.6em; margin: 16px 0 0; text-align: center; color: var(--muted); font-size: 14px; }
.status.error, .note.error { color: #ffb4a8; }
.examples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 30px; }
.example { padding: 12px 14px; border: 1px solid #38bdf81a; border-radius: 14px; background: #0c131d; color: #a8bdd1; font-size: 13px; line-height: 1.45; text-align: left; cursor: pointer; }
.example:hover { border-color: var(--gold-line); color: #e0f2fe; }
.note { margin: 16px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.note:empty { display: none; }
.note.limit { color: #7dd3fc; }
.note a { color: var(--gold-pale); }

/* Exchange & Thread */
.thread-history { display: grid; gap: 26px; margin-bottom: 28px; }
.previous-turn { padding-bottom: 22px; border-bottom: 1px solid #38bdf81c; opacity: .92; }
.exchange { margin-bottom: 30px; }
.asked { width: fit-content; max-width: 88%; margin: 0 0 24px auto; padding: 14px 20px; border-radius: 20px 20px 5px 20px; background: #0f2438; border: 1px solid #38bdf830; color: #e0f2fe; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-text { white-space: pre-wrap; overflow-wrap: anywhere; color: #e6f0f8; line-height: 1.8; margin: 0 0 14px; }
.prompt-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 22px; }
.prompt-saved-note { font-size: 12.5px; color: var(--faint); }
.prompt-saved-note.ok { color: var(--gold-pale); }
.prompt-saved-note.error { color: #ffb4a8; }
.card-box { padding: 20px 22px; border: 1px solid var(--gold-line); border-radius: 20px; background: linear-gradient(160deg, #0f1c2b, #0b121c); }
.kicker { margin: 0 0 10px; color: var(--gold); font: 500 13px/1.45 var(--sans); letter-spacing: 0; text-transform: none; }
.kicker strong { font-weight: 700; }
.card-q { margin: 0 0 8px; font-size: 17px; font-weight: 500; color: #f0f9ff; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-a { margin: 0 0 4px; color: #bfd2e3; white-space: pre-wrap; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions.center { justify-content: center; }
.card-box label, .dialog label, .item-edit label, .sci-edit label { display: block; margin: 0 0 12px; color: var(--muted); font-size: 13px; text-align: left; }
.card-box textarea, .item-edit textarea, .sci-edit textarea, .dialog input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid #38bdf840; border-radius: 10px; background: #121b28; color: var(--ink); resize: vertical;
}
.ok-line { margin: 0 0 6px; color: var(--gold-pale); }
.ok-line:empty { display: none; }
.look-once { margin-top: 12px; padding-top: 12px; border-top: 1px solid #ffffff12; }
.look-once .btn { margin: 6px 0 10px; }

/* Learn */
#learnView { text-align: center; }
#learnKicker { min-height: 28px; }
.learn-card { padding: 34px 28px 28px; border: 1px solid #38bdf822; border-radius: 22px; background: var(--panel); }
.learn-card:not(.is-reading) {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: clamp(90px, 15vh, 140px) clamp(140px, 23vh, 220px) 104px 44px auto;
  column-gap: 8px;
  text-align: left;
}
.learn-card:not(.is-reading) .learn-q { grid-area: 1 / 1 / 2 / -1; overflow: auto; margin: 0; padding-bottom: 16px; }
.learn-card:not(.is-reading) .learn-a { grid-area: 2 / 1 / 3 / -1; overflow: auto; margin: 0 0 16px; }
.learn-card:not(.is-reading) #learnPreActions,
.learn-card:not(.is-reading) #scienceActions,
.learn-card:not(.is-reading) #gradeGrid {
  grid-area: 3 / 1 / 4 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 48px; gap: 8px; margin: 0; align-content: start;
}
.learn-card:not(.is-reading) #learnPreActions .btn,
.learn-card:not(.is-reading) #scienceActions .btn { min-width: 0; width: 100%; padding: 8px 4px; }
.learn-card:not(.is-reading) #sciNextBtn { grid-area: 3 / 1 / 4 / 2; align-self: start; height: 48px; padding: 8px 4px; margin: 0; }
.learn-card:not(.is-reading) #ownShareActions { grid-area: 4 / 1 / 5 / -1; margin: 0; }
.learn-card:not(.is-reading) #sciCardEdit { grid-area: 5 / 1 / 6 / -1; }
.learn-shortcuts { text-align: center; font-size: 12px; }
.learn-q { margin: 0 0 26px; font: 500 clamp(20px, 3.4vw, 26px)/1.4 var(--sans); color: #f0f9ff; white-space: pre-wrap; overflow-wrap: anywhere; }
.learn-a { margin: 0 0 24px; padding-top: 22px; border-top: 1px solid #ffffff12; font-size: 18px; color: #d5e5f2; white-space: pre-wrap; overflow-wrap: anywhere; }
.flash { min-height: 1.65em; margin: 14px 0 0; color: var(--gold-pale); }
.grade-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grade { min-height: 44px; padding: 9px 6px; border: 1px solid #ffffff1a; border-radius: 12px; background: #131c29; font: 500 14px var(--sans); cursor: pointer; }
.grade:hover { filter: brightness(1.18); border-color: #ffffff30; }
.grade.pass { color: var(--pass); }
.grade.fail { color: var(--fail); }
.grade:disabled { opacity: .5; cursor: wait; }
#sciNextBtn { margin-top: 6px; }
.learn-done p { font-size: 17px; color: #d5e5f2; }
.nudge { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px; margin: 22px 0 0; padding: 10px 14px; border: 1px solid var(--gold-line); border-radius: 12px; color: #cce3f5; font-size: 13px; }
.x { border: 0; background: none; color: var(--faint); font-size: 18px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.x:hover { color: var(--ink); }

/* Items */
.items-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.items-head h2 { margin: 0; font: 600 24px var(--heading); color: #f0f9ff; }
.items-head .faint { font: 400 15px var(--sans); }
.items { list-style: none; margin: 18px 0 0; padding: 0; }
.items li { border-bottom: 1px solid #ffffff10; }
.items summary { padding: 14px 4px; cursor: pointer; color: #e2eef8; overflow-wrap: anywhere; list-style-position: inside; }
.items summary::marker { color: var(--gold); }
.item-body { padding: 0 4px 16px 22px; }
.item-body .card-a { margin-bottom: 6px; }
.item-meta { font-size: 12px; color: var(--faint); margin: 0 0 6px; }
.item-body .actions { margin-top: 8px; }
.empty { margin: 40px 0; text-align: center; color: var(--muted); }

/* Dialogs & Plans */
.dialog { width: min(460px, calc(100vw - 32px)); padding: 28px; color: var(--ink); background: #0e1622; border: 1px solid #38bdf838; border-radius: 22px; box-shadow: 0 30px 100px #000a; }
.dialog::backdrop { background: #0009; backdrop-filter: blur(6px); }
.dialog h2 { margin: 0 0 14px; font: 500 20px var(--sans); }
.dialog p { color: #9fb3c8; }
.dialog form .btn { margin-top: 4px; }
.dialog-close { display: flex; justify-content: flex-end; margin-top: 10px; }
.small-text { font-size: 12px; }
.plan-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid #ffffff14; }
.plan-heading { margin: 0 0 6px; font: 600 14px var(--sans); color: var(--gold-pale); }
.plan-grid { display: grid; gap: 8px; margin: 10px 0; }
.plan-card { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border: 1px solid #ffffff14; border-radius: 12px; background: #121c2b; }
.plan-card.active { border-color: var(--gold); background: #0f2438; }
.plan-title { font-weight: 600; font-size: 13px; color: #f0f9ff; }
.plan-meta { width: 100%; font-size: 12px; color: var(--muted); }

/* Download & Guide Page */
.doc-shell { padding-top: 110px; }
.doc-hero { margin-bottom: 32px; padding: 28px; }
.doc-title { margin: 4px 0 12px; font: 600 clamp(28px, 4.5vw, 40px)/1.2 var(--heading); color: #f0f9ff; }
.doc-lead { margin: 0 0 12px; color: #cbe0f2; font-size: 15px; }
.doc-section { margin-bottom: 32px; }
.doc-section h2 { margin: 0 0 12px; font: 600 20px var(--heading); color: var(--gold-pale); }
.doc-section p { margin: 0 0 12px; color: #bfd2e3; }
.doc-section a { color: var(--gold-pale); }
.doc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.doc-card { padding: 16px; border: 1px solid #38bdf824; border-radius: 16px; background: #0d1520; }
.doc-card h3 { margin: 0 0 6px; font: 600 15px var(--sans); color: #f0f9ff; }
.doc-card p { margin: 0; font-size: 13px; color: var(--muted); }
.doc-table-wrap { overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; }
.doc-table th, .doc-table td { border: 1px solid #38bdf826; padding: 10px 12px; text-align: left; vertical-align: top; }
.doc-table th { background: #0f2032; color: var(--gold-pale); font-weight: 600; }
.doc-table td { background: #0b131e; color: #d5e5f2; }

@media (max-width: 640px) {
  .top { padding: 10px 12px 20px; gap: 8px; }
  .wordmark { font-size: 16px; }
  .top-end { flex-basis: 100%; gap: 6px; }
  .chip { padding: 6px 9px; font-size: 12px; }
  .download { flex-direction: column; align-items: flex-end; gap: 0; margin-right: 2px; }
  .download a { font-size: 12px; }
  .shell { padding: 22vh 18px 70px; }
  .doc-shell { padding-top: 90px; }
  body.has-exchange .shell { padding-top: 156px; }
  .brand { margin-bottom: 30px; }
  .brand h1 { letter-spacing: -2px; }
  .examples, .doc-grid { grid-template-columns: 1fr; }
  .learn-card { padding: 26px 18px 20px; }
  .grade { font-size: 13px; }
}
@media (max-width: 360px) {
  .wordmark { font-size: 14px; }
  .chip { padding: 6px 7px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
