/* 庞庆洋的大转盘 - 赛博朋克科技风 */
:root {
  --bg-deep: #0a0e17;
  --bg-mid: #1a1a2e;
  --gold: #00d4ff;
  --gold-soft: rgba(0, 212, 255, 0.55);
  --gold-dim: rgba(124, 58, 237, 0.25);
  --neon-cyan: #00d4ff;
  --neon-purple: #7c3aed;
  --text: #e8f1ff;
  --text-muted: rgba(200, 220, 255, 0.58);
  --glass-bg: rgba(12, 20, 40, 0.45);
  --glass-border: rgba(0, 212, 255, 0.32);
  --glass-highlight: rgba(255, 255, 255, 0.14);
  --danger: #fb7185;
  --success: #34d399;
  --font-display: "Orbitron", "Rajdhani", "PingFang SC", sans-serif;
  --font-ui: "Rajdhani", "PingFang SC", "Microsoft YaHei", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg-deep);
}

body {
  background:
    radial-gradient(ellipse 80% 55% at 50% -10%, rgba(124, 58, 237, 0.28), transparent 55%),
    radial-gradient(ellipse 55% 45% at 10% 85%, rgba(0, 212, 255, 0.14), transparent 50%),
    radial-gradient(ellipse 50% 40% at 95% 70%, rgba(124, 58, 237, 0.18), transparent 45%),
    linear-gradient(165deg, #0a0e17 0%, #12182a 42%, #1a1a2e 100%);
}

.particle-layer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.cyber-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}

.app {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100dvh;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(0.25rem, 1.2vh, 0.75rem);
  padding:
    calc(clamp(0.35rem, 1.2vh, 0.7rem) + var(--safe-top))
    clamp(0.5rem, 1.5vw, 1.2rem)
    calc(clamp(0.35rem, 1.2vh, 0.7rem) + var(--safe-bottom));
  max-width: 1400px;
  margin: 0 auto;
  overflow: hidden;
}

/* ─── Header ─── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.4rem, 1.5vw, 1rem);
  min-height: 0;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1rem, 2.8vw, 1.85rem);
  letter-spacing: 0.08em;
  line-height: 1.15;
  background: linear-gradient(120deg, #00d4ff, #a78bfa, #00d4ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  text-shadow: 0 0 24px rgba(0, 212, 255, 0.25);
}

.brand .sub {
  font-size: clamp(0.55rem, 1.2vw, 0.72rem);
  color: var(--text-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.stats {
  display: flex;
  align-items: center;
  gap: clamp(0.3rem, 1vw, 0.65rem);
  flex-shrink: 0;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(0.25rem, 0.8vh, 0.45rem) clamp(0.45rem, 1.2vw, 0.85rem);
  min-width: clamp(3.2rem, 8vw, 5rem);
  border-radius: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}

.stat-pill .label {
  font-size: clamp(0.5rem, 1vw, 0.65rem);
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.stat-pill .value {
  font-size: clamp(0.75rem, 1.8vw, 1.05rem);
  font-weight: 700;
  color: var(--neon-cyan);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
}

/* ─── Main Stage ─── */
.stage {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(0.3rem, 1vh, 0.7rem);
  min-height: 0;
  align-items: center;
}

.wheel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  height: 100%;
}

#wheelCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.55));
}

.marker {
  position: absolute;
  top: 2%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: clamp(6px, 1vw, 10px) solid transparent;
  border-right: clamp(6px, 1vw, 10px) solid transparent;
  border-top: clamp(10px, 1.6vw, 16px) solid var(--gold);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
  z-index: 2;
  pointer-events: none;
  opacity: 0.92;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: clamp(0.35rem, 1vh, 0.65rem);
  min-height: 0;
}

.status-card {
  padding: clamp(0.45rem, 1.2vh, 0.8rem) clamp(0.6rem, 1.5vw, 1rem);
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  text-align: center;
}

.status-card .title {
  font-size: clamp(0.55rem, 1.1vw, 0.7rem);
  color: var(--text-muted);
  letter-spacing: 0.12em;
  margin-bottom: 0.2rem;
}

