:root {
  --navy: #000080;
  --navy-deep: #00004F;
  --navy-dark: #06061C;
  --gold: #D4AF37;
  --gold-light: #F0C845;
  --gold-dark: #A87F25;
  --off-white: #F7F5F0;
  --ink: #1A1A2E;
  --muted: #5a5a70;
  --line: rgba(0, 0, 128, .12);
  --ok: #1d7a46;
  --warn: #b26a00;
  --bad: #b3261e;
  --radius: 14px;
  --serif: 'Lora', Georgia, serif;
  --sans: 'Poppins', system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--off-white); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { font-family: var(--serif); color: var(--navy); line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(24px, 5vw, 32px); }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--navy-deep); color: var(--off-white); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--off-white); text-decoration: none; font-family: var(--serif); font-size: 20px; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.topnav { display: none; gap: 18px; align-items: center; }
.topnav a { color: rgba(247,245,240,.85); text-decoration: none; font-size: 14px; font-weight: 500; }
.topnav a.active, .topnav a:hover { color: var(--gold); }
@media (min-width: 860px) { .topnav { display: flex; } .tabbar { display: none !important; } main { padding-bottom: 40px !important; } }

/* Bottom tab bar (phones) */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; }
.tabbar a .ti { font-size: 20px; line-height: 1; }
.tabbar a.active { color: var(--navy); }
.tabbar:empty { display: none; }

