:root {
  --select-top: #65aef8;
  --select-mid: #2874db;
  --select-bot: #1659ba;
  --ipod-w: min(88vw, calc(88dvh * 618 / 1035), 372px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background-color: #121419;
  background-image: radial-gradient(circle at 50% 35%, #23262e 0%, #121419 65%, #090a0d 100%);
  color-scheme: dark;
}

body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background-color: #121419;
  background-image: radial-gradient(circle at 50% 35%, #23262e 0%, #121419 65%, #090a0d 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.sr-only {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0.001;
  pointer-events: none;
  left: -9999px;
}

/* ============================================================================
   1:1 Physical 6th/7th Gen Silver Anodized Aluminum iPod Classic (61.8 x 103.5mm)
   ============================================================================ */
.ipod-shell {
  width: var(--ipod-w);
  aspect-ratio: 618 / 1035;
  border-radius: calc(var(--ipod-w) * 0.088);
  padding: calc(var(--ipod-w) * 0.062) calc(var(--ipod-w) * 0.064) calc(var(--ipod-w) * 0.072);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.035) 0px,
      rgba(255, 255, 255, 0.035) 1px,
      rgba(0, 0, 0, 0.018) 1px,
      rgba(0, 0, 0, 0.018) 2px
    ),
    radial-gradient(120% 70% at 30% 0%, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(168deg, #eceef1 0%, #dcdde1 32%, #d2d5da 64%, #c4c8cf 100%);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.92),
    inset 0 -4px 7px rgba(0, 0, 0, 0.24),
    inset 3px 0 5px rgba(255, 255, 255, 0.55),
    inset -3px 0 6px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.32),
    0 0 0 2px rgba(90, 95, 105, 0.42),
    0 28px 64px rgba(0, 0, 0, 0.78),
    0 8px 20px rgba(0, 0, 0, 0.5);
}

/* Chamfered aluminum inner rim */
.ipod-shell::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: calc(var(--ipod-w) * 0.08);
  border: 1px solid rgba(255, 255, 255, 0.42);
  pointer-events: none;
}

/* ============================================================================
   Recessed 2.5" QVGA Color LCD (320 x 240, 4:3, Hardcore Read-Only)
   ============================================================================ */
.lcd-bezel {
  width: 100%;
  aspect-ratio: 4 / 3.04;
  background: linear-gradient(180deg, #0d0e10 0%, #1c1e22 100%);
  border-radius: 9px;
  padding: 6px;
  position: relative;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.85),
    0 -1px 1px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.lcd-screen {
  width: 100%;
  height: 100%;
  background: #f5f7fa;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.55);
}

/* Subtle glossy glass glare over LCD */
.lcd-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    132deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.04) 38%,
    rgba(255, 255, 255, 0) 41%
  );
  pointer-events: none;
  z-index: 20;
}

/* Authentic 6th/7th Gen Metallic Status Bar */
.status-bar {
  height: 22px;
  flex-shrink: 0;
  padding: 0 7px;
  background: linear-gradient(
    180deg,
    #fdfdfd 0%,
    #e5e8ec 48%,
    #d2d6dc 50%,
    #e2e5ea 100%
  );
  border-bottom: 1px solid #9fa6b0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #1a1c20;
  z-index: 5;
}

.status-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 72%;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.status-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.play-indicator {
  width: 11px;
  height: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #195ec2;
}

.play-indicator svg {
  width: 10px;
  height: 10px;
  fill: currentColor;
}

.battery {
  width: 21px;
  height: 10px;
  border: 1px solid #555c66;
  border-radius: 2px;
  padding: 1px;
  position: relative;
  background: linear-gradient(180deg, #e7eaef, #ffffff);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.15);
}

.battery::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 2px;
  width: 2px;
  height: 4px;
  background: #555c66;
  border-radius: 0 1px 1px 0;
}