.status-card .content {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.4vw, 1.45rem);
  color: var(--neon-cyan);
  letter-spacing: 0.08em;
  text-shadow: 0 0 12px rgba(0, 212, 255, 0.35);
}

.status-card .hint {
  margin-top: 0.2rem;
  font-size: clamp(0.55rem, 1.1vw, 0.7rem);
  color: var(--text-muted);
}

.skip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.55rem;
  font-size: clamp(0.65rem, 1.3vw, 0.8rem);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  letter-spacing: 0.06em;
}

.skip-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--neon-cyan);
}

.skip-toggle:hover {
  color: var(--neon-cyan);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(0.35rem, 1vw, 0.6rem);
}

/* ─── Liquid Glass Button ─── */
.glass-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 44px;
  padding: clamp(0.45rem, 1.2vh, 0.7rem) clamp(0.55rem, 1.5vw, 1rem);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.06) 45%,
    rgba(255, 255, 255, 0.1) 100%
  );
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 4px 16px rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: clamp(0.7rem, 1.6vw, 0.92rem);
  font-weight: 560;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.glass-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), transparent 42%);
  pointer-events: none;
  opacity: 0.55;
  z-index: 0;
}

.glass-btn > span,
.glass-btn > .btn-label {
  position: relative;
  z-index: 1;
}

.glass-btn:hover:not(:disabled) {
  transform: scale(1.02);
  border-color: rgba(0, 212, 255, 0.65);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 18px rgba(0, 212, 255, 0.35),
    0 0 32px rgba(124, 58, 237, 0.25),
    0 6px 20px rgba(0, 0, 0, 0.3);
}

.glass-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.glass-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.glass-btn.primary {
  border-color: rgba(0, 212, 255, 0.55);
  background: linear-gradient(
    145deg,
    rgba(0, 212, 255, 0.28) 0%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(124, 58, 237, 0.28) 100%
  );
  color: #d9f8ff;
}

.glass-btn.accent {
  border-color: rgba(100, 180, 255, 0.4);
}

.glass-btn.success {
  border-color: rgba(61, 214, 140, 0.45);
}

.glass-btn.danger {
  border-color: rgba(231, 76, 94, 0.4);
}

.glass-btn .cost {
  display: block;
  font-size: 0.78em;
  opacity: 0.8;
  font-weight: 450;
  margin-top: 0.1rem;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0);
  animation: ripple-out 0.55s ease-out forwards;
  pointer-events: none;
  z-index: 2;
}

@keyframes ripple-out {
  to {
    transform: scale(1);
    opacity: 0;
  }
}

/* ─── Footer ─── */
.footer {
  display: flex;
  align-items: stretch;
  gap: clamp(0.35rem, 1vw, 0.7rem);
  min-height: 0;
}

.prize-preview,
.footer-actions {
  flex: 1;
  min-width: 0;
}

.prize-preview {
  padding: clamp(0.35rem, 1vh, 0.6rem) clamp(0.5rem, 1.2vw, 0.85rem);
  border-radius: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}

.prize-preview .title {
  font-size: clamp(0.55rem, 1.1vw, 0.68rem);
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.prize-list {
  display: flex;
  gap: 0.35rem;
  overflow: hidden;
  flex-wrap: wrap;
  max-height: clamp(2rem, 5vh, 3rem);
}

.prize-chip {
  font-size: clamp(0.55rem, 1.1vw, 0.7rem);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  white-space: nowrap;
}

.footer-actions {
  display: flex;
  gap: clamp(0.3rem, 0.8vw, 0.5rem);
  align-items: stretch;
}

.footer-actions .glass-btn {
  flex: 1;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1rem;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: min(92vw, 420px);
  max-height: min(80vh, 560px);
  overflow: auto;
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(30, 38, 58, 0.92), rgba(14, 18, 30, 0.95));
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 var(--glass-highlight);
}

.modal h2 {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--neon-cyan);
  margin-bottom: 0.75rem;
  letter-spacing: 0.06em;
}

