/* ── Reset & Page ─────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0d0d1a, #1a1a2e, #0f0f2a);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding: 20px 0 32px;
  padding: 20px 0 calc(32px + env(safe-area-inset-bottom, 0px));
}

/* ── iPod Case ───────────────────────────────────────── */
.ipod {
  position: relative;
  width: 300px;
  height: 516px;
  background: linear-gradient(180deg, #f7f7f9 0%, #ededef 40%, #e2e2e4 70%, #d8d8da 100%);
  border-radius: 26px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.12),
    0 2px 4px rgba(0,0,0,0.15),
    0 12px 40px rgba(0,0,0,0.35),
    0 30px 80px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 22px;
  user-select: none;
  -webkit-user-select: none;
}

.ipod-shine {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 26px;
  background: linear-gradient(
    105deg,
    transparent 0%,
    transparent 35%,
    rgba(255,255,255,0.12) 42%,
    rgba(255,255,255,0.03) 50%,
    transparent 55%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 10;
}

/* ── Screen ──────────────────────────────────────────── */
.screen {
  width: 260px;
  height: 198px;
  background: #1a1a1a;
  border-radius: 6px;
  padding: 4px;
  box-shadow:
    inset 0 1px 4px rgba(0,0,0,0.6),
    0 1px 0 rgba(255,255,255,0.4);
  position: relative;
  z-index: 1;
}

.screen-glass {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  background: #fff;
}

/* ── Boot Screen ─────────────────────────────────────── */
.boot {
  position: absolute;
  inset: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: opacity 0.6s ease;
}

.boot i { font-size: 52px; color: #555; }
.boot.hidden { opacity: 0; pointer-events: none; }

/* ── UI Container ────────────────────────────────────── */
.ui {
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.5s ease 0.2s;
}
.ui.visible { opacity: 1; }

/* ── Title Bar ───────────────────────────────────────── */
.titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  height: 22px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #b8cde6 0%, #8aadd4 30%, #6892c4 70%, #5680b5 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.15);
}

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

.tb-play, .tb-shuffle {
  font-size: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.tb-play.on, .tb-shuffle.on { opacity: 1; }

/* Battery */
.battery {
  width: 22px;
  height: 10px;
  border: 1.5px solid rgba(255,255,255,0.9);
  border-radius: 2px;
  padding: 1.5px;
  position: relative;
}
.battery::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 5px;
  background: rgba(255,255,255,0.9);
  border-radius: 0 1px 1px 0;
}
.bat-fill {
  width: 80%;
  height: 100%;
  background: #5bd65b;
  border-radius: 0.5px;
}

/* ── Views Container ─────────────────────────────────── */
.views {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  transition: transform 0.3s ease;
  background: #fff;
}

.view.slide-left  { transform: translateX(-100%); }
.view.slide-right { transform: translateX(100%); }

/* ── Menu ─────────────────────────────────────────────── */
#view-menu {
  display: flex;
}

.menu {
  flex: 1;
  overflow: hidden;
}

.menu-item {
  display: flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  font-size: 12px;
  color: #000;
  cursor: default;
}

.menu-item.selected {
  background: linear-gradient(180deg, #5a8fd8 0%, #2d62b8 100%);
  color: #fff;
}

.menu-item .mi-icon {
  width: 12px;
  font-size: 8px;
  flex-shrink: 0;
  text-align: center;
  margin-right: 2px;
}

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

.menu-item .mi-detail {
  font-size: 11px;
  opacity: 0.5;
  margin-left: 4px;
  flex-shrink: 0;
}

.menu-item.selected .mi-detail {
  opacity: 0.7;
}

.menu-item .mi-arrow {
  font-size: 14px;
  font-weight: 700;
  margin-left: 4px;
  flex-shrink: 0;
  opacity: 0.4;
}

.menu-item.selected .mi-arrow {
  opacity: 0.8;
}

/* Scrollbar */
.scrollbar {
  width: 6px;
  background: #ddd;
  position: relative;
  flex-shrink: 0;
}

.scroll-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: #888;
  border-radius: 3px;
  min-height: 12px;
  transition: top 0.1s ease;
}

/* ── Now Playing ─────────────────────────────────────── */
.np-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 6px 12px 8px;
}

.np-art {
  width: 88px;
  height: 88px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 2px 8px rgba(0,0,0,0.25);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  flex-shrink: 0;
  margin-bottom: 4px;
}

.np-title-mask {
  width: 100%;
  overflow: hidden;
  text-align: center;
}

