:root {
  color-scheme: dark;
  --ink: #e7f6ff;
  --muted: #9bb9cf;
  --cyan: #79e3ec;
  --pink: #ffb3c2;
  --navy: #091d32;
  --line: #9ed6e340;
  --font: "DM Sans", sans-serif;
  --pixel: "VT323", monospace;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: #081d32;
  color: var(--ink);
  font: 14px/1.5 var(--font);
}
body {
  overflow-x: hidden;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  background: #15334b;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 12px 16px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: #23465e;
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}
a {
  color: inherit;
  text-decoration: none;
}
input {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #071c31bd;
  padding: 13px 15px;
  color: var(--ink);
  min-width: 0;
  width: 100%;
  outline: none;
}
input::placeholder {
  color: #9bb9cfb0;
}
input:focus {
  border-color: var(--cyan);
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hud {
  position: relative;
  z-index: 3;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  gap: 16px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 21px var(--pixel);
  letter-spacing: 1.5px;
  text-shadow: 0 1px 8px #071320;
}
.hud-right {
  display: flex;
  align-items: center;
  gap: 9px;
}
.icon-button {
  padding: 7px 10px;
  min-width: 36px;
  background: #0b263b7a;
  font: 22px var(--pixel);
  border-color: #b9e9f02a;
}
.icon-button span {
  font-size: 13px;
  color: var(--muted);
}
.quiet {
  background: transparent;
  border: 0;
  padding: 7px;
  color: var(--muted);
  font: 15px var(--pixel);
  letter-spacing: 1px;
}
.quiet:hover {
  background: #a0eaff12;
  color: var(--cyan);
}
main {
  position: relative;
  z-index: 2;
  min-height: calc(100svh - 76px);
  pointer-events: none;
}
.screen {
  pointer-events: auto;
}
.welcome {
  width: min(400px, calc(100% - 40px));
  margin: clamp(1rem, 4vh, 3rem) auto 0 max(5vw, calc((100vw - 1050px) / 2));
  padding-bottom: 40px;
}
.eyebrow {
  font: 14px var(--pixel);
  letter-spacing: 2.5px;
  color: var(--cyan);
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font: clamp(76px, 12vw, 124px)/.76 var(--pixel);
  letter-spacing: -2px;
  text-shadow: 3px 3px 0 #42758c;
  margin: 12px 0 14px;
}
.welcome-copy {
  color: #cee5f0;
  font-size: 15px;
}
.entry-panel {
  margin-top: 22px;
  padding: 20px;
  display: grid;
  gap: 8px;
}
.analytics-banner {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b2337f2;
}
.analytics-banner h2 {
  font-size: 14px;
}
.analytics-banner p {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.analytics-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.analytics-actions button {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 7px 10px;
}
.analytics-settings {
  margin-top: 16px;
}
.analytics-settings summary {
  cursor: pointer;
  color: var(--muted);
}
.entry-panel,
.party-panel,
.customizer,
.round-prompt,
.answer-dock,
.reveal-panel,
.results {
  background: #0b2337f2;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.entry-panel label {
  font-weight: 700;
}
.entry-panel label[for="roomCode"] {
  margin-top: 5px;
}
.entry-panel input {
  min-height: 46px;
  font-size: 16px;
}
#roomCode {
  min-height: 54px;
  font: 30px var(--pixel);
  letter-spacing: .25em;
  text-transform: uppercase;
}
#partyCodeHint {
  color: var(--muted);
  font-size: 12px;
}
#joinButton, #createButton {
  min-height: 48px;
  width: 100%;
}
#joinButton { margin-top: 5px; }
#createButton { background: transparent; }
#createButton:hover { background: #23465e; }
.entry-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}
.entry-divider::before, .entry-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}
.field-label {
  display: block;
  font: 13px var(--pixel);
  letter-spacing: 1px;
  color: var(--muted);
}
.primary {
  background: #a0e8ec;
  color: #113147;
  border: 1px solid #d0ffff;
  font: 20px var(--pixel);
  letter-spacing: 1.5px;
  padding: 13px 18px;
  box-shadow: 0 3px 0 #477e91;
}
.primary:hover {
  background: #d3fcff;
}
.primary > span {
  float: right;
}
.status {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  min-height: 18px;
}
.status.error {
  color: #ffc3cd;
}
.status:empty {
  display: none;
}
.water-label {
  position: fixed;
  bottom: 20px;
  left: 28px;
  color: #9ac2d0;
  font: 12px var(--pixel);
  letter-spacing: 2px;
  z-index: 2;
  pointer-events: none;
}
.connection {
  position: fixed;
  bottom: 15px;
  right: 20px;
  z-index: 8;
  font-size: 12px;
  max-width: 330px;
  padding: 10px 16px;
  background: #102f43e8;
  border: 1px solid var(--line);
}
.lobby {
  display: grid;
  grid-template-columns: minmax(0, 360px);
  justify-content: end;
  gap: 14px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 4vw 70px;
}
.lobby-top h2 {
  font: 46px/.95 var(--pixel);
}
.customizer {
  width: 100%;
  padding: 13px 18px;
}
.customizer summary {
  cursor: pointer;
  font-weight: 600;
}
.swatches {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 13px 0 17px;
}
.swatch {
  width: 27px;
  height: 27px;
  min-width: 27px;
  border: 2px solid transparent;
  padding: 0;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px #ffffff40;
}
.swatch:hover {
  background: var(--swatch);
}
.swatch[aria-pressed="true"] {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
.accessory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.accessory-row > span {
  font: 17px var(--pixel);
}
#accentColor {
  width: 100%;
  height: 30px;
  padding: 3px;
  margin-top: 9px;
  cursor: pointer;
}
.party-panel {
  padding: 18px;
}
.party-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  gap: 8px;
}
#partyCode {
  font: 40px/1 var(--pixel);
  color: var(--cyan);
  letter-spacing: .12em;
}
#copyCode { padding: 9px 12px; }
#partyCount { margin-top: 13px; }
.member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #bde9f014;
}
.member .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #fff1;
}
.member-name {
  flex: 1;
}
.member small {
  color: var(--muted);
  font: 14px var(--pixel);
}
.party-panel > .primary {
  margin-top: 24px;
  width: 100%;
  font-size: 17px;
  padding: 12px 8px;
}
.party-panel > .status {
  text-align: center;
  margin-top: 13px;
}
.round {
  padding: 10px 24px 90px;
}
.round-prompt {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: 12px 17px;
}
.round-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.round-heading .eyebrow {
  font-size: 16px;
}
#timer {
  font: 27px/1.1 var(--pixel);
  border: 1px solid var(--line);
  background: #0b263b;
  min-width: 44px;
  text-align: center;
  color: var(--cyan);
  border-radius: 5px;
}
#timer.urgent {
  color: var(--pink);
  border-color: var(--pink);
}
.question-panel { margin-top: 4px; }
.question-panel h2 {
  font: clamp(27px, 4vw, 40px)/1.02 var(--pixel);
  margin: 4px 0 6px;
}
.question-panel p {
  font-size: 12px;
  color: var(--muted);
}
.question-panel p:empty { display: none; }
.answer-dock {
  position: fixed;
  bottom: max(45px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(590px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: #092238ee;
  border: 1px solid var(--line);
  padding: 18px;
  backdrop-filter: blur(10px);
}
.answer-dock input {
  background: #061729;
  font-size: 16px;
}
.answer-dock .status {
  grid-column: 1/-1;
  text-align: center;
}
.reveal-panel {
  position: fixed;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 32px));
  padding: 20px 24px;
  background: #092238f2;
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  max-height: 45svh;
  overflow: auto;
}
#revealSummary {
  font: 24px var(--pixel);
  text-align: center;
  color: var(--cyan);
  margin-bottom: 10px;
}
.answer-row,
.final-row {
  display: flex;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid #bde9f01c;
  padding: 9px 0;
}
.answer-row .answer-text {
  flex: 1;
  overflow-wrap: anywhere;
}
.answer-row strong {
  font-weight: 500;
  font-size: 13px;
}
.answer-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.answer-row .rise {
  color: var(--cyan);
  font: 24px var(--pixel);
  white-space: nowrap;
}
.answer-row.wrong .rise {
  color: var(--pink);
}
.reveal-panel > .primary {
  display: block;
  margin: 15px auto 0;
  min-width: 200px;
}
.reveal-panel > .status {
  text-align: center;
  margin-top: 10px;
}
.results {
  position: relative;
  width: min(460px, calc(100% - 32px));
  margin: 6vh auto 80px;
  padding: 30px;
  background: #0b2337ed;
  border: 1px solid var(--line);
  text-align: center;
  backdrop-filter: blur(10px);
}
.results h2 {
  font: 50px/1 var(--pixel);
  margin: 15px 0;
}
.results > p {
  color: var(--muted);
  font-size: 13px;
}
.results > .primary {
  margin-top: 25px;
  width: 100%;
}
.final-row {
  text-align: left;
}
.final-row .place {
  font: 25px var(--pixel);
  color: var(--cyan);
  width: 26px;
}
.final-row .final-name {
  flex: 1;
}
.final-row .metres {
  font: 25px var(--pixel);
  color: var(--cyan);
}
#finalScores {
  margin-top: 20px;
}
dialog {
  color: var(--ink);
  background: #0c273c;
  border: 1px solid #72b9cc;
  max-width: 530px;
  width: calc(100% - 32px);
  max-height: 90svh;
  overflow: auto;
  padding: 34px;
  border-radius: 4px;
  box-shadow: 0 30px 100px #0007;
}
dialog::backdrop {
  background: #03111bbb;
  backdrop-filter: blur(6px);
}
dialog h2 {
  font: 48px/0.95 var(--pixel);
  margin: 15px 0 22px;
}
dialog ol {
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
}
dialog li {
  padding-left: 5px;
  margin-bottom: 15px;
}
dialog li strong {
  color: var(--ink);
}
dialog p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
  margin: 15px 0 24px;
}
dialog > .primary {
  width: 100%;
}
.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
}
@media (max-width: 800px) {
  .hud {
    padding: 0 20px;
    height: 64px;
  }
  .wordmark {
    font-size: 18px;
  }
  .hud-right {
    gap: 5px;
  }
  .water-label {
    left: 18px;
    font-size: 10px;
  }
  .round {
    padding-top: 8px;
  }
}
@media (max-width: 580px) {
  .hud {
    padding: 0 14px;
    height: 60px;
    gap: 8px;
  }
  .wordmark {
    font-size: 16px;
    letter-spacing: 1px;
  }
  .wordmark img {
    width: 22px;
    height: 22px;
  }
  .icon-button {
    font-size: 20px;
    min-width: 30px;
    padding: 6px 7px;
  }
  .hud-right .quiet {
    font-size: 12px;
  }
  .welcome {
    margin: 8px auto 0;
    width: min(400px, calc(100% - 28px));
  }
  .welcome-intro { text-align: center; }
  h1 { font-size: 76px; }
  .welcome-copy { font-size: 13px; }
  .entry-panel { margin-top: 15px; padding: 15px; }
  .eyebrow { font-size: 12px; letter-spacing: 1.5px; }
  .lobby {
    justify-content: center;
    padding: 10px 14px 54px;
  }
  .lobby-top h2 { font-size: 36px; }
  .party-panel { padding: 14px; }
  .swatches { gap: 12px; margin: 12px 0; }
  .accessory-row { margin-bottom: 9px; }
  .member {
    padding: 10px 0;
  }
  .party-panel > .primary {
    margin-top: 15px;
  }
  .round {
    padding: 6px 12px 85px;
  }
  .round-prompt { padding: 9px 11px; }
  .round-heading .eyebrow { font-size: 13px; }
  .answer-dock {
    bottom: 30px;
    padding: 12px;
    gap: 8px;
    grid-template-columns: 1fr;
  }
  .answer-dock input {
    font-size: 16px;
    padding: 12px;
  }
  .answer-dock .primary {
    font-size: 19px;
    padding: 10px;
  }
  .answer-dock .status {
    font-size: 11px;
  }
  .reveal-panel {
    bottom: 25px;
    max-height: 39svh;
    padding: 15px;
  }
  .answer-row {
    gap: 10px;
    padding: 7px 0;
  }
  .answer-row strong {
    font-size: 12px;
  }
  .answer-row .rise {
    font-size: 22px;
  }
  .results {
    margin-top: 4vh;
    padding: 24px;
  }
  .water-label {
    bottom: 9px;
    font-size: 9px;
    letter-spacing: 1px;
  }
  .connection {
    bottom: 30px;
    left: 16px;
    right: 16px;
    max-width: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}

/* Projected nameplates follow their penguin in the perspective scene. */
.scene-labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.scene-player-label {
  position: absolute;
  transform: translate(-50%, -100%);
  text-align: center;
  font: 16px/1.15 var(--pixel);
  color: #e5f7ff;
  text-shadow:
    0 2px 4px #032134,
    0 0 8px #032134;
  max-width: 125px;
  white-space: nowrap;
}
.scene-player-label > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 5px;
  background: #071e3180;
  border-radius: 2px;
}
.scene-player-label small {
  display: block;
  font: 14px var(--pixel);
  color: #b3d9e5;
  margin-bottom: 3px;
}
.scene-player-label.local {
  color: #99fff1;
}
.scene-player-label .scene-locked {
  width: max-content;
  margin: 0 auto 3px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #9effda;
  color: #103a35;
  text-shadow: none;
}
.view-controls {
  position: fixed;
  bottom: 14px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 4;
}
.view-controls > span {
  font: 12px var(--pixel);
  letter-spacing: 1.5px;
  color: #add2e0;
  margin-right: 7px;
}
.view-controls button {
  font: 22px var(--pixel);
  padding: 3px 10px;
  background: #092438a8;
  border-color: #b9e9f02a;
  min-width: 32px;
  min-height: 32px;
}
#world[data-renderer="webgl"] {
  cursor: grab;
}
#world.orbiting {
  cursor: grabbing;
}
@media (max-width: 580px) {
  .view-controls {
    right: 12px;
    bottom: 5px;
    gap: 3px;
  }
  .view-controls > span {
    display: none;
  }
  .view-controls button {
    padding: 2px 8px;
    min-width: 30px;
    min-height: 28px;
  }
  .scene-player-label {
    font-size: 13px;
    max-width: 85px;
  }
  .scene-player-label small {
    font-size: 12px;
  }
  .water-label {
    max-width: calc(100% - 125px);
  }
}
/* Empty scene space remains draggable beneath the game UI. */
.lobby,
.round {
  pointer-events: none;
}
.customizer,
.party-panel,
.answer-dock,
.reveal-panel {
  pointer-events: auto;
}

.altitude {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: #a6f4ec;
  font-size: 11px;
  font-weight: 700;
}
.altitude-readout { display: flex; align-items: baseline; gap: 6px; }
.altitude strong { color: #f2fffe; font: 1.7rem/.85 var(--pixel); }
#heightDelta { color: #fbe59f; font: 1.4rem/1 VT323, monospace; }
.altitude-gauge { width: min(15vw, 6rem); height: .4rem; position: relative; background: #1c4056; border-radius: 1rem; }
.altitude-gauge i { display: block; width: var(--pillar); height: 100%; background: #a6f4ec; border-radius: inherit; }
.altitude-gauge b { position: absolute; top: -.12rem; bottom: -.12rem; left: var(--tide); width: 3px; background: #ffbf96; border-radius: 2px; }
.altitude.danger, .scene-player-label.eliminated small { color: #ffc2a8; }
@media (max-width: 420px) {
  .altitude-gauge { display: none; }
}
body[data-screen="welcome"] .water-label,
body[data-screen="lobby"] .water-label { display: none; }
