/* Phone portrait is the layout. A wide window uses the same head / body / tail
   column so the player, board, and full letter circle stay on screen. */

:root {
  color-scheme: dark;
  --gold: #ffe14a;
  --gold-deep: #f5b400;
  --ink: #1a1204;
  --line: #ffe14a;
}

html,
html.glow-app,
html.glow-app body,
html.glow-app body * {
  cursor: auto !important;
}

.glow-cursor {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  background-color: #1a0830 !important;
  background-image:
    radial-gradient(ellipse 130% 70% at 50% 118%, #00eaff 0%, #6a2cff 34%, #ff2d8a 58%, transparent 78%),
    radial-gradient(ellipse 80% 42% at 8% 100%, rgba(255, 50, 160, 0.95), transparent 64%),
    radial-gradient(ellipse 70% 40% at 94% 96%, rgba(90, 40, 255, 0.9), transparent 66%),
    linear-gradient(180deg, #12041c 0%, #2a1050 55%, #5a1878 100%) !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}

/* One column on every window: player, board, wheel. Sized to the viewport. */
html,
html[data-o="t"],
html[data-o="w"] {
  --eh: calc(72px + env(safe-area-inset-top, 0px)) !important;
  --et: calc(min(34dvh, 300px) + env(safe-area-inset-bottom, 0px)) !important;
}

body,
html[data-o="t"] body,
html[data-o="w"] body {
  display: grid !important;
  grid-template-areas:
    "hat"
    "head"
    "body"
    "tail" !important;
  grid-template-rows: var(--hat, 0px) var(--eh) minmax(0, 1fr) var(--et) !important;
  grid-template-columns: minmax(0, 1fr) !important;
  width: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}

html.music-off {
  --eh: 0px !important;
}

html.music-off lux-head {
  visibility: hidden;
  pointer-events: none;
}

/* Glow's vignette fades to solid black at the edges. Keep it off. */
html.glow-app::before,
html::before {
  opacity: 0 !important;
  background-image: none !important;
  content: none !important;
}

#glow-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
}

/* Portrait slots stay on screen. The wide slot is only the rotate hint. */
lux-tall,
lux-vert {
  display: contents !important;
}

lux-wide,
lux-horiz {
  display: none !important;
}

lux-head,
lux-body,
lux-tail {
  position: relative !important;
  z-index: 2 !important;
  background: transparent !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  justify-self: stretch !important;
  align-self: stretch !important;
}

lux-head {
  grid-area: head !important;
  height: var(--eh) !important;
  max-height: var(--eh) !important;
  overflow: hidden;
}

lux-body {
  grid-area: body !important;
  overflow: hidden;
}

lux-tail {
  grid-area: tail !important;
  max-height: var(--et) !important;
  overflow: hidden;
}

.music-slot,
.board-slot,
.wheel-slot {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.rotate-hint {
  margin: auto;
  text-align: center;
  color: #fff;
  font: 600 1.1rem/1.3 "Avenir Next", "Century Gothic", system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.music-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
}

.music-frame {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, 720px);
  min-height: 64px;
  padding: 6px 8px;
  border-radius: 16px;
  color: #fff;
  background:
    linear-gradient(rgba(10, 0, 18, 0.42), rgba(10, 0, 18, 0.42)) padding-box,
    linear-gradient(100deg, #ffb03a, #ff2f86 42%, #c15bff 78%, #ffe07a) border-box;
  border: 2px solid transparent;
  box-shadow:
    0 0 10px rgba(255, 120, 40, 0.45),
    0 0 22px rgba(255, 40, 140, 0.28);
}

lmp-player {
  display: block;
  width: min(100%, 720px);
  color: #fff;
}

lmp-art {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 8px;
  overflow: hidden;
  background: #3a2058;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.music-mid {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 46px;
}

.music-name {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  font-family: "Avenir Next", "Century Gothic", system-ui, sans-serif;
  line-height: 1.1;
}

lmp-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 0;
  color: #fff;
}

lmp-artist {
  flex: 0 0 auto;
  font-size: 10px;
  opacity: 0.82;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

lmp-eq {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  height: 28px;
  --lmp-accent: #7cf4ff;
}

lmp-prev,
lmp-next,
lmp-mute {
  --lmp-btn-size: clamp(36px, 10vw, 44px);
  --lmp-btn-bg: transparent;
  color: #fff;
  flex: 0 0 auto;
}

lmp-play {
  --lmp-btn-size: clamp(42px, 12vw, 48px);
  --lmp-btn-bg: rgba(255, 255, 255, 0.14);
  color: #fff;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35));
}

.music-close {
  flex: 0 0 auto;
  width: clamp(36px, 10vw, 44px);
  height: clamp(36px, 10vw, 44px);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font: 500 26px/1 system-ui, sans-serif;
  cursor: pointer;
}

.board-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px 0;
}

.grid {
  display: grid;
  gap: 7px;
  justify-content: center;
  align-content: center;
}

.tile {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(18, 8, 32, 0.92);
  border: 3px solid var(--line);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.65),
    0 0 10px rgba(255, 210, 60, 0.85);
  color: transparent;
  font: 800 22px/1 "Avenir Next", "Century Gothic", "Trebuchet MS", system-ui, sans-serif;
  user-select: none;
}

.tile.is-on {
  background: linear-gradient(#fff1a4, var(--gold) 42%, var(--gold-deep));
  color: var(--ink);
  border-color: #fff6c2;
  text-shadow: none;
  box-shadow:
    0 0 10px rgba(255, 210, 40, 0.95),
    0 0 22px rgba(255, 170, 20, 0.55);
}

.tile.is-new {
  animation: tile-in 280ms ease;
}

@keyframes tile-in {
  from { transform: scale(0.86); filter: brightness(1.6); }
  to { transform: none; filter: none; }
}

.chip-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.chip {
  margin: 0;
  min-width: 4.6rem;
  min-height: 34px;
  padding: 0.28rem 1rem;
  border-radius: 999px;
  background: linear-gradient(#fff0a0, #ffd000);
  color: var(--ink);
  font: 800 1.05rem/1.4 "Avenir Next", "Century Gothic", system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-align: center;
  box-shadow: 0 0 12px rgba(255, 200, 40, 0.85);
}

.chip.is-empty {
  visibility: hidden;
}

.count {
  margin: 0;
  color: #fff;
  font: 600 0.85rem/1 "Avenir Next", "Century Gothic", system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
}

.clear {
  margin: 0;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 2px solid #fff;
  color: #fff;
  font: 700 0.95rem/1 "Avenir Next", "Century Gothic", system-ui, sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 0 10px #ffd24a, 0 0 18px #ff2d95;
  box-shadow: 0 0 14px rgba(255, 210, 70, 0.55);
}

.wheel-slot {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  height: 100%;
  padding: 4px 8px 18px;
  container-type: size;
}

.wheel {
  position: relative;
  width: min(100cqmin, 100%);
  height: auto;
  aspect-ratio: 1;
  touch-action: none;
  user-select: none;
}

.wheel.is-bad {
  animation: shake 280ms ease;
}

@keyframes shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.wheel-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.disc {
  fill: rgba(8, 4, 18, 0.2);
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1.1;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.45));
}

#spokes line {
  stroke: rgba(28, 16, 40, 0.72);
  stroke-width: 0.7;
  stroke-linecap: round;
}

#sel {
  fill: none;
  stroke: #ffd24a;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 1px #fff6);
}

.ring-label {
  fill: #fff6d8;
  font-family: "Avenir Next", "Century Gothic", system-ui, sans-serif;
  font-size: 7.2px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-anchor: middle;
}

.nodes {
  position: absolute;
  inset: 0;
}

.node {
  position: absolute;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 50%;
  border: 2px solid rgba(255, 230, 160, 0.95);
  background: radial-gradient(circle at 40% 35%, #fff, #ffe7a2 55%, #f0c24a);
  color: var(--ink);
  font: 800 22px/1 "Avenir Next", "Century Gothic", system-ui, sans-serif;
  box-shadow:
    0 0 8px rgba(255, 210, 60, 0.9),
    0 0 16px rgba(255, 140, 40, 0.35);
  transform: translate(-50%, -50%);
  touch-action: none;
}

.node.is-hot {
  background: radial-gradient(circle at 40% 35%, #fff, #fff 20%, #ffbf1f);
  box-shadow: 0 0 12px #fff, 0 0 20px #ffd24a;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .tile.is-new,
  .wheel.is-bad {
    animation: none;
  }
}
