:root {
  --ink: #18344b;
  --muted: #63788a;
  --panel: #ffffff;
  --line: #d7e4ea;
  --teal: #168d9b;
  --teal-dark: #0f6672;
  --yellow: #ffd86b;
  --orange: #f28f3b;
  --blue-soft: #eaf6fb;
  --green-soft: #eaf8ee;
  --orange-soft: #fff3df;
  --pink-soft: #fff0f5;
  --shadow: 0 18px 42px rgba(24, 52, 75, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 216, 107, 0.38), transparent 22rem),
    radial-gradient(circle at 90% 18%, rgba(22, 141, 155, 0.2), transparent 26rem),
    linear-gradient(180deg, #f9fdfe, #edf7fa);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(242, 145, 55, 0.65); outline-offset: 3px; }
.portal-shell, .app-shell { width: min(1180px, 100%); margin: 0 auto; padding: clamp(20px, 4vw, 48px) clamp(14px, 4vw, 40px) 72px; }
.portal-hero, .mission-hero { max-width: 900px; margin: 0 auto 28px; text-align: center; }
.eyebrow { margin: 0; color: var(--teal-dark); font-size: .82rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 7px 0 10px; font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.02; }
.portal-hero p:last-child, .mission-hero p:last-child { color: var(--muted); font-size: 1.06rem; line-height: 1.6; }

.mission-list { display: grid; gap: 18px; max-width: 900px; margin: 0 auto; }
.portal-card { display: grid; grid-template-columns: auto auto 1fr auto; gap: 18px; align-items: center; padding: 22px; color: inherit; text-decoration: none; background: var(--panel); border: 2px solid transparent; border-radius: 24px; box-shadow: var(--shadow); transition: transform 160ms ease, border-color 160ms ease; }
.portal-card:hover { transform: translateY(-4px); border-color: rgba(22, 141, 155, .5); }
.portal-card__number { color: var(--teal); font-size: .9rem; font-weight: 900; }
.portal-card__icon { font-size: 2.5rem; }
.portal-card strong, .portal-card small { display: block; }
.portal-card strong { margin-bottom: 5px; font-size: 1.25rem; }
.portal-card small { color: var(--muted); }
.portal-card__action { color: var(--teal-dark); font-weight: 900; }
.portal-card--locked { opacity: .58; }

.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.back-link { color: var(--teal-dark); font-weight: 850; text-decoration: none; }
.mission-status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.score-badge, .step-badge { padding: 9px 14px; border-radius: 999px; font-size: .88rem; font-weight: 900; box-shadow: 0 8px 18px rgba(24,52,75,.09); }
.score-badge { background: var(--yellow); }
.step-badge { color: white; background: var(--teal-dark); }

.mission-hero--petra { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; padding: 22px 26px; background: rgba(255,255,255,.82); border: 1px solid rgba(215,228,234,.9); border-radius: 30px; box-shadow: var(--shadow); text-align: left; }
.hero-character { display: grid; place-items: center; width: 94px; height: 94px; border-radius: 30px; background: linear-gradient(145deg, var(--pink-soft), #ffe0b8); font-size: 4.2rem; transform: rotate(-2deg); }
.hero-call { position: relative; display: grid; place-items: center; width: 120px; height: 94px; border: 7px solid var(--ink); border-radius: 18px; background: #dff7fb; font-size: 3.1rem; }
.hero-call::after { content: ""; position: absolute; bottom: -16px; width: 54px; height: 9px; border-radius: 99px; background: var(--ink); }
.hero-call span { position: absolute; right: -12px; top: -21px; padding: 7px 10px; color: var(--ink); background: white; border: 2px solid var(--line); border-radius: 14px 14px 14px 3px; font-size: .68rem; font-weight: 800; white-space: nowrap; }

.progress-panel { margin: 0 auto 20px; padding: 15px 18px 11px; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 10px 26px rgba(24,52,75,.08); }
.progress-track { height: 15px; overflow: hidden; background: #dce9ed; border-radius: 999px; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--yellow), var(--teal)); transition: width 300ms ease; }
.progress-labels { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 9px; }
.progress-label { min-width: 0; padding: 5px 3px; color: #8395a3; background: transparent; border: 2px solid transparent; border-radius: 12px; font-size: .68rem; font-weight: 800; text-align: center; transition: color 150ms ease, background 150ms ease, transform 150ms ease; }
.progress-label:not(:disabled):hover { color: var(--teal-dark); background: var(--blue-soft); transform: translateY(-2px); }
.progress-label:disabled { cursor: not-allowed; opacity: .42; }
.progress-label.is-current { color: var(--teal-dark); background: #fff8d9; border-color: var(--yellow); }
.progress-label.is-done { color: var(--teal-dark); }
.progress-label span, .progress-label strong, .progress-label small { display: block; }
.progress-label span { margin-bottom: 2px; font-size: 1.05rem; }
.progress-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-label small { margin-top: 2px; font-size: .65rem; }

.stage-card { overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); }
.stage-card__header { padding: 20px 24px; color: white; background: linear-gradient(135deg, var(--teal-dark), var(--teal)); }
.stage-card__header h2 { margin: 0 0 5px; }
.stage-card__header p { margin: 0; color: rgba(255,255,255,.86); }
.stage-card__body { padding: clamp(20px, 4vw, 34px); }

.scene-card { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(240px,.75fr); gap: 22px; align-items: center; padding: 24px; background: linear-gradient(145deg, #f0fbfd, #fff9e7); border: 2px solid #dcecf0; border-radius: 24px; }
.scene-illustration { position: relative; min-height: 230px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(#cceffc 0 62%, #f4d9b2 62%); border-radius: 22px; }
.scene-illustration::before { content: "🪴"; position: absolute; left: 18px; bottom: 16px; font-size: 3.4rem; }
.scene-illustration::after { content: "📚"; position: absolute; right: 18px; bottom: 18px; font-size: 3rem; }
.scene-person { font-size: 6rem; filter: drop-shadow(0 8px 8px rgba(24,52,75,.14)); }
.scene-screen { position: absolute; right: 20%; top: 25px; display: grid; place-items: center; width: 125px; height: 90px; border: 7px solid var(--ink); border-radius: 14px; background: #e9fbff; font-size: 3rem; }
.scene-copy h3 { margin-top: 0; font-size: 1.5rem; }
.scene-copy p { color: var(--muted); line-height: 1.6; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.choice-card { min-height: 180px; padding: 22px; color: inherit; background: #fbfeff; border: 2px solid var(--line); border-radius: 22px; text-align: left; transition: transform 150ms ease, border-color 150ms ease, background 150ms ease; }
.choice-card:hover { transform: translateY(-3px); border-color: var(--teal); }
.choice-card.is-selected { border-color: var(--teal); background: var(--blue-soft); }
.choice-card__icon { display: block; margin-bottom: 12px; font-size: 3.6rem; }
.choice-card strong, .choice-card small { display: block; }
.choice-card strong { margin-bottom: 7px; font-size: 1.16rem; }
.choice-card small { color: var(--muted); line-height: 1.45; }

.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.device-card { min-height: 135px; padding: 16px; color: inherit; background: #fff; border: 2px solid var(--line); border-radius: 18px; text-align: center; transition: transform 140ms ease, border-color 140ms ease, background 140ms ease; }
.device-card:hover { transform: translateY(-2px); border-color: rgba(22,141,155,.7); }
.device-card.is-selected { border-color: var(--teal); background: var(--blue-soft); }
.device-card.is-correct { border-color: #43a75d; background: var(--green-soft); }
.device-card.is-wrong { border-color: var(--orange); background: var(--orange-soft); }
.device-card > span { display: block; margin-bottom: 8px; font-size: 2.8rem; }
.device-card strong { font-size: .95rem; }

.task-stack { display: grid; gap: 16px; }
.question-card { padding: 20px; background: linear-gradient(145deg, #ffffff, #f6fbfd); border: 2px solid var(--line); border-radius: 22px; }
.question-card > h3 { margin: 0 0 14px; }
.question-card__heading { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.question-card__heading > span { display: grid; place-items: center; flex: 0 0 72px; width: 72px; height: 72px; border-radius: 20px; background: var(--blue-soft); font-size: 2.8rem; }
.question-card__heading h3, .question-card__heading p { margin: 0; }
.question-card__heading p { color: var(--muted); }
.answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.answer-card { display: flex; gap: 10px; align-items: center; min-height: 54px; padding: 11px 13px; color: var(--ink); background: white; border: 2px solid var(--line); border-radius: 14px; text-align: left; line-height: 1.35; transition: transform 130ms ease, border-color 130ms ease, background 130ms ease; }
.answer-card:hover { transform: translateY(-1px); border-color: var(--teal); }
.answer-card.is-selected { border-color: var(--teal); background: var(--blue-soft); box-shadow: 0 6px 15px rgba(22,141,155,.12); }
.answer-card__marker { flex: 0 0 18px; width: 18px; height: 18px; border: 2px solid #9bb2bc; border-radius: 50%; background: white; }
.answer-card.is-selected .answer-card__marker { border: 5px solid var(--teal); }

.option-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.pill-option { padding: 10px 14px; border: 2px solid var(--line); border-radius: 999px; background: white; font-weight: 850; }
.pill-option.is-selected { border-color: var(--teal); background: var(--blue-soft); }

.comparison-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.comparison-grid--four { grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 20px; }
.computer-panel { padding: 18px; border-radius: 22px; border: 2px solid var(--line); background: #fbfeff; }
.computer-panel__visual { display: grid; place-items: center; min-height: 125px; margin-bottom: 14px; border-radius: 18px; background: linear-gradient(145deg,#eaf7fb,#fff3df); font-size: 4.5rem; }
.computer-panel h3 { margin: 0 0 8px; }
.computer-panel p { margin: 0; color: var(--muted); line-height: 1.5; }
.concept-banner { margin: 20px 0 24px; padding: 16px 18px; background: #fff8d9; border-left: 6px solid var(--yellow); border-radius: 14px; line-height: 1.5; }

.problem-grid { display: grid; gap: 18px; }
.problem-card { padding: 22px; border: 2px solid var(--line); border-radius: 22px; background: linear-gradient(145deg,#fff,#f2fbfd); }
.problem-card h3 { margin: 10px 0 6px; }
.problem-card p { margin: 5px 0 14px; line-height: 1.5; }
.signal-route { display: inline-flex; align-items: center; min-height: 54px; padding: 8px 14px; border-radius: 16px; background: #fff0f3; font-size: 2rem; letter-spacing: .08em; }

.feedback { margin-top: 22px; padding: 18px; border-radius: 18px; line-height: 1.55; }
.feedback--info { background: var(--blue-soft); }
.feedback--success { background: var(--green-soft); }
.feedback--warning { background: var(--orange-soft); }
.feedback h3 { margin: 0 0 8px; }
.feedback p { margin: 0; }
.points-earned { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; padding: 7px 10px; border-radius: 999px; background: var(--yellow); font-weight: 900; }
.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.primary-button, .secondary-button { min-height: 48px; padding: 12px 18px; border-radius: 14px; font-weight: 900; }
.primary-button { color: white; background: var(--teal); border: 2px solid var(--teal); }
.primary-button:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.primary-button:disabled { cursor: not-allowed; opacity: .45; }
.secondary-button { color: var(--teal-dark); background: white; border: 2px solid var(--teal); }

.summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.summary-card { padding: 18px; border-radius: 18px; background: #f8fbfc; border: 1px solid var(--line); }
.summary-card__icon { display: block; margin-bottom: 10px; font-size: 3rem; }
.summary-card h3 { margin: 0 0 7px; font-size: 1rem; }
.summary-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.final-score { display: grid; place-items: center; margin: 24px 0; padding: 22px; color: white; background: linear-gradient(135deg, var(--orange), var(--teal)); border-radius: 22px; text-align: center; box-shadow: 0 12px 28px rgba(22,141,155,.2); }
.final-score span, .final-score strong { display: block; }
.final-score span { font-weight: 900; }
.final-score strong { margin-top: 5px; font-size: clamp(2rem, 6vw, 3.3rem); }

@media (max-width: 980px) {
  .comparison-grid--four { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .mission-hero--petra { grid-template-columns: auto 1fr; }
  .hero-call { display: none; }
  .scene-card { grid-template-columns: 1fr; }
  .progress-label strong { font-size: 0; }
  .progress-label span { font-size: 1rem; }
}
@media (max-width: 760px) {
  .choice-grid, .device-grid, .summary-grid, .comparison-grid, .answer-grid { grid-template-columns: 1fr; }
  .portal-card { grid-template-columns: auto auto 1fr; }
  .portal-card__action { grid-column: 2 / -1; }
  .topbar { align-items: flex-start; }
  .mission-status { flex-direction: column; align-items: flex-end; }
}
@media (max-width: 520px) {
  .mission-hero--petra { grid-template-columns: 1fr; text-align: center; }
  .hero-character { margin: 0 auto; }
  .progress-labels { grid-template-columns: repeat(7, minmax(38px, 1fr)); overflow-x: auto; padding-bottom: 6px; }
  .progress-label small { display: none; }
}
