/* Player controller (phone) styles. Everything ≥44px touch targets. */

html, body { height: 100%; overscroll-behavior: none; }

.play-app {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
}

.play-header {
  display: flex;
  align-items: center;
  gap: var(--p-space-300);
  padding: var(--p-space-300) var(--p-space-400);
  border-bottom: 1px solid var(--p-color-border-secondary);
  min-height: 58px;
}
.play-header .score { margin-left: auto; font-weight: var(--p-font-weight-bold); font-size: var(--p-font-size-body-lg); }

.play-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--p-space-400);
  gap: var(--p-space-400);
  overflow-y: auto;
  padding-bottom: calc(var(--p-space-600) + env(safe-area-inset-bottom));
}

/* ---------- join screen ---------- */
.join-title { font-size: var(--p-font-size-heading-2xl); text-align: center; margin-top: var(--p-space-400); }
.join-input {
  width: 100%;
  min-height: 52px;
  padding: var(--p-space-300) var(--p-space-400);
  font-size: var(--p-font-size-body-lg);
  border-radius: var(--p-border-radius-200);
  border: 1px solid var(--p-color-border);
  background: var(--p-color-bg-surface);
  color: var(--p-color-text);
}
.join-input:focus { outline: 2px solid var(--p-color-border-focus); }

.team-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--p-space-300);
}
.team-pick__btn {
  min-height: 76px;
  border-radius: var(--p-border-radius-300);
  padding: var(--p-space-300);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--p-space-100);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
  font-weight: var(--p-font-weight-bold);
  border: 3px solid transparent;
  transition: transform var(--p-motion-duration-150) var(--p-motion-ease);
}
.team-pick__btn:active { transform: scale(0.96); }
.team-pick__btn[aria-pressed="true"] { border-color: #fff; box-shadow: var(--p-shadow-glow-brand); }
.team-pick__btn .members { font-size: var(--p-font-size-body-xs); font-weight: var(--p-font-weight-medium); opacity: 0.9; }

/* ---------- quiz answer buttons ---------- */
.answers {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-300);
  flex: 1;
  justify-content: center;
}
.answer-btn {
  min-height: 64px;
  border-radius: var(--p-border-radius-300);
  display: flex;
  align-items: center;
  gap: var(--p-space-400);
  padding: var(--p-space-300) var(--p-space-400);
  font-size: var(--p-font-size-body-lg);
  font-weight: var(--p-font-weight-semibold);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  text-align: left;
  transition: transform var(--p-motion-duration-150) var(--p-motion-ease),
              opacity var(--p-motion-duration-200) var(--p-motion-ease),
              box-shadow var(--p-motion-duration-200);
}
.answer-btn:active { transform: scale(0.97); }
.answer-btn .shape { font-size: 1.5rem; width: 2rem; text-align: center; flex-shrink: 0; }
.answer-btn.dimmed { opacity: 0.35; }
.answer-btn.picked { box-shadow: 0 0 0 3px #fff inset, var(--p-shadow-300); }
.answer-btn:disabled { cursor: default; }
/* background comes inline from the per-team code shapes (js/codes.js) */
.answer-btn { background: var(--p-color-bg-surface-secondary); }

/* per-team code badge floating on choice buttons (dilemma, penalties) */
.code-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f6f8ff;
  border: 2px solid rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  box-shadow: var(--p-shadow-200);
  pointer-events: none;
}
.big-choice > button { position: relative; }
.goal-zone { position: relative; }

