:root {
  --lapis-deep: #060f2c;
  --lapis-mid: #0c1d52;
  --lapis-glass: rgba(9, 20, 56, 0.64);
  --lapis-glass-strong: rgba(7, 15, 44, 0.82);
  --gold-bright: #ffe293;
  --gold-primary: #e8b954;
  --gold-antique: #b8872f;
  --gold-border: rgba(242, 198, 102, 0.36);
  --gold-border-strong: rgba(255, 224, 140, 0.68);
  --text-warm: #fdf6e4;
  --text-muted: rgba(244, 232, 202, 0.74);
  --shadow-sacred: 0 12px 36px rgba(2, 6, 22, 0.62);
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 38%, #163082 0%, #091847 52%, #050b21 100%);
  color: var(--text-warm);
  font-family: var(--font-sans);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* Language Visibility Toggle via body classes */
body.hide-zh [data-lang="zh"] {
  display: none !important;
}
body.hide-en [data-lang="en"] {
  display: none !important;
}
body.hide-zh .eyebrow-sep,
body.hide-en .eyebrow-sep {
  display: none !important;
}

/* Full-Viewport 3D Stage */
#stage-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

#webgl-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#webgl-canvas:active {
  cursor: grabbing;
}

/* 3D Projected Hotspots Overlay */
#hotspots-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.hotspot-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.28s ease, transform 0.25s ease;
}

.hotspot-pin.occluded {
  opacity: 0.16;
  pointer-events: none;
}

.hotspot-dot {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff7d6 15%, #f4be49 70%, #b37817 100%);
  border: 1.5px solid #fff6d9;
  box-shadow: 0 0 14px rgba(255, 208, 96, 0.95);
  flex-shrink: 0;
}

.hotspot-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 224, 134, 0.72);
  animation: pulseRing 2.2s cubic-bezier(0.2, 0.7, 0.3, 1) infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.75); opacity: 0.9; }
  100% { transform: scale(1.75); opacity: 0; }
}

.hotspot-tag {
  background: rgba(8, 18, 48, 0.82);
  border: 1px solid var(--gold-border);
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.25;
  color: var(--gold-bright);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.hotspot-pin:hover .hotspot-tag,
.hotspot-pin.active .hotspot-tag {
  background: rgba(34, 24, 8, 0.92);
  border-color: var(--gold-bright);
  transform: translateX(3px);
}

.hotspot-tag .hs-en {
  font-size: 10.5px;
  color: rgba(255, 236, 186, 0.86);
  margin-left: 5px;
}

body.hide-zh .hotspot-tag .hs-en {
  margin-left: 0;
  font-size: 12px;
  color: var(--gold-bright);
}

/* Loading Ceremonial Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(circle at 50% 45%, rgba(12, 27, 74, 0.72), rgba(5, 11, 32, 0.88));
  backdrop-filter: blur(6px);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lotus-spinner {
  position: relative;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
}

.lotus-spinner .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}

.lotus-spinner .ring-outer {
  border-top-color: var(--gold-bright);
  border-right-color: rgba(242, 198, 102, 0.35);
  animation: spinCW 2.2s linear infinite;
}

.lotus-spinner .ring-inner {
  inset: 10px;
  border-bottom-color: #7cc4ff;
  border-left-color: rgba(242, 198, 102, 0.45);
  animation: spinCCW 1.6s linear infinite;
}

.lotus-spinner .core-char {
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(255, 214, 112, 0.85);
}

@keyframes spinCW { to { transform: rotate(360deg); } }
@keyframes spinCCW { to { transform: rotate(-360deg); } }

.loading-text {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
}

.loading-bar-wrap {
  width: 210px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.loading-bar {
  width: 15%;
  height: 100%;
  background: linear-gradient(90deg, #b8872f, #ffe49c, #79b8ff);
  transition: width 0.2s ease;
}

/* Top Bar */
.top-bar {
  position: fixed;
  top: 16px;
  left: 20px;
  right: 20px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.top-bar > * {
  pointer-events: auto;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 13px;
  border-radius: 14px;
  background: var(--lapis-glass);
  border: 1px solid var(--gold-border);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sacred);
  flex-shrink: 0;
}

.brand-emblem {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--gold-bright);
  background: radial-gradient(circle, rgba(242, 198, 102, 0.28), rgba(14, 30, 82, 0.65));
  border: 1px solid var(--gold-border-strong);
  box-shadow: 0 0 16px rgba(242, 198, 102, 0.3);
  flex-shrink: 0;
}