.battery-fill {
  width: 84%;
  height: 100%;
  background: linear-gradient(180deg, #b5f07d 0%, #58c32c 48%, #3da518 52%, #55be2b 100%);
}

/* Sliding Viewport Container */
.lcd-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

/* Classic iPod Quick-Scroll Letter Overlay (A-Z / Pinyin Initial) */
.letter-hud {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: rgba(18, 22, 28, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.36);
  color: #ffffff;
  font-size: 34px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 15;
}

.letter-hud.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.lcd-view {
  position: absolute;
  inset: 0;
  display: flex;
  background: #ffffff;
  will-change: transform;
}

.lcd-view.enter-from-right {
  animation: slideInRight 220ms cubic-bezier(0.22, 0.8, 0.25, 1) forwards;
}

.lcd-view.enter-from-left {
  animation: slideInLeft 220ms cubic-bezier(0.22, 0.8, 0.25, 1) forwards;
}

.lcd-view.leave-to-left {
  animation: slideOutLeft 220ms cubic-bezier(0.22, 0.8, 0.25, 1) forwards;
}

.lcd-view.leave-to-right {
  animation: slideOutRight 220ms cubic-bezier(0.22, 0.8, 0.25, 1) forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0%); }
}
@keyframes slideOutLeft {
  from { transform: translateX(0%); }
  to { transform: translateX(-100%); }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0%); }
}
@keyframes slideOutRight {
  from { transform: translateX(0%); }
  to { transform: translateX(100%); }
}

/* Split-Screen Home Menu (Left Menu + Right Full-Bleed Ken Burns Art) */
.menu-pane {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
  background: #ffffff;
}

.menu-pane::-webkit-scrollbar {
  display: none;
}

.lcd-view.split .menu-pane {
  width: 50%;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.16);
  z-index: 2;
}

.preview-pane {
  display: none;
  width: 50%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #252a34 0%, #101318 100%);
}

.lcd-view.split .preview-pane {
  display: block;
}

.preview-bg-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: kenBurns 16s ease-in-out infinite alternate;
  filter: saturate(1.06);
}

@keyframes kenBurns {
  0% { transform: scale(1.02) translate(0, 0); }
  100% { transform: scale(1.18) translate(-4%, -3%); }
}

.preview-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.55);
}

.preview-fallback svg {
  width: 54px;
  height: 54px;
  fill: currentColor;
}

.preview-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 8px 6px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.72) 100%);
  color: #fff;
  text-align: left;
}

