* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: #8e8e93;
  background-image: 
    url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='40' height='40' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E");
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Linen texture background */
.linen-bg {
  background-color: #c5c1b8;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0,0,0,0.03) 2px,
      rgba(0,0,0,0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(0,0,0,0.02) 2px,
      rgba(0,0,0,0.02) 4px
    );
}

/* Device frame */
.device-frame {
  width: 320px;
  max-height: 568px;
  height: 568px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.3),
    0 4px 20px rgba(0,0,0,0.5),
    0 8px 40px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
  background: #1a1a1e;
}

/* iOS 6 Status Bar */
.status-bar {
  height: 20px;
  background: linear-gradient(to bottom, #3a3a3c 0%, #2c2c2e 50%, #1c1c1e 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.5);
  position: relative;
  z-index: 100;
}

.status-bar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(0,0,0,0.5);
}

/* Navigation bar */
.nav-bar {
  height: 44px;
  background: linear-gradient(to bottom, #b0b3ba 0%, #8e929a 2%, #74787f 50%, #6b6f77 51%, #595d64 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid rgba(0,0,0,0.5);
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}

.nav-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.25), rgba(255,255,255,0.05));
  pointer-events: none;
}

.nav-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.6);
  letter-spacing: -0.2px;
}

.nav-btn {
  position: absolute;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.5);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  z-index: 2;
}

.nav-btn:active {
  opacity: 0.6;
}

.nav-btn-left { left: 0; }
.nav-btn-right { right: 0; }

/* Now Playing content area */
.now-playing-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px 8px;
  overflow: hidden;
  background: linear-gradient(to bottom, #2c2c2e 0%, #1c1c1e 100%);
}

/* Album art container */
.album-art-container {
  width: 240px;
  height: 240px;
  position: relative;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.album-art-wrapper {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.6),
    0 8px 24px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.08) inset;
  position: relative;
}

.album-art-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Glossy overlay */
.album-gloss {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.25) 0%,
    rgba(255,255,255,0.08) 30%,
    transparent 50%,
    rgba(0,0,0,0.05) 80%,
    rgba(0,0,0,0.15) 100%
  );
  pointer-events: none;
  border-radius: 6px;
}

.album-reflection {
  position: absolute;
  bottom: -30px;
  left: 10%;
  right: 10%;
  height: 30px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.06), transparent);
  filter: blur(2px);
  pointer-events: none;
}

/* Track info */
.track-info {
  text-align: center;
  margin-bottom: 8px;
  width: 100%;
  flex-shrink: 0;
}

.track-title {
  font-size: 16px;
  font-weight: 700;
  color: #e5e5ea;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 13px;
  font-weight: 400;
  color: #8e8e93;
  text-shadow: 0 1px 1px rgba(0,0,0,0.5);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-album {
  font-size: 11px;
  font-weight: 400;
  color: #636366;
  text-shadow: 0 1px 1px rgba(0,0,0,0.5);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Scrubber / Progress bar */
.scrubber-container {
  width: 100%;
  padding: 0 2px;
  flex-shrink: 0;
}

.scrubber-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #8e8e93;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.scrubber-track {
  width: 100%;
  height: 10px;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.scrubber-bg {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to bottom, #1a1a1e, #3a3a3c);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
  overflow: visible;
}

.scrubber-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(to bottom, #5ac8fa, #007aff);
  box-shadow: 0 0 4px rgba(90,200,250,0.3);
  transition: width 0.1s linear;
}

.scrubber-knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(to bottom, #fff 0%, #e5e5ea 40%, #c7c7cc 100%);
  box-shadow:
    0 1px 3px rgba(0,0,0,0.5),
    0 0 0 0.5px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.9);
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  z-index: 2;
}

.scrubber-knob:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.15);
}

/* Volume slider */
.volume-container {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px 4px;
  flex-shrink: 0;
}

.volume-icon {
  flex-shrink: 0;
  color: #8e8e93;
  font-size: 12px;
}