.brand-zh {
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  line-height: 1.2;
  white-space: nowrap;
}

.brand-en {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
}

.top-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

/* Language Checkboxes Control */
.lang-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--lapis-glass-strong);
  border: 1px solid var(--gold-border-strong);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sacred);
}

.lang-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-warm);
}

.lang-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.check-visual {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--gold-primary);
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.lang-check input:checked + .check-visual {
  background: linear-gradient(135deg, #f5cc66, #c68a22);
  border-color: #fff2c2;
  box-shadow: 0 0 10px rgba(244, 198, 92, 0.55);
}

.lang-check input:checked + .check-visual::after {
  content: "✓";
  color: #1d1202;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.lang-divider {
  width: 1px;
  height: 14px;
  background: rgba(242, 198, 102, 0.28);
}

/* Prominent Sliding Toggle Switch for Statue Part Labels */
.switch-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px 6px 9px;
  border-radius: 999px;
  background: var(--lapis-glass-strong);
  border: 1px solid var(--gold-border-strong);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sacred);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-bright);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.switch-pill:hover {
  background: rgba(34, 26, 12, 0.85);
  border-color: #fff0b8;
  box-shadow: 0 0 18px rgba(242, 198, 102, 0.34);
}

.switch-pill input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(242, 198, 102, 0.45);
  transition: background 0.22s ease, border-color 0.22s ease;
  flex-shrink: 0;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e9d9b0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.22s ease;
}

.switch-pill input:checked + .switch-track {
  background: linear-gradient(90deg, #c68a22, #f5cc66);
  border-color: #fff3c4;
  box-shadow: 0 0 10px rgba(245, 204, 102, 0.55);
}

.switch-pill input:checked + .switch-track .switch-thumb {
  transform: translateX(16px);
  background: #231402;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

/* Pill Buttons */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--gold-border);
  background: var(--lapis-glass);
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sacred);
  transition: all 0.22s ease;
  white-space: nowrap;
}

.pill-btn:hover {
  background: rgba(45, 32, 10, 0.78);
  border-color: var(--gold-bright);
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(242, 198, 102, 0.34);
}

.pill-btn .btn-icon {
  font-size: 13px;
}

#btn-webp .btn-icon {
  display: none;
}

/* Glass Cards */
.glass-card {
  background: var(--lapis-glass);
  border: 1px solid var(--gold-border);
  border-radius: 16px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sacred);
}

/* Left Panel */
.left-panel {
  position: fixed;
  left: 20px;
  top: 90px;
  width: 274px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.lore-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lore-badge {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 10px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(232, 185, 84, 0.22), rgba(232, 185, 84, 0.06));
  border: 1px solid rgba(242, 198, 102, 0.35);
  font-size: 12px;
  color: var(--gold-bright);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.lore-label {
  font-size: 11px;
  color: rgba(242, 198, 102, 0.78);
  letter-spacing: 0.08em;
  display: flex;
  gap: 6px;
}

.lore-value-zh {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text-warm);
  margin-top: 2px;
}

.lore-value-en {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.lore-blessing p {
  font-size: 12.5px;
  line-height: 1.62;
  color: rgba(250, 242, 224, 0.9);
}

.lore-blessing p[data-lang="en"] {
  font-size: 11.5px;
  line-height: 1.52;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Hotspot Detail Callout */
.hotspot-detail {
  padding: 13px 15px;
  border-color: var(--gold-border-strong);
  background: rgba(18, 22, 54, 0.84);
  animation: fadeSlideIn 0.25s ease;
}

.hotspot-detail.hidden {
  display: none;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hotspot-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.hotspot-title-zh {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--gold-bright);
  font-weight: 700;
}

.hotspot-title-en {
  font-size: 11.5px;
  color: var(--gold-primary);
}

.icon-close-sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--gold-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold-bright);
  cursor: pointer;
  font-size: 12px;
}

.icon-close-sm:hover {
  background: rgba(242, 198, 102, 0.25);
}

.hotspot-desc-zh {
  font-size: 12.5px;
  line-height: 1.58;
  color: var(--text-warm);
}

