:root {
  --bg: #0f1419;
  --panel: #161b22;
  --grid: #1c2230;
  --accent: #f7a8c4;       /* Moca's pink bow */
  --accent-dim: #d98aa8;
  --text: #e6edf3;
  --muted: #7d8590;
}

* { 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: 3px solid var(--accent);
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffd9ec 0%, #ffc2e0 60%, #ffb0d6 100%);
  box-shadow: 0 8px 30px rgba(247, 168, 196, 0.35);
}

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

/* HUD bar overlaid at the top of the board */
.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;       /* let canvas drags pass through; buttons re-enable */
  z-index: 3;
}

.bar h1 { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }

.scores { display: flex; align-items: center; gap: 8px; }
.score { font-size: 12px; color: var(--muted); text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.score strong { color: var(--text); margin-left: 3px; }

/* HUD buttons (mute / fullscreen / home) */
.mute {
  pointer-events: auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(22, 27, 34, 0.7);
  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 (start / game over) */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(15, 20, 25, 0.82);
  text-align: center;
  padding: 16px;
  cursor: pointer;
  transition: opacity 0.15s ease;
  z-index: 4;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
#overlay-title { font-size: 30px; font-weight: 700; }
#overlay-sub { font-size: 14px; color: var(--muted); }

/* Cat picker */
.pick {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(15, 20, 25, 0.92);
  padding: 20px;
  z-index: 5;
}
.pick.hidden { display: none; }
.pick-title { font-size: 20px; font-weight: 700; }
.pick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 320px;
}
.cat-card {
  background: var(--panel);
  border: 2px solid var(--grid);
  border-radius: 12px;
  padding: 10px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
  color: var(--text);
}
.cat-card:hover { transform: translateY(-2px); }
.cat-card.selected { border-color: var(--accent); background: #20262f; }
.cat-card canvas { width: 70px; height: 70px; }
.cat-card .cat-name { font-size: 13px; font-weight: 700; }
.cat-card .cat-desc { font-size: 10px; color: var(--muted); text-align: center; }

.pick-help {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}
.pick-help b { color: var(--accent); }

.play {
  background: var(--accent);
  color: #2a1620;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
  padding: 10px 28px;
  cursor: pointer;
  transition: opacity .15s, transform .15s;
}
.play:disabled { opacity: .4; cursor: not-allowed; }
.play:not(:disabled):hover { transform: translateY(-1px); }

/* On-screen touch controls: two paired groups, one per cat */
.touch {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: none;
  justify-content: space-between;
  padding: 12px 12px;
  z-index: 3;
  pointer-events: none;
}
.tgroup { display: flex; gap: 8px; }
.tbtn {
  pointer-events: auto;
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 1px solid var(--accent-dim);
  background: rgba(255, 255, 255, 0.55);
  color: #b14d7c;
  font-size: 20px;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
.tbtn:active { background: rgba(247, 168, 196, 0.7); border-color: var(--accent); }

@media (pointer: coarse) {
  .touch { display: flex; }
}

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