:root {
  --petrol-950: #102b33;
  --petrol-900: #17313b;
  --petrol-800: #1d4e58;
  --petrol-700: #2f7277;
  --cream-100: #fffaf0;
  --cream-200: #f7edda;
  --cream-300: #eadbc1;
  --gold: #d89a3b;
  --terracotta: #b95f3f;
  --ink: #243746;
  --muted: #6b675e;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cream-200);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 249, 236, 0.82), rgba(255, 249, 236, 0.82)),
    url("../assets/motif-page.webp") center / 620px 620px repeat,
    var(--cream-200);
  font-family: Arial, Helvetica, sans-serif;
}

button,
canvas {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 68px) clamp(12px, 3vw, 28px) 28px;
}

.project-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  overflow: hidden;
  padding: clamp(30px, 5vw, 58px);
  color: var(--cream-100);
  border: 1px solid rgba(255, 243, 219, 0.2);
  border-radius: 32px 32px 14px 14px;
  background:
    radial-gradient(circle at 90% 15%, rgba(216, 154, 59, 0.24), transparent 28%),
    linear-gradient(135deg, var(--petrol-950), var(--petrol-800));
  box-shadow: 0 24px 65px rgba(29, 57, 62, 0.24);
}

.project-header::before,
.project-header::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.project-header::before {
  top: -86px;
  right: -48px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(255, 243, 219, 0.13);
  border-radius: 50%;
  box-shadow:
    0 0 0 24px rgba(255, 243, 219, 0.025),
    0 0 0 52px rgba(255, 243, 219, 0.018);
}

.project-header::after {
  bottom: 22px;
  left: 32px;
  width: 92px;
  height: 2px;
  opacity: 0.52;
  background: repeating-linear-gradient(
    90deg,
    var(--gold) 0 8px,
    transparent 8px 14px
  );
}

.project-intro,
.field-notes {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 14px;
  color: #f0bd6d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.project-intro h1 {
  max-width: 660px;
  margin: 0;
  color: var(--cream-100);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 6vw, 70px);
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: -0.045em;
}

.project-intro h1 span {
  display: block;
  color: #f0bd6d;
  font-size: 0.68em;
  font-style: italic;
  letter-spacing: -0.025em;
}

