.wheel-main {
  --diameter: clamp(242px, min(44vw, calc(100svh - var(--header-height) - 146px)), 570px);
  display: grid;
  grid-template:
    "menu wheel result" auto
    ". spin ." auto
    / minmax(0, 1fr) minmax(0, var(--diameter)) minmax(0, 1fr);
  column-gap: clamp(16px, 2.4vw, 36px);
  row-gap: clamp(16px, 2.6vh, 24px);
  align-content: center;
  align-items: center;
  min-height: calc(100svh - var(--header-height));
  padding-block: clamp(24px, 4vh, 46px);
}

.wheel-controls, .wheel-result {
  width: min(100%, 259px);
  padding: clamp(12px, 1.55vw, 22px);
}

.wheel-controls {
  grid-area: menu;
  justify-self: end;
  display: grid;
  gap: 12px;
}

.wheel-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #170e0ab3;
}
.wheel-modes label { position: relative; display: block; min-width: 0; }
.wheel-modes input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.wheel-modes span {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 780;
  letter-spacing: .07em;
  text-align: center;
}
.wheel-modes input:checked + span {
  border-color: var(--line-gold);
  color: var(--gold-light);
  background: linear-gradient(180deg, #9e6a406b, #67412870);
  box-shadow: inset 0 1px #fff2d320;
}
.wheel-modes input:focus-visible + span { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.wheel-modes input:disabled { cursor: default; }
.wheel-control-buttons { display: grid; gap: 8px; }
.wheel-control-buttons .button {
  width: 100%;
  min-height: 43px;
}

.wheel-stage { grid-area: wheel; display: grid; place-items: center; min-width: 0; }
.wheel-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(from -38deg, #8f5938, #dfaf74, #75472c, #b6844e, #613821, #bb8552, #f0bf82, #8f5938);
  box-shadow: 0 0 0 1px #d6aa767f, 0 0 0 4px #311e18, 0 0 0 5px #a573487d, 0 19px 44px #070403b3;
}
#wheel-canvas {
  display: block;
  width: 94%;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid #3a211a;
  border-radius: 50%;
  background: #38251c;
}
.wheel-hub {
  display: grid;
  place-items: center;
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(50px, 15.5%, 89px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid #dbab78bc;
  border-radius: 50%;
  background: radial-gradient(circle at 37% 29%, #563a2c 1%, #241611 70%);
  box-shadow: 0 4px 13px #0b0505a8, inset 0 1px #f3d6a377;
}
/* El lettering pesa más que la llama en el centro visual del logo. */
.wheel-hub .fogon-logo { --logo-width: 69%; transform: translate(-.65%, -5.5%); }
.wheel-pointer {
  position: absolute;
  z-index: 1;
  top: -3.2%;
  left: 50%;
  width: 5.1%;
  height: 9.8%;
  transform: translateX(-50%);
  clip-path: polygon(6% 0, 94% 0, 100% 18%, 50% 100%, 0 18%);
  background: linear-gradient(90deg, #743d2b, #efb586 38%, #c66d4e 61%, #642d20);
}

.spin-button {
  grid-area: spin;
  justify-self: center;
  min-width: min(220px, 100%);
  min-height: 48px;
  padding-inline: 26px;
  font-size: .91rem;
  letter-spacing: .092em;
}

.wheel-result {
  grid-area: result;
  justify-self: start;
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.result-text, .announcement-dialog .winner-title {
  max-inline-size: 100%;
  min-inline-size: 0;
  margin: 0;
  color: var(--gold-light);
  font: 700 clamp(1.9rem, 3.55vw, 2.75rem) / 1.05 var(--display);
  letter-spacing: .045em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.result-text[data-title-size="medium"] { font-size: clamp(1.65rem, 3vw, 2.25rem); }
.result-text[data-title-size="compact"] { font-size: clamp(1.5rem, 2.7vw, 1.85rem); }
.announcement-dialog .winner-title { margin-top: 5px; font-size: clamp(2rem, 5vw, 3.5rem); }
#songs-button { width: 100%; }
.wheel-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.wheel-stat { display: grid; gap: 3px; justify-items: center; font-size: .66rem; letter-spacing: .09em; }
.wheel-stat + .wheel-stat { border-left: 1px solid var(--line); }
.wheel-stat strong { color: var(--cream); font: 700 1.55rem / 1 var(--display); }
#wheel-note { max-width: 100%; overflow-wrap: anywhere; }

#result-dialog { width: min(720px, 100% - 24px); }
#result-dialog .section-label { margin-bottom: 7px; }
#song-choice { margin-top: 12px; }
#song-search { width: 100%; margin-top: 10px; }
#back-to-artists { margin-top: 8px; }
.song-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: min(46dvh, 448px);
  margin-top: 12px;
  padding: 3px;
  overflow: auto;
}
.song-choices button { display: grid; justify-content: stretch; gap: 3px; min-height: 57px; text-align: left; overflow-wrap: anywhere; }
.song-choices small { color: var(--muted); }
.song-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.lyrics-dialog { width: min(1450px, 100% - 20px); height: calc(100dvh - 20px); max-height: none; }
.lyrics-layout { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; gap: 11px; }
.lyrics-header { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: space-between; align-items: center; }
.lyrics-header h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.35rem); overflow-wrap: anywhere; }
#lyrics-artist { color: var(--muted); font-size: .8rem; letter-spacing: .05em; }
.lyrics-scroll {
  overflow: auto;
  padding: clamp(10px, 1.8vw, 22px);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #17100dcc;
}
.lyrics-text {
  --max-columns: 3;
  column-count: min(var(--columns, 3), var(--max-columns));
  column-gap: clamp(14px, 3vw, 40px);
  font-size: var(--lyric-size, 1.45rem);
  line-height: 1.34;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.lyrics-layout .dialog-actions { margin-top: 0; }

@media (max-width: 960px) {
  .wheel-main {
    width: min(580px, 100% - 2 * var(--gutter));
    min-height: 0;
    grid-template: "menu" "wheel" "spin" "result" / minmax(0, 1fr);
    row-gap: 17px;
    padding-block: 15px 22px;
  }
  .wheel-controls, .wheel-result { width: 100%; }
  .wheel-controls { grid-template-columns: minmax(160px, 1fr) minmax(0, 1.45fr); gap: 8px; }
  .wheel-control-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wheel-control-buttons .button { padding-inline: 5px; }
  .wheel-shell { width: min(94%, 480px, max(280px, 58svh)); }
  .wheel-stage { padding-top: 7px; }
  .wheel-result { gap: 9px; padding: 13px; }
  #songs-button, .wheel-stats { max-width: 244px; }
  .wheel-stats { padding-top: 8px; }
}

@media (max-width: 900px) { .lyrics-text { --max-columns: 2; } }

@media (max-width: 620px) {
  .wheel-controls { grid-template-columns: minmax(0, 1fr); }
  .wheel-control-buttons .button { min-height: 37px; }
  .wheel-modes span { min-height: 32px; }
  .wheel-shell { width: min(94%, 392px); }
  .spin-button { min-height: 43px; }
  .lyrics-header .game-actions { gap: 5px; }
  .lyrics-header .button { padding-inline: 7px; }
  #lyrics-columns { padding-inline: 4px; font-size: .72rem; }
  .lyrics-text { --max-columns: 1; }
  .song-choices { grid-template-columns: minmax(0, 1fr); }
  .song-fields { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
