:root {
  --ink: #17333a;
  --water: #79d6d8;
  --water-deep: #3faab8;
  --grass: #83c66e;
  --reed: #d9c169;
  --wood: #a56638;
  --left: #f28c38;
  --right: #3b8adf;
  --panel: rgba(255, 252, 236, 0.9);
  --shadow: rgba(23, 51, 58, 0.22);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  overflow: hidden;
  background:
    radial-gradient(
      circle at 20% 15%,
      rgba(255, 245, 170, 0.9),
      transparent 26%
    ),
    linear-gradient(160deg, #bfeaa0 0%, #8bd0a0 38%, #67bfd0 100%);
}

button,
input {
  font: inherit;
}

little-boat-game {
  display: block;
  height: 100%;
}

.game-shell {
  position: relative;
  height: 100%;
  isolation: isolate;
}

.scene-host {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.scene-host canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(14px, 3vw, 28px);
}

game-lobby,
game-hud {
  pointer-events: auto;
}

.center-layer {
  pointer-events: none;
  display: grid;
  place-items: center;
}

.message-card {
  min-width: min(440px, calc(100vw - 32px));
  max-width: 540px;
  padding: 18px 20px;
  border: 2px solid rgba(23, 51, 58, 0.12);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 45px var(--shadow);
  text-align: center;
  transform: translateY(-3vh);
}

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

.lobby-card,
.hud {
  border: 2px solid rgba(23, 51, 58, 0.12);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 45px var(--shadow);
}

.lobby-card {
  width: min(420px, calc(100vw - 32px));
  padding: 22px;
  transform: translateY(-5vh);
}

.lobby-card h1 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 0.92;
  letter-spacing: 0;
  color: #114450;
}

.lobby-card label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.lobby-card input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 2px solid rgba(23, 51, 58, 0.18);
  border-radius: 6px;
  color: var(--ink);
  background: #fffdf1;
  outline: 0;
}

.lobby-card input:focus {
  border-color: var(--water-deep);
}

.lobby-card button {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: 6px;
  color: #fff8df;
  background: #d65b35;
  box-shadow: 0 5px 0 #9d3d26;
  cursor: pointer;
}

.lobby-card button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #9d3d26;
}

.lobby-card .status {
  min-height: 22px;
  margin: 14px 0 0;
}

.hud {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto minmax(96px, 0.7fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
}

.hud > div {
  min-width: 0;
}

.hud strong,
.hud span {
  display: block;
}

.hud strong {
  font-size: 1.02rem;
}

.hud span {
  font-size: 0.82rem;
}

.players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: min(360px, 42vw);
}

.player {
  position: relative;
  min-width: 112px;
  padding: 7px 10px 7px 42px;
  border-radius: 6px;
  color: var(--ink);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player small {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0;
  opacity: 0.88;
}

.player.left {
  background: var(--left);
}

.player.right {
  background: var(--right);
}

.player.self {
  outline: 3px solid #fff8df;
  box-shadow: 0 0 0 5px rgba(23, 51, 58, 0.2);
}

.row-state {
  min-width: 118px;
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 900;
  color: #fff8df;
  background: #114450;
}

.row-state.cooling {
  color: rgba(255, 248, 223, 0.72);
  background: #607a72;
}

.message-title {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 4vw, 2.6rem);
  letter-spacing: 0;
}

.message-meta {
  margin: 0;
  font-size: 1rem;
}

.row-again {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 14px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  color: #fff8df;
  background: #d65b35;
  box-shadow: 0 5px 0 #9d3d26;
  cursor: pointer;
}

.row-again:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #9d3d26;
}

@media (max-width: 700px) {
  .hud { grid-template-columns: 1fr 1fr; }
  .players { min-width: 0; }
  .player { min-width: 0; }
  .overlay {
    padding: 10px;
  }
}

.player b { display: block; overflow: hidden; text-overflow: ellipsis; }
.oar-icon {
  position: absolute;
  left: 17px;
  top: 11px;
  width: 6px;
  height: 24px;
  border-radius: 4px;
  background: #fff8df;
  transform: rotate(-35deg);
}
.oar-icon::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 11px;
  left: -3px;
  bottom: -2px;
  background: inherit;
  border-radius: 3px;
}
.row-feedback { position: relative; padding-bottom: 15px; }
.rhythm-cue { position: absolute; bottom: -1px; width: 100%; text-align: center; color: #735316; font-weight: 800; }
.sound-bar { position: relative; display: flex; justify-content: flex-end; align-items: center; }
.game-notice {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 9px 14px;
  border-radius: 6px;
  background: var(--panel);
  font-size: .88rem;
  font-weight: 700;
}
.mute-control {
  pointer-events: auto;
  padding: 9px 12px;
  border: 1px solid #17333a30;
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.mute-control:disabled { cursor: default; opacity: .7; }
.control-reminder { margin: 18px 0 0; font-size: .78rem; line-height: 1.7; letter-spacing: .06em; }
.summary table { width: 100%; margin-top: 14px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.summary th, .summary td { padding: 6px 9px; text-align: right; }
.summary th:first-child { text-align: left; }
.summary thead { font-size: .78rem; color: #45605b; }
.summary tbody tr + tr { border-top: 1px solid #17333a12; }

.eyebrow { font-size: .75rem; letter-spacing: .18em; font-weight: bold; }
button:focus-visible { outline: 3px solid #114450; outline-offset: 4px; }
