:root {
  --brand: #e8502a;        /* coral-orange Españero */
  --brand-dark: #c7401d;
  --brand-soft: #fff1ea;
  --sun: #f7a64b;          /* тёплый акцент */
  --ink: #2a2118;          /* тёплый charcoal */
  --muted: #8a8178;
  --bg: #fff9f5;           /* тёплый кремовый фон */
  --card: #ffffff;
  --line: #efe6dd;
  --green: #1aa860;
  --green-bg: #e7f7ee;
  --wrong: #e23b3b;
  --wrong-bg: #fdecec;
  --shadow: 0 14px 40px rgba(60, 40, 25, 0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
.hidden { display: none !important; }

/* ---------- START SCREEN ---------- */
#start-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 520px at 85% -10%, #ffe7d6 0%, rgba(255,231,214,0) 60%),
    radial-gradient(700px 480px at 0% 110%, #ffeede 0%, rgba(255,238,222,0) 55%),
    var(--bg);
}
.card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.start-card {
  max-width: 640px;
  width: 100%;
  padding: 44px 40px 36px;
  position: relative;
  overflow: hidden;
}
.flag-bar {
  position: absolute;
  inset: 0 0 auto 0;
  height: 7px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--sun) 100%);
}
.logo { font-size: 30px; font-weight: 800; margin-top: 8px; letter-spacing: -.5px; }
.start-card h1 { font-size: 30px; line-height: 1.18; margin: 12px 0 16px; font-weight: 800; letter-spacing: -.5px; }
.start-card h1 span { color: var(--brand); }
.lead { color: #5b5249; margin: 0 0 20px; font-size: 16px; }
.hints { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 9px; }
.hints li { background: var(--brand-soft); border: 1px solid #ffe0d0; border-radius: 14px; padding: 11px 15px; font-size: 15px; color: #6b4636; }
.note-box { background: var(--brand-soft); border: 1px solid #ffd9c6; border-left: 4px solid var(--brand); border-radius: 14px; padding: 14px 16px; margin: 0 0 18px; font-size: 15px; color: #6b4636; }
.note-box b { color: var(--brand-dark); }
.fields { display: grid; gap: 14px; margin-bottom: 24px; }
.fields label { font-weight: 700; font-size: 14px; display: grid; gap: 6px; color: #4a423a; }
.fields input {
  font: inherit; padding: 14px 15px; border: 1.5px solid var(--line);
  border-radius: 13px; outline: none; transition: border-color .15s, box-shadow .15s;
  background: #fffdfb;
}
.fields input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232,80,42,.12); }
.form-error { color: var(--wrong); font-weight: 700; font-size: 14px; min-height: 18px; }

/* ---------- BUTTONS ---------- */
.btn {
  font: inherit; font-weight: 800; cursor: pointer; border: none;
  border-radius: 13px; padding: 13px 22px; transition: transform .08s, background .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(232,80,42,.28); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-lg { width: 100%; padding: 17px; font-size: 18px; }
.btn-ghost { background: #f1e7df; color: var(--ink); }
.btn-ghost:hover { background: #e8dbd0; }
.btn-finish { background: var(--brand); color: #fff; padding: 14px 30px; font-size: 17px; box-shadow: 0 8px 22px rgba(232,80,42,.34); }
.btn-finish:hover { background: var(--brand-dark); }

/* ---------- TOP BAR ---------- */
.top-bar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 14px rgba(60,40,25,.05);
}
.top-inner { max-width: 760px; margin: 0 auto; padding: 13px 16px; display: flex; align-items: center; gap: 18px; }
.top-title { font-weight: 800; white-space: nowrap; letter-spacing: -.3px; }
.top-title b { color: var(--brand); }
.progress-wrap { flex: 1; display: flex; align-items: center; gap: 12px; }
.progress-track { flex: 1; height: 10px; background: #f1e2d7; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--sun), var(--brand)); transition: width .25s; }
.progress-label { font-weight: 700; font-size: 14px; color: var(--muted); white-space: nowrap; }

/* ---------- QUESTIONS ---------- */
.questions { max-width: 760px; margin: 0 auto; padding: 24px 16px; display: grid; gap: 16px; }

.q {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 20px 20px 16px; box-shadow: 0 6px 18px rgba(60,40,25,.04);
}
.q-title { font-weight: 700; margin: 0 0 14px; font-size: 16px; }
.q-title .num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; padding: 0 8px; margin-right: 9px;
  background: var(--brand-soft); color: var(--brand); border-radius: 9px;
  font-weight: 800; font-size: 14px; vertical-align: 2px;
}
.options { display: grid; gap: 9px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 13px; cursor: pointer;
  transition: border-color .12s, background .12s; user-select: none;
}
.opt:hover { border-color: #f4c3b0; background: #fffaf7; }
.opt .letter {
  flex: none; width: 28px; height: 28px; border-radius: 9px;
  background: #f4ece4; color: var(--ink); font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center; text-transform: lowercase;
}
.opt .text { padding-top: 3px; }
.opt.selected { border-color: var(--brand); background: var(--brand-soft); }
.opt.selected .letter { background: var(--brand); color: #fff; }

/* состояние результата */
.q.locked .opt { cursor: default; }
.q.skipped { opacity: .85; border-style: dashed; }
.q-skipped-note { margin-top: 11px; font-size: 13px; font-weight: 700; color: var(--muted); background: #f7f1ea; border-radius: 10px; padding: 8px 12px; }
.opt.correct { border-color: var(--green); background: var(--green-bg); }
.opt.correct .letter { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--wrong); background: var(--wrong-bg); }
.opt.wrong .letter { background: var(--wrong); color: #fff; }
.opt .mark { margin-left: auto; font-weight: 800; padding-top: 2px; }
.opt.correct .mark { color: var(--green); }
.opt.wrong .mark { color: var(--wrong); }

/* ---------- FINISH BAR ---------- */
.footer-spacer { height: 96px; }
.finish-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.93); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 22px rgba(60,40,25,.07);
}
.finish-inner { max-width: 760px; margin: 0 auto; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.finish-hint { color: var(--muted); font-weight: 700; font-size: 14px; }

/* ---------- RESULT ---------- */
.result-banner { background: linear-gradient(135deg, #e8502a 0%, #f7a64b 100%); color: #fff; }
.result-inner { max-width: 760px; margin: 0 auto; padding: 34px 16px 28px; }
.result-inner h2 { margin: 0 0 12px; font-size: 27px; font-weight: 800; letter-spacing: -.5px; }
.result-summary { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); border-radius: 16px; padding: 18px 20px; font-size: 16px; line-height: 1.6; white-space: pre-line; }
.result-summary .lvl { font-weight: 800; }
.result-card-status { margin: 14px 0 16px; font-size: 14px; opacity: .95; }
.result-banner .btn { margin-right: 10px; margin-top: 4px; }
.result-banner .btn-ghost { background: rgba(255,255,255,.92); color: var(--brand-dark); }
.result-banner .btn-ghost:hover { background: #fff; }

/* ---------- MODAL / LOADING ---------- */
.modal-overlay, .loading-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(42,33,24,.55); padding: 20px;
}
.modal { background: #fff; border-radius: 20px; padding: 28px; max-width: 430px; width: 100%; box-shadow: var(--shadow); text-align: center; }
.modal h3 { margin: 0 0 8px; font-size: 22px; font-weight: 800; }
.modal p { color: #5b5249; margin: 0 0 22px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
.loading-overlay { flex-direction: column; gap: 16px; color: #fff; font-weight: 700; }
.spinner { width: 46px; height: 46px; border: 5px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .start-card { padding: 32px 22px 28px; }
  .start-card h1 { font-size: 24px; }
  .top-title { font-size: 14px; }
  .finish-hint { display: none; }
  .btn-finish { flex: 1; }
}
