:root {
  --bg: #07111f;
  --bg-soft: #0e1b31;
  --panel: rgba(12, 24, 45, 0.88);
  --panel-border: rgba(142, 188, 255, 0.18);
  --text: #edf4ff;
  --muted: #9ab0cf;
  --accent: #61dafb;
  --accent-strong: #16a6d9;
  --success: #64d68a;
  --danger: #ff7f7f;
  --warning: #ffc857;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(97, 218, 251, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 200, 87, 0.12), transparent 24%),
    linear-gradient(145deg, #030912 0%, #07111f 45%, #0c1930 100%);
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
}

.page-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 24px;
  padding: 28px;
  margin-bottom: 24px;
}

.hero h1,
.panel h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.intro,
.panel-note,
.incident-text {
  color: var(--muted);
}

.hero-actions,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-actions {
  margin-top: 20px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.button:hover,
.protection-card:hover {
  transform: translateY(-2px);
}

.primary {
  background: linear-gradient(135deg, var(--accent), #8ef4ff);
  color: #032131;
  font-weight: 700;
}

.secondary,
.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.danger {
  background: linear-gradient(135deg, #ff7f7f, #ffb36b);
  color: #351010;
  font-weight: 700;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.score-tile {
  display: grid;
  grid-template-rows: 2.5rem auto;
  align-items: start;
  padding: 20px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.score-label {
  display: block;
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.2;
  align-self: start;
}

.score-tile strong {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1;
  min-height: 1em;
  align-self: end;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.panel {
  padding: 24px;
}

.layout > .message-bar {
  margin-top: 0;
}

.mission-panel {
  grid-column: 1 / 2;
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.mission-grid.hidden-panel {
  display: none;
}

.message-bar.hidden-panel {
  display: none;
}

.panel-heading.hidden-panel {
  display: none;
}

.button.hidden-button {
  display: none;
}

.mission-panel.hidden-panel {
  display: none;
}

.finish-panel[hidden] {
  display: none !important;
}

.incident-text.hidden-panel {
  display: none;
}

.placeholder-card.hidden-panel {
  display: none;
}

.shopping-panel {
  margin-top: 18px;
  padding: 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.choices-layout {
  display: block;
}

.shopping-panel.identify-layout .choices-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.identify-incident-panel {
  position: sticky;
  top: 16px;
  align-self: start;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.identify-incident-panel img {
  width: 100%;
  border-radius: 14px;
  margin: 10px 0 12px;
}

.shopping-panel.identify-layout .protection-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shopping-panel .protection-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.shopping-panel .protection-card {
  padding: 10px;
}

.shopping-panel .protection-card img {
  margin: 6px 0;
  border-radius: 12px;
}

.shopping-panel .badge {
  padding: 5px 9px;
  font-size: 0.7rem;
}

.shopping-panel .protection-name {
  font-size: 0.86rem;
  line-height: 1.2;
}

.shopping-panel .protection-price {
  margin-top: 4px;
  font-size: 0.76rem;
}

.shopping-panel.hidden-panel {
  display: none;
}

.card-frame,
.incident-box,
.protection-card,
.answer-item {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.spotlight,
.incident-box {
  padding: 16px;
}

.spotlight img,
.incident-box img {
  width: 100%;
  border-radius: 16px;
}

.placeholder-card {
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  color: var(--muted);
  text-align: center;
}

.message-bar {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 200, 87, 0.2), rgba(255, 127, 127, 0.16));
  color: #fff4cf;
  border: 1px solid rgba(255, 200, 87, 0.4);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-line;
}

.bonus-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.bonus-options {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.bonus-option {
  width: 100%;
  text-align: left;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.bonus-option.correct {
  border-color: rgba(100, 214, 138, 0.7);
  box-shadow: inset 0 0 0 1px rgba(100, 214, 138, 0.55);
}

.bonus-option.incorrect {
  border-color: rgba(255, 127, 127, 0.7);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 8, 18, 0.68);
  z-index: 50;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-card {
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20, 42, 25, 0.96), rgba(10, 26, 19, 0.96));
  border: 1px solid rgba(100, 214, 138, 0.35);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.modal-card h2 {
  margin: 0 0 10px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.budget-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.budget-tile {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.budget-tile span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.budget-tile strong {
  font-size: 1.25rem;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
}

.status-pill.neutral,
.badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.status-pill.success {
  background: rgba(100, 214, 138, 0.14);
  color: var(--success);
}

.status-pill.danger {
  background: rgba(255, 127, 127, 0.14);
  color: var(--danger);
}

.protection-grid,
.answer-key {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.protection-card {
  position: relative;
  padding: 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.protection-card[data-tooltip]:hover::after,
.protection-card[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(100% + 10px);
  z-index: 20;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(4, 10, 20, 0.96);
  border: 1px solid rgba(142, 188, 255, 0.22);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.35;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.protection-card[data-tooltip]:hover::before,
.protection-card[data-tooltip]:focus-visible::before {
  content: "";
  position: absolute;
  left: 24px;
  bottom: calc(100% + 4px);
  width: 12px;
  height: 12px;
  background: rgba(4, 10, 20, 0.96);
  border-right: 1px solid rgba(142, 188, 255, 0.22);
  border-bottom: 1px solid rgba(142, 188, 255, 0.22);
  transform: rotate(45deg);
  z-index: 19;
  pointer-events: none;
}

.protection-card img {
  width: 100%;
  border-radius: 14px;
  margin: 8px 0;
}

.protection-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
}

.protection-price {
  display: block;
  margin-top: 4px;
  color: var(--warning);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.protection-card.correct {
  border-color: rgba(100, 214, 138, 0.7);
  box-shadow: inset 0 0 0 1px rgba(100, 214, 138, 0.55);
}

.protection-card.incorrect {
  border-color: rgba(255, 127, 127, 0.7);
}

.protection-card:disabled {
  cursor: default;
  opacity: 0.82;
}

.protection-card.selected {
  border-color: rgba(97, 218, 251, 0.75);
  box-shadow: inset 0 0 0 1px rgba(97, 218, 251, 0.5);
}

.protection-card.attack-option .badge {
  background: rgba(255, 200, 87, 0.14);
  color: var(--warning);
}

.protection-card.locked {
  opacity: 0.5;
}

.hint {
  margin: 12px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 200, 87, 0.08);
  border: 1px solid rgba(255, 200, 87, 0.18);
  color: #ffe5a1;
}

.answer-item {
  padding: 16px;
}

.answer-item h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.answer-item p {
  margin: 0;
  color: var(--muted);
}

.finish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

@media (max-width: 1024px) {
  .hero,
  .layout,
  .mission-grid,
  .shopping-panel.identify-layout .choices-layout {
    grid-template-columns: 1fr;
  }

  .teacher-panel,
  .mission-panel,
  .choices-panel {
    grid-column: auto;
  }

  .identify-incident-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 12px;
  }

  .hero,
  .panel {
    padding: 18px;
    border-radius: 20px;
  }

  .scoreboard,
  .budget-strip,
  .protection-grid,
  .answer-key {
    grid-template-columns: 1fr;
  }

  .shopping-panel .protection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