.np-title {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.np-title.scrolling {
  animation: marquee var(--marquee-dur, 6s) linear infinite;
}

@keyframes marquee {
  0%, 12%  { transform: translateX(0); }
  50%, 62% { transform: translateX(var(--scroll-dist, 0px)); }
  100%     { transform: translateX(0); }
}

.np-artist {
  font-size: 11px;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
  margin-bottom: auto;
}

/* Scrubber */
.np-scrubber {
  width: 100%;
  flex-shrink: 0;
}

.np-bar {
  position: relative;
  height: 5px;
  background: #ccc;
  border-radius: 2.5px;
  overflow: visible;
}

.np-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(180deg, #6a9ee0, #4a7ec8);
  border-radius: 2.5px;
}

.np-diamond {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 9px;
  height: 9px;
  background: #4a7ec8;
  border: 1px solid #3668aa;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 1px;
}

.np-times {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #666;
  margin-top: 2px;
}

/* Volume overlay */
.vol-bar {
  position: absolute;
  bottom: 8px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #888;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.vol-bar.show { opacity: 1; }

.vol-track {
  flex: 1;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  overflow: hidden;
}

.vol-fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #6a9ee0, #4a7ec8);
  border-radius: 2px;
}

/* ── Click Wheel ─────────────────────────────────────── */
.wheel {
  width: 194px;
  height: 194px;
  border-radius: 50%;
  background: linear-gradient(145deg, #d9d9db, #c4c4c6, #cfcfd1);
  margin-top: 22px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.08),
    0 1px 2px rgba(255,255,255,0.6);
  z-index: 1;
  touch-action: none;
}

.center {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f2f2f4 0%, #e4e4e6 60%, #dcdcde 100%);
  box-shadow:
    0 1px 3px rgba(0,0,0,0.12),
    inset 0 1px 0 rgba(255,255,255,0.9);
  position: relative;
  z-index: 2;
}

.center:active, .center.pressing {
  background: linear-gradient(180deg, #e6e6e8 0%, #d8d8da 60%, #d0d0d2 100%);
}

/* Wheel labels */
.wl {
  position: absolute;
  font-size: 11px;
  color: #8a8a8c;
  pointer-events: none;
  z-index: 1;
}
.wl-top    { top: 15px; font-weight: 600; font-size: 11px; letter-spacing: 0.5px; }
.wl-right  { right: 22px; }
.wl-bottom { bottom: 14px; font-size: 10px; }
.wl-left   { left: 22px; }

/* Visual feedback on wheel press */
.wheel.pressed-top    .wl-top,
.wheel.pressed-right  .wl-right,
.wheel.pressed-bottom .wl-bottom,
.wheel.pressed-left   .wl-left {
  color: #555;
}

/* ── Branding ────────────────────────────────────────── */
.branding {
  margin-top: 8px;
  font-size: 12px;
  color: #aaa;
  font-weight: 500;
  letter-spacing: 0.8px;
  z-index: 1;
}

/* ── Subscribe Section ───────────────────────────────── */
.subscribe {
  margin-top: 28px;
  text-align: center;
  max-width: 340px;
}

.sub-heading {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}

.sub-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sub-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.1);
  transition: background 0.2s, color 0.2s;
}

.sub-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.sub-url {
  display: flex;
  align-items: center;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 6px 8px 6px 12px;
  margin-bottom: 8px;
}

.sub-url code {
  flex: 1;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  font-family: "SF Mono", "Menlo", "Monaco", monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 13px;
  transition: color 0.2s, background 0.2s;
}

.copy-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.copy-btn.copied {
  color: #5bd65b;
}

.sub-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
}

/* ── Credit Footer ───────────────────────────────────── */
.credit {
  margin-top: 20px;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  text-align: center;
}

.credit a {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  transition: color 0.2s;
}

.credit a:hover {
  color: rgba(255,255,255,0.85);
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 350px) {
  .ipod { transform: scale(0.88); transform-origin: top center; }
  .subscribe { max-width: 280px; }
  .sub-btn { padding: 7px 10px; font-size: 11px; }
}

@media (max-height: 700px) {
  body { padding: 12px 0; justify-content: flex-start; padding-top: 16px; }
  .subscribe { margin-top: 16px; }
}

@media (max-height: 620px) {
  .ipod { transform: scale(0.88); transform-origin: top center; }
}

@media (max-height: 520px) {
  .ipod { transform: scale(0.75); transform-origin: top center; }
}
