:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  --bg: #f3f5fb;
  --surface: #ffffff;
  --ink: #0f2038;
  --muted: #586a80;
  --line: #dbe2ee;
  --brand: #1f45d6;
  --brand-ink: #ffffff;
  --hi: #ffc83d;
  --ok: #16905a;
  --bad: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1626;
    --surface: #152238;
    --ink: #e8eef7;
    --muted: #9db0c6;
    --line: #27384f;
    --brand: #7d9bff;
    --brand-ink: #0c1626;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1626;
  --surface: #152238;
  --ink: #e8eef7;
  --muted: #9db0c6;
  --line: #27384f;
  --brand: #7d9bff;
  --brand-ink: #0c1626;
}

html { scroll-padding-top: env(safe-area-inset-top, 0px); }
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: inherit; }
.wrap { max-width: 1020px; margin: 0 auto; padding: 0 20px; }

header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 10;
}
header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.logo span { display: flex; flex-direction: column; line-height: 1.15; }
.logo small { font-weight: 600; font-size: 11.5px; color: var(--muted); letter-spacing: 0; }

nav { display: flex; align-items: center; gap: 16px; }
nav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 15px; }
nav a:hover { color: var(--ink); }

.theme-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 10px;
  font: 600 13px Manrope, sans-serif;
  cursor: pointer;
}

.slogan {
  font-size: clamp(20px, 3.4vw, 28px);
  font-weight: 800;
  color: var(--brand);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.btn {
  display: inline-block;
  background: var(--brand);
  color: var(--brand-ink);
  border: 0;
  border-radius: 10px;
  padding: 12px 20px;
  font: 800 15px Manrope, sans-serif;
  cursor: pointer;
  text-decoration: none;
  margin: 0 8px 8px 0;
  text-align: center;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.hi { background: var(--hi); color: #0f2038; }
.btn.sm { padding: 8px 14px; font-size: 13.5px; }

:focus-visible { outline: 3px solid var(--hi); outline-offset: 2px; }

.hero { padding: 44px 0 20px; }
h1 {
  font-size: clamp(30px, 5.2vw, 50px);
  line-height: 1.08;
  margin: 0 0 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 16em;
}
.lead { font-size: 18px; color: var(--muted); max-width: 38em; margin: 0 0 24px; }
h2 { font-size: 25px; margin: 36px 0 14px; letter-spacing: -0.01em; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s, transform 0.15s;
}
a.card:hover, button.card:hover { border-color: var(--brand); transform: translateY(-2px); }
button.card { text-align: left; cursor: pointer; font-family: inherit; color: inherit; width: 100%; }
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.free { border: 2px solid var(--hi); }

.tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  border-radius: 6px;
  padding: 3px 8px;
  margin-bottom: 10px;
  background: var(--hi);
  color: #0f2038;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  align-self: flex-start;
}
.tag.lock { background: var(--line); color: var(--muted); }
.tag.skill { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }

.crumbs { margin: 24px 0 8px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--brand); font-weight: 600; text-decoration: none; }

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin: 18px 0;
  padding-bottom: 2px;
}
.tabs button {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 9px 14px;
  font: 600 14.5px Manrope, sans-serif;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--brand); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  min-height: 180px;
  max-width: 100%;
}
.panel h3 { margin-top: 0; }

.wod-box {
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: 16px;
  padding: 24px;
  margin: 24px 0;
}
.wod-word { font-size: clamp(26px, 4vw, 34px); font-weight: 800; color: var(--brand); margin: 4px 0; }
.wod-pos { font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }

.text {
  background: var(--bg);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 0 0 18px;
  max-width: 72ch;
  line-height: 1.7;
}
.para-num {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  color: var(--brand);
  margin-right: 6px;
}
.ev-highlight {
  background: color-mix(in srgb, var(--hi) 55%, transparent);
  border-bottom: 2px solid var(--hi);
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.3s;
}

.kwt-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.kwt-key {
  display: inline-block;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 6px;
  margin: 8px 0;
}

.fc { max-width: 440px; margin: 10px auto; perspective: 900px; }
.fc button { width: 100%; height: 210px; border: 0; background: none; padding: 0; cursor: pointer; }
.fc .in { position: relative; width: 100%; height: 100%; transition: transform 0.45s; transform-style: preserve-3d; }
.fc.flip .in { transform: rotateY(180deg); }
.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  font-weight: 800;
  font-size: 24px;
  padding: 20px;
  text-align: center;
  background: var(--brand);
  color: var(--brand-ink);
}
.face small { font-weight: 400; font-size: 13.5px; margin-top: 8px; opacity: 0.85; }
.face.back { transform: rotateY(180deg); background: var(--hi); color: #0f2038; font-size: 18px; font-weight: 600; }
.ctl { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 16px; color: var(--muted); }

.pbar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.pbar div { height: 100%; background: var(--brand); transition: width 0.25s; }

.opt {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 12px 15px;
  margin: 8px 0;
  font: 600 15px Manrope, sans-serif;
  color: var(--ink);
  cursor: pointer;
}
.opt:hover:not(.ok):not(.bad) { border-color: var(--brand); }
.opt.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.opt.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); }

.why {
  border-left: 4px solid var(--hi);
  background: var(--bg);
  padding: 12px 15px;
  border-radius: 0 10px 10px 0;
  margin: 12px 0;
  font-size: 15px;
  line-height: 1.6;
}
.rev { border-top: 1px solid var(--line); padding: 14px 0; }
.paywall { border: 2px solid var(--hi); border-radius: 14px; padding: 22px; }

.checklist { list-style: none; padding: 0; margin: 12px 0; }
.checklist li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.plan-list { list-style: none; padding: 0; margin: 14px 0 18px; font-size: 14.5px; color: var(--muted); }
.plan-list li { padding: 5px 0; }

.timer-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg);
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
}
.timer-display { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--brand); min-width: 72px; }

input[type="text"], input:not([type]) {
  font: 600 16px Manrope, sans-serif;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  margin: 0 8px 8px 0;
  max-width: 100%;
}
.msg { font-weight: 600; margin: 8px 0; }
audio { width: 100%; margin: 12px 0; }

footer { margin: 56px 0 30px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
@media (max-width: 640px) { nav a:not(:last-of-type) { display: none; } }
</style>
