/* =====================================================================
   /wheel/ — 霓虹摩天轮
   ---------------------------------------------------------------------
   The page is one full-bleed WebGL canvas with UI pinned to the edges.
   The camera framing (see wheel.js fitCamera) reserves exactly the space
   these panels occupy, so the wheel is never hidden behind them.
   ===================================================================== */

.wh-page {
  background: #040718;
  color: #eef3ff;
  overflow: hidden;
}

/* site.css constrains every <main> to min(1120px, 100% - 32px). */
main.wh-shell {
  height: 100dvh;
  margin: 0;
  max-width: none;
  padding: 0;
  position: relative;
  width: 100%;
}

/* Fixed so the stage is the viewport regardless of the <main> ancestor. */
.wh-stage {
  inset: 0;
  overflow: hidden;
  position: fixed;
}

/* Explicit size on the canvas itself: without it the drawing buffer feeds
   back into the layout size and grows every frame. */
.wh-canvas {
  display: block;
  height: 100%;
  inset: 0;
  position: absolute;
  touch-action: none;
  width: 100%;
}

/* Boot line. wheel.js hides it once the scene is up — so if it is still on
   screen, the module never executed. */
.wh-boot {
  color: rgba(200, 214, 246, 0.5);
  font-size: 12px;
  left: 50%;
  letter-spacing: 0.16em;
  margin: 0;
  pointer-events: none;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.wh-boot[hidden] {
  display: none;
}

/* CSS2D label layer: DOM chips pinned to each pod, above the canvas but below
   all of the panels. */
.wh-labels {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  z-index: 4;
}

.wh-tag {
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  background: rgba(8, 16, 42, 0.76);
  border: 1px solid rgba(126, 234, 255, 0.45);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32);
  color: #eaf6ff;
  font-family: "SF Mono", "Cascadia Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  max-width: 132px;
  overflow: hidden;
  padding: 3px 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The operator's own pod is highlighted. */
.wh-tag.is-mine {
  background: rgba(224, 44, 116, 0.88);
  border-color: #ffa3d6;
  color: #ffffff;
}

.wh-tag[hidden] {
  display: none;
}

/* ---------- top bar ---------- */
.wh-bar {
  align-items: center;
  background: linear-gradient(180deg, rgba(9, 15, 44, 0.72), rgba(9, 15, 44, 0));
  display: flex;
  gap: 12px;
  justify-content: space-between;
  left: 0;
  padding: max(12px, env(safe-area-inset-top, 0px)) 16px 14px;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 6;
}

.wh-brand {
  align-items: center;
  color: #dfe8ff;
  display: inline-flex;
  font-size: 12px;
  gap: 8px;
  letter-spacing: 0.14em;
}

.wh-brand b {
  background: #ff4fbe;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(255, 79, 190, 0.8);
  height: 7px;
  width: 7px;
}

.wh-bar-actions {
  display: flex;
  gap: 8px;
}

/* Background music toggle. The dot is the state: lit while playing. */
.wh-music {
  align-items: center;
  display: inline-flex;
  gap: 7px;
}

/* `hidden` has to win over the inline-flex above. */
.wh-music[hidden] {
  display: none;
}

.wh-music__dot {
  background: #7eeaff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(126, 234, 255, 0.8);
  display: block;
  height: 6px;
  width: 6px;
}

.wh-music.is-off {
  color: rgba(226, 236, 255, 0.6);
}

.wh-music.is-off .wh-music__dot {
  background: rgba(200, 214, 246, 0.35);
  box-shadow: none;
}

/* ---------- shared panel look ---------- */
.wh-panel,
.wh-modal__card {
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  background: linear-gradient(180deg, rgba(22, 48, 110, 0.62), rgba(8, 20, 60, 0.7));
  border: 1px solid rgba(117, 158, 255, 0.42);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 44px rgba(0, 0, 0, 0.32);
}

.wh-panel {
  padding: 14px;
  position: absolute;
  z-index: 6;
}

.wh-panel--control {
  left: 18px;
  top: 50%;
  transform: translateY(-46%);
  width: 244px;
}

.wh-panel--stats {
  right: 18px;
  top: 50%;
  transform: translateY(-46%);
  width: 214px;
}

.wh-panel__title {
  color: #9fb4f0;
  font-size: 11px;
  letter-spacing: 0.18em;
  margin: 0 0 12px;
}

.wh-sub {
  color: #8fa4e0;
  font-size: 11px;
  letter-spacing: 0.14em;
  margin: 14px 0 8px;
}

/* ---------- buttons ---------- */
.wh-btn {
  appearance: none;
  background: linear-gradient(180deg, rgba(37, 92, 178, 0.9), rgba(17, 44, 104, 0.92));
  border: 1px solid rgba(113, 173, 255, 0.55);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  color: #eaf3ff;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  min-height: 38px;
  padding: 0 16px;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.wh-btn:hover {
  border-color: rgba(126, 234, 255, 0.85);
  color: #ffffff;
}

.wh-btn:focus-visible {
  outline: 2px solid #7eeaff;
  outline-offset: 2px;
}

.wh-btn--run {
  background: linear-gradient(180deg, #ff5c66, #d91e48);
  border-color: #ff9ca6;
  box-shadow: 0 0 18px rgba(255, 48, 89, 0.5);
  flex: 1 1 auto;
}

.wh-btn--ghost {
  background: transparent;
  width: 100%;
}

.wh-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.wh-row {
  display: flex;
  gap: 8px;
}

.wh-row .wh-btn {
  flex: 1 1 0;
}

/* ---------- cabin grid ---------- */
.wh-cabins {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wh-cabin {
  appearance: none;
  background: rgba(40, 74, 150, 0.42);
  border: 1px solid rgba(109, 149, 255, 0.3);
  border-radius: 7px;
  color: #cfdcff;
  cursor: pointer;
  display: grid;
  font-family: "SF Mono", "Cascadia Mono", ui-monospace, monospace;
  font-size: 10px;
  gap: 1px;
  line-height: 1.25;
  padding: 6px 4px;
  text-align: center;
}

.wh-cabin b {
  color: #ffffff;
  font-size: 11px;
}

.wh-cabin i {
  color: #8fa4e0;
  font-style: normal;
}

.wh-cabin:hover {
  border-color: rgba(126, 234, 255, 0.7);
}

.wh-cabin.is-mine {
  background: linear-gradient(180deg, rgba(255, 92, 102, 0.9), rgba(217, 30, 72, 0.9));
  border-color: #ff9ca6;
  box-shadow: 0 0 16px rgba(255, 48, 89, 0.5);
  color: #fff;
}

.wh-cabin.is-mine i {
  color: rgba(255, 240, 246, 0.85);
}

.wh-cabin[disabled] {
  background: rgba(70, 76, 110, 0.34);
  border-color: rgba(160, 166, 200, 0.22);
  color: #8e93b6;
  cursor: not-allowed;
}

.wh-cabin[disabled] b,
.wh-cabin[disabled] i {
  color: #8e93b6;
}

/* ---------- stats ---------- */
.wh-stat {
  align-items: baseline;
  color: #d8e3ff;
  display: flex;
  font-size: 13px;
  justify-content: space-between;
  margin: 9px 0;
}

.wh-stat span {
  align-items: center;
  display: inline-flex;
  gap: 10px;
}

.wh-stat span::before {
  background: #3eafff;
  border-radius: 3px;
  content: "";
  height: 14px;
  width: 3px;
}

.wh-stat strong {
  color: #ffffff;
  font-size: 17px;
  letter-spacing: 0.03em;
}

/* ---------- toast ---------- */
.wh-toast {
  background: rgba(12, 22, 58, 0.92);
  border: 1px solid rgba(126, 234, 255, 0.45);
  border-radius: 999px;
  bottom: max(86px, env(safe-area-inset-bottom, 0px) + 76px);
  box-shadow: 0 0 26px rgba(58, 150, 255, 0.28);
  color: #eef6ff;
  font-size: 12px;
  left: 50%;
  max-width: min(420px, calc(100vw - 32px));
  opacity: 0;
  padding: 10px 20px;
  pointer-events: none;
  position: fixed;
  text-align: center;
  transform: translate(-50%, 10px);
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 40;
}

.wh-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- modals ---------- */
.wh-modal {
  align-items: center;
  background: rgba(3, 6, 20, 0.7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: grid;
  inset: 0;
  justify-items: center;
  padding: 20px;
  position: fixed;
  z-index: 50;
}

.wh-modal[hidden] {
  display: none;
}

.wh-modal--error {
  z-index: 60;
}

.wh-modal__card {
  display: grid;
  gap: 12px;
  max-height: calc(100dvh - 40px);
  max-width: min(380px, calc(100vw - 32px));
  overflow: auto;
  padding: 22px;
  width: 100%;
}

.wh-modal__card h2 {
  color: #ffffff;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.wh-modal__card p {
  color: rgba(206, 218, 246, 0.72);
  font-size: 12px;
  line-height: 1.75;
  margin: 0;
}

.wh-field {
  display: grid;
  gap: 6px;
}

.wh-field span {
  color: #9fb4f0;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.wh-field input,
.wh-field select,
.wh-field textarea {
  background: rgba(6, 13, 36, 0.72);
  border: 1px solid rgba(117, 158, 255, 0.34);
  border-radius: 8px;
  color: #f2f6ff;
  font-family: inherit;
  font-size: 13px;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.wh-field textarea {
  min-height: 76px;
  resize: vertical;
}

.wh-field input:focus,
.wh-field select:focus,
.wh-field textarea:focus {
  border-color: #7eeaff;
  outline: none;
}

.wh-modal__actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.wh-modal__actions .wh-btn {
  flex: 1 1 0;
}

.wh-plot {
  text-align: center;
}

/* Who is in the pod, named. */
.wh-plot__pair {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.wh-plot__pair:empty {
  display: none;
}

.wh-plot__name {
  background: rgba(224, 44, 116, 0.22);
  border: 1px solid rgba(255, 154, 214, 0.6);
  border-radius: 999px;
  color: #ffe9f6;
  font-size: 14px;
  font-weight: 600;
  max-width: 46%;
  overflow: hidden;
  padding: 4px 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wh-plot__join {
  color: rgba(206, 218, 246, 0.62);
  font-size: 12px;
}

/* ---------- pod guest list ---------- */
.wh-pod__list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wh-pod__person {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(126, 234, 255, 0.24);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  padding: 9px 11px;
}

.wh-pod__person strong {
  color: #f5f7ff;
  font-size: 14px;
  font-weight: 600;
}

.wh-pod__person.is-mine {
  background: rgba(224, 44, 116, 0.2);
  border-color: rgba(255, 154, 214, 0.6);
}

.wh-pod__person p {
  color: rgba(206, 218, 246, 0.66);
  flex: 1 0 100%;
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
}

.wh-pod__gender {
  align-self: center;
  border: 1px solid rgba(126, 234, 255, 0.4);
  border-radius: 999px;
  color: #bfe9ff;
  font-size: 10px;
  padding: 1px 8px;
}

.wh-pod__note {
  color: rgba(206, 218, 246, 0.5);
  font-size: 11px;
  margin: 0;
  text-align: right;
}

.wh-pod__empty {
  color: rgba(206, 218, 246, 0.5);
  font-size: 12px;
  padding: 4px 0;
}

/* =====================================================================
   Clean screen. After one full turn the wheel keeps the viewport to itself;
   a tap anywhere brings the console back, and another sends it away.
   ===================================================================== */
.wh-bar,
.wh-panel,
.wh-clips-toggle,
.wh-clips,
.wb-nav {
  transition: opacity 320ms ease;
}

body.wh-clean .wh-bar,
body.wh-clean .wh-panel,
body.wh-clean .wh-clips-toggle,
body.wh-clean .wh-clips,
body.wh-clean .wb-nav {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .wh-bar,
  .wh-panel,
  .wh-clips-toggle,
  .wh-clips,
  .wb-nav {
    transition: none;
  }
}

.wh-plot__kiss {
  font-size: 34px;
  line-height: 1;
}

/* ---------- canvas interaction hygiene ---------- */
.wh-canvas,
.wh-btn,
.wh-cabin {
  -webkit-tap-highlight-color: transparent;
}

.wh-btn,
.wh-cabin,
.wh-bar-actions,
.wh-panel {
  touch-action: manipulation;
}

@media (prefers-reduced-motion: reduce) {
  .wh-btn,
  .wh-toast {
    transition: none;
  }
}

/* =====================================================================
   Mobile: the control panel becomes a bottom sheet and the stats move to
   a compact strip, so the middle of the screen stays free for the wheel.
   ===================================================================== */
@media (max-width: 860px) {
  .wh-panel--control {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    bottom: 0;
    left: 0;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom, 0px));
    right: 0;
    top: auto;
    transform: none;
    width: auto;
    z-index: 8;
  }

  .wh-panel--stats {
    gap: 0;
    left: 50%;
    padding: 8px 12px;
    right: auto;
    top: calc(max(12px, env(safe-area-inset-top, 0px)) + 44px);
    transform: translateX(-50%);
    width: auto;
    z-index: 7;
  }

  .wh-panel--stats .wh-stat {
    display: none;
  }

  .wh-panel--stats .wh-stat:nth-child(1),
  .wh-panel--stats .wh-stat:nth-child(3),
  .wh-panel--stats .wh-stat:nth-child(4) {
    display: flex;
    font-size: 11px;
    gap: 14px;
    margin: 2px 0;
  }

  .wh-panel--stats .wh-stat span::before {
    display: none;
  }

  .wh-panel--stats .wh-stat strong {
    font-size: 12px;
  }

  .wh-cabins {
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 10px;
  }

  .wh-cabin {
    font-size: 9px;
    min-height: 42px;
    padding: 5px 3px;
  }

  .wh-panel__title,
  .wh-sub {
    display: none;
  }

  .wh-panel--control .wh-row + .wh-row,
  .wh-panel--control .wh-btn--ghost {
    display: none;
  }

  .wh-brand {
    font-size: 11px;
  }

  .wh-bar-actions .wh-btn {
    font-size: 11px;
    min-height: 34px;
    padding: 0 12px;
  }

  .wh-bar-actions {
    flex: 0 0 auto;
  }

  .wh-toast {
    bottom: calc(100% - 52vh);
  }
}

@media (max-width: 420px) {
  .wh-panel--control {
    padding: 10px 10px max(10px, env(safe-area-inset-bottom, 0px));
  }

  .wh-cabin {
    font-size: 8.5px;
    min-height: 38px;
  }
}

/* =====================================================================
   The injected site nav (nav.js) is `position: fixed; z-index: 950` at the
   top of every page, so it sits ON TOP of this page's own toolbar. Two
   consequences are handled here:

   1. on phones it is collapsed to the single round menu button the owner
      asked for, which also frees the top-left corner for the music and
      profile controls;
   2. on wider screens the toolbar is pushed below it so it is not hidden.
   ===================================================================== */
@media (min-width: 981px) {
  /* 14px offset + 64px bar + a 6px gap. */
  .wh-bar {
    padding-top: calc(max(12px, env(safe-area-inset-top, 0px)) + 70px);
  }
}

@media (max-width: 980px) {
  /* Shrink the nav to exactly its menu button, in the top-right corner. */
  body.wh-page .wb-nav {
    border-radius: 50%;
    left: auto;
    margin-left: 0;
    min-height: 0;
    right: max(10px, env(safe-area-inset-right, 0px) + 4px);
    transform: none;
    width: auto;
  }

  body.wh-page .wb-nav-inner {
    min-height: 0;
    padding: 4px;
  }

  /* Everything except the menu button goes. */
  body.wh-page .wb-nav .wb-brand {
    display: none;
  }

  /* One circle with three bars — drop the second ring inside it. */
  body.wh-page .wb-menu-toggle {
    background: transparent;
    border-color: transparent;
  }

  body.wh-page .wb-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
  }

  /* The page title is redundant beside the nav; the controls stay. */
  body.wh-page .wh-brand {
    display: none;
  }

  body.wh-page .wh-bar {
    justify-content: flex-start;
    padding-left: 12px;
    padding-right: 12px;
    padding-top: max(14px, env(safe-area-inset-top, 0px));
  }
}
