/* Apple iPod Classic-inspired landscape player & Apple UI polish for monkey controls/dialog. */

/* Hide redundant top-left 12·08 and top-right music icon while keeping #soundBtn clickable by JS. */
body.site-controls.leeroy-stage .nav {
  position: fixed !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.site-controls.leeroy-stage .hero.section {
  overflow: auto;
  justify-content: safe center !important;
  padding: 28px 16px 46px !important;
}

/* ── Classic Apple 3D Molded White Polycarbonate iPod Chassis ── */
.home-player {
  position: relative;
  width: min(1140px, 94vw);
  min-height: min(610px, 78svh);
  display: grid;
  grid-template-columns: minmax(196px, 0.84fr) minmax(0, 2.38fr);
  align-items: center;
  gap: clamp(24px, 3.8vw, 48px);
  padding: clamp(26px, 3.8vw, 46px) clamp(28px, 4.2vw, 50px);
  color: #1d1d1f;
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 36px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 251, 0.96) 58%, rgba(239, 241, 246, 0.98) 100%);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 1),
    inset 0 18px 26px -12px rgba(202, 208, 218, 0.42),
    inset 20px 0 28px -12px rgba(176, 183, 196, 0.56),
    inset -20px 0 28px -12px rgba(176, 183, 196, 0.56),
    inset 0 -24px 30px -10px rgba(146, 154, 168, 0.64),
    0 4px 10px -2px rgba(0, 0, 0, 0.58),
    0 24px 64px rgba(0, 0, 0, 0.64);
  font-family: var(--control-font);
}

/* Brushed aluminum top-left HOLD switch (Reference Fig. 3) */
.home-player::before {
  content: "";
  position: absolute;
  top: -7px;
  left: clamp(66px, 9.5vw, 118px);
  width: 54px;
  height: 7px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, #b8bec7 0%, #e5e8ed 18%, #cfd4dc 50%, #e7eaef 82%, #aeb4be 100%);
  box-shadow:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.92),
    inset 0 -1px 1.5px rgba(84, 92, 104, 0.52),
    0 -1px 2px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

/* Studio contact shadow & subtle mirrored floor reflection (Reference Fig. 5) */
.home-player::after {
  content: "";
  position: absolute;
  left: 2.5%;
  right: 2.5%;
  top: calc(100% + 2px);
  height: 46px;
  border-radius: 34px 34px 18px 18px;
  background: linear-gradient(
    180deg,
    rgba(232, 237, 245, 0.24) 0%,
    rgba(218, 224, 235, 0.10) 42%,
    rgba(210, 218, 230, 0.02) 78%,
    transparent 100%
  );
  box-shadow: inset 0 6px 12px -6px rgba(0, 0, 0, 0.42);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.35) 45%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.35) 45%, transparent 100%);
  pointer-events: none;
}

/* ── Left Click Wheel (Apple Matte Micro-Grain Silver-Grey + Crisp White Icons, Fig. 1) ── */
.home-wheel {
  justify-self: center;
  width: min(100%, 276px);
  aspect-ratio: 1;
  display: grid;
  grid-template: 1fr 0.92fr 1fr / 1fr 0.92fr 1fr;
  place-items: center;
  position: relative;
  border-radius: 50%;
  border: 1px solid rgba(164, 170, 180, 0.56);
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0 1px, rgba(0, 0, 0, 0.018) 1px 2px),
    linear-gradient(180deg, #dcdee1 0%, #d1d3d7 52%, #c5c8cd 100%);
  box-shadow:
    inset 0 2px 4px rgba(108, 114, 124, 0.22),
    inset 0 -2px 4px rgba(255, 255, 255, 0.55),
    0 1px 2px rgba(255, 255, 255, 0.95),
    0 -1px 1px rgba(145, 152, 162, 0.22);
}

.home-wheel button {
  appearance: none;
  border: 0;
  min-width: 34px;
  min-height: 34px;
  padding: 0 5px;
  color: rgba(255, 255, 255, 0.95);
  background: transparent;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font: 600 13.5px/1 var(--control-font);
  letter-spacing: 0.08em;
  text-shadow: 0 1px 1px rgba(112, 118, 128, 0.2);
  cursor: pointer;
  transition: background-color 140ms ease, transform 120ms ease, opacity 140ms ease;
}

