/* BrainBerry on the web.
   Tokens: wide screens use the landing page's berry look; phones (<= 640px) switch to the
   iPhone app's palette and the system font so the page reads as the app. Every screen shares
   one structure, so only the tokens and a little spacing change. */
:root {
  --bg: #FFF8EE;
  --bg-deep: #F6EBDD;
  --card: #FFFFFF;
  --ink: #2A1A3E;
  --soft: #6B5A80;
  --faint: #A79CB5;
  --line: #E9DCCB;
  --primary: #C7206E;
  --primary-deep: #7E1E63;
  --primary-soft: #FBE4EE;
  --coral: #E24A5F;
  --coral-soft: #FBE3E6;
  --sun: #F5B63D;
  --sun-soft: #FFF1CF;
  --sun-deep: #8A5E00;
  --mint: #3E9B4F;
  --mint-soft: #E3F3E5;
  --mint-deep: #2A7539;
  --sky: #2F8FD6;
  --miss: #C8453B;
  --miss-soft: #FCE6E2;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(42, 26, 62, 0.08);
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Atkinson Hyperlegible", "Helvetica Neue", Arial, sans-serif;
  --soft-axis: "SOFT" 100;
}
@media (max-width: 640px) {
  :root {
    --bg: #FFF9F0;
    --bg-deep: #F3EEE4;
    --ink: #24204A;
    --soft: #6B6690;
    --faint: #A7A3C2;
    --line: #EFE9F7;
    --primary: #6C4CF1;
    --primary-deep: #4A30C4;
    --primary-soft: #EFEAFF;
    --coral: #FF6B6B;
    --coral-soft: #FFE9E6;
    --sun: #FFC53D;
    --sun-soft: #FFF3D1;
    --sun-deep: #8A5E00;
    --mint: #2ED3A2;
    --mint-soft: #DFF8EF;
    --mint-deep: #149A73;
    --sky: #3DB2FF;
    --miss: #D84A4A;
    --miss-soft: #FFE9E6;
    --radius: 20px;
    --radius-sm: 14px;
    --shadow: 0 6px 18px rgba(36, 32, 74, 0.06);
    --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    --soft-axis: normal;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  padding-inline: max(clamp(16px, 5vw, 40px), env(safe-area-inset-left), env(safe-area-inset-right));
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  min-height: 100vh;
  min-height: 100dvh;
}
a { color: var(--primary-deep); }
h1, h2, h3 { font-family: var(--display); font-variation-settings: var(--soft-axis); line-height: 1.1; text-wrap: balance; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.wrap { max-width: 720px; margin-inline: auto; padding-bottom: 72px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); }
.eyebrow.hot { color: var(--primary); }
.soft { color: var(--soft); }
.small { font-size: 14.5px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.inline { display: inline-flex; align-items: center; gap: 8px; }
.stack { display: grid; gap: 10px; margin-top: 18px; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 22px; border-radius: 999px; font-weight: 800; font-size: 16px; border: 2px solid transparent; text-decoration: none; transition: transform .15s ease, background .15s ease, border-color .15s ease; min-height: 50px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-deep); transform: translateY(-1px); }
.btn-coral { background: var(--coral); color: #fff; }
.btn-coral:hover:not(:disabled) { filter: brightness(.94); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--card); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); }
.btn-danger { border-color: var(--coral); color: var(--coral); background: var(--card); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-wide { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--primary-deep); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.back { display: inline-flex; align-items: center; gap: 2px; margin-top: 14px; font-weight: 800; text-decoration: none; color: var(--primary); font-size: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 4vw, 26px); margin-top: 14px; }
.card .eyebrow + * { margin-top: 10px; }
.err { margin-top: 12px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--miss-soft); color: #8E2A22; font-size: 15px; }
.msg { margin-top: 12px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--mint-soft); color: var(--mint-deep); font-size: 15px; }
.hint { margin-top: 10px; font-size: 14.5px; color: var(--soft); }
label { display: block; font-weight: 800; font-size: 14px; margin: 14px 0 6px; color: var(--soft); }
input[type=text], input[type=email], input[type=password], textarea {
  width: 100%; padding: 13px 16px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--bg); outline: none; font-size: 16px;
}
input:focus, textarea:focus { border-color: var(--primary); background: var(--card); }
textarea { min-height: 120px; resize: vertical; display: block; line-height: 1.5; }
.spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255,255,255,.45); border-top-color: #fff; animation: spin .8s linear infinite; }
.spinner.dark { border-color: var(--line); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { text-align: center; padding: 90px 0; }

/* sign in */
.login { max-width: 420px; margin: clamp(20px, 8vh, 72px) auto 0; text-align: center; }
.login .logo { width: 88px; height: 88px; border-radius: 24px; margin: 0 auto; display: block; }
.login h1 { font-size: clamp(32px, 7vw, 42px); font-weight: 900; margin-top: 14px; }
.login .tag { color: var(--soft); margin-top: 6px; }
.login form { text-align: left; }
.login .btn { margin-top: 20px; }
.login .switch { margin-top: 18px; font-size: 15px; color: var(--soft); }
.login .forgot { margin-top: 8px; font-size: 14.5px; text-align: right; }
.login .forgot .linkbtn { font-weight: 700; }
.login .intro { color: var(--soft); font-size: 15px; line-height: 1.5; }
.login form .msg:first-child { margin-top: 0; }
.login input.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .18em; text-transform: uppercase; }
.login input.code::placeholder { letter-spacing: .18em; opacity: .4; }