.hotspot-desc-en {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Camera Tools Card */
.tools-card {
  padding: 11px 12px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.tool-btn {
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--gold-border);
  background: rgba(12, 24, 64, 0.65);
  color: var(--gold-bright);
  font-size: 15px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.tool-btn:hover {
  background: rgba(232, 185, 84, 0.22);
  border-color: var(--gold-bright);
}

.tool-btn.active {
  background: linear-gradient(135deg, rgba(245, 204, 102, 0.34), rgba(184, 135, 47, 0.25));
  border-color: var(--gold-bright);
  box-shadow: 0 0 12px rgba(245, 204, 102, 0.3);
}

.tools-hint {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Right Interactive 12-Shichen Zodiac Wheel Panel */
.wheel-panel {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 316px;
  z-index: 12;
  padding: 14px 14px 12px;
  border-radius: 22px;
  background: var(--lapis-glass);
  border: 1px solid var(--gold-border);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sacred);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.wheel-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wheel-title {
  display: flex;
  flex-direction: column;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.08em;
}

.wheel-title [data-lang="en"] {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.now-btn {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--gold-border-strong);
  background: rgba(232, 185, 84, 0.16);
  color: var(--gold-bright);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  gap: 5px;
  align-items: center;
  transition: all 0.2s ease;
}

.now-btn:hover {
  background: rgba(232, 185, 84, 0.34);
  box-shadow: 0 0 12px rgba(242, 198, 102, 0.45);
}

.wheel-stage {
  width: 282px;
  height: 282px;
  position: relative;
}

.wheel-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.55));
}

.wheel-sector {
  cursor: pointer;
  outline: none;
  transition: opacity 0.2s ease;
}

.wheel-sector:focus {
  outline: none;
}

.wheel-sector:focus-visible path.sector-bg {
  stroke: #ffffff;
  stroke-width: 2;
}

.wheel-sector path.sector-bg {
  fill: rgba(11, 25, 68, 0.72);
  stroke: rgba(242, 198, 102, 0.38);
  stroke-width: 1;
  transition: fill 0.22s ease, stroke 0.22s ease;
}

.wheel-sector:hover path.sector-bg {
  fill: rgba(176, 126, 36, 0.42);
  stroke: var(--gold-bright);
}

.wheel-sector.active path.sector-bg {
  fill: url(#activeSectorGrad);
  stroke: #fff3c4;
  stroke-width: 1.6;
}

.wheel-sector text.shichen-txt {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  fill: #fce6a8;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: central;
}

.wheel-sector text.zodiac-txt {
  font-size: 10.5px;
  font-weight: 600;
  fill: rgba(234, 224, 198, 0.88);
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: central;
}

.wheel-sector.active text.shichen-txt,
.wheel-sector.active text.zodiac-txt {
  fill: #1b1002;
}

.wheel-footer-nav {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.step-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--gold-border);
  background: rgba(12, 26, 68, 0.75);
  color: var(--gold-bright);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
}

.step-btn:hover {
  background: rgba(232, 185, 84, 0.28);
  border-color: var(--gold-bright);
}

.wheel-caption {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Bottom Ceremonial Nameplate Plaque */
.nameplate-dock {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  max-width: calc(100vw - 40px);
  pointer-events: auto;
}

.nameplate-plaque {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 28px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(196, 139, 36, 0.92) 0%, rgba(145, 93, 18, 0.94) 55%, rgba(102, 62, 10, 0.96) 100%);
  border: 1.5px solid rgba(255, 236, 168, 0.85);
  box-shadow:
    0 12px 34px rgba(0, 0, 0, 0.62),
    0 0 28px rgba(242, 188, 72, 0.32),
    inset 0 1px 0 rgba(255, 248, 214, 0.65);
  color: #241302;
  text-align: center;
}

.plaque-ornament {
  font-size: 16px;
  color: #fff0be;
  text-shadow: 0 1px 6px rgba(58, 30, 0, 0.7);
}

.plaque-eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(48, 24, 2, 0.88);
  font-weight: 700;
  margin-bottom: 3px;
}

