:root {
  --bg-top: #fff7d8;
  --bg-bottom: #ffd0c8;
  --panel: rgba(255, 249, 239, 0.88);
  --panel-strong: #fff3e1;
  --ink: #4c2a3d;
  --ink-soft: #7a5067;
  --accent: #ff6f91;
  --accent-deep: #db4b74;
  --mint: #9ee2c0;
  --mint-deep: #4f9b85;
  --gold: #ffc857;
  --shadow: 0 18px 40px rgba(117, 54, 83, 0.18);
  --border: 3px solid rgba(76, 42, 61, 0.15);
  --pixel-border: 4px solid #4c2a3d;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 32%),
    radial-gradient(circle at 85% 10%, rgba(255, 200, 87, 0.3), transparent 18%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto auto 0 0;
  width: 220px;
  height: 220px;
  pointer-events: none;
  opacity: 0.28;
  z-index: 0;
}

body::before {
  top: 4rem;
  left: -2rem;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 111, 145, 0.65), transparent 16%),
    radial-gradient(circle at 60% 55%, rgba(158, 226, 192, 0.7), transparent 15%),
    radial-gradient(circle at 42% 78%, rgba(255, 200, 87, 0.8), transparent 13%);
  animation: drift 9s ease-in-out infinite alternate;
}

body::after {
  right: -3rem;
  bottom: 2rem;
  left: auto;
  background:
    radial-gradient(circle at 25% 45%, rgba(255, 111, 145, 0.5), transparent 14%),
    radial-gradient(circle at 65% 30%, rgba(158, 226, 192, 0.8), transparent 12%),
    radial-gradient(circle at 55% 70%, rgba(255, 255, 255, 0.9), transparent 14%);
  animation: drift 7s ease-in-out infinite alternate-reverse;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero,
.panel {
  border: var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 100px 1fr 100px;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 2.5rem 1.75rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.16)),
    linear-gradient(145deg, rgba(255, 111, 145, 0.15), rgba(158, 226, 192, 0.22));
}

.hero__content {
  text-align: center;
}

.eyebrow,
.section-tag,
.hud-label {
  margin: 0;
  font-family: "Courier New", monospace;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
}

.eyebrow,
.section-tag {
  color: var(--accent-deep);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
}

h1 {
  margin-top: 0.8rem;
  font-size: clamp(2.6rem, 6vw, 4.7rem);
  line-height: 0.95;
}

.hero__lede {
  width: min(44rem, 100%);
  margin: 1rem auto 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.hero__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.hero__chips span,
.reason-card,
.instructions {
  background: rgba(255, 249, 239, 0.82);
  border: var(--border);
}

.hero__chips span {
  padding: 0.65rem 1rem;
  border-radius: 999px;
  font-size: 0.95rem;
}

.hero__decor {
  aspect-ratio: 1;
  border-radius: 24px;
  border: var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.45)),
    repeating-linear-gradient(
      45deg,
      rgba(255, 111, 145, 0.25) 0,
      rgba(255, 111, 145, 0.25) 8px,
      rgba(255, 200, 87, 0.25) 8px,
      rgba(255, 200, 87, 0.25) 16px
    );
  position: relative;
}

.hero__decor::before,
.hero__decor::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
}

.hero__decor::before {
  width: 52px;
  height: 52px;
  background: var(--accent);
  clip-path: polygon(50% 15%, 84% 0, 100% 28%, 100% 55%, 50% 100%, 0 55%, 0 28%, 16% 0);
}

.hero__decor::after {
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
}

main {
  display: grid;
  gap: 1.5rem;
}

.panel {
  padding: 1.5rem;
  background: var(--panel);
}

.panel--game {
  margin-top: clamp(6rem, 12vw, 11rem);
  min-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.panel__heading {
  max-width: 44rem;
  margin-bottom: 1.4rem;
}

.panel__heading p:last-child {
  margin-bottom: 0;
  line-height: 1.7;
  color: var(--ink-soft);
}

.message-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1.2rem;
}

.message-layout--single {
  grid-template-columns: 1fr;
}

.letter-form,
.letter-preview,
.game-shell,
.game-copy {
  background: var(--panel-strong);
  border: var(--border);
  border-radius: 24px;
  padding: 1rem;
}

.letter-form__actions,
.game-actions,
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.button,
.control-button {
  border: none;
  cursor: pointer;
  font: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button {
  padding: 0.85rem 1.15rem;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(76, 42, 61, 0.15);
}

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

.button--primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: white;
}

.button--secondary {
  background: linear-gradient(180deg, #fff8f0, #f5ddcf);
  color: var(--ink);
}

.letter-form--locked {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.85rem;
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 247, 239, 0.94), rgba(255, 231, 220, 0.9));
}

.letter-form--locked p,
.letter-form--locked h3 {
  margin: 0;
}

.locked-label {
  font-family: "Courier New", monospace;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  color: var(--accent-deep);
}

