:root {
  --ink: #1e2430;
  --muted: #586173;
  --paper: #fff9ef;
  --surface: #ffffff;
  --line: #d9e1ec;
  --blue: #2364a6;
  --blue-dark: #173f70;
  --green: #3f8d55;
  --coral: #ec624f;
  --yellow: #f3b73f;
  --teal: #168a93;
  --shadow: 0 18px 45px rgba(23, 47, 79, 0.14);
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.55;
}

img,
svg {
  display: block;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

button,
a.button {
  font: inherit;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 20;
  transform: translateY(-180%);
  padding: 0.75rem 1rem;
  color: #fff;
  background: var(--blue-dark);
  border-radius: var(--radius);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 70px;
  padding: 0.7rem clamp(1rem, 3vw, 2.5rem);
  background: rgba(255, 249, 239, 0.94);
  border-bottom: 1px solid rgba(30, 36, 48, 0.08);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  padding: 0.18rem;
  background: #fff;
  border-radius: var(--radius);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.98rem;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.main-nav a {
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: #fff;
  background: var(--blue);
  outline: none;
}

.hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: calc(86svh - 70px);
  isolation: isolate;
  overflow: hidden;
  background: #173f70;
}

.hero-media,
.hero-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-media img {
  object-fit: cover;
  object-position: center;
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(11, 25, 43, 0.82), rgba(11, 25, 43, 0.35) 55%, rgba(11, 25, 43, 0.08)),
    linear-gradient(0deg, rgba(11, 25, 43, 0.36), rgba(11, 25, 43, 0.12));
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(760px, 92vw);
  padding: clamp(2rem, 7vw, 6rem);
  color: #fff;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--coral);
  font-size: 0.84rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #ffe082;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 {
  max-width: 10ch;
  font-size: clamp(3rem, 8vw, 6.4rem);
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.24);
}

h2 {
  font-size: clamp(2rem, 4vw, 3.8rem);
}

h3 {
  font-size: clamp(1.45rem, 3vw, 2.4rem);
}

.hero-content p:not(.eyebrow) {
  max-width: 680px;
  margin: 1rem 0 0;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
  font-weight: 800;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.3);
}