.project-lead {
  max-width: 610px;
  margin: 26px 0 0;
  color: rgba(255, 250, 240, 0.8);
  font-size: clamp(14px, 2vw, 17px);
  line-height: 1.68;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.project-tags span {
  padding: 8px 12px;
  color: #f6e8ce;
  border: 1px solid rgba(246, 232, 206, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  font-size: 10px;
  font-weight: 700;
}

.field-notes {
  padding: 22px 22px 20px;
  color: var(--ink);
  border: 1px solid rgba(88, 66, 35, 0.2);
  border-radius: 8px 20px 8px 20px;
  background:
    linear-gradient(90deg, rgba(185, 95, 63, 0.08), transparent 34%),
    var(--cream-200);
  box-shadow:
    8px 9px 0 rgba(6, 27, 33, 0.17),
    inset 22px 0 0 rgba(216, 154, 59, 0.1);
  transform: rotate(1deg);
}

.field-notes-title {
  margin: 0 0 15px 18px;
  color: var(--terracotta);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
}

.field-notes ol {
  display: grid;
  gap: 0;
  padding: 0;
  margin: 0 0 0 18px;
  list-style: none;
}

.field-notes li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 0 9px;
  padding: 10px 0;
  color: var(--muted);
  border-top: 1px dashed rgba(75, 67, 54, 0.25);
  font-size: 11px;
  line-height: 1.45;
}

.field-notes li span {
  grid-row: span 2;
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.field-notes li strong {
  display: block;
  color: var(--petrol-800);
  font-size: 12px;
}

.game-panel {
  width: min(100%, 970px);
  margin: clamp(22px, 4vw, 38px) auto 0;
  padding: clamp(14px, 2.5vw, 24px);
  border: 1px solid rgba(74, 58, 36, 0.2);
  border-radius: 20px;
  background: rgba(255, 250, 240, 0.92);
  box-shadow:
    0 24px 55px rgba(47, 61, 57, 0.18),
    inset 0 0 0 5px rgba(255, 255, 255, 0.46);
}

.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 66px;
  padding: 10px 14px 12px 18px;
  color: var(--cream-100);
  border-radius: 12px 12px 0 0;
  background:
    linear-gradient(90deg, rgba(216, 154, 59, 0.08), transparent 40%),
    var(--petrol-900);
}

.game-status {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.status-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #68b8ad;
  box-shadow: 0 0 0 5px rgba(104, 184, 173, 0.14);
}

.game-status p,
.game-status h2 {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-status p {
  color: rgba(255, 250, 240, 0.58);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-status h2 {
  margin-top: 3px;
  color: var(--cream-100);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
}

.audio-toggle {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: var(--cream-100);
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  line-height: 0;
  transition:
    transform 130ms ease,
    background-color 130ms ease;
}

.audio-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.audio-toggle:focus-visible {
  outline: 3px solid var(--cream-100);
  outline-offset: 3px;
}

.audio-toggle svg {
  display: block;
  grid-area: 1 / 1;
  width: 21px;
  height: 21px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  border: 4px solid var(--petrol-900);
  border-top: 0;
  background: var(--petrol-950);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--petrol-900);
  touch-action: none;
}

.game-loading {
  position: absolute;
  inset: 0;
  display: grid;
  margin: 0;
  padding: 30px;
  place-items: center;
  color: var(--cream-100);
  background: var(--petrol-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
}

.game-error {
  color: #ffd8c9;
}

.mission-note {
  display: flex;
  align-items: center;
  gap: 17px;
  min-height: 92px;
  padding: 16px 20px;
  border: 2px solid var(--petrol-900);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background:
    linear-gradient(90deg, rgba(216, 154, 59, 0.1), transparent 38%),
    var(--cream-100);
}

.mission-mark {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--cream-100);
  border-radius: 50%;
  background: var(--terracotta);
  box-shadow: 0 0 0 5px rgba(185, 95, 63, 0.12);
}

.mission-mark svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mission-note h3,
.mission-note p {
  margin: 0;
}

.mission-note h3 {
  color: var(--petrol-800);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
}

.mission-note p {
  max-width: 720px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  padding: 0 16px 26px;
}

.footer-links a {
  color: var(--petrol-800);
  font-size: 10px;
  font-weight: 700;
  opacity: 0.68;
  text-underline-offset: 3px;
}

.footer-links a:hover {
  opacity: 1;
}

@media (max-width: 780px) {
  .page-shell {
    padding-top: 16px;
  }

  .project-header {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 30px 24px 36px;
    border-radius: 22px 22px 10px 10px;
  }

  .project-header::after {
    display: none;
  }

  .field-notes {
    width: min(100%, 430px);
    transform: none;
  }

  .game-panel {
    padding: 10px;
    border-radius: 14px;
  }
}

@media (max-width: 520px) {
  body {
    background-size: auto, 420px 420px, auto;
  }

  .project-header {
    padding: 26px 18px 30px;
  }

  .project-intro h1 {
    font-size: clamp(36px, 13vw, 52px);
  }

  .project-lead {
    margin-top: 20px;
    font-size: 14px;
  }

  .game-panel {
    padding: 6px;
  }

  .game-toolbar {
    min-height: 58px;
    padding: 8px 10px 9px 13px;
  }

  .game-status p {
    display: none;
  }

  .game-status h2 {
    margin-top: 0;
    font-size: 15px;
  }

  .audio-toggle {
    width: 38px;
    height: 38px;
  }

  .game-frame {
    border-width: 3px;
    border-top: 0;
  }

  .mission-note {
    align-items: flex-start;
    gap: 13px;
    min-height: 0;
    padding: 14px;
  }

  .mission-mark {
    width: 42px;
    height: 42px;
  }

  .mission-note h3 {
    font-size: 16px;
  }

  .mission-note p {
    font-size: 11px;
  }
}

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