/* FreeReads – minimal, black/white with green */
:root {
  --bg: #000; --panel: #0b0b0b; --fg: #ededed; --text-2: #bdbdbd; --muted: #8a8a8a;
  --line: #1f1f1f; --line-2: #2e2e2e;
  --accent: #2bf58a;     /* green text and links */
  --fill: #2bf58a;       /* green backgrounds */
  --fill-hover: #5cffa8;
  --ink: #001a0b;        /* text on green */
  --bad: #ff6b6b;
  --shadow: 0 12px 30px rgba(0,0,0,.7);
  --font: "Inter", system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #fff; --panel: #f6f6f6; --fg: #111; --text-2: #333; --muted: #6b6b6b;
    --line: #ececec; --line-2: #d6d6d6;
    --accent: #0a8a47; --fill: #2bf58a; --fill-hover: #1fe07f; --ink: #001a0b;
    --bad: #c62828; --shadow: 0 12px 30px rgba(0,0,0,.12);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #fff; --panel: #f6f6f6; --fg: #111; --text-2: #333; --muted: #6b6b6b;
  --line: #ececec; --line-2: #d6d6d6;
  --accent: #0a8a47; --fill: #2bf58a; --fill-hover: #1fe07f; --ink: #001a0b;
  --bad: #c62828; --shadow: 0 12px 30px rgba(0,0,0,.12);
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.6 var(--font); -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s; }
a { color: var(--accent); text-underline-offset: 3px; }
::selection { background: var(--fill); color: var(--ink); }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--fg); text-decoration: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fill); }
nav { display: flex; align-items: center; gap: 18px; }
nav a { font-size: 14px; color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--fg); }

/* theme switch: moon in dark mode, sun in light mode */
.theme { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--fg); }
.theme:hover { border-color: var(--accent); color: var(--accent); }
.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme .sun { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme .sun { display: block; }
  :root:not([data-theme="dark"]) .theme .moon { display: none; }
}
:root[data-theme="light"] .theme .sun { display: block; }
:root[data-theme="light"] .theme .moon { display: none; }
.theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* home */
.hero { padding: 48px 0 0; }
.hero h1 { margin: 0 0 6px; font-size: clamp(30px, 6vw, 42px); line-height: 1.1; letter-spacing: -.03em; }
.hero p { margin: 0; color: var(--muted); }
.intro { margin: 28px 0 0; color: var(--text-2); }

/* A1–C2 level line */
.levelbar { margin: 18px 0 8px; padding: 14px 16px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.levelhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.levelhead label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.levelhead output { font-weight: 700; color: var(--accent); }
.levelbar input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: none; cursor: pointer; --fill-pct: 40%; }
.levelbar input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--fill) var(--fill-pct), var(--line-2) var(--fill-pct)); }
.levelbar input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-2); }
.levelbar input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--fill); }
.levelbar input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%;
  background: var(--fill); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--fill); }
