@font-face {
  font-family: 'Press Start 2P';
  src: url('../fonts/pressstart2p.ttf') format('truetype');
  font-display: swap;
}

:root {
  --ink: #2a1f16;
  --cream: #f4e8d2;
  --wood: #8a5a33;
  --wood-d: #5f3c20;
  --green: #3f9e4d;
  --gold: #e6b83a;
  --red: #c23b2e;
  --blue: #2e62c2;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #1a1410; }
body { font-family: 'Press Start 2P', monospace; color: var(--cream); }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.hidden { display: none !important; }

/* ---------- panels ---------- */
.panel {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 20px; text-align: center;
  background: radial-gradient(ellipse at center, rgba(20,14,8,0.42) 0%, rgba(20,14,8,0.78) 100%);
}
.panel h2 { font-size: clamp(16px, 3.4vw, 30px); color: var(--gold); text-shadow: 3px 3px 0 rgba(0,0,0,.55); letter-spacing: 2px; }

/* ---------- logo ---------- */
#logo { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.logo-voxel {
  font-size: clamp(13px, 2vw, 20px); letter-spacing: 10px; color: var(--cream);
  background: var(--wood); padding: 8px 16px 8px 24px; border: 3px solid var(--wood-d);
  box-shadow: 0 4px 0 var(--wood-d), inset 0 2px 0 rgba(255,255,255,.25);
}
.logo-main {
  font-size: clamp(26px, 7vw, 64px); color: var(--gold);
  text-shadow: 4px 4px 0 #7a2c1c, 8px 8px 0 rgba(0,0,0,.4);
  letter-spacing: 4px;
}
.logo-sub { font-size: clamp(8px, 1.3vw, 12px); color: #d8c8a8; opacity: .9; }

/* ---------- buttons ---------- */
.title-buttons { display: flex; flex-direction: column; gap: 14px; }
.big-btn {
  font-family: inherit; font-size: clamp(11px, 1.8vw, 16px); cursor: pointer;
  color: var(--ink); background: var(--cream); border: 0;
  padding: 16px 26px; min-width: min(420px, 78vw);
  box-shadow: 0 6px 0 #b8a888, 0 10px 14px rgba(0,0,0,.45);
  transition: transform .06s, box-shadow .06s;
}
.big-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #b8a888, 0 12px 16px rgba(0,0,0,.45); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #b8a888; }
.big-btn.go { background: var(--gold); box-shadow: 0 6px 0 #a8842a, 0 10px 14px rgba(0,0,0,.45); }
.big-btn.go:hover { box-shadow: 0 8px 0 #a8842a, 0 12px 16px rgba(0,0,0,.45); }
.small-btn {
  font-family: inherit; font-size: 10px; cursor: pointer; color: var(--cream);
  background: transparent; border: 2px solid #7a6a50; padding: 10px 16px;
}
.small-btn:hover { border-color: var(--cream); }
#attract-note { font-size: 9px; color: #a89878; margin-top: 8px; animation: pulse 2.2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- setup ---------- */
.setup-row { display: flex; flex-direction: column; gap: 10px; align-items: center; width: 100%; }
.setup-row > label { font-size: 10px; color: #cbb890; letter-spacing: 2px; }
.card-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: 92vw; }
.card {
  font-family: inherit; cursor: pointer; border: 3px solid #4a3a28;
  background: rgba(42,31,22,.85); color: var(--cream);
  padding: 12px 14px; font-size: 10px; line-height: 1.7;
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 96px;
}
.card:hover { border-color: #a89060; }
.card.sel { border-color: var(--gold); background: rgba(80,58,26,.92); box-shadow: 0 0 0 2px rgba(230,184,58,.35), 0 4px 10px rgba(0,0,0,.4); }
.card .face { font-size: 16px; }
.card .desc { font-size: 7px; color: #b8a888; }
.card .swatch { width: 34px; height: 22px; border: 2px solid rgba(255,255,255,.5); box-shadow: 0 3px 0 rgba(0,0,0,.4); }
.setup-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
.key-cap { background: rgba(0,0,0,.3); padding: 2px 6px; font-size: 9px; }

/* ---------- HUD ---------- */
#hud { position: absolute; top: 0; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
#scorebug {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  background: rgba(26,18,10,.82); border: 3px solid var(--wood-d);
  padding: 10px 18px; font-size: clamp(14px, 2.4vw, 22px);
  box-shadow: 0 4px 0 rgba(0,0,0,.4);
}
#scorebug .team-tag { font-size: 9px; color: #cbb890; letter-spacing: 1px; }
#scorebug .score-sep { color: #8a7a60; }
#score0 { color: var(--gold); } #score1 { color: var(--gold); }
#matchclock { margin-top: 8px; font-size: 8px; color: #b8a888; letter-spacing: 2px; }
#matchclock.matchpoint { color: #ff9c5a; animation: pulse 1s infinite; }
#hintbar {
  position: absolute; top: calc(100vh - 44px); left: 50%; transform: translateX(-50%);
  font-size: 8px; color: rgba(244,232,210,.75); letter-spacing: 1px; white-space: nowrap;
  background: rgba(26,18,10,.6); padding: 8px 14px; border: 2px solid rgba(95,60,32,.6);
  transition: opacity .6s;
}

/* ---------- banner ---------- */
#banner {
  position: absolute; top: 26%; left: 50%; transform: translate(-50%,-50%);
  text-align: center; pointer-events: none; z-index: 5;
}
#banner-text {
  font-size: clamp(24px, 6vw, 56px); color: var(--gold);
  text-shadow: 4px 4px 0 #7a2c1c, 8px 8px 0 rgba(0,0,0,.45); letter-spacing: 3px;
}
#banner-sub { margin-top: 12px; font-size: clamp(9px, 1.6vw, 14px); color: var(--cream); text-shadow: 2px 2px 0 rgba(0,0,0,.6); }
#banner.zoom #banner-text { animation: bzoom .5s ease-out; }
@keyframes bzoom { 0% { transform: scale(.2); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ---------- pause ---------- */
.pause-controls { font-size: 8px; line-height: 2.4; color: #cbb890; background: rgba(0,0,0,.35); padding: 14px 22px; border: 2px solid #4a3a28; }
.pause-opts { display: flex; gap: 18px; font-size: 9px; color: #b8a888; flex-wrap: wrap; justify-content: center; }
.pause-opts label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.pause-opts input { accent-color: var(--gold); width: 16px; height: 16px; cursor: pointer; }

/* ---------- game over ---------- */
#go-score { font-size: clamp(20px, 4vw, 34px); color: var(--cream); }
#go-detail { font-size: 9px; color: #b8a888; line-height: 2; }

/* ---------- touch UI ---------- */
#touch-ui { position: absolute; inset: 0; pointer-events: none; }
#touch-ui > * { pointer-events: auto; }
#stick-zone { position: absolute; left: 4vw; bottom: 6vh; width: 34vw; max-width: 210px; height: 34vh; max-height: 230px; }
#stick {
  position: absolute; inset: 0; border: 3px solid rgba(244,232,210,.35); border-radius: 18px;
  background: rgba(26,18,10,.35);
}
#stick::before { content: 'SLIDE'; position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 8px; color: rgba(244,232,210,.6); }
#stick-nub {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 12px;
  transform: translate(-50%,-50%); background: rgba(230,184,58,.85); border: 3px solid #a8842a;
}
#touch-btns { position: absolute; right: 3vw; bottom: 6vh; display: grid; grid-template-columns: repeat(2, auto); gap: 10px; align-items: end; }
#touch-btns button {
  font-family: inherit; border: 3px solid rgba(244,232,210,.4); color: var(--cream);
  background: rgba(26,18,10,.55); border-radius: 12px; font-size: 11px;
  width: 74px; height: 62px; touch-action: none;
}
#tb-kick { width: 92px !important; height: 92px !important; background: rgba(194,59,46,.75) !important; font-size: 13px !important; }
#tb-lift { background: rgba(62,98,194,.6) !important; }
#tb-pause { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; width: 44px; height: 40px; font-family: inherit; font-size: 12px; background: rgba(26,18,10,.6); color: var(--cream); border: 2px solid rgba(244,232,210,.35); border-radius: 8px; }

#mute-btn {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px;
  width: 44px; height: 40px; font-family: inherit; font-size: 15px; cursor: pointer;
  background: rgba(26,18,10,.6); color: var(--cream); border: 2px solid rgba(244,232,210,.35); border-radius: 8px;
}
#mute-btn.off { color: #777; text-decoration: line-through; }
body.touch #mute-btn { right: 64px; }

#rotate-note {
  display: none; position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  font-size: 8px; color: rgba(244,232,210,.65); letter-spacing: 1px; pointer-events: none;
}
@media (orientation: portrait) and (max-width: 640px) { body.touch #rotate-note { display: block; } }

@media (max-width: 700px) {
  .card { min-width: 76px; padding: 9px 8px; font-size: 8px; }
  .card .desc { display: none; }
  .pause-controls { font-size: 7px; }
  #hintbar { font-size: 7px; white-space: normal; text-align: center; max-width: 86vw; }
}
