:root {
  /* Web release 2026-08-11: larger, heading-free learning descriptions. */
  --navy: #10253f;
  --navy-2: #173c66;
  --blue: #2569aa;
  --blue-soft: #edf5fc;
  --red: #df3138;
  --red-soft: #fff1f2;
  --green: #16864a;
  --green-soft: #effaf3;
  --ink: #12233b;
  --muted: #607086;
  --line: #d9e1ea;
  --surface: #ffffff;
  --canvas: #f6f8fb;
  --shadow: 0 12px 34px rgba(16, 37, 63, 0.09);
  --radius: 14px;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input { font: inherit; }
button { color: inherit; }

.app-header {
  height: 74px;
  padding: 0 max(24px, calc((100vw - 1480px) / 2));
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  background: var(--navy);
  color: white;
  box-shadow: 0 2px 10px rgba(16, 37, 63, 0.22);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: white;
  text-decoration: none;
  font-size: clamp(17px, 2vw, 23px);
  font-weight: 750;
  letter-spacing: -0.02em;
}
.brand svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.main-nav { display: flex; gap: 8px; }
.nav-button {
  position: relative;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.78);
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 680;
  cursor: pointer;
}
.nav-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-button::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: transparent; }
.nav-button:hover, .nav-button.active { color: white; }
.nav-button.active::after { background: var(--red); }

.shell { max-width: 1480px; margin: 0 auto; padding: 30px clamp(20px, 4vw, 56px) 56px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.subject-tabs, .view-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; padding: 4px; background: white; box-shadow: 0 2px 7px rgba(16,37,63,.04); }
.subject-tab, .view-tab {
  border: 0; border-radius: 9px; padding: 11px 17px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer;
}
.subject-tab.active { color: white; background: var(--blue); }
.subject-tab[data-subject="signale"].active { background: var(--red); }
.view-tab { padding: 9px 13px; font-size: 14px; }
.view-tab.active { background: var(--blue-soft); color: var(--blue); }
.answer-toggle {
  min-height: 46px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}
.answer-toggle:hover { border-color: var(--blue); background: var(--blue-soft); }
.answer-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toolbar-meta { color: var(--muted); font-size: 14px; font-weight: 600; margin-left: auto; }