/* dashboard */
.greet { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.greet h1 { font-size: clamp(28px, 6vw, 36px); font-weight: 900; display: flex; align-items: center; gap: 8px; }
.greet h1 .i { color: var(--sun); width: 30px; height: 30px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; font-weight: 900; font-size: 18px; display: grid; place-items: center; text-decoration: none; }
.streak { margin-top: 16px; border-radius: var(--radius); padding: 20px 22px; background: var(--coral); color: #fff; box-shadow: var(--shadow); }
.streak .big { font-family: var(--display); font-variation-settings: var(--soft-axis); font-size: 26px; font-weight: 900; display: flex; align-items: center; gap: 8px; letter-spacing: -0.02em; }
.streak .big .i { width: 28px; height: 28px; }
.streak .sub { opacity: .9; margin-top: 2px; font-size: 15px; }
.streak .best { font-weight: 800; opacity: .9; white-space: nowrap; }
.dots { display: flex; justify-content: space-between; margin-top: 16px; }
.dot { display: grid; justify-items: center; gap: 5px; font-size: 12px; font-weight: 800; opacity: .9; }
.dot i { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); display: grid; place-items: center; }
.dot i.on { background: #fff; border-color: #fff; color: var(--coral); }
.dot i.today { border-style: dashed; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tile b { display: block; font-family: var(--display); font-variation-settings: var(--soft-axis); font-weight: 900; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tile span { display: block; font-size: 13.5px; color: var(--soft); margin-top: 2px; }
.tile small { display: block; font-size: 12.5px; color: var(--faint); }
.section { margin-top: 26px; }
.class-card { display: block; text-decoration: none; color: inherit; transition: transform .12s ease, border-color .15s ease; }
.class-card:hover { border-color: var(--primary); }
.class-card:active { transform: scale(.985); }
.class-card .top { display: flex; align-items: center; gap: 14px; }
.disc { width: 46px; height: 46px; border-radius: 15px; color: #fff; font-weight: 900; font-size: 20px; display: grid; place-items: center; flex: none; }
.class-card h3 { font-size: 20px; font-weight: 800; }
.class-card .stat { font-size: 14px; color: var(--soft); margin-top: 2px; }
.class-card .chev { font-size: 26px; font-weight: 800; margin-left: auto; }
.class-card .bar { margin-top: 14px; }
.empty { text-align: center; padding: 30px 20px; color: var(--soft); }
.empty .i { width: 56px; height: 56px; color: var(--faint); display: block; margin: 0 auto 10px; }
.add-row { display: flex; gap: 10px; margin-top: 16px; }
.add-row input { flex: 1; }
.add-row .btn { padding-inline: 22px; }

/* coverage */
.bar { height: 10px; border-radius: 6px; background: var(--bg-deep); overflow: hidden; display: flex; }
.bar.thin { height: 6px; }
.bar i { display: block; height: 100%; }
.bar .m { background: var(--mint); } .bar .s { background: var(--sun); }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: var(--soft); font-variant-numeric: tabular-nums; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--line); }
.legend .lm::before { background: var(--mint); } .legend .ls::before { background: var(--sun); }
.pct { font-weight: 800; color: var(--mint-deep); font-size: 14.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* class page */
.hero { margin-top: 12px; border-radius: var(--radius); padding: 22px 22px 20px; color: #fff; box-shadow: var(--shadow); }
.hero h1 { font-size: clamp(28px, 6vw, 38px); font-weight: 900; color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: rgba(255,255,255,.22); font-size: 13.5px; font-weight: 800; }
.chip .i { width: 15px; height: 15px; }
.thumbs { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; margin-top: 10px; scrollbar-width: none; }
.thumbs::-webkit-scrollbar { display: none; }
.thumb { position: relative; flex: none; width: 92px; height: 116px; border-radius: 14px; overflow: hidden; border: 2px solid var(--line); background: var(--bg-deep); padding: 0; }
.thumb.failed { border-color: var(--coral); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .badge { position: absolute; left: 6px; bottom: 6px; padding: 3px 8px; border-radius: 999px; color: #fff; font-size: 11.5px; font-weight: 900; display: inline-flex; align-items: center; gap: 4px; }
.badge.processed { background: var(--mint); } .badge.pending { background: var(--sun); color: var(--ink); } .badge.failed { background: var(--coral); }
.seg-label { font-weight: 800; font-size: 14px; margin: 16px 0 8px; color: var(--soft); }
.seg { display: flex; gap: 6px; background: var(--bg-deep); padding: 5px; border-radius: 16px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 10px 4px; white-space: nowrap; border-radius: 12px; font-weight: 800; font-size: 15px; color: var(--soft); }
.seg button[aria-pressed=true] { background: var(--card); color: var(--primary-deep); box-shadow: 0 2px 8px rgba(42, 26, 62, .10); }
.nudge { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--sun-soft); font-size: 14.5px; border: 0; text-align: left; width: 100%; color: var(--ink); }
.nudge b { color: var(--primary); font-weight: 900; }
.resume { background: var(--sun-soft); border-color: transparent; }

/* photo */
.photo-full { width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius); background: var(--bg-deep); margin-top: 12px; display: block; }
.status-pill { padding: 4px 10px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 900; }

/* quiz */
.quiz-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; font-weight: 800; }
.quiz-head .count { color: var(--primary); font-variant-numeric: tabular-nums; }
.progress { display: flex; gap: 4px; margin-top: 10px; }
.progress i { flex: 1; height: 8px; border-radius: 4px; background: var(--line); }
.progress .now { background: var(--primary); }
.progress .correct { background: var(--mint); } .progress .partial { background: var(--sun); } .progress .miss { background: var(--miss); }
.pill { display: inline-block; padding: 5px 11px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-deep); font-size: 11.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.prompt { font-family: var(--display); font-variation-settings: var(--soft-axis); font-weight: 800; font-size: clamp(21px, 3.4vw, 27px); line-height: 1.25; margin-top: 12px; }
.answer { margin-top: 16px; }
.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
kbd { font-family: var(--body); font-size: 12px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--soft); }
.choices { display: grid; gap: 10px; margin-top: 16px; }
.choice { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); font-size: 16px; }
.choice:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.choice:disabled { cursor: default; opacity: .6; }
.choice .n { width: 30px; height: 30px; border-radius: 9px; background: var(--bg-deep); display: grid; place-items: center; font-weight: 800; font-size: 14px; color: var(--soft); }
.verdict { margin-top: 16px; border-radius: 18px; padding: 18px 20px; }
.verdict.correct { background: var(--mint-soft); } .verdict.partial { background: var(--sun-soft); } .verdict.miss { background: var(--miss-soft); }
.verdict .word { font-family: var(--display); font-variation-settings: var(--soft-axis); font-weight: 900; font-size: 25px; display: flex; align-items: center; gap: 8px; }
.verdict .word .i { width: 26px; height: 26px; }
.verdict.correct .word { color: var(--mint-deep); } .verdict.partial .word { color: var(--sun-deep); } .verdict.miss .word { color: var(--miss); }
.verdict .fb { margin-top: 6px; }
.verdict .yours { margin-top: 8px; font-size: 14.5px; color: var(--soft); }
.verdict .notes { margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(42, 26, 62, .18); }
.verdict .notes b { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); margin-bottom: 2px; }
.later { margin-top: 16px; text-align: center; font-size: 14.5px; color: var(--soft); }

/* learn */
.learn-stats { margin-top: 8px; font-size: 15px; color: var(--soft); font-variant-numeric: tabular-nums; }
.date-row { display: flex; align-items: center; gap: 14px; }
.date-row input[type=date] { flex: 1; min-width: 0; padding: 11px 14px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--bg); outline: none; font-size: 16px; }
.date-row input[type=date]:focus { border-color: var(--primary); background: var(--card); }
.concepts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.concept { display: inline-block; padding: 5px 11px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-deep); font-size: 13.5px; font-weight: 800; }
.hint-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.hint-row .btn { padding: 10px 18px; min-height: 42px; font-size: 15px; }
.hint-text { margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--sun-soft); color: var(--sun-deep); font-size: 15.5px; }
.hint-text:not([hidden]) + .answer { margin-top: 10px; }
.explain { margin-top: 14px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--ink); }
.explain .eyebrow { color: var(--primary-deep); }
.explain .eyebrow + * { margin-top: 4px; }
.override { display: inline-block; margin-top: 12px; background: none; border: 0; padding: 2px 0; color: var(--soft); font-size: 14px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.override:hover { color: var(--primary-deep); }
.score .score-label { margin-top: 10px; font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .9; }
.dump-box { min-height: 220px; }
.dump-result { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.dump-result li { display: flex; align-items: flex-start; gap: 6px; font-size: 15.5px; }
.dump-result li .i { color: var(--mint-deep); margin-top: 4px; }

/* done */
.score { margin-top: 16px; border-radius: var(--radius); padding: clamp(26px, 6vw, 40px); color: #fff; text-align: center; background: var(--primary); box-shadow: var(--shadow); }
.score.sweep { background: var(--mint); }
.score .i { width: 52px; height: 52px; }
.score b { display: block; font-family: var(--display); font-variation-settings: var(--soft-axis); font-weight: 900; font-size: clamp(42px, 9vw, 60px); line-height: 1; font-variant-numeric: tabular-nums; margin-top: 6px; }
.score p { margin: 10px auto 0; max-width: 38ch; opacity: .92; }
.miss-card { border-left: 5px solid var(--miss); }
.miss-card.partial { border-left-color: var(--sun); }
.miss-card .q { font-weight: 800; margin-top: 8px; }
.miss-card .a { margin-top: 6px; color: var(--soft); }

/* profile */
.profile-hero { text-align: center; margin-top: 16px; }
.profile-hero .disc { width: 84px; height: 84px; border-radius: 50%; font-size: 36px; margin: 0 auto; background: var(--primary); }
.profile-hero h1 { font-size: 28px; font-weight: 900; margin-top: 12px; }
.profile-hero .soft { margin-top: 2px; }
.danger { border-color: var(--coral-soft); }
.danger .eyebrow { color: var(--coral); }

/* upload toast */
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 800; font-size: 14.5px; box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); z-index: 10; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding-bottom: 40px; }
  .btn-row { flex-direction: row; }
  .actions .btn { width: 100%; }
  .hint-row { flex-direction: column; align-items: stretch; }
  .hint-row .btn { width: 100%; }
  .hint-row .linkbtn { text-align: center; }
  .keys { display: none; }
  .card { padding: 18px; }
  .seg button { font-size: 14px; }
  .greet { margin-top: 10px; }
  .login { margin-top: 24px; }
}
@media (hover: none) { .keys { display: none; } }
@media (prefers-reduced-motion: reduce) { .btn, .class-card { transition: none; } .spinner { animation-duration: 2s; } }
