:root {
  --bg: #15101a;
  --panel: #211826;
  --grid: #2e2236;
  --accent: #ff7bd5;        /* hot pink */
  --accent-dim: #d957ab;
  --gold: #ffcf6b;
  --runway: #b48bff;
  --text: #f3e9f5;
  --muted: #a78fb0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
}

.board {
  position: relative;
  width: min(440px, 94vw);
  aspect-ratio: 3 / 4;
  max-height: 86vh;
  border: 2px solid var(--grid);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #2a1830 0%, #1d1326 60%, #150e1c 100%);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* HUD bar */
.bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  pointer-events: none;
  z-index: 3;
}
.bar h1 { font-size: 14px; font-weight: 700; letter-spacing: 0.5px; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.scores { display: flex; align-items: center; gap: 8px; }
.score { font-size: 11px; color: var(--muted); text-shadow: 0 1px 3px rgba(0,0,0,.7); max-width: 120px; }

.mute {
  pointer-events: auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(33, 24, 38, 0.75);
  border: 1px solid var(--grid);
  color: var(--text);
  border-radius: 8px;
  font-size: 14px; line-height: 1;
  padding: 5px 7px;
  cursor: pointer;
  text-decoration: none;
}
.mute:hover { border-color: var(--accent); }

/* Overlays / panels */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(21, 16, 26, 0.82);
  text-align: center;
  padding: 16px;
  transition: opacity 0.15s ease;
  z-index: 4;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
#overlay-title { font-size: 26px; font-weight: 700; color: var(--gold); }
#overlay-sub { font-size: 13px; color: var(--text); max-width: 300px; white-space: pre-line; }

.pick {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(21, 16, 26, 0.95);
  padding: 18px;
  z-index: 5;
  overflow-y: auto;
}
.pick.hidden { display: none; }
.pick-title { font-size: 19px; font-weight: 700; color: var(--accent); }

.pick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 320px;
}
.char-card {
  background: var(--panel);
  border: 2px solid var(--grid);
  border-radius: 12px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  color: var(--text);
}
.char-card:hover { transform: translateY(-2px); }
.char-card.selected { border-color: var(--accent); background: #2c2034; }
.char-card canvas { width: 64px; height: 80px; }
.char-card .c-name { font-size: 12px; font-weight: 700; }
.char-card .c-desc { font-size: 9px; color: var(--muted); text-align: center; }

/* Shop panel */
.shop-row {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  justify-content: center;
}
.shop-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.shop-label { font-size: 11px; color: var(--muted); }

.type-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  width: 100%;
}
.type-btn {
  background: var(--panel);
  border: 2px solid var(--grid);
  border-radius: 9px;
  color: var(--text);
  font-size: 12px;
  padding: 7px 8px;
  cursor: pointer;
  transition: border-color .15s, transform .12s;
  text-align: left;
}
.type-btn:hover { transform: translateX(2px); }
.type-btn.selected { border-color: var(--accent); background: #2c2034; }

.colour-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}
.colour-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--grid);
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  justify-self: center;
}
.colour-swatch:hover { transform: translateY(-2px); }
.colour-swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent); }

.shop-actions { display: flex; gap: 10px; }

.play {
  background: var(--accent);
  color: #2a0e21;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  padding: 9px 22px;
  cursor: pointer;
  transition: opacity .15s, transform .15s;
}
.play:disabled { opacity: .4; cursor: not-allowed; }
.play:not(:disabled):hover { transform: translateY(-1px); }
.play.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--grid); }

/* Room */
.room-card {
  background: linear-gradient(135deg, #ffe7f6, #ffd0ee);
  color: #5a1240;
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  border: 2px solid var(--accent);
  min-width: 220px;
}
.room-card b { font-size: 16px; }

/* Action buttons */
.touch {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 12px 14px;
  z-index: 3;
  pointer-events: none;
  gap: 6px;
}
.tgroup { display: flex; gap: 8px; pointer-events: none; }
.tbtn {
  pointer-events: auto;
  border-radius: 50%;
  border: 2px solid var(--grid);
  background: rgba(33, 24, 38, 0.85);
  color: var(--text);
  font-weight: 700;
  font-size: 20px;
  width: 54px; height: 54px;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
  touch-action: none;
  box-shadow: 0 3px 0 rgba(0,0,0,.35);
}
.tbtn:active { transform: translateY(2px); box-shadow: none; }
.tbtn.action { width: 64px; height: 64px; font-size: 26px; background: var(--accent); border-color: var(--accent-dim); color: #2a0e21; }
.tbtn.small { width: 46px; height: 46px; font-size: 18px; }
.tbtn.runway { background: var(--runway); border-color: #8f6bd6; color: #1c1030; }

.foot { font-size: 11px; color: var(--muted); }
