:root {
  --orange: #FF8A3D;
  --ink: #3A2215;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1B100D;
  color: #fff8ee;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button {
  font-family: inherit;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

[hidden] { display: none !important; }

.stage {
  position: fixed;
  inset: 0;
  max-width: 560px;
  margin: 0 auto;
  overflow: hidden;
  background: #24140e;
}

.table-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  z-index: 1;
}

.hud {
  position: absolute;
  z-index: 4;
  left: 12px;
  right: 12px;
  top: calc(var(--sat) + 8px);
  pointer-events: none;
}

.hud-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.player-chip,
.round-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(28, 12, 6, 0.55);
  color: #fff6ea;
  font-size: 12px;
  font-weight: 700;
}

.chip-bottom {
  position: absolute;
  left: 0;
  top: calc(100vh - var(--sab) - 44px);
}

.pause-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff8ee;
  background: rgba(28, 12, 6, 0.55);
}

.pause-btn .mp-icon { width: 20px; height: 20px; }

.scoreboard {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 3px 0 rgba(90, 30, 0, 0.45);
}

.scoreboard em {
  font-style: normal;
  opacity: 0.7;
  font-size: 28px;
}

.round-banner,
.pause-layer,
.result-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(24, 10, 6, 0.42);
}

.sheet {
  width: min(78vw, 320px);
  padding: 22px 18px 16px;
  border-radius: 18px;
  text-align: center;
  background: #fff6ea;
  color: var(--ink);
}

.sheet-kicker {
  margin: 0;
  font-size: 13px;
  color: #9a6848;
}

.sheet h2 {
  margin: 6px 0 0;
  font-size: 26px;
}

.sheet-score {
  margin: 8px 0 14px;
  font-size: 32px;
  font-weight: 900;
}

.sheet-score em { font-style: normal; margin: 0 6px; }

.btn {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 800;
}

.btn-primary { background: var(--orange); color: #fff; }
.btn-ghost { background: #ffe4cc; color: #8a3e12; }

.round-banner {
  background: transparent;
  pointer-events: none;
  text-align: center;
  color: #fff8ee;
  text-shadow: 0 3px 0 rgba(90, 30, 0, 0.4);
}

.round-banner span { display: block; font-size: 14px; }
.round-banner b { display: block; font-size: 36px; }

.flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.28);
}

.live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.start-layer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--sab) + 18px);
  z-index: 9;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.start-layer .btn {
  width: min(72%, 240px);
  margin: 0;
  color: #fff;
  pointer-events: auto;
  box-shadow: 0 4px 0 #a5471b, 0 8px 20px rgba(24, 10, 6, 0.45);
}

.pause-btn:disabled { opacity: 0.45; cursor: default; pointer-events: none; }
