/* Degree Tracker styles. Three looks: adult (parents and public), fun (students), clean (students). */
:root {
  --bg: #f7f8fc; --card: #ffffff; --ink: #1f2937; --muted: #5b6474; --line: #e3e7ef; --track: #e8ebf3;
  --accent: #2563eb; --accent-ink: #ffffff; --accent-soft: #e8efff; --ok: #0f9d58; --warn: #b45309; --danger: #c62828;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: var(--font);
}
.theme-fun {
  --bg: #fff8ef; --accent: #7c3aed; --accent-soft: #f1e9ff; --track: #efe7f9; --radius: 20px;
  --display: "Trebuchet MS", "Segoe UI Rounded", "Arial Rounded MT Bold", var(--font);
}
.theme-clean { --bg: #f6f7f9; --accent: #0f766e; --accent-soft: #e2f3f1; --radius: 10px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }
img, svg { max-width: 100%; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .88rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.devbar { background: #fef3c7; color: #78350f; text-align: center; font-size: .85rem; padding: 6px 16px; }
.devbar a { color: inherit; font-weight: 600; }

/* header */
.top { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-family: var(--display); color: var(--ink); text-decoration: none; font-size: 1.1rem; }
.top nav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.top nav a, .linkish { color: var(--ink); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.top nav a:hover, .linkish:hover { background: var(--accent-soft); }
.linkish { background: none; border: 0; font: inherit; cursor: pointer; color: var(--accent); }
.navtoggle { display: none; margin-left: auto; }
form.inline { display: inline; }

main { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
main.wide { max-width: 1100px; }
.foot { text-align: center; padding: 24px 16px 40px; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }

/* cards, buttons, forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 520px; margin: 24px auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: var(--accent-ink); border: 2px solid var(--accent); border-radius: 999px; padding: 10px 20px; font: 600 1rem var(--font); text-decoration: none; cursor: pointer; min-height: 44px; }
.btn:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 6px 14px; font-size: .9rem; min-height: 36px; }
.btn.big { padding: 14px 26px; font-size: 1.08rem; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.disabled { opacity: .55; cursor: not-allowed; }
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-weight: 600; margin-bottom: 4px; }
.field small { display: block; color: var(--muted); margin-top: 4px; font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid #cdd3df; border-radius: 10px; font: inherit; background: #fff; color: var(--ink); min-height: 44px; }
textarea { resize: vertical; }
select[multiple] { min-height: 120px; }
.check { display: block; position: relative; padding-left: 28px; margin: 10px 0; }
.check input { position: absolute; left: 0; top: 3px; width: 18px; height: 18px; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.code-input { font: 600 1.3rem ui-monospace, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.error { background: #fdecec; color: #8a1c1c; border-radius: 10px; padding: 10px 12px; }
.flash { border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; background: #e7f6ee; color: #11502f; font-weight: 600; }
.flash.warn { background: #fff4e0; color: #7a4b00; }
.flash.party { background: linear-gradient(90deg, #fdf2ff, #eef4ff); color: #4c1d95; font-size: 1.05rem; }
.notice { background: #fffbea; border: 1px solid #f5e1a4; border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.pill { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; }
.pill.ok { background: #e7f6ee; color: var(--ok); }
.pill.warn { background: #fff4e0; color: var(--warn); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .grid2, .grid2 + section, section + .grid2 { margin-top: 16px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f3f5fa; font-weight: 600; }
code { background: #f1f3f8; padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.readonly-note { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; }
.draft-banner { background: #fde68a; color: #713f12; font-weight: 700; padding: 10px 14px; border-radius: 10px; }

/* landing */
.landing main { padding-top: 0; }
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; padding: 48px 0 24px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--accent); }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); }
.lead { font-size: 1.15rem; color: #374151; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.hero-svg .h1 { fill: #fde68a; } .hero-svg .h2 { fill: #a7f3d0; } .hero-svg .h3 { fill: #c7d2fe; } .hero-svg .h4 { fill: #fbcfe8; }
.hero-svg .hline { stroke: #2563eb; stroke-width: 4; fill: none; stroke-dasharray: 8 8; }
.hero-svg .hdot { fill: #2563eb; }
.hero-svg text { font: 700 18px var(--font); fill: #374151; }
.section { padding: 32px 0; border-top: 1px solid var(--line); }
.steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.steps li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step-n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; margin-bottom: 8px; }
.stage-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stage { border-radius: var(--radius); padding: 18px; }
.stage.s1 { background: #fff7e6; } .stage.s2 { background: #e8f8f1; } .stage.s3 { background: #eef0ff; } .stage.s4 { background: #fdeef6; }
.honest { background: var(--card); border-left: 4px solid var(--accent); padding: 14px 18px; border-radius: 8px; margin-top: 16px; }
.state-pick { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.state-pick .field { flex: 1 1 260px; margin: 0; }
.state-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-top: 16px; box-shadow: var(--shadow); }
.estimate { font-size: 1.2rem; }
.code-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.code-box > div { background: var(--card); border: 2px dashed #c7d2fe; border-radius: var(--radius); padding: 20px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.features > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 10px 0 0; }

/* dashboard */
.hero-card { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: center; }
.ring { width: 170px; height: 170px; }
.ring-big { font: 800 30px var(--display); fill: var(--ink); }
.ring-sub { font: 500 11px var(--font); fill: var(--muted); }
.bar { width: 100%; height: 12px; display: block; }
.mile { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: .85rem; color: var(--muted); margin: 10px 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--accent-soft); border-radius: 999px; padding: 4px 12px; font-size: .9rem; }
.big { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.streak.lit { background: linear-gradient(135deg, #fff7ed, #fff); border-color: #fed7aa; }
.checkin { margin-top: 12px; }
.stage-row { margin-bottom: 14px; }
.stage-label { margin-bottom: 4px; font-size: .95rem; }
.goals { list-style: none; padding: 0; margin: 0 0 12px; }
.goal { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: #f6f7fb; margin-bottom: 8px; border-left: 4px solid var(--line); }
.goal.soon { border-left-color: #f59e0b; } .goal.late { border-left-color: var(--danger); } .goal.done-ontime { border-left-color: var(--ok); background: #effaf4; }
.goal-actions { display: flex; gap: 6px; }
.goal-form { display: grid; grid-template-columns: 2fr 1fr auto; gap: 8px; align-items: end; }
.goal-form .field { margin: 0; }
.badges { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 10px 6px; border-radius: 12px; background: #f6f7fb; }
.badge.earned { background: linear-gradient(160deg, #fff7d6, #ffe8f3); }
.badge.locked { opacity: .55; }
.b-icon { display: block; font-size: 1.8rem; }
.b-name { display: block; font-weight: 700; font-size: .82rem; }
.b-desc { display: block; font-size: .72rem; color: var(--muted); }
.tag { display: inline-block; font-size: .72rem; border-radius: 6px; padding: 1px 6px; background: #eef1f7; color: var(--muted); }
.tag.exam { background: #fdeef6; color: #9d174d; } .tag.upper { background: #eef0ff; color: #3730a3; }
.dash.clean .badge.earned { background: #eef7f6; }
.theme-fun .card { border-width: 2px; }
.theme-fun .hero-card { background: linear-gradient(135deg, #fff, #f6efff); }

/* parent home */
.kid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kid-card { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; text-decoration: none; color: inherit; }
.kid-card .ring { width: 116px; height: 116px; }
.kid-card:hover { border-color: var(--accent); }
.kid-card .link { color: var(--accent); font-weight: 600; }
.codes { list-style: none; padding: 0; } .codes li { margin: 6px 0; } .codes code { font-size: 1.05rem; }
.kidrow { padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0 0 16px; }
.facts div { background: #f6f7fb; border-radius: 10px; padding: 12px; }
.facts dt { color: var(--muted); font-size: .85rem; } .facts dd { margin: 0; font-weight: 700; }
.note-from { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; }
.screen-name { font: 800 1.5rem var(--display); color: var(--accent); }

/* purchases and library */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.products .card { margin: 0; }
.product-head { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.files { padding-left: 18px; } .files li { margin: 4px 0; }
.share summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.doc-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stamp { font-size: .8rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; text-align: center; }
.doc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px clamp(16px, 4vw, 40px); }
.doc table { font-size: .9rem; }
.doc blockquote { border-left: 4px solid var(--line); margin: 0 0 1em; padding: 4px 14px; color: #374151; }
.doc pre { white-space: pre-wrap; background: #f6f7fb; padding: 12px; border-radius: 8px; }

/* community */
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }
.inline-form .field { margin: 0; min-width: 200px; }
.new-post summary { list-style: none; display: inline-flex; }
.new-post[open] summary { margin-bottom: 12px; }
.post { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.post.held, .post.hidden { border-style: dashed; background: #fffdf5; }
.post-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: .92rem; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.post-tools { margin-left: auto; position: relative; }
.post-tools summary { cursor: pointer; list-style: none; padding: 0 8px; font-size: 1.2rem; color: var(--muted); }
.post-tools[open] > form { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 6px; box-shadow: var(--shadow); min-width: 240px; }
.replies { margin-left: clamp(8px, 4vw, 32px); }
.replies-link { margin: -4px 0 14px 16px; font-size: .9rem; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.room-card { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-decoration: none; color: inherit; }
.room-card.mine { border: 2px solid var(--accent); }
.room-card:hover { box-shadow: var(--shadow); }
.room-count { font-size: .8rem; color: var(--accent); }
.chat { max-height: 60vh; overflow-y: auto; padding: 4px; margin-bottom: 12px; }
.chat-form textarea { min-height: 64px; }

/* admin */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--muted); }
.tile-n { display: block; font: 800 2rem var(--display); color: var(--ink); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; }
.reject { display: flex; gap: 8px; margin-top: 8px; }
.email pre { white-space: pre-wrap; font: 14px/1.5 ui-monospace, Consolas, monospace; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2.2s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .8; } }

/* small screens */
@media (max-width: 760px) {
  .top { padding: 10px 16px; flex-wrap: wrap; }
  .navtoggle { display: inline-flex; background: none; border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 12px; font: inherit; }
  .top nav { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .top nav.open { display: flex; }
  .top nav a, .top nav .linkish { padding: 12px; }
  .hero { grid-template-columns: 1fr; padding-top: 24px; }
  .hero-art { display: none; }
  .hero-card { grid-template-columns: 1fr; text-align: center; }
  .ring-wrap { display: flex; justify-content: center; }
  .chips { justify-content: center; }
  .goal-form { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .kid-card { grid-template-columns: 90px 1fr; }
  .kid-card .ring { width: 88px; height: 88px; }
}

@media print {
  .top, .foot, .devbar, .noprint, .flash { display: none !important; }
  body { background: #fff; }
  main, main.wide { max-width: none; padding: 0; }
  .doc { border: 0; padding: 0; }
  .stamp { border: 0; }
  a { color: inherit; text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.mod form { margin-bottom: 8px; }

/* weekly review */
.pill.bad { background: #fdecec; color: var(--danger); }
table.review td { vertical-align: top; }
table.review td.actions { min-width: 220px; }
table.review .inline-form { display: inline-flex; gap: 6px; align-items: flex-end; margin: 4px 0; }
table.review .inline-form .field { margin: 0; min-width: 0; width: 110px; }
table.review details summary { list-style: none; display: inline-flex; margin-top: 4px; }
tr.rv.bad td:first-child { border-left: 4px solid var(--danger); }
tr.rv.warn td:first-child { border-left: 4px solid #f59e0b; }
tr.rv.ok td:first-child { border-left: 4px solid var(--ok); }
.csv-form textarea { font: 12px ui-monospace, Consolas, monospace; }

/* ---------- state map (tile grid) ---------- */
.map-card { margin: 0 0 16px; padding: 14px; }
.usmap { width: 100%; height: auto; display: block; max-width: 640px; margin: 0 auto; }
.usmap .tile .hit { fill: transparent; stroke: none; }
.usmap .tile rect.face { fill: #e9edf5; stroke: #c9d1e0; stroke-width: 1; transition: fill .15s; }
.usmap .tile text { font: 700 15px/1 system-ui, sans-serif; fill: #374151; pointer-events: none; }
.usmap .tile.t-soon rect.face { fill: #f3f4f6; } .usmap .tile.t-soon text { fill: #6b7280; }
.usmap .tile.t-home rect.face { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.usmap .tile.t-mine rect.face { fill: var(--accent); stroke: var(--accent); }
.usmap .tile.t-mine text { fill: var(--accent-ink); }
.usmap .tile .dot { fill: #f59e0b; stroke: #fff; stroke-width: 1.5; }
.usmap .tile:hover rect.face, .usmap .tile:focus rect.face { fill: #cbd8f7; stroke: var(--accent); stroke-width: 2; }
.usmap .tile.t-mine:hover rect.face, .usmap .tile.t-mine:focus rect.face { fill: #1d4ed8; }
.usmap .tile:focus { outline: none; } .usmap .tile:focus-visible rect.face { stroke: #111827; stroke-width: 3; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin-top: 10px; font-size: .9rem; color: var(--muted); }
.legend .sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; background: #e9edf5; border: 1px solid #c9d1e0; }
.legend .sw.t-mine { background: var(--accent); border-color: var(--accent); }
.legend .sw.t-home { background: var(--accent-soft); border: 2px solid var(--accent); }
.map-start { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.state-list { margin: 8px 0 16px; } .state-list summary { cursor: pointer; font-weight: 600; padding: 10px 0; min-height: 44px; }
.state-links { list-style: none; padding: 0; columns: 3 180px; column-gap: 18px; }
.state-links li { break-inside: avoid; } .state-links a { display: inline-block; padding: 8px 0; min-height: 40px; }
.tag.mine { background: var(--accent); color: var(--accent-ink); }
.state-kid { display: flex; gap: 18px; align-items: flex-start; }
.state-kid > div:last-child { flex: 1; min-width: 0; }
.ring-wrap.small .ring { width: 110px; height: 110px; }
@media (max-width: 560px) {
  .usmap .tile text { font-size: 17px; }
  .map-card { padding: 6px 2px; margin-left: -8px; margin-right: -8px; }
  .state-kid { flex-direction: column; align-items: stretch; }
  .state-links { columns: 2 140px; }
}
.plain-list { list-style: none; padding: 0; margin: 10px 0; } .plain-list li { margin: 6px 0; }
.section-tight { margin-top: 18px; }
.locked-card { border: 2px dashed #c7cfdd; background: #fafbfe; }
.locked-card h3 { color: var(--ink); }