.code-hint {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 16px;
  border: 2px dashed rgba(76, 42, 61, 0.2);
  background: rgba(255, 255, 255, 0.7);
}

.code-hint code {
  font-family: "Courier New", monospace;
  font-size: 0.92rem;
}

.letter-preview {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.letter-preview__top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: "Courier New", monospace;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.message-notice {
  display: grid;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border-radius: 20px;
  border: 2px solid rgba(219, 75, 116, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 111, 145, 0.18), rgba(255, 200, 87, 0.18));
  animation: pulsePop 420ms ease;
}

.notification-controls {
  display: grid;
  gap: 0.65rem;
  padding: 0.95rem 1rem;
  border-radius: 20px;
  border: 2px solid rgba(76, 42, 61, 0.12);
  background: rgba(255, 255, 255, 0.6);
}

.notification-controls p {
  margin: 0;
  line-height: 1.6;
  color: var(--ink-soft);
}

.message-notice p {
  margin: 0;
  line-height: 1.6;
}

.message-gate {
  display: grid;
  gap: 0.7rem;
  padding: 1.3rem;
  border-radius: 20px;
  border: 2px dashed rgba(219, 75, 116, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.96), rgba(255, 237, 227, 0.92));
}

.message-gate h3,
.message-gate p {
  margin: 0;
}

.message-gate__tag {
  font-family: "Courier New", monospace;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  color: var(--accent-deep);
}

.letter-preview__paper {
  flex: 1;
  min-height: 100%;
  padding: 1.4rem;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 247, 232, 0.95)),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 29px,
      rgba(219, 75, 116, 0.08) 29px,
      rgba(219, 75, 116, 0.08) 30px
    );
  border: 2px dashed rgba(76, 42, 61, 0.2);
}

.message-choice-row {
  display: flex;
  gap: 0.85rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.message-choice {
  min-width: 120px;
  justify-content: center;
  text-decoration: none;
}

.letter-preview__paper p {
  margin: 0;
  white-space: pre-wrap;
  font-size: 1.05rem;
  line-height: 1.9;
}

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

.reason-card {
  padding: 1.2rem;
  border-radius: 22px;
}

.reason-card p {
  margin-bottom: 0;
  line-height: 1.7;
  color: var(--ink-soft);
}

.arcade-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem;
  align-items: start;
}

.arcade-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-radius: 24px;
  border: var(--border);
  background:
    linear-gradient(180deg, rgba(255, 247, 239, 0.96), rgba(255, 236, 228, 0.88));
  box-shadow: 0 12px 28px rgba(76, 42, 61, 0.1);
}

.arcade-card__header {
  display: grid;
  gap: 0.4rem;
}

.game-note {
  margin: 0;
  line-height: 1.65;
  color: var(--ink-soft);
}

.game-shell {
  background:
    linear-gradient(180deg, #fff7ef, #ffe1da),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent);
}

.game-screen {
  padding: 0.9rem;
  border-radius: 22px;
  background: #37222d;
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.08);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border: var(--pixel-border);
  image-rendering: pixelated;
  background: #fff4d9;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.game-hud--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hud-card {
  padding: 0.8rem 0.9rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: var(--border);
}

.hud-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.4rem;
}

.game-copy {
  display: grid;
  gap: 1rem;
}

.instructions {
  padding: 1rem 1.05rem;
  border-radius: 22px;
}

.instructions p {
  margin-bottom: 0;
  line-height: 1.7;
  color: var(--ink-soft);
}

.control-button {
  min-width: 92px;
  padding: 1rem 1.4rem;
  border-radius: 22px;
  background: linear-gradient(180deg, var(--mint), var(--mint-deep));
  color: #18372f;
  font-size: 1.4rem;
  box-shadow: 0 10px 18px rgba(79, 155, 133, 0.2);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.control-button--wide {
  width: 100%;
}

.controls--triple .control-button {
  flex: 1;
}

.controls--shark-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.controls--shark-pad .control-button {
  min-width: 0;
  width: 100%;
}

.controls-spacer {
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes drift {
  from {
    transform: translateY(0) rotate(0deg);
  }

  to {
    transform: translateY(18px) rotate(8deg);
  }
}

@keyframes pulsePop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 72px 1fr 72px;
  }

  .message-layout,
  .arcade-grid,
  .reasons-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 1rem;
  }

  .hero,
  .panel {
    border-radius: 22px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 1.5rem 1.1rem;
  }

  .hero__decor {
    display: none;
  }

  h1 {
    font-size: clamp(2.2rem, 12vw, 3.3rem);
  }

  .panel {
    padding: 1.1rem;
  }

  .panel--game {
    margin-top: 4.5rem;
    min-height: auto;
    justify-content: flex-start;
  }

  .letter-preview__top {
    flex-direction: column;
    gap: 0.4rem;
  }

  .game-hud {
    grid-template-columns: 1fr;
  }

  .control-button {
    flex: 1;
  }
}