.plaque-name-zh {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rank-zh {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: #361c03;
  letter-spacing: 0.08em;
}

.main-zh {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #fff9e4;
  text-shadow: 0 2px 8px rgba(72, 34, 0, 0.75);
}

.zodiac-pill-zh {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(42, 20, 2, 0.22);
  border: 1px solid rgba(255, 236, 178, 0.5);
  color: #fff3cf;
}

.plaque-name-en {
  margin-top: 3px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
}

.main-en {
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff6d9;
  text-shadow: 0 1px 6px rgba(64, 30, 0, 0.7);
}

.sub-en {
  font-size: 12px;
  font-weight: 600;
  color: #2f1702;
}

body.hide-zh .main-en {
  font-size: 24px;
}

/* Solo Mode */
body.solo-mode .left-panel,
body.solo-mode .wheel-panel {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

body.solo-mode .wheel-panel {
  transform: translateY(-50%) translateX(24px);
}

.solo-bar {
  position: fixed;
  top: 78px;
  left: 20px;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 10px;
}

.solo-bar.hidden {
  display: none;
}

.solo-mini-controls {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: var(--lapis-glass);
  border: 1px solid var(--gold-border);
  backdrop-filter: blur(10px);
}

.solo-mini-controls .tool-btn {
  width: 34px;
  height: 32px;
}

/* Modals (All-12 Mandala & Source WebP Lightbox) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(3, 8, 26, 0.8);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 24px;
  transition: opacity 0.25s ease;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-dialog {
  background: linear-gradient(160deg, rgba(12, 26, 72, 0.96), rgba(6, 13, 38, 0.98));
  border: 1.5px solid var(--gold-border-strong);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
  max-width: 1020px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--gold-bright);
  letter-spacing: 0.08em;
}

.modal-head p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--gold-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--gold-bright);
  font-size: 16px;
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(242, 198, 102, 0.28);
}

.mandala-grid {
  padding: 18px 22px 22px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 14px;
}

.mandala-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--gold-border);
  background: rgba(8, 18, 52, 0.85);
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  display: flex;
  flex-direction: column;
}

.mandala-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold-bright);
  box-shadow: 0 10px 28px rgba(242, 198, 102, 0.28);
}

.mandala-card.active {
  border-color: #fff2be;
  box-shadow: 0 0 22px rgba(255, 214, 102, 0.45);
}

.mandala-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.mandala-card-meta {
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(16, 26, 66, 0.9), rgba(10, 18, 46, 0.98));
  text-align: center;
}

.mandala-card-shichen {
  font-size: 10.5px;
  color: var(--gold-primary);
  margin-bottom: 2px;
}

.mandala-card-zh {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--gold-bright);
}

.mandala-card-en {
  font-size: 11px;
  color: var(--text-muted);
}

.webp-dialog {
  max-width: 520px;
}

.webp-body {
  padding: 16px;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  background: rgba(3, 8, 22, 0.75);
}

#webp-preview-img {
  max-height: 72vh;
  width: auto;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--gold-border);
}

/* Responsive Adjustments */
@media (max-width: 1080px) {
  .left-panel {
    width: 236px;
  }
  .wheel-panel {
    width: 268px;
  }
  .wheel-stage {
    width: 236px;
    height: 236px;
  }
}

@media (max-width: 820px) {
  .left-panel {
    display: none;
  }
  .wheel-panel {
    top: auto;
    bottom: 112px;
    right: 12px;
    transform: none;
    width: 210px;
    padding: 10px;
  }
  .wheel-stage {
    width: 186px;
    height: 186px;
  }
  .nameplate-plaque {
    padding: 9px 16px;
  }
  .main-zh {
    font-size: 20px;
  }
}

.music-btn[aria-pressed="false"] .btn-icon { opacity: .5; text-decoration: line-through; }
.music-btn[aria-pressed="true"] { border-color: var(--gold, #d8ae55); }

.offline-btn[hidden] { display: none; }
.offline-btn[data-state="ready"] { border-color: var(--gold-primary); }
.offline-btn[data-state="ready"] .btn-icon { color: var(--gold-bright); }
.offline-btn[data-state="saving"] { cursor: progress; opacity: .85; }
.offline-btn[data-state="failed"] { border-color: #e0806a; }

.mobile-control, .phone-nav { display: none; }

.phone-layout {
  --phone-top: max(8px, env(safe-area-inset-top));
  --phone-bottom: max(8px, env(safe-area-inset-bottom));
  --phone-left: max(8px, env(safe-area-inset-left));
  --phone-right: max(8px, env(safe-area-inset-right));
}
.phone-layout .mobile-control { display: inline-flex; min-height: 44px; align-items: center; }
.phone-layout .top-bar {
  inset: var(--phone-top) var(--phone-right) auto var(--phone-left);
  gap: 6px;
}
.phone-layout .brand-block { min-width: 0; padding: 5px 8px; gap: 6px; }
.phone-layout .brand-titles { min-width: 0; }
.phone-layout .brand-zh { font-size: clamp(12px, 3.6vw, 17px); }
.phone-layout .brand-en { font-size: 10px; white-space: normal; }
.phone-layout .brand-emblem { font-size: 19px; }
.phone-layout .top-controls, .phone-layout .wheel-panel, .phone-layout .left-panel { display: none; }
.phone-layout .top-controls.phone-open, .phone-layout .wheel-panel.phone-open,
.phone-layout .left-panel.phone-open {
  position: fixed; top: calc(var(--phone-top) + 58px); bottom: auto;
  right: var(--phone-right); left: auto; transform: none;
  width: min(350px, calc(100vw - var(--phone-left) - var(--phone-right)));
  max-height: calc(100dvh - var(--phone-top) - var(--phone-bottom) - 120px);
  overflow: auto; overscroll-behavior: contain; z-index: 20;
  background: #101b38; border: 1px solid var(--gold-border); border-radius: 16px;
  box-shadow: var(--shadow-sacred); padding: 10px;
}
.phone-layout .top-controls.phone-open { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.phone-layout .top-controls .lang-box { grid-column: span 2; justify-content: center; }
.phone-layout .top-controls :is(.pill-btn,.switch-pill,.lang-check) { min-height: 44px; justify-content: center; }
.phone-layout .left-panel.phone-open, .phone-layout .wheel-panel.phone-open { display: block; }
.phone-layout .left-panel .glass-card + .glass-card { margin-top: 8px; }
.phone-layout .tools-hint { display: none; }
.phone-layout .tools-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(44px,1fr)); }
.phone-layout :is(.tool-btn,.step-btn,.modal-close,.icon-close-sm,.now-btn) { min-width: 44px; min-height: 44px; }
.phone-layout .wheel-stage { width: min(100%, 268px); height: auto; aspect-ratio: 1; margin: auto; }
.phone-layout .phone-nav {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  position: fixed; z-index: 16; bottom: var(--phone-bottom);
  left: var(--phone-left); right: var(--phone-right); pointer-events: none;
}
.phone-layout .phone-nav > * { pointer-events: auto; background: #172243; }
.phone-layout .nameplate-dock { bottom: calc(var(--phone-bottom) + 50px); width: max-content; max-width: calc(100vw - 18px); z-index: 10; pointer-events: none; }
.phone-layout .nameplate-plaque { padding: 4px 12px; gap: 6px; }
.phone-layout :is(.plaque-ornament,.plaque-eyebrow,.sub-en) { display: none; }
.phone-layout .main-en { font-size: 15px; }
.phone-layout .plaque-name-zh { gap: 5px; }
.phone-layout .solo-bar { top: var(--phone-top); left: var(--phone-left); right: var(--phone-right); flex-wrap: wrap; gap: 4px; }
.phone-layout.solo-mode :is(.top-bar,.phone-nav) { display: none; }
.phone-layout.solo-mode .nameplate-dock { bottom: var(--phone-bottom); }
.phone-layout .solo-mini-controls { gap: 2px; }
.phone-layout .modal-backdrop { padding: var(--phone-top) var(--phone-right) var(--phone-bottom) var(--phone-left); }
.phone-layout .modal-dialog { max-height: calc(100dvh - var(--phone-top) - var(--phone-bottom)); }
.phone-layout .mandala-grid { grid-template-columns: repeat(auto-fit,minmax(116px,1fr)); padding: 10px; gap: 8px; }

@media (orientation: landscape) and (max-height: 600px) {
  .phone-layout .phone-nav { left: auto; }
  .phone-layout .nameplate-dock { left: var(--phone-left); transform: none; bottom: var(--phone-bottom); }
  .phone-layout .brand-en { display: none; }
  .phone-layout.hide-zh .brand-en { display: block; }
}