main { max-width: 980px; margin: 0 auto; padding: 20px 16px 96px; outline: none; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

/* Banner */
#banner:empty { display: none; }
.banner { max-width: 980px; margin: 12px auto 0; padding: 0 16px; }
.banner > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-radius: 12px; font-size: 14px; }
.banner .b-student { background: rgba(212,175,55,.15); border: 1px solid rgba(212,175,55,.45); color: #5c4310; }
.banner .b-expired { background: #fff4e5; border: 1px solid #f3c27a; color: #6b4200; }
.banner .b-free { background: #eef0ff; border: 1px solid #c8cdf5; color: #23236b; }

/* Cards & layout */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 2px 12px rgba(0,0,64,.04); }
.card + .card { margin-top: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.section { margin-top: 26px; }
.hero { background: linear-gradient(135deg, var(--navy-deep), var(--navy)); color: var(--off-white); border-radius: var(--radius); padding: 22px; }
.hero h1 { color: var(--off-white); }
.hero p { color: rgba(247,245,240,.75); margin: 0; }
.overline { font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-dark); }
.hero .overline { color: var(--gold); }

/* Tool tiles */
.tile { display: block; text-decoration: none; color: inherit; position: relative; }
.tile .t-icon { font-size: 28px; }
.tile h3 { margin: 8px 0 4px; }
.tile p { margin: 0; font-size: 14px; color: var(--muted); }
.tile:hover { border-color: var(--gold); }
.lock { position: absolute; top: 14px; right: 14px; font-size: 12px; font-weight: 600; color: var(--gold-dark); background: rgba(212,175,55,.14); border-radius: 999px; padding: 3px 9px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 10px; border: 1.5px solid transparent; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; transition: transform .12s, background .12s; }
.btn:active { transform: scale(.98); }
.btn-gold { background: var(--gold); color: var(--navy-deep); }
.btn-gold:hover { background: var(--gold-light); }
.btn-navy { background: var(--navy); color: var(--off-white); }
.btn-line { background: #fff; border-color: var(--line); color: var(--navy); }
.btn-line:hover { border-color: var(--navy); }
.btn-danger { background: #fff; border-color: #f1c4c0; color: var(--bad); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--navy); font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); }
textarea { min-height: 90px; resize: vertical; }
.field + .field { margin-top: 12px; }
.form-error { color: var(--bad); font-size: 14px; margin-top: 10px; }
.fields-2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--ink); }
.check input { width: 20px; height: 20px; }

/* Auth */
.auth { max-width: 420px; margin: 12px auto; }
.tabs { display: flex; gap: 6px; background: #eceaf3; padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tabs button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* Progress */
.bar { height: 8px; background: #e8e6f0; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width .3s; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.pill.ok { background: #e3f4ea; color: var(--ok); }
.pill.warn { background: #fff1db; color: var(--warn); }
.pill.bad { background: #fde7e5; color: var(--bad); }
.pill.neutral { background: #eceaf3; color: var(--muted); }

/* Quiz */
.q-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.q-text { font-size: 18px; font-weight: 500; line-height: 1.5; color: var(--ink); margin: 6px 0 16px; }
.opt { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; cursor: pointer; font-size: 16px; line-height: 1.45; color: var(--ink); }
.opt .ol { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #eceaf3; font-weight: 700; color: var(--navy); }
.opt:hover:not([disabled]) { border-color: var(--navy); }
.opt.correct { border-color: var(--ok); background: #eef8f2; }
.opt.correct .ol { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: #fdf0ef; }
.opt.wrong .ol { background: var(--bad); color: #fff; }
.opt[disabled] { cursor: default; }
.feedback { padding: 12px 14px; border-radius: 10px; margin: 6px 0 14px; font-weight: 500; }
.feedback.ok { background: #e3f4ea; color: var(--ok); }
.feedback.bad { background: #fde7e5; color: var(--bad); }
.feedback .why, .why { color: var(--ink); font-weight: 400; font-size: 15px; line-height: 1.5; margin-top: 6px; }
.fig-btn { margin-bottom: 14px; }
.score-big { font-family: var(--serif); font-size: 54px; color: var(--navy); line-height: 1; }

/* Flashcards */
.flash { min-height: 230px; display: flex; flex-direction: column; justify-content: center; cursor: pointer; user-select: none; }
.flash .side { font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-dark); margin-bottom: 10px; }
.flash .ftext { font-size: 18px; line-height: 1.5; }
.flash.back { background: #fbf8ee; border-color: rgba(212,175,55,.5); }

/* Checklist */
.shot { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.shot:last-child { border-bottom: 0; }
.shot input { flex: none; width: 24px; height: 24px; margin-top: 2px; accent-color: var(--navy); }
.shot .sn { font-weight: 600; }
.shot .sg { font-size: 14px; color: var(--muted); margin-top: 2px; }
.shot.done .sn { text-decoration: line-through; color: var(--muted); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.tbl-wrap { overflow-x: auto; }
.tbl input { padding: 7px 8px; font-size: 15px; min-width: 64px; }

/* Charts */
.chart { width: 100%; height: auto; }

/* Quote print */
.quote-doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.quote-doc .qd-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--gold); padding-bottom: 12px; margin-bottom: 14px; }
.quote-doc .total { font-family: var(--serif); font-size: 26px; color: var(--navy); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(6,6,28,.7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal .m-box { background: #fff; border-radius: var(--radius); max-width: 960px; width: 100%; max-height: 92vh; overflow: auto; padding: 16px; }
.modal .m-box img { width: 100%; height: auto; display: block; border-radius: 8px; }
@media (max-width: 600px) {
  .modal { padding: 0; align-items: stretch; }
  .modal .m-box { max-height: 100vh; height: 100%; border-radius: 0; padding: 12px; padding-top: max(12px, env(safe-area-inset-top)); }
}

/* Toast */
.toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 60; background: var(--navy-deep); color: var(--off-white); padding: 11px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: 90vw; }
.toast[hidden] { display: none; }

/* Pricing */
.plan { display: flex; flex-direction: column; }
.plan .amt { font-family: var(--serif); font-size: 34px; color: var(--navy); margin: 6px 0 2px; }
.plan.featured { border: 2px solid var(--gold); }
.plan ul { padding-left: 18px; margin: 10px 0 16px; line-height: 1.7; font-size: 14px; flex: 1; }

@media print {
  .topbar, .tabbar, #banner, .no-print { display: none !important; }
  main { padding: 0 !important; max-width: none; }
  body { background: #fff; }
  .quote-doc { border: 0; }
}

/* portfolio photos */
.thumbs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; display: block; background: #eee; }

/* cards inside grids line up (the stacked-card gap is only for vertical lists) */
.grid > .card, .grid-2 > .card { margin-top: 0; }

/* tile buttons: keep content at the top like link tiles (buttons center it by default) */
button.tile { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; font: inherit; color: inherit; }
