:root {
  --bg-a: #eef1ff;
  --bg-b: #f7f5f1;
  --surface: #ffffff;
  --ink: #1e2130;
  --muted: #6b7280;
  --muted-2: #9aa1b1;
  --line: #ebe9f0;
  --accent: #4338ca;
  --accent-2: #6366f1;
  --accent-soft: #eef0ff;
  --gold: #b45309;
  --gold-soft: #fef3c7;
  --green: #15803d;
  --green-soft: #e8f8ee;
  --red: #b91c1c;
  --red-soft: #fdecec;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-sm: 0 1px 2px rgba(30, 33, 48, .05);
  --shadow-md: 0 10px 30px -12px rgba(30, 33, 48, .18);
  --shadow-hover: 0 16px 36px -14px rgba(30, 33, 48, .26);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: ui-serif, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 480px at 12% -10%, var(--bg-a), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, #fdf3ea 0%, transparent 55%),
    var(--bg-b);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 720px; margin: 0 auto; padding: 22px 20px 6px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-serif); font-size: 19px; font-weight: 600;
  color: var(--ink); text-decoration: none; letter-spacing: .1px;
}
.brand:hover { text-decoration: none; opacity: .82; }
.brand .mark {
  font-size: 21px; width: 34px; height: 34px; display: inline-flex;
  align-items: center; justify-content: center; border-radius: 10px;
  background: var(--accent-soft);
}
.site-header nav { display: flex; gap: 18px; }
.site-header nav a {
  color: var(--muted); font-size: 14px; font-weight: 600;
}
.site-header nav a:hover { color: var(--accent); text-decoration: none; }

main { max-width: 720px; margin: 0 auto; padding: 8px 20px 70px; }
main.narrow { max-width: 560px; }

.hero { padding: 34px 0 8px; }
.hero h1 {
  font-family: var(--font-serif); font-size: 38px; margin: 0 0 8px;
  letter-spacing: -.3px; font-weight: 600;
}
.hero p.tag { color: var(--muted); font-size: 16px; margin: 0 0 28px; }

h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.2px; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.subtitle { color: var(--muted); font-size: 14px; margin: 0 0 22px; }

.card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 20px 22px; margin: 14px 0;
  box-shadow: var(--shadow-sm), var(--shadow-md);
  border: 1px solid rgba(30,33,48,.04);
}

a.link-card {
  display: flex; align-items: flex-start; gap: 16px;
  text-decoration: none; color: var(--ink);
  transition: transform .18s ease, box-shadow .18s ease;
}
a.link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm), var(--shadow-hover); text-decoration: none; }
.link-card .icon {
  flex: none; width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: var(--accent-soft);
}
.link-card h2 { margin: 0 0 4px; font-size: 17px; }
.link-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.link-card .chevron { align-self: center; color: var(--muted-2); font-size: 18px; margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; border: 0; border-radius: 12px;
  padding: 13px 22px; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  box-shadow: 0 6px 16px -6px rgba(67, 56, 202, .55);
}
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn.block { width: 100%; }
.btn.ghost {
  background: transparent; color: var(--accent); box-shadow: none;
  border: 1.5px solid var(--line);
}
.btn.ghost:hover { background: var(--accent-soft); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.muted { background: var(--line); color: var(--muted); }

.stat-row { display: flex; flex-wrap: wrap; gap: 22px; margin: 4px 0 14px; }
.stat .n { font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

.bar {
  height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 4px 0 2px;
}
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold);
}
.chip.ok { background: var(--green-soft); color: var(--green); }

table.clean { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 13.5px; }
table.clean th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1.5px solid var(--line);
}
table.clean td { padding: 10px 10px; border-bottom: 1px solid var(--line); }
table.clean tr:last-child td { border-bottom: 0; }

.msg { color: var(--muted); padding: 18px 0; }
.foot { color: var(--muted-2); font-size: 12.5px; margin-top: 36px; text-align: center; }

input[type="password"], input[type="text"] {
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 15px; font-family: var(--font); background: #fff; color: var(--ink);
}
input[type="password"]:focus, input[type="text"]:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }

.key-gate { display: flex; gap: 10px; }
.key-gate input { flex: 1; }

/* Quiz question options styled as selectable cards */
.opt {
  display: block; padding: 13px 15px; margin: 8px 0; border: 1.5px solid var(--line);
  border-radius: var(--radius-md); cursor: pointer; line-height: 1.4; font-size: 15px;
  transition: border-color .12s ease, background .12s ease;
}
.opt:hover { border-color: var(--accent-2); background: var(--accent-soft); }
.opt input { margin-right: 10px; accent-color: var(--accent); }
.opt.checked { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.q-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 7px; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; font-weight: 800; margin-right: 8px;
}

.result-row { display: flex; align-items: flex-start; gap: 10px; }
.result-row .mark { font-size: 17px; line-height: 1.5; }
.result-row .word { font-weight: 700; }

/* Flip card (deck viewer) */
.stage { perspective: 1200px; margin: 22px 0 8px; }
.flip {
  position: relative; min-height: 240px; border-radius: var(--radius-lg); cursor: pointer;
  transform-style: preserve-3d; transition: transform .45s cubic-bezier(.4,.2,.2,1);
}
.flip.flipped { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm), var(--shadow-md);
  border: 1px solid rgba(30,33,48,.04);
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 30px; font-size: 23px; font-weight: 700;
}
.face.front { background: linear-gradient(160deg, #fff, var(--accent-soft)); }
.face.back { transform: rotateY(180deg); color: var(--accent); }
.face .note { font-size: 14px; color: var(--muted); font-weight: 400; margin-top: 12px; }
.flip-hint { text-align: center; color: var(--muted-2); font-size: 12.5px; margin-top: 10px; }

.nav-row { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.nav-row .count { color: var(--muted); font-size: 14px; font-weight: 600; }

@media (max-width: 480px) {
  .hero h1 { font-size: 30px; }
  .stat-row { gap: 16px; }
}
