:root {
  --ink: #1c1c1c;
  --muted: #6b6b6b;
  --line: #eadfe3;
  --paper: #f4f4f4;
  --card: #ffffff;
  --green: #ff1f55;
  --green-2: #ff1f55;
  --green-soft: #ffe8ef;
  --amber: #8a5a10;
  --amber-soft: #fff4df;
  --red: #9f1239;
  --red-soft: #ffe4ea;
  --shadow: 0 18px 40px rgba(28, 28, 28, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 320px at 100% -10%, #ffd6e3 0%, transparent 60%),
    var(--paper);
  min-height: 100vh;
}
a { color: var(--green); }
code {
  font-family: Consolas, "Courier New", monospace;
  background: #eef4f0;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 1.4rem;
  background: #141414;
  color: white;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: white;
  text-decoration: none;
  margin-right: auto;
}
.brand strong { display: block; letter-spacing: 0.01em; }
.brand small { display: block; color: #ffc2d1; font-size: 0.78rem; }
.mark {
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--green-2);
  font-weight: 800;
}
.mark.big { width: 3.2rem; height: 3.2rem; font-size: 1.5rem; border-radius: 12px; }
.nav { display: flex; gap: 0.35rem; }
.nav a { color: #f3d5de; text-decoration: none; padding: 0.4rem 0.75rem; border-radius: 999px; }
.nav a.is-on, .nav a:hover { background: rgba(255,255,255,0.1); color: white; }
.who { display: flex; align-items: center; gap: 0.8rem; font-size: 0.92rem; }
.exit { color: #f2c9c9; text-decoration: none; }

.shell { width: min(1120px, calc(100% - 2rem)); margin: 1.5rem auto 3rem; }
.narrow { width: min(760px, 100%); margin: 0 auto; }
.page-head h1, .intro h1, .narrow h1 { margin: 0.15rem 0 0.4rem; font-size: 1.8rem; letter-spacing: -0.03em; }
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--green);
}
.muted { color: var(--muted); }

.btn, button, .actions button, .actions a {
  font: inherit;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  text-decoration: none;
}
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.8rem 1.1rem; font-weight: 700; }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: #d41248; }
.actions button.danger { color: var(--red); border-color: #f3c1cf; }
.btn-ghost, .actions button, .actions a {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.45rem 0.7rem;
}
.card, .quiz-card, .login-card, .result {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
label { display: block; font-weight: 700; font-size: 0.92rem; margin: 0.85rem 0; }
input[type="text"], input[type="password"], input:not([type]) {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  font: inherit;
  background: #fffafb;
}
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.grid-2 { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 1rem; margin: 1rem 0; }
.stats, .bands { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.7rem; margin: 1rem 0; }
.bands { grid-template-columns: repeat(3, 1fr); }
.stats article, .bands article {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 1rem;
}
.stats b, .bands b { display: block; font-size: 1.35rem; }
.stats span, .bands span { color: var(--muted); }
.bands article.is-current { outline: 2px solid var(--green); }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: white;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.login-copy {
  background:
    linear-gradient(160deg, rgba(255, 31, 85, 0.35), transparent 46%),
    #1a1a1a;
  color: white;
  padding: 2.4rem;
}
.login-copy h1 { font-size: 2.3rem; letter-spacing: -0.04em; margin: 0.6rem 0; }
.login-copy .eyebrow { color: #ffb3c7; }
.login-copy .scale { padding-left: 1.1rem; }
.login-copy li { margin: 0.35rem 0; }
.login-card { margin: 0; border: 0; box-shadow: none; padding: 2.2rem; display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { margin-top: 0; }

.alert, .toast {
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}
.alert { background: var(--red-soft); color: var(--red); }
.toast.ok { background: var(--green-soft); color: #9f1239; }

.progress-head { display: flex; justify-content: space-between; gap: 1rem; align-items: end; }
.score-pill {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.45rem 0.8rem;
  text-align: right;
}
.score-pill strong { font-size: 1.4rem; }
.bar { height: 8px; background: #f3d5de; border-radius: 99px; overflow: hidden; margin: 0.8rem 0 1rem; }
.bar span { display: block; height: 100%; background: var(--green-2); }
.worth { color: var(--muted); margin-top: -0.2rem; }
.options { display: grid; gap: 0.65rem; margin: 1rem 0; }
.option {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.7rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.option:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.option input { accent-color: var(--green); }
.option.is-correct { border-color: var(--green); background: var(--green-soft); }
.option.is-wrong { border-color: #e11d48; background: #fff1f4; }
.key {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffe8ef;
  font-size: 0.8rem;
  font-weight: 800;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 20;
}
.modal-card { width: min(640px, 100%); background: white; border-radius: 22px; padding: 1.4rem; }
.flag {
  display: inline-block;
  margin: 0 0 0.4rem;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 800;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}
.flag.ok { background: #ffe8ef; color: #c4124a; }
.modal-q { font-weight: 700; }
.compare p, .misses p { margin: 0.35rem 0; }
.compare span, .misses span {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.compare .right, .misses .right { background: var(--green-soft); border-radius: 12px; padding: 0.7rem; }
.why { color: #3a2430; }
.react-gif { width: 140px; height: 140px; object-fit: contain; display: block; margin: 0 auto 0.6rem; }
.react-fallback { font-size: 4.5rem; text-align: center; line-height: 1; margin-bottom: 0.4rem; }
.modal-card { text-align: left; }
.modal-card .react-gif, .modal-card .react-fallback { text-align: center; }
textarea, .editor input[type="text"], .choice-line input[type="text"] {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  font: inherit;
  background: #fffafb;
}
.choice-line { border: 1px solid var(--line); border-radius: 14px; padding: 0.7rem 0.8rem; }
.editor { margin-bottom: 1rem; }
.bank article .btn { margin-top: 0.4rem; }
.zero { font-weight: 800; }

.result { text-align: center; margin: 1rem 0; }
.result-band { font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.result-score { font-size: 4.5rem; line-height: 1; margin: 0.2rem 0; font-weight: 800; }
.result-score small { font-size: 1.5rem; }
.result-meta { list-style: none; display: flex; justify-content: center; gap: 1.2rem; padding: 0; color: var(--muted); }
.band-ok .result-band, .pill.band-ok { color: #c4124a; }
.result.band-ok { background: linear-gradient(#fff, #fff1f5); }
.band-mid .result-band, .pill.band-mid { color: var(--amber); }
.result.band-mid { background: linear-gradient(#fff, #fff8ec); }
.band-bad .result-band, .pill.band-bad { color: var(--red); }
.result.band-bad { background: linear-gradient(#fff, #fff5f5); }
.pill { display: inline-block; border-radius: 999px; padding: 0.2rem 0.6rem; background: #f3f6f4; font-weight: 800; font-size: 0.85rem; }

.search { display: flex; gap: 0.6rem; margin: 0.5rem 0 1rem; }
.search input { margin: 0; }
.table-wrap { overflow: auto; background: white; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.85rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
td small { display: block; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.actions form { margin: 0; }
.creds { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.7rem; }
.creds li { display: flex; justify-content: space-between; gap: 0.7rem; align-items: center; }
.creds code { display: inline-block; margin-right: 0.3rem; }
.pass-card { margin-top: 1rem; }
.pass-card summary { cursor: pointer; font-weight: 800; }
.stack { max-width: 420px; }
.bank article { border-top: 1px solid var(--line); padding-top: 0.8rem; }
.bank h3 { font-size: 1rem; }
.bank ul { padding-left: 0; list-style: none; }
.bank li.is-right { background: var(--green-soft); border-radius: 10px; padding: 0.35rem 0.5rem; }
.misses { padding: 0; list-style: none; display: grid; gap: 0.8rem; }
.misses li { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 1rem; }
body:has(.modal.open) { overflow: hidden; }

@media (max-width: 860px) {
  .login-panel, .grid-2, .split, .stats { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .result-meta { flex-direction: column; gap: 0.3rem; }
  .who { width: 100%; justify-content: space-between; }
}