.home-wheel button svg {
  display: block;
  filter: drop-shadow(0 1px 1px rgba(112, 118, 128, 0.18));
}

.home-wheel button:hover {
  background: rgba(255, 255, 255, 0.24);
}

.home-wheel button:active {
  transform: scale(0.95);
}

.home-wheel button:focus-visible {
  outline: 2px solid #2b81e0;
  outline-offset: 2px;
}

.home-wheel .wheel-wish {
  grid-area: 1 / 2;
  align-self: start;
  margin-top: 14px;
}

.home-wheel .wheel-prev {
  grid-area: 2 / 1;
  justify-self: start;
  margin-left: 14px;
}

.home-wheel .wheel-next {
  grid-area: 2 / 3;
  justify-self: end;
  margin-right: 14px;
}

.home-wheel .wheel-enter {
  grid-area: 2 / 2;
  width: 96%;
  height: auto;
  aspect-ratio: 1;
  border: 1px solid rgba(164, 170, 179, 0.56);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 46% 30%, #ffffff 0%, #f7f8fa 70%, #eceef2 100%);
  box-shadow:
    inset 0 1.5px 2px #ffffff,
    inset 0 -1.5px 3px rgba(146, 154, 166, 0.22),
    0 1px 2px rgba(255, 255, 255, 0.72),
    0 -1px 2px rgba(118, 124, 134, 0.22);
}

.home-wheel .wheel-enter span {
  display: none;
}

.home-wheel .wheel-enter:hover {
  background: radial-gradient(circle at 46% 30%, #ffffff 0%, #fafbfd 74%, #f0f2f6 100%);
}

.home-wheel .wheel-enter:active {
  box-shadow: inset 0 2px 6px rgba(118, 126, 138, 0.3);
}

.home-wheel .wheel-play {
  grid-area: 3 / 2;
  align-self: end;
  margin-bottom: 14px;
}

.home-wheel .wheel-play.is-playing {
  color: #ffffff;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.55));
}

/* ── Right Inset iPod Screen ── */
.home-display {
  min-width: 0;
  border: 2.5px solid #59626b;
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.96),
    0 -1px 2px rgba(125, 134, 145, 0.26);
}

.home-player-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-bottom: 1px solid #9aa4b0;
  border-radius: 0;
  background: linear-gradient(180deg, #fafcfe 0%, #dfe4eb 48%, #c9d1dc 52%, #d8dfe8 100%);
  box-shadow: inset 0 1px 0 #ffffff;
  color: #1d242b;
  font-size: 11.5px;
}

.home-player-bar strong {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.home-bar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: #2f3842;
}

