:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #effcf8;
  background: #031b25;
  --ink: #effcf8;
  --muted: #a9d0ce;
  --line: rgba(176, 236, 224, 0.24);
  --panel: rgba(4, 43, 54, 0.84);
  --coral: #ff7b55;
  --foam: #bdfaf0;
  --aqua: #1bc6bd;
  --felt: #1c6946;
  --felt-deep: #10432f;
  --walnut: #74401f;
  --walnut-dark: #3b2115;
  --ivory: #f5ecd8;
  --brass: #d3aa53;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(3, 35, 37, 0.74), rgba(2, 20, 24, 0.92)),
    url("/shared/game-room/v1/assets/room-backdrop-1536.webp") center / cover fixed,
    linear-gradient(180deg, #062f3c 0%, #031b25 58%, #020f17 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.18;
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.035) 3px 4px);
  pointer-events: none;
}

button,
canvas { -webkit-tap-highlight-color: transparent; }

button { font: inherit; }

main {
  width: min(76rem, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.25rem);
}

.game-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.eyebrow,
.panel-number,
.start-kicker {
  margin: 0 0 0.4rem;
  color: #80eee1;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.8rem, 8vw, 6rem);
  line-height: 0.82;
  letter-spacing: -0.075em;
  text-transform: uppercase;
  color: var(--ivory);
  text-shadow: 0 0.055em 0 var(--walnut), 0 0.1em 0 var(--walnut-dark), 0 0.16em 0 rgba(2, 14, 20, 0.72);
}

.lede {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: clamp(0.9rem, 2vw, 1.05rem);
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.45rem;
}

.header-actions button,
.start-card button,
.touch-controls button {
  min-height: 2.55rem;
  border: 1px solid rgba(245, 236, 216, 0.62);
  border-radius: 0.45rem;
  color: var(--ink);
  background: linear-gradient(180deg, #87512b, #663719);
  box-shadow: 0 0.18rem 0 var(--walnut-dark), 0 0.4rem 0.8rem rgba(14, 7, 3, 0.25);
  font-weight: 780;
  cursor: pointer;
}

.header-actions button {
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
}

button:hover,
button:focus-visible {
  border-color: var(--foam);
  outline: 2px solid var(--foam);
  outline-offset: 2px;
}

.game-shell {
  position: relative;
  overflow: hidden;
  border: 0.38rem solid var(--walnut);
  border-radius: 1.15rem;
  background: #063847;
  box-shadow: 0 0 0 0.14rem var(--brass), 0 0 0 0.28rem var(--walnut-dark), 0 2rem 5rem rgba(0, 8, 15, 0.48);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  outline: none;
  image-rendering: auto;
  touch-action: none;
}

.start-card {
  z-index: 5;
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  padding: clamp(1.25rem, 6vw, 4rem);
  text-align: center;
  background:
    linear-gradient(rgba(1, 23, 30, 0.18), rgba(1, 18, 27, 0.9)),
    url("og-contour.webp") center / cover;
}

.start-card[hidden] { display: none; }

.start-card::before {
  position: absolute;
  inset: 0;
  content: "";
  background: radial-gradient(circle at center, transparent 10%, rgba(0, 13, 21, 0.55) 80%);
}

.start-card > * { position: relative; }

.start-card h2 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.8rem);
  line-height: 0.9;
  letter-spacing: -0.055em;
  text-transform: uppercase;
  text-shadow: 0 0.08em 0 #002e3c, 0 0.16em 0 rgba(0, 13, 20, 0.7);
}

.start-card > p:not(.start-kicker):not(.start-controls) {
  width: min(38rem, 100%);
  margin: 1rem auto 1.2rem;
  color: #e4f8f5;
  line-height: 1.55;
  text-shadow: 0 1px 2px #00151c;
}

.start-card button {
  justify-self: center;
  min-height: 3.2rem;
  padding: 0.7rem 1.4rem;
  border-color: #e5fff8;
  color: #012c36;
  background: #d7fff5;
  font-size: 1rem;
}

.start-controls {
  margin: 0.9rem 0 0;
  color: #bde4df;
  font-size: 0.78rem;
}

.touch-controls {
  z-index: 4;
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  align-items: end;
  justify-content: space-between;
  padding: 0.8rem;
  pointer-events: none;
}

.touch-cluster {
  display: grid;
  grid-template-columns: repeat(3, 3.15rem);
  gap: 0.38rem;
  align-items: end;
}

.touch-cluster button {
  min-height: 3rem;
  padding: 0.35rem;
  border-color: rgba(231, 255, 250, 0.62);
  background: rgba(1, 38, 48, 0.76);
  font-size: 0.72rem;
  backdrop-filter: blur(4px);
  pointer-events: auto;
  touch-action: none;
}

.touch-cluster button[data-press="jump"] { grid-column: 1 / -1; }
.touch-actions { grid-template-columns: repeat(2, 4.25rem); }

.information-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(17rem, 0.75fr);
  gap: 1rem;
  margin-top: 1rem;
}

.panel {
  padding: clamp(1rem, 2.5vw, 1.4rem);
  border: 1px solid rgba(211, 170, 83, 0.56);
  border-radius: 0.75rem;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.035) 0 1px, transparent 1.5px),
    linear-gradient(180deg, rgba(28, 105, 70, 0.94), rgba(16, 67, 47, 0.96));
  background-size: 8px 8px, auto;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 0.35rem 0 var(--walnut-dark), 0 0.8rem 1.2rem rgba(0, 10, 9, 0.24);
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

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

dl { margin: 0; }

dl > div {
  display: grid;
  grid-template-columns: minmax(5.2rem, 0.7fr) minmax(8rem, 1.3fr);
  gap: 0.55rem;
  padding: 0.48rem 0;
  border-bottom: 1px solid rgba(170, 232, 221, 0.15);
}

dl > div:last-child { border-bottom: 0; }
dt { color: #8fcac6; font-size: 0.78rem; }
dd { margin: 0; color: #e8f7f4; font-size: 0.8rem; }

kbd {
  display: inline-block;
  min-width: 1.65rem;
  padding: 0.08rem 0.3rem;
  border: 1px solid rgba(190, 244, 234, 0.45);
  border-bottom-width: 2px;
  border-radius: 0.25rem;
  background: #092f38;
  font: 750 0.72rem/1.35 inherit;
  text-align: center;
}

.brief-panel p:not(.panel-number) {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.brief-panel p:last-child { margin-bottom: 0; }

.preservation-note {
  margin: 1rem 0 0;
  color: #8eb4b3;
  font-size: 0.78rem;
  text-align: center;
}

a { color: #a8fff1; }

@media (max-width: 850px) {
  .game-header { align-items: start; }
  .information-grid { grid-template-columns: 1fr; }
  .control-columns { grid-template-columns: 1fr 1fr; }
}

@media (hover: none), (pointer: coarse) {
  .touch-controls { display: flex; }
}

@media (max-width: 620px) {
  main { padding: 0.8rem; }
  .game-header { display: block; }
  .header-actions { margin-top: 0.9rem; }
  .header-actions button { flex: 1 1 0; }
  .start-card { place-content: start center; padding-top: 8%; }
  .start-card > p:not(.start-kicker):not(.start-controls) { font-size: 0.82rem; }
  .start-controls { display: none; }
  .control-columns { grid-template-columns: 1fr; }
  .touch-cluster { grid-template-columns: repeat(3, 2.8rem); }
  .touch-actions { grid-template-columns: repeat(2, 3.7rem); }
  .touch-cluster button { min-height: 2.7rem; }
}

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