.levelbar input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--fill); border: 3px solid var(--bg); }
.levelbar input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.ticks { display: flex; justify-content: space-between; margin: 4px -6px 0; }
.ticks button { font: 600 12px var(--font); color: var(--muted); background: none; border: 0; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.ticks button:hover { color: var(--fg); }
.ticks button.on { color: var(--accent); }
[data-v][hidden] { display: none; }

.cards { padding-bottom: 40px; }
.card { position: relative; padding: 22px 0; border-bottom: 1px solid var(--line); }
.card h2 { margin: 6px 0 6px; font-size: 21px; line-height: 1.3; letter-spacing: -.015em; }
.card h2 a { color: var(--fg); text-decoration: none; }
.card h2 a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.card:hover h2 a { color: var(--accent); }
.card p { margin: 0 0 8px; color: var(--text-2); }
.meta { font-size: 13px; color: var(--muted); }

/* level as plain text */
.lvl { font-size: 13px; font-weight: 600; color: var(--accent); }

/* story */
.story { padding: 36px 16px 48px; }
.story h1 { font-size: clamp(28px, 5vw, 38px); line-height: 1.15; letter-spacing: -.025em; margin: 8px 0 6px; }
.hint { font-size: 14px; color: var(--muted); margin: 20px 0 14px; }
.picked { color: var(--accent); font-weight: 600; margin-left: 4px; }
.text p { margin: 0 0 1.1em; font-size: 19px; line-height: 1.95; }

/* words: plain text until clicked, then they become a brick.
   Padding is cancelled by negative margin so turning into a brick never shifts the line. */
.w {
  display: inline-block; padding: 0 .28em; margin: 0 -.28em; line-height: 1.55; border-radius: 6px;
  border: 1px solid transparent; background: transparent; color: inherit;
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background .15s, color .15s;
}
.w:hover { background: var(--panel); }
.w:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.w.on { border-color: var(--accent); background: var(--panel); color: var(--accent); animation: pop .22s ease-out; }
.w.v { color: var(--accent); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 4px; }
.w.v.open, .w.v.on { background: var(--fill); border-color: var(--fill); color: var(--ink); text-decoration: none; animation: pop .22s ease-out; }
@keyframes pop { 40% { transform: scale(1.08); } }
.w.demo { cursor: default; margin: 0; padding: 0; }
.w.big { font-size: clamp(36px, 8vw, 54px); font-weight: 700; line-height: 1.2; padding: 0 .3em; margin: 0; border-radius: 12px;
  letter-spacing: -.02em; background: var(--fill); border-color: var(--fill); color: var(--ink); text-decoration: none; cursor: default; }
.box li .w, .wordlist .w { margin: 0 6px 0 0; padding: 0; }

/* definition popover */
.pop { position: absolute; z-index: 20; width: min(300px, calc(100vw - 24px)); padding: 14px 16px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.pop[hidden] { display: none; }
.pop .pw { font-size: 20px; font-weight: 700; }
.pop .pp { font-size: 12px; color: var(--muted); }
.pop p { margin: 8px 0 10px; }
.pop a { font-size: 14px; font-weight: 600; }

/* buttons and boxes */
.btn { display: inline-block; font: 600 15px var(--font); color: var(--ink); background: var(--fill); text-decoration: none;
  cursor: pointer; padding: 12px 20px; margin: 20px 0 8px; border: 0; border-radius: 8px; }
.btn:hover { background: var(--fill-hover); }
.box { margin-top: 28px; padding-top: 4px; border-top: 1px solid var(--line); }
.box h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.box ul { list-style: none; padding: 0; margin: 0; }
.box li { margin-bottom: 10px; color: var(--text-2); }

/* word pages */
.word { margin: 0 0 6px; }
.def { font-size: 21px; line-height: 1.45; margin: 14px 0; }
.ex { font-style: italic; color: var(--muted); border-left: 2px solid var(--fill); padding-left: 12px; }
.forms { font-size: 14px; color: var(--muted); }
.wordlist { list-style: none; padding: 0; }
.wordlist li { padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text-2); }

/* quiz */
.q { border: 0; border-bottom: 1px solid var(--line); margin: 0; padding: 18px 0; }
.q legend { font-weight: 600; padding: 0; float: left; width: 100%; margin-bottom: 8px; }
.q label { display: flex; align-items: center; gap: 10px; clear: both; margin: 6px 0; padding: 8px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--panel); }
.q label:hover { border-color: var(--muted); }
.q label:has(input:checked) { border-color: var(--accent); }
.q input { accent-color: var(--accent); }
.q.ok label.right, .q.bad label.right { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.fb { font-size: 14px; font-weight: 600; min-height: 1em; margin-top: 6px; }
.q.ok .fb { color: var(--accent); } .q.bad .fb { color: var(--bad); }
.score { font-size: 22px; font-weight: 700; color: var(--accent); }

.foot { border-top: 1px solid var(--line); padding: 24px 0 36px; font-size: 13px; color: var(--muted); }

@media (max-width: 560px) {
  .text p { font-size: 17px; }
  nav { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