.learn-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr); gap: 22px; align-items: stretch; }
.media-panel, .description-panel, .exam-card, .gallery-card, .setup-panel, .result-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.media-panel { overflow: hidden; display: flex; flex-direction: column; min-height: 620px; }
.card-image-wrap { flex: 1; min-height: 470px; display: grid; place-items: center; background: white; padding: 26px; }
.card-image-wrap.dark { background: #050505; }
.card-image { display: block; width: 100%; height: 100%; max-height: 570px; object-fit: contain; }
.card-controls { min-height: 82px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 16px 20px; }
.card-controls .next { justify-self: end; }
.counter { font-weight: 750; font-variant-numeric: tabular-nums; }
.control-button, .primary-button, .ghost-button {
  border-radius: 10px; min-height: 46px; padding: 0 18px; font-weight: 720; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
}
.control-button { border: 1px solid #bdc9d7; background: white; }
.control-button:hover { border-color: var(--blue); color: var(--blue); }
.control-button:disabled { opacity: .42; cursor: not-allowed; }
.primary-button { border: 1px solid var(--blue); background: var(--blue); color: white; box-shadow: 0 5px 12px rgba(37,105,170,.18); }
.primary-button:hover { background: #1e5d98; }
.primary-button.red { background: var(--red); border-color: var(--red); box-shadow: 0 5px 12px rgba(223,49,56,.18); }
.ghost-button { border: 1px solid var(--line); background: white; }

.description-panel { padding: clamp(28px, 3.5vw, 48px); display: flex; flex-direction: column; justify-content: center; }
.description-panel.is-hidden { background: #fbfcfe; box-shadow: none; }
.section-kicker { color: var(--blue); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; margin: 0 0 12px; }
.exam-heading { font-size: clamp(25px, 3vw, 36px); line-height: 1.14; margin: 0; letter-spacing: -0.035em; }
.description-text { margin: 0; white-space: pre-line; font-size: clamp(22px, 1.8vw, 27px); line-height: 1.55; color: #21364f; }

.gallery-header { display: flex; gap: 15px; margin-bottom: 20px; }
.search-field { flex: 1; min-width: 0; height: 48px; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 0 16px; color: var(--ink); outline: none; }
.search-field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,105,170,.12); }
.gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.gallery-card { overflow: hidden; cursor: pointer; box-shadow: 0 4px 15px rgba(16,37,63,.06); transition: transform .18s ease, box-shadow .18s ease; }
.gallery-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.gallery-image { aspect-ratio: 4 / 3; width: 100%; object-fit: contain; display: block; padding: 14px; background: white; }
.gallery-card.dark .gallery-image { background: #050505; padding: 0; }
.gallery-copy { padding: 16px 17px 18px; border-top: 1px solid var(--line); }
.gallery-copy p { margin: 0; color: #30435b; font-size: 18px; line-height: 1.55; white-space: pre-line; }

.setup-panel, .result-panel { max-width: 850px; margin: 42px auto; padding: clamp(28px, 5vw, 52px); }
.setup-panel h1, .result-panel h1 { margin: 0 0 12px; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.04em; }
.lead { color: var(--muted); font-size: 18px; line-height: 1.55; margin: 0 0 32px; }
.setup-section { border-top: 1px solid var(--line); padding-top: 25px; margin-top: 25px; }
.setup-section h2 { font-size: 16px; margin: 0 0 14px; }
.option-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice-chip { border: 1px solid var(--line); background: white; border-radius: 9px; padding: 11px 16px; font-weight: 700; cursor: pointer; }
.choice-chip.active { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.start-button { margin-top: 32px; width: 100%; }

.exam-topline { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; margin-bottom: 28px; }
.exam-progress { text-align: center; min-width: 260px; }
.progress-label { font-weight: 750; margin-bottom: 8px; }
.progress-track { height: 7px; background: #e7ebf0; border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--red); border-radius: inherit; transition: width .25s ease; }
.error-count { justify-self: end; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 18px; }
.review-top { color: var(--blue); font-size: 14px; }
.exam-card { padding: clamp(20px, 3vw, 36px); }
.exam-heading { margin-bottom: 22px; }
.exam-media { height: min(38vh, 400px); min-height: 280px; border: 1px solid var(--line); border-radius: 12px; display: grid; place-items: center; background: white; overflow: hidden; }
.exam-media.dark { background: #050505; }
.exam-media img { display: block; width: auto; height: 100%; max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; padding: 18px; }
.exam-media.dark img { padding: 0; }
.answers { display: grid; gap: 10px; margin-top: 20px; }
.answer {
  width: 100%; min-height: 61px; border: 1px solid var(--line); border-radius: 10px; background: white; padding: 12px 18px; display: grid; grid-template-columns: 34px 38px 1fr 26px; align-items: center; text-align: left; cursor: pointer; line-height: 1.35;
}
.answer:hover:not(:disabled) { border-color: var(--blue); background: #fbfdff; }
.answer-letter { font-weight: 820; color: var(--navy); }
.radio { width: 21px; height: 21px; border: 2px solid #aab6c4; border-radius: 50%; }
.answer.correct { border-color: var(--green); background: var(--green-soft); color: #0a6535; }
.answer.wrong { border-color: var(--red); background: var(--red-soft); color: #b51f29; }
.answer.correct .radio { border-color: var(--green); box-shadow: inset 0 0 0 5px var(--green-soft); background: var(--green); }
.answer.wrong .radio { border-color: var(--red); box-shadow: inset 0 0 0 5px var(--red-soft); background: var(--red); }
.answer-icon { font-size: 23px; font-weight: 850; }
.feedback { min-height: 58px; margin-top: 14px; padding: 15px 18px; border-radius: 10px; display: flex; align-items: center; gap: 12px; font-weight: 700; }
.feedback.wrong { background: var(--red-soft); color: #b51f29; border: 1px solid #ffcbd0; }
.feedback.correct { background: var(--green-soft); color: #0a6535; border: 1px solid #bfe8ce; }
.exam-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; }
.review-note { color: var(--blue); font-size: 14px; font-weight: 700; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 28px 0; }
.stat { padding: 22px; text-align: center; background: #fbfcfe; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat strong { display: block; font-size: 32px; color: var(--navy); }
.stat span { color: var(--muted); font-size: 13px; }
.empty { padding: 80px 20px; text-align: center; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); padding: 12px 17px; border-radius: 9px; background: var(--navy); color: white; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s ease; z-index: 40; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
button:focus-visible, input:focus-visible, .gallery-card:focus-visible { outline: 3px solid rgba(37,105,170,.35); outline-offset: 2px; }

@media (max-width: 1050px) {
  .learn-grid { grid-template-columns: 1fr; }
  .media-panel { min-height: 520px; }
  .description-panel { min-height: 360px; }
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .app-header { height: auto; min-height: 66px; padding: 0 16px; }
  .brand span { max-width: 170px; line-height: 1.05; }
  .brand svg { width: 28px; }
  .nav-button { padding: 0 10px; font-size: 14px; }
  .nav-button svg { display: none; }
  .shell { padding: 20px 14px 40px; }
  .toolbar { align-items: stretch; flex-wrap: wrap; }
  .subject-tabs, .view-tabs { flex: 1; }
  .subject-tab, .view-tab { flex: 1; }
  .answer-toggle { flex: 1 1 100%; }
  .toolbar-meta { width: 100%; margin: 0; }
  .media-panel { min-height: 410px; }
  .card-image-wrap { min-height: 320px; padding: 14px; }
  .card-controls { grid-template-columns: 1fr 1fr; }
  .counter { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .gallery-copy { padding: 12px; }
  .exam-topline { grid-template-columns: 1fr auto; }
  .exam-progress { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  .error-count { grid-column: 2; grid-row: 1; }
  .review-top { display: none; }
  .exam-media { min-height: 230px; height: 34vh; }
  .answer { grid-template-columns: 27px 28px 1fr 20px; padding: 12px; }
  .answer-text { font-size: 14px; }
  .description-text { font-size: 21px; line-height: 1.58; }
  .result-stats { grid-template-columns: 1fr; }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 1050px) {
  .description-panel.is-hidden { display: none; }
}

@media (max-width: 430px) {
  .brand { gap: 8px; }
  .brand span { font-size: 12.5px; line-height: 1.15; max-width: 160px; }
  .nav-button { padding: 0 7px; }
  .gallery-grid { grid-template-columns: 1fr; }
  .control-button { padding: 0 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
