:root {
  font-family: "Inter", system-ui, sans-serif;
  background-color: #080c17;
  color: #f0f6ff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle, #151836 0%, #060913 60%);
  overflow: hidden;
}
main {
  width: 100%;
  max-width: 1200px;
  padding: clamp(8px, 2vmin, 16px);
}
.board-shell {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.9);
}
.rotate-overlay.hidden {
  display: none;
}
.rotate-card {
  width: min(320px, 84vw);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(4, 8, 20, 0.95);
  padding: 20px 16px;
  text-align: center;
}
.rotate-icon {
  font-size: 2rem;
  margin-bottom: 6px;
}
.rotate-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.rotate-text {
  font-size: 0.9rem;
  color: #dbe7ff;
}
.splash-screen {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(94vw, 960px);
  max-height: 74vh;
  aspect-ratio: 960 / 680;
  display: grid;
  place-items: center;
  z-index: 20;
  background: radial-gradient(circle at 50% 40%, rgba(22, 35, 80, 0.55) 0%, rgba(0, 0, 0, 0.94) 68%);
  border-radius: 24px;
}
.splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}
.splash-card {
  width: min(560px, 82%);
  min-height: 340px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(0, 0, 0, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
}
.splash-card h1 {
  margin: 0 0 10px 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.2;
}
.splash-card p {
  margin: 0;
  color: #dbe7ff;
}
#board-canvas {
  width: min(94vw, 960px);
  max-height: 74vh;
  height: auto;
  aspect-ratio: 960 / 680;
  border-radius: 24px;
  background: #02030a;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.9), inset 0 0 20px #0f172a;
}
.overlay-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(470px, 80vw);
  background: rgba(0, 0, 0, 0.78);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: none;
  text-align: center;
  z-index: 2;
  transition: background-color 220ms ease, border-color 220ms ease, opacity 220ms ease;
}
.overlay-panel.is-spinning {
  background: rgba(0, 0, 0, 0.36);
  border-color: rgba(255, 255, 255, 0.08);
}
.overlay-panel.is-spinning .instructions,
.overlay-panel.is-spinning .coin-stats,
.overlay-panel.is-spinning .status-text,
.overlay-panel.is-spinning .center-controls {
  opacity: 0.38;
  transition: opacity 220ms ease;
}
.jackpot {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.instructions {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #cbd5f5;
  margin-bottom: 12px;
  opacity: 0.58;
  transition: opacity 240ms ease, max-height 240ms ease, margin 240ms ease;
  max-height: 44px;
  overflow: hidden;
}
.instructions.instructions-hidden {
  opacity: 0;
  max-height: 0;
  margin-bottom: 0;
}
.coin-stats {
  margin: 0 auto 12px auto;
  width: min(280px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(7, 12, 32, 0.7);
  overflow: hidden;
}
.coin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 0.9rem;
  color: #dbe7ff;
}
.coin-row + .coin-row {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.coin-row strong {
  color: #fff;
}
.status-text {
  font-size: 0.9rem;
  color: #f8fafc;
  margin-bottom: 16px;
  white-space: pre-line;
}
.center-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.control-icons {
  display: flex;
  gap: 12px;
}
#start-btn {
  width: 200px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #f97316, #ec4899);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(236, 72, 153, 0.35);
}
#start-btn:disabled {
  filter: grayscale(70%);
  cursor: not-allowed;
  box-shadow: none;
}
.icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: rgba(10, 16, 36, 0.82);
  color: #f3f7ff;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#mute-btn .mute-slash {
  opacity: 0;
}
#mute-btn.is-muted .mute-slash {
  opacity: 1;
}
.icon-btn:hover {
  border-color: rgba(255, 255, 255, 0.45);
}
.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 700px) {
  .overlay-panel {
    width: min(320px, 84vw);
    padding: 16px;
  }
}

@media (max-width: 950px) and (max-height: 500px) {
  body {
    align-items: flex-start;
    background: radial-gradient(circle at 50% 50%, rgba(46, 90, 220, 0.18) 0%, #04060f 72%);
  }

  main {
    height: 90dvh;
    padding: 4px;
  }

  .board-shell {
    min-height: 90dvh;
  }

  #board-canvas {
    width: min(98vw, 960px);
    max-height: 90dvh;
  }

  .splash-screen {
    width: min(98vw, 960px);
    max-height: 90dvh;
  }

  .overlay-panel {
    width: min(520px, 92vw);
    padding: 12px 14px;
    border-radius: 16px;
  }

  .instructions {
    font-size: 0.8rem;
    margin-bottom: 6px;
    max-height: 30px;
  }

  .coin-stats {
    width: 100%;
    margin-bottom: 8px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .coin-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 8px;
    font-size: 0.76rem;
  }

  .coin-row + .coin-row {
    border-top: none;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
  }

  .status-text {
    font-size: 0.8rem;
    margin-bottom: 10px;
  }

  .center-controls {
    gap: 8px;
  }

  #start-btn {
    width: 152px;
    padding: 9px;
    font-size: 0.9rem;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }
  .icon-btn svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 740px) and (orientation: portrait) {
  :root {
    background-color: #000;
  }

  body {
    min-height: 100dvh;
    align-items: flex-start;
    background: #000;
    overflow: hidden;
  }

  main {
    position: fixed;
    inset: 0;
    max-width: none;
    width: 100vw;
    height: 90dvh;
    padding: 0;
  }

  .board-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  #board-canvas {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }

  .splash-screen {
    width: 100%;
    height: 100%;
    max-height: none;
    left: 0;
    top: 0;
    transform: none;
    border-radius: 0;
  }

  .splash-card {
    min-height: 420px;
  }

  .overlay-panel {
    top: 58%;
    width: min(220px, 56vw);
    min-height: min(285px, 56vh);
    padding: 10px 10px;
    border-radius: 14px;
    text-align: center;
  }

  .coin-stats {
    width: 100%;
    display: block;
    margin-bottom: 10px;
  }

  .coin-row {
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 8px;
    font-size: 0.7rem;
  }

  .coin-row + .coin-row {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
  }

  .coin-row strong {
    font-size: 0.8rem;
  }

  .status-text {
    font-size: 0.72rem;
    margin-bottom: 10px;
    min-height: 2.1em;
    text-align: center;
  }

  .center-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #start-btn {
    width: 100%;
    padding: 8px;
    font-size: 0.8rem;
  }

  .control-icons {
    justify-content: center;
    gap: 12px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 740px) and (max-height: 430px) {
  main {
    padding: 2px;
  }

  #board-canvas {
    max-height: 94vh;
  }

  .splash-screen {
    max-height: 94vh;
  }

  .overlay-panel {
    width: min(300px, 60vw);
    padding: 8px 10px;
    border-radius: 14px;
    height: min(460px, 85vh);
    text-align: left;
  }

  .instructions {
    display: none;
  }

  .coin-stats {
    margin-bottom: 6px;
  }

  .coin-row {
    padding: 4px 6px;
    font-size: 0.68rem;
    flex-direction: column;
    align-items: flex-start;
  }

  .coin-row strong {
    font-size: 0.76rem;
  }

  .status-text {
    font-size: 0.74rem;
    margin-bottom: 7px;
  }

  .center-controls {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  #start-btn {
    width: 100%;
    padding: 8px;
    font-size: 0.8rem;
  }

  .center-controls .icon-btn {
    width: 44px;
    height: 44px;
    align-self: center;
  }
}