.modal {
  border-color: rgba(0, 212, 255, 0.35) !important;
  box-shadow: 0 0 40px rgba(124, 58, 237, 0.25), 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

.modal .msg {
  color: var(--text);
  font-size: clamp(0.85rem, 2vw, 1rem);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.modal-actions .glass-btn {
  flex: 1;
  min-width: 100px;
}

.shop-grid {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.shop-item .name {
  font-size: 0.88rem;
}

.shop-item .cost {
  font-size: 0.75rem;
  color: var(--gold);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 4vh, 2.5rem);
  transform: translateX(-50%) translateY(120%);
  padding: 0.65rem 1.2rem;
  border-radius: 12px;
  background: rgba(20, 26, 40, 0.92);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  color: var(--text);
  font-size: clamp(0.75rem, 1.8vw, 0.9rem);
  z-index: 200;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ─── Landscape phone priority ─── */
@media (orientation: landscape) and (max-height: 560px) {
  .app {
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
  }

  .brand .sub { display: none; }

  .header .glass-btn {
    padding: 0.35rem 0.55rem;
    min-height: 40px;
    font-size: 0.75rem;
  }

  .stage {
    grid-template-columns: minmax(0, 1.2fr) minmax(200px, 0.8fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
  }

  .side-panel {
    justify-content: center;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }

  .footer {
    max-height: 16vh;
  }

  .prize-list {
    max-height: 2.2rem;
  }

  .skip-toggle {
    margin-top: 0.35rem;
  }
}

/* 平板横屏 */
@media (orientation: landscape) and (min-height: 561px) and (max-width: 1200px) {
  .stage {
    grid-template-columns: minmax(0, 1.25fr) minmax(240px, 0.75fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (orientation: landscape) and (min-width: 900px) {
  .stage {
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* 桌面竖屏小窗仍可用；手机竖屏由遮罩拦截 */
@media (orientation: portrait) and (max-width: 600px) {
  .header {
    flex-wrap: wrap;
  }

  .stats {
    width: 100%;
    justify-content: space-between;
  }

  .stat-pill {
    flex: 1;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* ─── 全屏 / 横屏门禁（仅手机平板） ─── */
.fs-gate,
.orient-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background:
    radial-gradient(ellipse at center, rgba(124, 58, 237, 0.25), transparent 55%),
    rgba(6, 10, 20, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.is-mobile-like.need-fs .fs-gate {
  display: flex;
}

body.is-mobile-like.need-rotate .orient-gate {
  display: flex;
}

/* 未过门禁时隐藏主界面交互，避免误触 */
body.is-mobile-like.need-fs .app,
body.is-mobile-like.need-rotate .app {
  visibility: hidden;
  pointer-events: none;
}

.gate-card {
  width: min(92vw, 380px);
  text-align: center;
  padding: 1.5rem 1.25rem;
  border-radius: 18px;
  border: 1px solid rgba(0, 212, 255, 0.4);
  background: rgba(12, 18, 36, 0.85);
  box-shadow: 0 0 40px rgba(0, 212, 255, 0.2), 0 0 60px rgba(124, 58, 237, 0.15);
}

.gate-icon {
  font-size: 2.8rem;
  color: var(--neon-cyan);
  margin-bottom: 0.5rem;
  animation: spin-hint 2.4s linear infinite;
}

@keyframes spin-hint {
  to { transform: rotate(90deg); }
}

.gate-title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4vw, 1.45rem);
  letter-spacing: 0.08em;
  color: var(--neon-cyan);
  margin-bottom: 0.5rem;
}

.gate-desc {
  color: var(--text-muted);
  font-size: clamp(0.85rem, 2.8vw, 1rem);
  line-height: 1.55;
  margin-bottom: 1.1rem;
}

.gate-card .glass-btn {
  width: 100%;
}

/* 全屏后利用完整视口 */
body.is-mobile-like:fullscreen .app,
body.is-mobile-like:-webkit-full-screen .app {
  height: 100vh;
  height: 100dvh;
  max-width: none;
}

@media (prefers-reduced-motion: reduce) {
  .glass-btn,
  .toast,
  .modal-overlay {
    transition: none;
  }
  .ripple { animation: none; opacity: 0; }
  .gate-icon { animation: none; }
}