.volume-track {
  flex: 1;
  height: 10px;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.volume-bg {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to bottom, #1a1a1e, #3a3a3c);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
}

.volume-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(to bottom, #e5e5ea, #c7c7cc);
  box-shadow: 0 0 2px rgba(255,255,255,0.1);
}

.volume-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(to bottom, #fff 0%, #e5e5ea 40%, #c7c7cc 100%);
  box-shadow:
    0 1px 3px rgba(0,0,0,0.5),
    0 0 0 0.5px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.9);
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  z-index: 2;
}

/* Playback controls */
.playback-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 4px 0 2px;
  width: 100%;
  flex-shrink: 0;
}

.control-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #e5e5ea;
  padding: 8px 16px;
  position: relative;
  transition: all 0.1s;
}

.control-btn:active {
  transform: scale(0.92);
  opacity: 0.7;
}

.control-btn svg {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.control-btn-main {
  padding: 8px 20px;
}

.shuffle-repeat-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 8px;
  flex-shrink: 0;
}

.toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #636366;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.toggle-btn.active {
  color: #5ac8fa;
  text-shadow: 0 0 6px rgba(90,200,250,0.4);
}

.toggle-btn svg {
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4));
}

.toggle-btn.active svg {
  filter: drop-shadow(0 0 4px rgba(90,200,250,0.5));
}

/* Bottom toolbar - iOS 6 style tab bar */
.bottom-toolbar {
  height: 49px;
  background: linear-gradient(to bottom, #4a4a4e 0%, #2c2c2e 4%, #1c1c1e 50%, #141416 100%);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: none;
  border: none;
  cursor: pointer;
  color: #8e8e93;
  font-size: 10px;
  padding: 4px 12px;
  transition: color 0.15s;
}

.tab-btn.active {
  color: #5ac8fa;
}

.tab-btn svg {
  opacity: 0.7;
}

.tab-btn.active svg {
  opacity: 1;
}

/* Track List View */
.track-list-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(to bottom, #2c2c2e, #1c1c1e);
}

.track-list-section-header {
  background: linear-gradient(to bottom, rgba(58,58,62,0.95), rgba(44,44,46,0.95));
  padding: 4px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #8e8e93;
  text-shadow: 0 1px 1px rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(0,0,0,0.3);
  border-top: 1px solid rgba(255,255,255,0.05);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.track-list-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.1s;
}

.track-list-item:active {
  background: rgba(90,200,250,0.15);
}

.track-list-item.playing {
  background: rgba(90,200,250,0.08);
}

.track-list-thumb {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  margin-right: 12px;
  flex-shrink: 0;
}

.track-list-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.track-list-info {
  flex: 1;
  min-width: 0;
}

.track-list-title {
  font-size: 15px;
  font-weight: 500;
  color: #e5e5ea;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-list-artist-line {
  font-size: 12px;
  color: #8e8e93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.track-list-duration {
  font-size: 12px;
  color: #636366;
  margin-left: 8px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.now-playing-indicator {
  width: 16px;
  margin-right: 8px;
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.eq-bar {
  width: 3px;
  background: #5ac8fa;
  border-radius: 1px;
  animation: eqBounce 0.6s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.eq-bar:nth-child(2) { height: 14px; animation-delay: 0.15s; }
.eq-bar:nth-child(3) { height: 6px; animation-delay: 0.3s; }

@keyframes eqBounce {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

/* View transition */
.view-flip-enter {
  animation: flipIn 0.4s ease-out;
}

@keyframes flipIn {
  0% { transform: translateX(100%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

.view-flip-back {
  animation: flipBack 0.4s ease-out;
}

@keyframes flipBack {
  0% { transform: translateX(-100%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* Album art pulse animation */
@keyframes albumPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.01); }
}

.album-playing {
  animation: albumPulse 3s ease-in-out infinite;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 12px;
  color: rgba(255,255,255,0.35);
  font-size: 12px;
}

.app-footer a {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* Custom scrollbar */
.track-list-area::-webkit-scrollbar {
  width: 4px;
}
.track-list-area::-webkit-scrollbar-track {
  background: transparent;
}
.track-list-area::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

/* Responsive - scale down on very small screens */
@media (max-height: 640px) {
  .device-frame {
    height: 520px;
    max-height: 95vh;
  }
}

@media (max-height: 560px) {
  .device-frame {
    height: 480px;
    max-height: 92vh;
  }
  .album-art-container {
    width: 180px;
    height: 180px;
  }
}