/* ---------- status hero (big center message) ---------- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--p-space-400);
  text-align: center;
}
.hero__emoji { font-size: 4rem; line-height: 1; }
.hero__title { font-size: var(--p-font-size-heading-xl); }
.hero__points { font-family: var(--p-font-family-display); font-size: var(--p-font-size-heading-2xl); }
.hero--good .hero__points { color: var(--p-color-text-success); }
.hero--bad .hero__points { color: var(--p-color-text-critical); }

/* ---------- timer bar ---------- */
.timebar { height: 8px; border-radius: var(--p-border-radius-full); background: var(--p-color-bg-surface-secondary); overflow: hidden; flex-shrink: 0; }
.timebar__fill { height: 100%; background: linear-gradient(90deg, var(--p-color-bg-fill-brand), #38bdf8); border-radius: inherit; }
.timebar--hot .timebar__fill { background: linear-gradient(90deg, #ef4444, #ffca3a); }

/* ---------- minigame: racer grid ---------- */
.racer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--p-space-300); }
.racer-btn {
  min-height: 84px;
  border-radius: var(--p-border-radius-300);
  background: var(--p-color-bg-surface);
  border: 3px solid var(--p-color-border-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--p-space-100);
  padding: var(--p-space-200);
  font-weight: var(--p-font-weight-semibold);
  font-size: var(--p-font-size-body-sm);
  color: var(--p-color-text);
}
.racer-btn img { width: 48px; height: 48px; image-rendering: pixelated; }
.racer-btn[aria-pressed="true"] { border-color: var(--p-color-bg-fill-brand); background: var(--p-color-bg-surface-hover); box-shadow: var(--p-shadow-glow-brand); }

/* ---------- minigame: roulette ---------- */
.bet-tabs { display: flex; gap: var(--p-space-200); flex-wrap: wrap; }
.bet-tab {
  flex: 1;
  min-height: 44px;
  border-radius: var(--p-border-radius-full);
  background: var(--p-color-bg-surface);
  border: 1px solid var(--p-color-border);
  font-weight: var(--p-font-weight-semibold);
  color: var(--p-color-text-secondary);
  white-space: nowrap;
  padding: 0 var(--p-space-300);
}
.bet-tab[aria-selected="true"] { background: var(--p-color-bg-fill-brand); color: #fff; border-color: transparent; }

.num-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.num-btn {
  aspect-ratio: 1;
  min-height: 44px;
  border-radius: var(--p-border-radius-200);
  font-weight: var(--p-font-weight-bold);
  color: #fff;
  border: 2px solid transparent;
  font-size: var(--p-font-size-body-md);
}
.num-btn.red { background: #c0392b; }
.num-btn.black { background: #232633; border-color: #3a3f55; }
.num-btn.green { background: #0e8a4d; }
.num-btn[aria-pressed="true"] { border-color: #ffd700; box-shadow: 0 0 12px rgba(255, 215, 0, 0.5); }

.big-choice { display: grid; grid-template-columns: 1fr 1fr; gap: var(--p-space-300); }
.big-choice > button {
  min-height: 92px;
  border-radius: var(--p-border-radius-300);
  font-size: var(--p-font-size-body-lg);
  font-weight: var(--p-font-weight-bold);
  color: #fff;
  border: 3px solid transparent;
}
.big-choice > button[aria-pressed="true"] { border-color: #fff; }

/* ---------- roulette wallet & chips ---------- */
.rl-wallet {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--p-color-bg-surface);
  border: 1px solid var(--p-color-border-secondary);
  border-radius: var(--p-border-radius-300);
  padding: var(--p-space-200) var(--p-space-400);
}
.rl-wallet__money {
  font-family: var(--p-font-family-display);
  font-size: 1.5rem;
  color: var(--p-color-gold);
}
.rl-amount { display: flex; gap: var(--p-space-200); flex-wrap: wrap; justify-content: center; }
.chip-btn {
  min-width: 52px; min-height: 52px;
  border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, 0.5);
  background: var(--p-color-bg-surface-secondary);
  font-weight: var(--p-font-weight-bold);
  color: var(--p-color-text);
}
.chip-btn[aria-pressed="true"] { border-style: solid; border-color: var(--p-color-gold); background: rgba(255, 215, 0, 0.18); color: var(--p-color-gold); }
.chip-btn--allin { border-radius: var(--p-border-radius-full); padding: 0 var(--p-space-300); }

/* ---------- minigame: penalty goal picker ---------- */
.goal-pick {
  position: relative;
  aspect-ratio: 3 / 2;
  border-radius: var(--p-border-radius-300);
  background:
    linear-gradient(rgba(10, 60, 30, 0.35), rgba(10, 60, 30, 0.55)),
    repeating-linear-gradient(90deg, #1c7a43 0 40px, #17693a 40px 80px);
  border-top: 10px solid #f4f6ff;
  border-left: 10px solid #f4f6ff;
  border-right: 10px solid #f4f6ff;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--p-space-200);
  padding: var(--p-space-300);
}
.goal-zone {
  border-radius: var(--p-border-radius-200);
  border: 2px dashed rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 1.6rem;
  min-height: 44px;
}
.goal-zone[aria-pressed="true"] { background: rgba(255, 215, 0, 0.45); border-color: #ffd700; border-style: solid; }
.goal-zone:disabled { opacity: 0.5; }
.goal-zone--UL { grid-area: 1 / 1; }
.goal-zone--C  { grid-area: 1 / 2 / span 2 / span 1; }
.goal-zone--UR { grid-area: 1 / 3; }
.goal-zone--DL { grid-area: 2 / 1; }
.goal-zone--DR { grid-area: 2 / 3; }

.role-banner {
  text-align: center;
  font-family: var(--p-font-family-display);
  font-size: var(--p-font-size-heading-xl);
  padding: var(--p-space-300);
  border-radius: var(--p-border-radius-300);
  background: var(--p-color-bg-surface);
}

/* ---------- minigame: poker ---------- */
.po-hud {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--p-space-200);
  background: var(--p-color-bg-surface); border: 1px solid var(--p-color-border-secondary);
  border-radius: var(--p-border-radius-300); padding: var(--p-space-200) var(--p-space-300);
}
.po-hud__cell { display: flex; flex-direction: column; gap: 2px; font-size: var(--p-font-size-body-xs); min-width: 0; }
.po-hud__cell.center { text-align: center; align-items: center; }
.po-hud__cell.right { text-align: right; align-items: flex-end; }
.po-hud__stack { font-family: var(--p-font-family-display); font-size: 1.35rem; color: var(--p-color-gold); }
.po-hud__pot { font-weight: var(--p-font-weight-bold); font-size: var(--p-font-size-body-lg); white-space: nowrap; }
.po-hud__bet { font-weight: var(--p-font-weight-bold); font-size: var(--p-font-size-body-lg); }

.po-board { display: flex; justify-content: center; gap: 6px; }
.po-board .pcard, .po-board .pcard-slot { --card-w: min(15vw, 84px); }

.po-hole {
  display: flex; justify-content: center; align-items: center;
  margin: var(--p-space-200) 0;
  min-height: calc(min(36vw, 200px) * 1.48);
}
.po-hole .pcard { --card-w: min(36vw, 200px); }
.po-hole__slot--l { transform: rotate(-7deg) translate(4vw, 0); z-index: 1; }
.po-hole__slot--r { transform: rotate(7deg) translate(-4vw, 0); }

.po-handname { text-align: center; font-weight: var(--p-font-weight-bold); color: var(--p-color-gold); min-height: 1.4em; font-size: var(--p-font-size-body-lg); }
.po-status { text-align: center; color: var(--p-color-text-secondary); min-height: 1.4em; }
.po-status--turn {
  color: var(--p-color-gold); font-family: var(--p-font-family-display);
  font-size: var(--p-font-size-heading-lg);
  animation: po-turn 0.8s infinite alternate;
}
@keyframes po-turn { from { transform: scale(1); opacity: 0.85; } to { transform: scale(1.04); opacity: 1; } }

.po-actions { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: var(--p-space-300); margin-top: auto; }
.po-btn {
  min-height: 74px; border-radius: var(--p-border-radius-300);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 1.4rem; color: #fff; border: 3px solid transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: transform var(--p-motion-duration-150), opacity var(--p-motion-duration-200);
}
.po-btn span { font-size: var(--p-font-size-body-sm); font-weight: var(--p-font-weight-bold); letter-spacing: 0.04em; }
.po-btn:active { transform: scale(0.96); }
.po-btn:disabled { opacity: 0.3; cursor: default; }
.po-btn--fold { background: #7f1d1d; }
.po-btn--call { background: #15803d; }
.po-btn--raise { background: #b45309; }
.po-btn[aria-expanded="true"] { border-color: #fff; }

.po-raise {
  background: var(--p-color-bg-surface); border: 1px solid var(--p-color-border);
  border-radius: var(--p-border-radius-300); padding: var(--p-space-300);
  display: flex; flex-direction: column; gap: var(--p-space-300);
}
.po-raise__presets { display: grid; grid-template-columns: 1fr 1fr; gap: var(--p-space-200); }
.po-raise__presets .btn[aria-pressed="true"] { border-color: var(--p-color-gold); color: var(--p-color-gold); }
.po-raise input[type="range"] { width: 100%; accent-color: var(--p-color-gold); min-height: 44px; }
.po-raise__value { text-align: center; font-family: var(--p-font-family-display); font-size: 1.5rem; color: var(--p-color-gold); }

.po-result {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--p-space-200);
  padding: var(--p-space-300); border-radius: var(--p-border-radius-300);
  background: var(--p-color-bg-surface); border: 1px solid var(--p-color-border-secondary);
  animation: pop-in 0.4s var(--p-motion-ease-bounce);
}
.po-result--win { border-color: var(--p-color-gold); box-shadow: 0 0 24px rgba(255, 215, 0, 0.35); }
.po-result__emoji { font-size: 2.6rem; line-height: 1; }
.po-result__title { font-size: var(--p-font-size-heading-xl); }
.po-result--win .po-result__title { color: var(--p-color-gold); }
@keyframes pop-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- mini standings ---------- */
.mini-standings { display: flex; flex-direction: column; gap: var(--p-space-200); }
.mini-standings__row {
  display: flex; align-items: center; gap: var(--p-space-300);
  padding: var(--p-space-200) var(--p-space-300);
  border-radius: var(--p-border-radius-200);
  background: var(--p-color-bg-surface);
  border: 1px solid var(--p-color-border-secondary);
}
.mini-standings__row.mine { border-color: var(--p-color-border-focus); box-shadow: var(--p-shadow-glow-brand); }
.mini-standings__rank { font-weight: var(--p-font-weight-bold); width: 2rem; }
