:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #f1f3f6;
  --text: #15171a;
  --muted: #5f6875;
  --line: #d9dee7;
  --accent: #2457d6;
  --accent-dark: #153da1;
  --danger: #b3261e;
  --success: #1f7a4d;
  --shadow: 0 18px 55px rgba(18, 30, 60, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(circle at 10% -10%, #eaf0ff 0, transparent 34rem), var(--bg);
  color: var(--text);
  font: 18px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, label:focus-within {
  outline: 3px solid rgba(36, 87, 214, 0.35);
  outline-offset: 3px;
}

a { color: var(--accent); }
.app { min-height: 100vh; padding: 32px 16px; }
.shell { width: min(1120px, 100%); margin: 0 auto; }
.screen {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 222, 231, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 38px;
}
.start-screen { padding: 48px; }
.eyebrow { color: var(--accent); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 14px; margin: 0 0 8px; }
h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.08; margin: 0 0 18px; letter-spacing: -0.04em; }
h2 { font-size: clamp(28px, 3.2vw, 40px); line-height: 1.16; margin: 0 0 16px; letter-spacing: -0.025em; }
h3 { font-size: 22px; line-height: 1.25; margin: 0 0 10px; }
p { margin: 0 0 16px; }
.lead { color: var(--muted); font-size: 22px; max-width: 860px; }
.start-screen .lead, .start-card { font-size: 20px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card, .start-card, .summary-box, .question-card, .notice, .artifact, .result-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}
.start-card { background: #f8faff; }
.summary-box { background: var(--surface-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.notice { background: #fff8e8; border-color: #ead6a6; color: #4d3b10; }
.error { color: var(--danger); font-size: 16px; margin: 8px 0 0; }
.muted { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 28px; }
.btn {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px 20px;
  min-height: 54px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }
.btn.secondary { background: #fff; color: var(--accent); border-color: var(--accent); }
.btn.secondary:hover:not(:disabled) { background: #eef3ff; color: var(--accent-dark); }
.btn.text { background: transparent; color: var(--accent); border-color: transparent; padding-left: 0; padding-right: 0; }
.btn.text:hover:not(:disabled) { background: transparent; transform: none; }
.progress { color: var(--muted); font-size: 15px; margin-bottom: 18px; }
.video-wrap { margin: 24px 0; }
video { width: 100%; max-height: 520px; border-radius: 18px; background: #111; display: block; }
.transcript { margin-top: 20px; white-space: pre-line; }
textarea, input[type="text"], input[type="tel"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 170px; resize: vertical; }
.form-row { margin: 18px 0; }
label.label { display: block; font-weight: 700; margin-bottom: 8px; }
.checkbox-line { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; }
.checkbox-line input { margin-top: 6px; min-width: 18px; min-height: 18px; }
.situation-card { text-align: left; min-height: 100%; }
.situation-card button { width: 100%; text-align: left; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.radio-card, .check-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 62px;
}
.radio-card input, .check-card input { margin-top: 6px; min-width: 18px; min-height: 18px; }
.radio-card.selected, .check-card.selected { border-color: var(--accent); background: #eef3ff; }
.question-card.missing { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.12); }
.score { font-size: 34px; font-weight: 800; color: var(--accent); }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  background: #eef3ff;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 14px;
}
ul.clean { padding-left: 22px; margin-top: 8px; }
.artifact { white-space: pre-wrap; max-height: 430px; overflow: auto; font-size: 16px; background: #fbfcff; }
.storage-warning { background: #fff3f0; border: 1px solid #f1c2b8; color: #6f1f16; padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; }
.noscript { margin: 24px; padding: 16px; background: #fff3f0; border: 1px solid #f1c2b8; border-radius: 14px; }
.hidden { display: none !important; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.copy-ok { color: var(--success); font-weight: 700; }

@media (max-width: 860px) {
  body { font-size: 16px; }
  .app { padding: 16px 10px 84px; }
  .screen, .start-screen { padding: 24px 18px; border-radius: 18px; }
  .grid-2, .grid-3, .choice-grid { grid-template-columns: 1fr; }
  .lead { font-size: 18px; }
  .actions { position: sticky; bottom: 0; background: rgba(246,247,249,0.96); padding: 10px 0 0; margin-bottom: -4px; }
  .actions .btn { width: 100%; }
}

.screen-nav {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}
.back-btn {
  min-height: 44px;
  padding: 10px 16px;
}
.situation-card {
  display: flex;
  flex-direction: column;
}
.situation-card .actions {
  margin-top: auto;
  padding-top: 22px;
}
.transcript-details {
  margin-top: 20px;
  white-space: pre-line;
}
.transcript-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
  list-style-position: inside;
}
.transcript-details[open] summary {
  margin-bottom: 12px;
}
.transcript-details p {
  margin-bottom: 0;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}
.summary-header h3 { margin-bottom: 0; }
.small-link {
  min-height: auto;
  padding: 0;
  font-size: 16px;
}
.term-details {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.term-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}
.term-details[open] summary { margin-bottom: 10px; }
.intro-card ul { margin-bottom: 0; }
.situation-card { cursor: pointer; }
.situation-card:focus-visible {
  outline: 3px solid rgba(36, 87, 214, 0.35);
  outline-offset: 3px;
}
.situation-button { pointer-events: none; width: 100%; }
.diagnostic-original { max-height: 280px; overflow: auto; }