.hero-actions,
.controls,
.scene-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.hero-actions {
  margin-top: 1.65rem;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 950;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button {
  padding: 0.75rem 1rem;
}

.button svg,
.icon-button svg,
.action-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.button.primary {
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 12px 26px rgba(243, 183, 63, 0.32);
}

.button.secondary {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 12px 26px rgba(35, 100, 166, 0.24);
}

.button.ghost {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.button.ghost-light {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.button:hover,
.icon-button:hover,
.button:focus-visible,
.icon-button:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.section-inner {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
}

.section-pad {
  padding: clamp(3rem, 7vw, 6rem) 0;
}

.intro-band {
  padding: clamp(2rem, 5vw, 3.5rem) 0;
  background: #fff;
  border-bottom: 1px solid rgba(30, 36, 48, 0.08);
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(90px, 150px) minmax(0, 1fr) minmax(90px, 150px);
  align-items: center;
  gap: clamp(1rem, 4vw, 3rem);
}

.intro-grid h2 {
  max-width: 780px;
}

.intro-grid p:not(.eyebrow) {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
}

.intro-character {
  max-height: 250px;
  object-fit: contain;
  filter: drop-shadow(0 15px 18px rgba(23, 47, 79, 0.18));
}

.intro-character.mauri {
  justify-self: end;
}

.section-heading {
  display: grid;
  gap: 0.7rem;
  max-width: 820px;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.section-heading p:not(.eyebrow) {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.section-heading.compact {
  max-width: 780px;
}

.game-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.scene-nav {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 0.5rem;
}

.scene-tab {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 54px;
  padding: 0.7rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 950;
  text-align: left;
}

.scene-tab span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
}

.scene-tab.is-active,
.scene-tab:hover,
.scene-tab:focus-visible {
  color: #fff;
  background: var(--blue-dark);
  outline: none;
}

.scene-tab.is-active span,
.scene-tab:hover span,
.scene-tab:focus-visible span {
  color: var(--ink);
  background: var(--yellow);
}

.scene-stage {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.scene-progress {
  height: 8px;
  background: #edf1f7;
}

.scene-progress span {
  display: block;
  width: 16.666%;
  height: 100%;
  background: linear-gradient(90deg, var(--coral), var(--yellow), var(--green));
  transition: width 240ms ease;
}

.scene-panel {
  display: none;
  padding: clamp(1rem, 3vw, 2rem);
}

.scene-panel.is-active {
  display: block;
}

.scene-copy {
  display: grid;
  gap: 0.7rem;
  max-width: 820px;
}

.scene-count,
.activity-title {
  margin: 0;
  color: var(--coral);
  font-size: 0.86rem;
  font-weight: 950;
  text-transform: uppercase;
}

.scene-copy p:not(.scene-count) {
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.dialogues {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.25rem 0;
}

.dialogue {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  background: #f7fbff;
  border: 1px solid #d7e6f7;
  border-radius: var(--radius);
}

.dialogue img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.dialogue p {
  margin: 0;
}

.word-game,
.deputies-layout,
.organization-game,
.law-layout,
.trivia {
  margin-top: 1.2rem;
}

.drag-zone,
.drop-row,
.trivia-options,
.area-buttons,
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.drag-zone {
  margin-top: 0.8rem;
}

.drag-item {
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  color: var(--blue-dark);
  background: #eef6ff;
  border: 1px dashed #a9cbe9;
  border-radius: var(--radius);
  cursor: grab;
  font-weight: 900;
}

.drag-item.is-selected {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.drop-row {
  margin-top: 1rem;
}

.drop-slot {
  width: min(116px, 100%);
  min-height: 48px;
  padding: 0.4rem;
  color: var(--ink);
  background: #fff9ef;
  border: 2px dashed #d8b66f;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 950;
}

.drop-slot.is-filled {
  background: #ffe6a7;
  border-style: solid;
}

.success-msg {
  display: none;
  margin: 1rem 0 0;
  padding: 0.8rem 1rem;
  color: #245637;
  background: #e9f8ed;
  border: 1px solid #b7e2c3;
  border-radius: var(--radius);
  font-weight: 900;
}

.success-msg.is-visible {
  display: block;
}

.controls {
  margin-top: 1rem;
}

.controls.stacked {
  display: grid;
  align-items: stretch;
}

.deputies-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 1rem;
  align-items: start;
}

.seats {
  display: grid;
  grid-template-columns: repeat(10, minmax(30px, 1fr));
  gap: 0.45rem;
}

.seat {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  color: var(--blue-dark);
  background: #eef1f5;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 950;
}

.seat.blue {
  color: #fff;
  background: var(--blue);
}

.seat.coral {
  color: #fff;
  background: var(--coral);
}

.legend {
  margin-top: 0.9rem;
  color: var(--muted);
  font-weight: 800;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.blue {
  background: var(--blue);
}

.dot.coral {
  background: var(--coral);
}

.deputy-status {
  padding: 1rem;
  background: #fff9ef;
  border: 1px solid #f3dfb3;
  border-radius: var(--radius);
}

.deputy-status p {
  margin: 0 0 0.8rem;
  color: var(--muted);
}

.deputy-status strong {
  display: block;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--blue-dark);
}

.map-frame {
  position: relative;
  overflow: hidden;
  margin: 1.25rem 0 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #f8ead0;
}

.map-frame img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.map-pin {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 8px rgba(236, 98, 79, 0.2), 0 8px 18px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.map-pin.alt {
  background: var(--blue);
  box-shadow: 0 0 0 8px rgba(35, 100, 166, 0.2), 0 8px 18px rgba(0, 0, 0, 0.22);
}

.map-pin.green {
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(63, 141, 85, 0.2), 0 8px 18px rgba(0, 0, 0, 0.22);
}

.map-tip {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: 0.7rem 0.9rem;
  color: #fff;
  background: rgba(23, 63, 112, 0.92);
  border-radius: var(--radius);
  font-weight: 950;
}

.organization-game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
  gap: 1rem;
}

.area-buttons {
  align-content: start;
}

.area-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  min-height: 68px;
  flex: 1 1 240px;
  padding: 0.85rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 950;
  text-align: left;
}

.area-button span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--teal);
  border-radius: 50%;
}

.area-button.is-active,
.area-button:hover,
.area-button:focus-visible {
  color: #fff;
  background: var(--blue-dark);
  outline: none;
}

.area-result {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: #eef6ff;
  border: 1px solid #d7e6f7;
  border-radius: var(--radius);
}

.area-result img {
  width: min(150px, 60%);
  max-height: 190px;
  object-fit: contain;
}

.area-result p {
  margin: 0;
  color: var(--blue-dark);
  font-weight: 900;
}

.law-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 360px);
  gap: 1rem;
  align-items: stretch;
}

.law-visual {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff9ef;
  aspect-ratio: 1 / 1;
}

.law-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.timeline {
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

.law-step {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}

.law-step strong {
  color: var(--blue-dark);
}

.law-step.is-active,
.law-step:hover,
.law-step:focus-visible {
  color: #fff;
  background: var(--green);
  outline: none;
}

.law-step.is-active strong,
.law-step:hover strong,
.law-step:focus-visible strong {
  color: #fff;
}

.law-feedback {
  margin: 1rem 0 0;
  padding: 0.8rem 1rem;
  color: var(--blue-dark);
  background: #fff9ef;
  border: 1px solid #f3dfb3;
  border-radius: var(--radius);
  font-weight: 900;
}

.trivia-options {
  margin-top: 1rem;
}

.trivia-option {
  flex: 1 1 220px;
  min-height: 54px;
  padding: 0.8rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
}

.trivia-option.correct {
  color: #245637;
  background: #e9f8ed;
  border-color: #9bd6ab;
}

.trivia-option.wrong {
  color: #7a2018;
  background: #ffe8e5;
  border-color: #f0aaa0;
}

.scene-controls {
  justify-content: center;
  padding: 1rem;
  background: #f7fbff;
  border-top: 1px solid var(--line);
}

.icon-button {
  width: 48px;
  padding: 0;
  color: #fff;
  background: var(--blue-dark);
}

.actions {
  background: #fff;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.action-card {
  padding: 1.2rem;
  background: #fff9ef;
  border: 1px solid #f3dfb3;
  border-radius: var(--radius);
}

.action-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: #fff;
  background: var(--blue);
  border-radius: var(--radius);
}

.action-icon.coral {
  background: var(--coral);
}

.action-icon.green {
  background: var(--green);
}

.action-card h3 {
  margin-top: 1rem;
  font-size: 1.35rem;
}

.action-card p {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.badge-band {
  padding: clamp(3rem, 7vw, 5rem) 0;
  color: #fff;
  background: var(--blue-dark);
}

.badge-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 1.5rem;
  align-items: center;
}

.badge-layout p:not(.eyebrow) {
  max-width: 680px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
}

.badge {
  display: grid;
  place-items: center;
  gap: 0.35rem;
  min-height: 260px;
  padding: 1rem;
  color: var(--ink);
  background: radial-gradient(circle at 50% 30%, #fff3c4 0, var(--yellow) 58%, #d89218 100%);
  border: 8px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}

.badge span {
  font-size: 4rem;
  font-weight: 950;
  line-height: 0.9;
}

.badge strong,
.badge small {
  display: block;
}

.badge strong {
  font-size: 1.25rem;
}

.badge small {
  color: #5c4316;
  font-weight: 900;
}

@media (max-width: 940px) {
  .game-layout,
  .deputies-layout,
  .organization-game,
  .law-layout,
  .badge-layout {
    grid-template-columns: 1fr;
  }

  .scene-nav {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .law-visual {
    max-width: 640px;
    justify-self: center;
  }
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .main-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }

  .hero {
    min-height: calc(92svh - 122px);
  }

  .hero-shade {
    background: rgba(11, 25, 43, 0.66);
  }

  .intro-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .intro-character {
    justify-self: center;
    max-height: 190px;
  }

  .dialogues,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .scene-nav {
    grid-template-columns: 1fr;
  }

  .seats {
    grid-template-columns: repeat(5, minmax(34px, 1fr));
  }

  .drop-slot {
    width: calc(50% - 0.4rem);
  }

  .scene-controls .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
