:root {
  --bg:      #f1f5f9;
  --card:    #ffffff;
  --primary: #2563eb;
  --text:    #1e293b;
  --muted:   #64748b;
  --ok:      #16a34a;
  --warn:    #d97706;
  --danger:  #dc2626;
  --border:  #e2e8f0;
  --r:       12px;
  --shadow:  0 2px 8px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */
header {
  background: var(--primary);
  color: #fff;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
nav a  { color: #fff; text-decoration: none; margin-left: 18px; font-size: .95rem; }
nav a:hover { text-decoration: underline; }

/* ── Main container ──────────────────────────────────────── */
main {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

/* ── Section label ───────────────────────────────────────── */
.section-label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 22px 0 8px 2px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
  text-align: center;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ok      { background: var(--ok);      color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-gray    { background: #e2e8f0;        color: var(--text); }
.btn-block   { display: block; width: 100%; }
.btn-lg      { padding: 15px 28px; font-size: 1.15rem; }

/* ── Topic grid ──────────────────────────────────────────── */
.topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.topic-card {
  background: var(--card);
  border-radius: var(--r);
  padding: 14px 16px;
  border-left: 4px solid var(--border);
  box-shadow: var(--shadow);
}
.topic-card .tc-emoji  { font-size: 1.4rem; margin-bottom: 4px; font-family: monospace; }
.topic-card .tc-name   { font-weight: 700; font-size: .95rem; margin-bottom: 2px; }
.topic-card .tc-desc   { font-size: .78rem; color: var(--muted); margin-bottom: 10px; min-height: 2.4em; }

.p1 { border-left-color: var(--danger); }
.p2 { border-left-color: var(--warn);   }
.p3 { border-left-color: var(--primary);}

/* ── Progress bar ────────────────────────────────────────── */
.pbar {
  height: 7px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin: 6px 0 3px;
}
.pbar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .4s ease;
}

/* ── Urgent strip ────────────────────────────────────────── */
.urgent-card {
  background: var(--card);
  border-radius: var(--r);
  padding: 14px 18px;
  border-left: 5px solid var(--danger);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.urgent-card .uc-title  { font-weight: 700; font-size: 1rem; }
.urgent-card .uc-sub    { font-size: .83rem; color: var(--danger); margin-top: 1px; }
.urgent-card .uc-stats  { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ── Task page ───────────────────────────────────────────── */
.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: .9rem;
  color: var(--muted);
}
.task-text {
  font-size: 1.35rem;
  line-height: 1.55;
  padding: 18px 20px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 16px 0;
}

/* ── Answer inputs ───────────────────────────────────────── */
.answer-input {
  width: 100%;
  padding: 13px 16px;
  font-size: 1.2rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  transition: border-color .2s;
}
.answer-input:focus { outline: none; border-color: var(--primary); }

.radio-row { display: flex; gap: 10px; margin-bottom: 12px; }
.radio-card {
  flex: 1;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 1.05rem;
  user-select: none;
  transition: border-color .15s, background .15s;
}
.radio-card input[type=radio] { display: none; }
.radio-card.selected { border-color: var(--primary); background: #eff6ff; }

/* ── Hint ────────────────────────────────────────────────── */
.hint-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: .9rem;
  color: var(--muted);
  margin-top: 6px;
}
.hint-body {
  display: none;
  margin-top: 8px;
  padding: 12px 16px;
  background: #fef9c3;
  border-radius: 8px;
  font-size: .92rem;
  line-height: 1.6;
}
.hint-body.open { display: block; }

/* ── Result feedback ─────────────────────────────────────── */
.fb-ok {
  background: #f0fdf4;
  border: 2px solid var(--ok);
  border-radius: var(--r);
  padding: 18px;
  text-align: center;
  margin-bottom: 14px;
}
.fb-wrong {
  background: #fef2f2;
  border: 2px solid var(--danger);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 14px;
}
.fb-icon { font-size: 2.2rem; margin-bottom: 4px; }

/* ── Done page ───────────────────────────────────────────── */
.score-big {
  font-size: 3.2rem;
  font-weight: 800;
  text-align: center;
  margin: 14px 0 4px;
}
.result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: .92rem;
}
.result-row:last-child { border-bottom: none; }
.result-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ── Progress page ───────────────────────────────────────── */
.prog-row {
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}
.prog-row:last-child { border-bottom: none; }
.prog-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.prog-name { font-weight: 600; font-size: .95rem; }
.prog-score{ font-size: .85rem; color: var(--muted); }

/* ── Navigation row ──────────────────────────────────────── */
.nav-row { display: flex; gap: 10px; margin-top: 18px; }
.nav-row .btn { flex: 1; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 520px) {
  .topic-grid { grid-template-columns: 1fr; }
  .task-text  { font-size: 1.15rem; padding: 14px; }
  .score-big  { font-size: 2.6rem; }
}