.preview-caption {
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-sub {
  font-size: 9.5px;
  opacity: 0.85;
  margin-top: 1px;
}

/* Classic Aqua-Blue Highlighted Menu Rows */
.menu-row {
  height: 26px;
  padding: 0 7px 0 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: #16181c;
  gap: 6px;
}

.menu-row.selected {
  background: linear-gradient(
    180deg,
    var(--select-top) 0%,
    var(--select-mid) 49%,
    var(--select-bot) 51%,
    #256fd4 100%
  );
  color: #ffffff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.28);
}

.menu-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.menu-right {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.menu-row.selected .menu-right {
  color: #ffffff;
}

.chevron {
  width: 7px;
  height: 11px;
  fill: currentColor;
}

/* ============================================================================
   Authentic 6th/7th Gen Now Playing (3D Tilted Album Art + Glossy Reflection)
   ============================================================================ */
.now-playing-view {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #ffffff 0%, #f1f4f8 72%, #e6eaf0 100%);
  padding: 10px 11px 7px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.np-top {
  display: flex;
  gap: 11px;
  align-items: center;
  flex: 1;
  min-height: 0;
}

.np-art-stage {
  width: 92px;
  height: 106px;
  flex-shrink: 0;
  perspective: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.np-art-3d {
  width: 88px;
  transform: rotateY(18deg);
  transform-style: preserve-3d;
}

.np-art {
  width: 88px;
  height: 88px;
  display: block;
  object-fit: cover;
  background: linear-gradient(135deg, #2d3440, #161a22);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.32);
}

.np-art-fallback {
  width: 88px;
  height: 88px;
  background: linear-gradient(135deg, #323946, #171b23);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c5cedb;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.32);
}

.np-art-fallback svg {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

.np-reflection {
  width: 88px;
  height: 18px;
  overflow: hidden;
  transform: scaleY(-1);
  opacity: 0.28;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 15%, rgba(0, 0, 0, 1) 100%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 15%, rgba(0, 0, 0, 1) 100%);
  margin-top: 1px;
}

.np-reflection img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  display: block;
}

.np-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.np-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #111317;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.np-artist {
  font-size: 11.5px;
  font-weight: 600;
  color: #464e5a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.np-album {
  font-size: 10.5px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.np-count {
  font-size: 10px;
  font-weight: 600;
  color: #7c8594;
  margin-top: 5px;
}

.np-bottom {
  padding-top: 4px;
}

.np-mode-hint {
  font-size: 9.5px;
  font-weight: 700;
  color: #195ec2;
  text-align: center;
  height: 12px;
  margin-bottom: 2px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 1px;
  background: linear-gradient(180deg, #c6cdd8 0%, #e7ebf2 55%, #f3f5f8 100%);
  border: 1px solid #9da6b3;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.16);
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(
    180deg,
    #88c7ff 0%,
    #3d8ef0 46%,
    #1c66cd 52%,
    #3282e8 100%
  );
}

.scrub-diamond {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  background: #1456b8;
  border: 1px solid #ffffff;
  transform: translate(-50%, -50%) rotate(45deg);
  display: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.progress-track.scrubbing .scrub-diamond {
  display: block;
}

.time-row {
  margin-top: 3px;
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  font-weight: 700;
  color: #363d47;
}

/* ============================================================================
   1:1 Tactile Matte-White Click Wheel with 3D Press Tilt & iOS Switch Label
   ============================================================================ */
.wheel-stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 520px;
}

.wheel-haptic-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.click-wheel {
  width: calc(var(--ipod-w) * 0.65);
  height: calc(var(--ipod-w) * 0.65);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #f5f6f8 68%, #e8eaee 100%);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.96),
    inset 0 -2px 5px rgba(0, 0, 0, 0.11),
    0 0 0 1px rgba(135, 142, 152, 0.55),
    0 1px 3px rgba(255, 255, 255, 0.75);
  position: relative;
  touch-action: none;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 70ms ease-out;
}

.click-wheel:active {
  cursor: grabbing;
}

.click-wheel.tilt-top {
  transform: rotateX(6deg) translateY(0.5px);
}
.click-wheel.tilt-bottom {
  transform: rotateX(-6deg) translateY(0.5px);
}
.click-wheel.tilt-left {
  transform: rotateY(-6deg);
}
.click-wheel.tilt-right {
  transform: rotateY(6deg);
}

.wheel-label {
  position: absolute;
  color: #9399a3;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-label.menu {
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  font-size: calc(var(--ipod-w) * 0.036);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.wheel-label.next {
  right: 8.5%;
  top: 50%;
  transform: translateY(-50%);
}

.wheel-label.prev {
  left: 8.5%;
  top: 50%;
  transform: translateY(-50%);
}

.wheel-label.play {
  bottom: 9.5%;
  left: 50%;
  transform: translateX(-50%);
}

.wheel-label svg {
  width: calc(var(--ipod-w) * 0.056);
  height: calc(var(--ipod-w) * 0.038);
  fill: currentColor;
}

.center-btn {
  width: 35.5%;
  height: 35.5%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(162deg, #e7e9ed 0%, #d5d8de 58%, #c6cad1 100%);
  border: 1px solid #b1b6bf;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.85),
    inset 0 -2px 4px rgba(0, 0, 0, 0.16),
    0 1px 2px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  transition: transform 65ms ease, box-shadow 65ms ease;
}

.center-btn.pressed {
  transform: scale(0.955);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.24);
}

/* Lock Overlay */
.lock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 18, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.lock-overlay.visible {
  display: flex;
}

.lock-card {
  width: min(100%, 340px);
  background: linear-gradient(180deg, #eceef1, #d5d8de);
  color: #181a1f;
  border-radius: 20px;
  padding: 22px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.lock-card h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.lock-card p {
  margin: 0 0 14px;
  font-size: 12px;
  color: #4b5563;
  line-height: 1.5;
}

.lock-card input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #aeb4bc;
  background: #fff;
  color: #111;
  font-size: 14px;
  margin-bottom: 10px;
  user-select: text;
  -webkit-user-select: text;
}

.lock-card button {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(180deg, #5da6f6, #1a5ec0);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.lock-error {
  margin-top: 8px;
  font-size: 12px;
  color: #c81e1e;
  min-height: 16px;
}