.home-bar-play {
  display: inline-block;
  width: 8px;
  height: 9px;
  background: linear-gradient(180deg, #8e9aa8, #6d7987);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  opacity: 0.45;
  transition: opacity 180ms ease, background 180ms ease;
}

.home-bar-play.is-playing {
  opacity: 1;
  background: linear-gradient(180deg, #5eb2ff 0%, #1d75d8 100%);
  filter: drop-shadow(0 0 2px rgba(29, 117, 216, 0.45));
}

.home-bar-battery {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 22px;
  height: 11px;
  padding: 1.5px;
  border: 1px solid #727c87;
  border-radius: 2px;
  background: linear-gradient(180deg, #eef2f6, #d4dbe2);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.14);
}

.home-bar-battery::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 2.5px;
  width: 2px;
  height: 4px;
  border-radius: 0 1px 1px 0;
  background: #727c87;
}

.home-bar-battery i {
  display: block;
  width: 82%;
  height: 100%;
  border-radius: 1px;
  background: linear-gradient(180deg, #7be05c 0%, #44b929 52%, #2e9a19 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ── Screen Body: Smaller Square Album Cover + Compact Tracklist + Full-Width Progress Bar ── */
.home-player-screen {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  grid-template-rows: 1fr auto;
  align-items: center;
  min-height: clamp(350px, 48svh, 456px);
  column-gap: clamp(18px, 3vw, 34px);
  row-gap: clamp(18px, 2.6vw, 28px);
  padding: clamp(22px, 3vw, 36px) clamp(24px, 3.4vw, 40px) clamp(16px, 2.2vw, 24px);
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
  box-shadow: inset 0 2px 5px rgba(105, 118, 134, 0.14);
}

/* ── Compact Square 1:1 Album Cover with Subtle 3D Pop-Out Portrait (Fig. 4) ── */
body.leeroy-stage .home-player .portrait-stage {
  position: relative;
  width: clamp(168px, 19vw, 214px) !important;
  max-width: 100%;
  min-height: 0 !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  justify-self: center;
  overflow: visible;
  margin-top: 8px;
  border: 1px solid rgba(25, 34, 44, 0.16);
  border-radius: 4px;
  background: radial-gradient(ellipse at 52% 33%, #485046, #212926 68%, #151b19);
  box-shadow: 0 8px 18px rgba(18, 28, 40, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body.leeroy-stage .home-player .portrait-stage::after {
  content: "";
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: -14px;
  height: 14px;
  background: linear-gradient(180deg, rgba(28, 36, 33, 0.20) 0%, rgba(28, 36, 33, 0.04) 55%, transparent 100%);
  filter: blur(2px);
  pointer-events: none;
}

.home-player .portrait-light,
.home-player .portrait-pool,
.home-player .portrait-star {
  display: none !important;
}

body.leeroy-stage .home-player .portrait-scene {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

body.leeroy-stage .home-player .portrait-anchor {
  height: 108% !important;
  width: 90% !important;
  margin-bottom: -1%;
  transform: translateY(-4%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

body.leeroy-stage .home-player .portrait-pat {
  width: 100%;
  height: 100%;
  overflow: visible;
}

body.leeroy-stage .home-player .hero-portrait {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  max-width: 100% !important;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 8px 14px rgba(12, 18, 15, 0.42));
}

.home-player .portrait-reply {
  left: 60%;
  top: 14%;
  z-index: 6;
}

body.site-controls.leeroy-stage .home-player .portrait-reply:not(:empty) {
  color: #1d242b !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 242, 248, 0.94)) !important;
  border: 1px solid rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22), inset 0 1px 0 #ffffff !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  padding: 4px 10px !important;
}

.home-player .monkey-hanger {
  inset: 55% auto auto 67%;
}

body.leeroy-stage .home-player .monkey-guide.is-hanging .monkey-toggle canvas {
  width: clamp(50px, 4.8vw, 68px) !important;
}

/* ── Unified Apple Frosted Glass Pill for "拍拍罗师傅" & "取下小猴" & "小猴" (Fig. 4) ── */
body.site-controls.leeroy-stage .home-player .portrait-pat-hint,
body.site-controls.leeroy-stage .home-player .monkey-guide.is-hanging .monkey-toggle > span,
body.site-controls.leeroy-stage .monkey-toggle > span {
  color: #1d242b !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(235, 240, 246, 0.88) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.96) !important;
  border-radius: 999px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22), inset 0 1px 0 #ffffff !important;
  backdrop-filter: blur(10px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(10px) saturate(160%) !important;
  font: 500 10.5px/1.2 var(--control-font) !important;
  letter-spacing: 0.03em !important;
  padding: 3px 9px !important;
  white-space: nowrap !important;
}

body.site-controls.leeroy-stage .home-player .portrait-pat-hint {
  bottom: 4px;
}

/* Counter-rotate hanging monkey label so "取下小猴" sits crisp and level */
body.site-controls.leeroy-stage .home-player .monkey-guide.is-hanging .monkey-toggle > span {
  transform: rotate(9deg) !important;
  margin-top: -5px !important;
}

body.site-controls.leeroy-stage .home-player .portrait-pat:hover .portrait-pat-hint,
body.site-controls.leeroy-stage .monkey-toggle:hover > span {
  background: linear-gradient(180deg, #ffffff 0%, #e7f1fd 100%) !important;
  border-color: #ffffff !important;
  color: #1455a8 !important;
}

/* ── Compact Right-Side Scene List ── */
.home-track-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.site-controls .home-player .portal-orbit {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  border: 1px solid #d1d7e0;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: inset 0 1px 2px rgba(90, 105, 125, 0.08);
  overflow: hidden;
}

.site-controls .home-player .portal-orbit .portal-card {
  min-height: 30px;
  border: 0;
  border-bottom: 1px solid #e6ebf0;
  border-radius: 0;
  padding: 4px 10px;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: #1d242b;
  box-shadow: none;
}

.site-controls .home-player .portal-orbit .portal-card:nth-child(even) {
  background: #f6f8fb;
}

.site-controls .home-player .portal-orbit .portal-card:last-child {
  border-bottom: 0;
}

.site-controls .home-player .portal-orbit .portal-card:is(:hover, :focus-visible, [aria-current="true"]) {
  color: #ffffff;
  background: linear-gradient(180deg, #57a9f7 0%, #378de8 48%, #1e73d6 52%, #2b81e0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  outline-offset: -2px;
}

.home-player .portal-title {
  text-shadow: none;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.site-controls .home-player .portal-card .portal-pill {
  color: #6b7685;
  font-size: 10px;
  font-weight: 500;
}

.site-controls .home-player .portal-card:is(.is-done, .is-unlocked-final) .portal-pill {
  color: #1e73d6;
}

.site-controls .home-player .portal-card:is(:hover, :focus-visible, [aria-current="true"]) .portal-pill {
  color: rgba(255, 255, 255, 0.92);
}

.site-controls .home-player .portal-card.is-locked {
  opacity: 0.72;
}

.site-controls .home-player .hero-micro-bar {
  max-width: none;
  justify-content: flex-start;
  margin-top: 8px;
  padding: 0 2px;
  font-size: 10.5px;
  line-height: 1.5;
  color: #6e7781;
  letter-spacing: 0.01em;
}

/* ── Classic iPod Music Player Progress Bar (Full Width Across Bottom of Screen) ── */
.home-progress {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 0;
  color: #46505a;
  font: 600 10.5px/1.2 var(--control-font);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.home-progress output {
  min-width: 30px;
}

#homeProgressRemain {
  text-align: right;
  color: #5b6570;
}

.home-progress-steps {
  position: relative;
  display: block;
  flex: 1;
  height: 10px;
  padding: 0;
  border: 1px solid #cbd2dc;
  border-radius: 2px;
  background: linear-gradient(180deg, #dde2e9 0%, #eef1f5 48%, #f9fafc 100%);
  box-shadow:
    inset 0 1px 2px rgba(72, 86, 102, 0.2),
    0 5px 8px -3px rgba(130, 145, 165, 0.26);
  overflow: hidden;
}

.home-progress-steps i {
  display: none;
}

.home-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: max(8px, var(--progress-pct, 0%));
  background: linear-gradient(180deg, #74c2ff 0%, #3996f2 46%, #1c78dc 52%, #3ca0f8 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.68),
    1px 0 2px rgba(24, 104, 198, 0.35);
  transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Apple-Style Monkey Dialog Across ALL Scenes (Fig. 5) ── */
body.site-controls.leeroy-stage .monkey-card {
  border-radius: 16px !important;
  padding: 16px 18px 14px !important;
  background: linear-gradient(180deg, rgba(252, 253, 255, 0.94) 0%, rgba(238, 242, 248, 0.91) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(22px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(22px) saturate(180%) !important;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.28),
    0 1px 3px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 #ffffff !important;
  color: #1d1d1f !important;
  font-family: var(--control-font) !important;
}

body.site-controls.leeroy-stage .monkey-copy {
  color: #1d1d1f !important;
  font-weight: 450 !important;
  font-size: 13.5px !important;
  line-height: 1.55 !important;
  letter-spacing: 0.01em !important;
  margin: 0 28px 13px 0 !important;
}

body.site-controls.leeroy-stage .monkey-close {
  right: 11px !important;
  top: 11px !important;
  width: 24px !important;
  height: 24px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  display: grid !important;
  place-items: center !important;
  background: linear-gradient(180deg, #ffffff 0%, #e4e9f0 100%) !important;
  border: 1px solid rgba(154, 164, 178, 0.58) !important;
  box-shadow: inset 0 1px 0 #ffffff, 0 1px 2px rgba(0, 0, 0, 0.08) !important;
  color: #4b5563 !important;
  font-size: 14px !important;
  line-height: 1 !important;
}

body.site-controls.leeroy-stage .monkey-close:hover {
  background: linear-gradient(180deg, #ffffff 0%, #d8e0ea 100%) !important;
  color: #111827 !important;
  border-color: rgba(120, 132, 148, 0.72) !important;
}

body.site-controls.leeroy-stage .monkey-actions {
  gap: 8px !important;
}

body.site-controls.leeroy-stage .monkey-actions > * {
  font-family: var(--control-font) !important;
  font-weight: 500 !important;
  font-size: 12px !important;
  letter-spacing: 0.02em !important;
  padding: 5px 13px !important;
  border-radius: 999px !important;
  color: #1d242b !important;
  background: linear-gradient(180deg, #ffffff 0%, #f0f3f7 49%, #e3e8ef 51%, #edf0f5 100%) !important;
  border: 1px solid rgba(152, 162, 176, 0.68) !important;
  box-shadow: inset 0 1px 0 #ffffff, 0 1px 2px rgba(0, 0, 0, 0.08) !important;
  transition: all 150ms ease !important;
}

body.site-controls.leeroy-stage .monkey-actions > *:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f5f8fc 49%, #e9eef5 51%, #f3f6fa 100%) !important;
  border-color: rgba(118, 130, 146, 0.78) !important;
  color: #111827 !important;
}

body.site-controls.leeroy-stage .monkey-actions > .monkey-next {
  color: #ffffff !important;
  background: linear-gradient(180deg, #5eb1ff 0%, #378de8 49%, #1f74d8 51%, #2f84e3 100%) !important;
  border: 1px solid #1b65bf !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 3px rgba(24, 102, 198, 0.32) !important;
}

body.site-controls.leeroy-stage .monkey-actions > .monkey-next:hover {
  background: linear-gradient(180deg, #70bbff 0%, #4397ee 49%, #257ce0 51%, #398ee9 100%) !important;
  color: #ffffff !important;
}

/* ── Responsive Adjustments ── */
@media (min-width: 601px) and (max-width: 760px) {
  .home-player-screen {
    column-gap: 12px;
    padding: 12px;
  }
  .site-controls .home-player .portal-orbit .portal-card {
    min-height: 27px;
  }
}

@media (max-width: 600px) {
  .home-player {
    width: min(410px, 100%);
    min-height: 0;
    max-width: none;
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 16px;
    border-radius: 24px;
  }
  .home-wheel {
    grid-row: 2;
    width: min(168px, 48vw);
  }
  .home-display {
    grid-row: 1;
  }
  .home-player-screen {
    grid-template-columns: 1fr;
    min-height: 0;
    row-gap: 12px;
    padding: 12px;
  }
  body.leeroy-stage .home-player .portrait-stage {
    width: min(180px, 60vw) !important;
  }
  .site-controls .home-player .portal-orbit .portal-card {
    min-height: 29px;
  }
  .home-player .portrait-reply {
    left: 55%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   APPLE JET-BLACK iPOD + DARK GLASS COMPARISON THEME (?ui=dark)
   ═══════════════════════════════════════════════════════════════════════════ */
body.ui-dark .home-player {
  color: #f5f7fa;
  border-color: rgba(255, 255, 255, 0.16);
  background: radial-gradient(ellipse at 50% 0%, #2a2e36 0%, #171a20 56%, #0d0f13 100%);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.22),
    inset 0 18px 26px -12px rgba(255, 255, 255, 0.08),
    inset 20px 0 28px -12px rgba(0, 0, 0, 0.72),
    inset -20px 0 28px -12px rgba(0, 0, 0, 0.72),
    inset 0 -24px 30px -10px rgba(0, 0, 0, 0.85),
    0 6px 14px -2px rgba(0, 0, 0, 0.78),
    0 28px 72px rgba(0, 0, 0, 0.82);
}

body.ui-dark .home-player::before {
  background: linear-gradient(90deg, #4b515c 0%, #868e9c 20%, #636b78 50%, #8a92a0 80%, #444a54 100%);
  box-shadow:
    inset 0 1.5px 1px rgba(255, 255, 255, 0.5),
    inset 0 -1px 1.5px rgba(0, 0, 0, 0.65);
}

body.ui-dark .home-player::after {
  background: linear-gradient(180deg, rgba(120, 134, 158, 0.16) 0%, rgba(90, 104, 126, 0.06) 45%, transparent 100%);
}

body.ui-dark .home-wheel {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.025) 0 1px, rgba(0, 0, 0, 0.05) 1px 2px),
    linear-gradient(180deg, #383d46 0%, #292d35 54%, #1e2128 100%);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.55),
    inset 0 -1.5px 3px rgba(255, 255, 255, 0.14),
    0 1px 1px rgba(255, 255, 255, 0.12);
}

body.ui-dark .home-wheel .wheel-enter {
  border-color: rgba(255, 255, 255, 0.14);
  background: radial-gradient(circle at 46% 28%, #2c313a 0%, #191c22 72%, #101216 100%);
  box-shadow:
    inset 0 1.5px 2px rgba(255, 255, 255, 0.22),
    inset 0 -2px 4px rgba(0, 0, 0, 0.65),
    0 1px 2px rgba(255, 255, 255, 0.12);
}

body.ui-dark .home-display {
  border-color: #363c46;
  background: #14171d;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14),
    0 -1px 3px rgba(0, 0, 0, 0.65);
}

body.ui-dark .home-player-bar {
  background: linear-gradient(180deg, #3c424d 0%, #2a2f38 48%, #21252d 52%, #292e37 100%);
  border-bottom-color: #12151a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: #f0f4fa;
}

body.ui-dark .home-bar-status { color: rgba(235, 240, 248, 0.86); }
body.ui-dark .home-bar-battery {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.35);
}
body.ui-dark .home-bar-battery::after { background: rgba(255, 255, 255, 0.35); }

body.ui-dark .home-player-screen {
  background: linear-gradient(180deg, #171b22 0%, #11141a 100%);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.55);
}

body.ui-dark.site-controls .home-player .portal-orbit {
  border-color: rgba(255, 255, 255, 0.14);
  background: #1a1e26;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}

body.ui-dark.site-controls .home-player .portal-orbit .portal-card {
  border-bottom-color: rgba(255, 255, 255, 0.08);
  background: #1d222b;
  color: #f0f4fa;
}

body.ui-dark.site-controls .home-player .portal-orbit .portal-card:nth-child(even) {
  background: #181c24;
}

body.ui-dark.site-controls .home-player .portal-orbit .portal-card:is(:hover, :focus-visible, [aria-current="true"]) {
  color: #ffffff;
  background: linear-gradient(180deg, #57a9f7 0%, #378de8 48%, #1e73d6 52%, #2b81e0 100%);
}

body.ui-dark.site-controls .home-player .portal-card .portal-pill {
  color: rgba(206, 216, 230, 0.66);
}

body.ui-dark.site-controls .home-player .portal-card:is(.is-done, .is-unlocked-final) .portal-pill {
  color: #7cc2ff;
}

body.ui-dark.site-controls .home-player .portal-card:is(:hover, :focus-visible, [aria-current="true"]) .portal-pill {
  color: rgba(255, 255, 255, 0.94);
}

body.ui-dark.site-controls .home-player .hero-micro-bar {
  color: rgba(206, 216, 230, 0.66);
}

body.ui-dark .home-progress,
body.ui-dark #homeProgressRemain {
  color: rgba(214, 224, 238, 0.78);
}

body.ui-dark .home-progress-steps {
  border-color: rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, #0f1217 0%, #1a1f28 52%, #232934 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.68), 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Dark Apple Frosted Glass for Pat/Monkey Pills & Cross-Scene Monkey Dialog */
body.ui-dark.site-controls.leeroy-stage .home-player .portrait-pat-hint,
body.ui-dark.site-controls.leeroy-stage .home-player .monkey-guide.is-hanging .monkey-toggle > span,
body.ui-dark.site-controls.leeroy-stage .monkey-toggle > span,
body.ui-dark.site-controls.leeroy-stage .home-player .portrait-reply:not(:empty) {
  color: #f5f7fa !important;
  background: linear-gradient(180deg, rgba(48, 53, 64, 0.86) 0%, rgba(26, 30, 38, 0.90) 100%) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

body.ui-dark.site-controls.leeroy-stage .home-player .portrait-pat:hover .portrait-pat-hint,
body.ui-dark.site-controls.leeroy-stage .monkey-toggle:hover > span {
  background: linear-gradient(180deg, rgba(64, 72, 86, 0.92) 0%, rgba(36, 42, 52, 0.94) 100%) !important;
  color: #82c4ff !important;
}

body.ui-dark.site-controls.leeroy-stage .monkey-card {
  background: linear-gradient(180deg, rgba(38, 42, 50, 0.88) 0%, rgba(20, 23, 30, 0.92) 100%) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow:
    0 20px 52px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
  color: #f5f7fa !important;
}

body.ui-dark.site-controls.leeroy-stage .monkey-copy {
  color: #f5f7fa !important;
}

body.ui-dark.site-controls.leeroy-stage .monkey-close {
  background: linear-gradient(180deg, rgba(70, 76, 88, 0.9), rgba(44, 49, 58, 0.92)) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 3px rgba(0, 0, 0, 0.35) !important;
  color: rgba(240, 244, 250, 0.86) !important;
}

body.ui-dark.site-controls.leeroy-stage .monkey-actions > * {
  color: #f5f7fa !important;
  background: linear-gradient(180deg, rgba(68, 74, 86, 0.88) 0%, rgba(46, 51, 60, 0.90) 49%, rgba(36, 40, 48, 0.92) 51%, rgba(44, 49, 58, 0.90) 100%) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 6px rgba(0, 0, 0, 0.34) !important;
}

body.ui-dark.site-controls.leeroy-stage .monkey-actions > *:hover {
  background: linear-gradient(180deg, rgba(84, 92, 106, 0.92) 0%, rgba(58, 64, 76, 0.92) 49%, rgba(46, 51, 60, 0.94) 51%, rgba(56, 62, 74, 0.92) 100%) !important;
  color: #ffffff !important;
}

body.ui-dark.site-controls.leeroy-stage .monkey-actions > .monkey-next {
  color: #ffffff !important;
  background: linear-gradient(180deg, #5eb1ff 0%, #378de8 49%, #1f74d8 51%, #2f84e3 100%) !important;
  border-color: #1b65bf !important;
}

/* ── Top-Right Viewport Utility Controls (Day/Night Switch + Immersive Fullscreen) ── */
.viewport-tools {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  z-index: 98;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(252, 253, 255, 0.88) 0%, rgba(236, 241, 248, 0.82) 100%);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 #ffffff, 0 8px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  transition: top 220ms ease, right 220ms ease;
}

body.site-controls.leeroy-stage .room-home-btn {
  width: 42px !important;
  height: 42px !important;
  top: 74px !important;
  right: 20px !important;
  padding: 0 !important;
  font-size: 10.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0.02em !important;
}

body.leeroy-stage.in-room .viewport-tools {
  top: 124px;
  right: 20px;
  flex-direction: column;
  border-radius: 999px;
  padding: 4px;
  gap: 5px;
}

.vp-tool-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(154, 166, 182, 0.45);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(234, 240, 247, 0.90) 100%);
  box-shadow: inset 0 1px 0 #ffffff, 0 1px 3px rgba(15, 23, 34, 0.10);
  color: #1d242b;
  cursor: pointer;
  transition: all 150ms ease;
}

.vp-tool-btn:hover {
  background: linear-gradient(180deg, #ffffff 0%, #e7f0fb 100%);
  border-color: rgba(110, 130, 156, 0.65);
  color: #111827;
}

.vp-tool-btn:active {
  transform: scale(0.96);
}

.vp-tool-btn .vp-ico {
  display: block;
  flex: none;
}

#themeToggleBtn[aria-pressed="false"] .vp-ico-moon,
#themeToggleBtn[aria-pressed="true"] .vp-ico-sun,
#fullscreenBtn[aria-pressed="false"] .vp-ico-compress,
#fullscreenBtn[aria-pressed="true"] .vp-ico-expand {
  display: none;
}

#fullscreenBtn[aria-pressed="true"] {
  color: #ffffff;
  background: linear-gradient(180deg, #62b5ff 0%, #378ee8 49%, #1d73d6 51%, #2f84e3 100%);
  border-color: #1b65bf;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 6px rgba(24, 102, 198, 0.3);
}

body.ui-dark .viewport-tools {
  background: linear-gradient(180deg, rgba(38, 42, 50, 0.84) 0%, rgba(20, 23, 30, 0.88) 100%);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 10px 28px rgba(0, 0, 0, 0.52);
}

body.ui-dark .vp-tool-btn {
  color: #f0f4fa;
  background: linear-gradient(180deg, rgba(66, 72, 84, 0.86) 0%, rgba(40, 45, 54, 0.90) 100%);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 5px rgba(0, 0, 0, 0.34);
}

body.ui-dark .vp-tool-btn:hover {
  background: linear-gradient(180deg, rgba(82, 90, 106, 0.92) 0%, rgba(50, 56, 68, 0.94) 100%);
  color: #ffffff;
}
