:root {
  --bg: #eaf7f3;
  --surface: rgba(255, 255, 255, 0.92);
  --ink: #113b39;
  --muted: #4b6f6b;
  --line: rgba(17, 59, 57, 0.12);
  --accent: #0d9f8c;
  --shadow: 0 18px 40px rgba(18, 70, 81, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(39, 194, 182, 0.2), transparent 28%),
    radial-gradient(circle at right 20%, rgba(20, 137, 175, 0.16), transparent 32%),
    linear-gradient(180deg, #f2faf7 0%, #ddeff1 100%);
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  padding: 24px;
  max-width: 1640px;
  margin: 0 auto;
}

.game-card,
.info-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.game-card {
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.eyebrow,
.version {
  margin: 0;
  color: #167a73;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  margin-bottom: 6px;
}

.brand h1,
.info-card h2 {
  margin: 0;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #16c6b0);
  color: white;
  font-weight: 700;
}

.secondary-button {
  background: #eef6f4;
  color: var(--ink);
  font-weight: 700;
}

.small-button {
  padding: 10px 14px;
  font-size: 14px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.hud-item {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 16px;
}

.hud-item .label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.hud-item strong {
  font-size: 24px;
}

.stage-wrap {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(18, 63, 70, 0.18);
  background: #b1f0f4;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
}

.message-banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90%, 540px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(12, 93, 111, 0.9);
  color: white;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 24px rgba(12, 93, 111, 0.25);
}

.info-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.info-card {
  padding: 20px;
}

.info-card p {
  margin: 12px 0 0;
  line-height: 1.55;
  color: var(--muted);
}

.camera-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  margin-top: 14px;
  background: linear-gradient(180deg, #dbf8ff 0%, #c0eef6 100%);
  border: 1px solid rgba(17, 59, 57, 0.12);
}

.camera-video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transform: scaleX(-1);
  background: #d9f4fb;
}

.gesture-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(8, 68, 82, 0.84);
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.gesture-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.gesture-readout {
  font-size: 17px;
}

.legend-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.legend-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.legend-photo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  object-fit: cover;
}

.legend-item strong {
  display: block;
}

.legend-item span {
  color: var(--muted);
}

@media (max-width: 1200px) {
  .shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .shell {
    padding: 14px;
    gap: 16px;
  }

  .game-card {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
  }

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