/* === Cyberpunk Tech Theme === */
:root {
  --bg: #000000;
  --bg-rgb: 0,0,0;
  --panel: rgba(10,10,10,0.88);
  --panel-2: rgba(18,18,18,0.75);
  --line: rgba(100,100,255,0.12);
  --text: #e0e0f0;
  --muted: #6a6a8a;
  --accent: #00e5ff;
  --accent-rgb: 0,229,255;
  --accent2: #b44dff;
  --accent2-rgb: 180,77,255;
  --glow: 0 0 20px rgba(var(--accent-rgb),0.3), 0 0 60px rgba(var(--accent-rgb),0.1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
[data-theme="light"] {
  --bg: #f0f0f5; --bg-rgb: 240,240,245; --panel: rgba(255,255,255,0.9); --panel-2: rgba(240,240,250,0.8);
  --line: rgba(100,100,200,0.2); --text: #1a1a2e; --muted: #666; --accent: #0070cc; --accent-rgb: 0,112,204;
  --accent2: #7020cc; --accent2-rgb: 112,32,204;
  --glow: 0 0 20px rgba(var(--accent-rgb),0.15), 0 0 40px rgba(var(--accent-rgb),0.05);
}
[data-theme="warm"] {
  --bg: #120e0a; --bg-rgb: 18,14,10; --panel: rgba(25,18,12,0.85); --panel-2: rgba(35,26,16,0.7);
  --line: rgba(200,150,80,0.15); --text: #f0e0c0; --muted: #a08060; --accent: #ffaa30; --accent-rgb: 255,170,48;
  --accent2: #ff6040; --accent2-rgb: 255,96,64;
  --glow: 0 0 20px rgba(var(--accent-rgb),0.3), 0 0 60px rgba(var(--accent-rgb),0.1);
}
[data-theme="cool"] {
  --bg: #080c18; --bg-rgb: 8,12,24; --panel: rgba(12,16,30,0.85); --panel-2: rgba(18,24,42,0.7);
  --line: rgba(60,100,220,0.15); --text: #c0d0f0; --muted: #6070a0; --accent: #4080ff; --accent-rgb: 64,128,255;
  --accent2: #40d0ff; --accent2-rgb: 64,208,255;
  --glow: 0 0 20px rgba(var(--accent-rgb),0.3), 0 0 60px rgba(var(--accent-rgb),0.1);
}
[data-theme="jade"] {
  --bg: #030f08; --bg-rgb: 3,15,8; --panel: rgba(5,16,8,0.9); --panel-2: rgba(8,22,12,0.78);
  --line: rgba(20,140,80,0.15); --text: #b0e0c0; --muted: #387050; --accent: #10c050; --accent-rgb: 16,192,80;
  --accent2: #10e080; --accent2-rgb: 16,224,128;
  --glow: 0 0 20px rgba(var(--accent-rgb),0.3), 0 0 60px rgba(var(--accent-rgb),0.1);
}
[data-theme="purple"] {
  --bg: #0f0a16; --bg-rgb: 15,10,22; --panel: rgba(18,12,28,0.85); --panel-2: rgba(26,18,38,0.7);
  --line: rgba(140,40,220,0.15); --text: #e0c0f0; --muted: #8050a0; --accent: #b040f0; --accent-rgb: 176,64,240;
  --accent2: #e040c0; --accent2-rgb: 224,64,192;
  --glow: 0 0 20px rgba(var(--accent-rgb),0.3), 0 0 60px rgba(var(--accent-rgb),0.1);
}
[data-theme="ocean"] {
  --bg: #000a18; --bg-rgb: 0,10,24; --panel: rgba(2,12,28,0.9); --panel-2: rgba(4,18,40,0.78);
  --line: rgba(20,120,220,0.15); --text: #a0c8f0; --muted: #3860a0; --accent: #1068d0; --accent-rgb: 16,104,208;
  --accent2: #1088f0; --accent2-rgb: 16,136,240;
  --glow: 0 0 20px rgba(var(--accent-rgb),0.3), 0 0 60px rgba(var(--accent-rgb),0.1);
}
[data-theme="sunset"] {
  --bg: #180a06; --bg-rgb: 24,10,6; --panel: rgba(30,12,8,0.88); --panel-2: rgba(42,18,12,0.75);
  --line: rgba(220,100,40,0.15); --text: #f0d0c0; --muted: #a06040; --accent: #e06830; --accent-rgb: 224,104,48;
  --accent2: #e04060; --accent2-rgb: 224,64,96;`n  --glow: 0 0 20px rgba(var(--accent-rgb),0.3), 0 0 60px rgba(var(--accent-rgb),0.1);
}
[data-theme="forest"] {
  --bg: #060f08; --bg-rgb: 6,15,8; --panel: rgba(8,18,10,0.88); --panel-2: rgba(14,26,16,0.75);
  --line: rgba(60,160,80,0.15); --text: #c0e8d0; --muted: #508868; --accent: #30b050; --accent-rgb: 48,176,80;
  --accent2: #40c070; --accent2-rgb: 64,192,112;`n  --glow: 0 0 20px rgba(var(--accent-rgb),0.3), 0 0 60px rgba(var(--accent-rgb),0.1);
}
[data-theme="gray"] {
  --bg: #101010; --bg-rgb: 16,16,16; --panel: rgba(20,20,20,0.85); --panel-2: rgba(30,30,30,0.7);
  --line: rgba(100,100,100,0.15); --text: #d0d0d0; --muted: #808080; --accent: #c0c0c0; --accent-rgb: 192,192,192;
  --accent2: #909090; --accent2-rgb: 144,144,144;
  --glow: 0 0 20px rgba(var(--accent-rgb),0.2), 0 0 40px rgba(var(--accent-rgb),0.05);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', ui-sans-serif, system-ui, sans-serif;
  min-height: 100dvh; overflow-x: hidden;
  transition: background 0.5s, color 0.5s;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* === Scan Lines Overlay === */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
  opacity: 0.3;
}

/* Background layers */
.bg-layer {
  position: fixed; inset: 0; z-index: -2;
  background: center/cover no-repeat;
  opacity: 1; transition: background-image 1.5s;
}
.bg-overlay {
  position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.5) 100%);
}

/* === Top Toolbar === */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 44px));
  background: transparent;
}
.top-brand {
  font-size: 15px; font-weight: 800; letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}
.top-actions { display: flex; gap: 6px; }
.top-btn {
  width: 34px; height: 34px; border-radius: 11px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s ease; min-height: 34px; padding: 0;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  position: relative;
}
.top-btn .icon { font-size: 15px; line-height: 1; opacity: 0.8; }
.top-btn::after {
  content:''; position:absolute; inset:-12px; border-radius:inherit;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(255,255,255,0.35) 0%, transparent 60%);
  opacity:0; transition: opacity 0.25s; pointer-events:none;
}
.top-btn:hover { border-color: rgba(255,255,255,0.25); box-shadow: 0 0 36px rgba(var(--accent-rgb),0.3), 0 0 72px rgba(var(--accent-rgb),0.1); transform: translateY(-1px); }
.top-btn:hover::after { opacity: 1; }
.top-btn:active { transform: scale(0.93); transition: transform 0.1s; }
.top-btn.active { background: var(--accent); color: #000; border-color: var(--accent); box-shadow: var(--glow); }

/* === Main Shell === */
.shell {
  width: 100%; max-width: 700px; margin: 0 auto;
  padding: 54px 16px 0;
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
}

/* === Player === */
.player-section {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 14px 0 12px; flex-shrink: 0; overflow-y: auto; min-height: 0;
}
.clock-time { font-size: clamp(50px, 12vw, 72px); font-weight: 600; letter-spacing: -1px; line-height: 1; color: var(--text); margin: 0 0 2px; font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif; }
.clock-date { font-size: 13px; color: var(--muted); font-weight: 500; margin: 0 0 10px; }
.clock-weather { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* === Spectrum === */
.spectrum {
  width: min(360px, 90vw); height: min(260px, 68vw);
  display: block; margin: 0 auto; border-radius: 12px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--line);
}

/* === Progress === */
.progress-wrap {
  display: flex; align-items: center; gap: 8px;
  width: 100%; max-width: min(500px, 90vw); margin: 4px auto;
}
.time-label { font-family: monospace; font-size: 10px; color: var(--muted); min-width: 44px; flex-shrink: 0; letter-spacing: 0.05em; }
.progress-bar {
  flex: 1; -webkit-appearance: none; appearance: none; height: 3px;
  background: var(--line); border-radius: 2px; outline: none; cursor: pointer;
}
.progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer; box-shadow: 0 0 10px rgba(var(--accent-rgb),0.5);
}

/* === Now Playing === */
.now-playing {
  font-size: 14px; font-weight: 600; margin: 4px 0; text-align: center;
  max-width: min(500px, 90vw); width: 100%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.6; padding: 4px 8px;
}
.now-artist { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 8px; letter-spacing: 0.03em; max-width: min(500px, 90vw); width: 100%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === Volume === */
.volume-wrap { display: flex; align-items: center; gap: 6px; margin-top: 8px; justify-content: center; max-width: 300px; width: 100%; }
.vol-icon { font-size: 14px; flex-shrink: 0; opacity: 0.7; }
.volume-slider { flex: 1; -webkit-appearance: none; appearance: none; height: 3px; background: var(--line); border-radius: 2px; outline: none; cursor: pointer; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; }

/* === Player Controls === */
.player-controls {
  display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.ctrl-btn {
  width: 40px; height: 40px; min-width: 36px; min-height: 36px;
  border-radius: 50%; font-size: 13px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  position: relative;
}
.ctrl-btn::after {
  content:''; position:absolute; inset:-8px; border-radius:50%;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(var(--accent-rgb),0.35) 0%, rgba(var(--accent-rgb),0.08) 40%, transparent 70%);
  opacity:0; transition: opacity 0.2s; pointer-events:none;
}
.ctrl-btn:hover::after,
.ctrl-btn:active::after { opacity: 1; }
.ctrl-btn::after {
  content:''; position:absolute; inset:-14px; border-radius:50%;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(var(--accent-rgb),0.4) 0%, transparent 55%);
  opacity:0; transition: opacity 0.25s; pointer-events:none;
}
.ctrl-btn:hover::after { opacity: 1; }
.ctrl-btn:hover { border-color: rgba(255,255,255,0.25); box-shadow: 0 0 36px rgba(var(--accent-rgb),0.3), 0 0 72px rgba(var(--accent-rgb),0.1); transform: translateY(-1px); }
.ctrl-btn:active { transform: scale(0.9); transition: transform 0.1s; }
.ctrl-play {
  width: 50px; height: 50px; font-size: 18px;
  background: var(--accent); border-color: var(--accent); color: #000;
  box-shadow: 0 0 20px rgba(var(--accent-rgb),0.4);
}
.ctrl-play:active { transform: scale(0.92); filter: brightness(0.85); transition: transform 0.1s; }
.ctrl-play:hover { filter: brightness(1.15); box-shadow: 0 0 40px rgba(var(--accent-rgb),0.5), 0 0 80px rgba(var(--accent-rgb),0.15); transform: translateY(-2px); }

/* === DJ Popup (left slide) === */
.dj-popup { position: relative;
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: rgba(0,0,0,0.4); backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  animation: slideDown 0.2s ease-out;
}
@keyframes slideDown { from{opacity:0;transform:translateY(-20px)} to{opacity:1;transform:translateY(0)} }
.dj-close {
  position: absolute; right: 8px; top: 8px;
  width: 22px; height: 22px; padding: 0; border: 0; min-height: 22px;
  background: rgba(255,255,255,0.08); border-radius: 4px;
  color: var(--muted); font-size: 10px; cursor: pointer; line-height: 1;
}
.dj-popup p { font-size: 12px; font-weight: 600; margin: 0; white-space: nowrap; flex-shrink: 0; padding-right: 24px; }
.dj-popup select {
  padding: 4px 6px; border-radius: 6px; background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1); color: var(--text); font-size: 11px; outline: none; cursor: pointer; flex-shrink: 0;
}
.dj-popup select option { background: #111; color: #fff; }
.dj-prow { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.dj-prow .ctrl-btn { width: 30px; height: 30px; font-size: 11px; }
.dj-pnav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 60px; }
.dj-pnav span { font-size: 9px; color: var(--muted); flex-shrink: 0; }
.dj-pnav input { flex: 1; -webkit-appearance: none; appearance: none; height: 2px; background: var(--line); border-radius: 1px; outline: none; cursor: pointer; min-width: 40px; }
.dj-pnav input::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
@keyframes slideLeft { from{opacity:0;transform:translateX(-12px)} to{opacity:1;transform:translateX(0)} }
.dj-popup-inner {
  padding: 12px; background: rgba(0,0,0,0.9); border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08); backdrop-filter: blur(16px);
}
.dj-popup p { font-size: 12px; font-weight: 600; margin: 0 0 6px; }
.dj-popup select {
  width: 100%; padding: 4px 8px; border-radius: 6px; margin-bottom: 8px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text); font-size: 11px; outline: none; cursor: pointer;
}
.dj-popup select option { background: #111; color: #fff; }
.dj-prow { display: flex; gap: 6px; justify-content: center; }
.dj-prow .ctrl-btn { width: 34px; height: 34px; font-size: 12px; }
.dj-pnav { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.dj-pnav span { font-size: 10px; color: var(--muted); flex-shrink: 0; min-width: 28px; }
.dj-pnav input { flex: 1; -webkit-appearance: none; appearance: none; height: 3px; background: var(--line); border-radius: 2px; outline: none; cursor: pointer; }
.dj-pnav input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }

/* Playing highlight */
.embedded-track.playing {
  border-left: 2px solid var(--accent);
  background: rgba(var(--accent-rgb),0.08);
  box-shadow: 0 0 12px rgba(var(--accent-rgb),0.15);
}
/* Article paragraph */
.article-para {
  padding: 10px 14px; margin: 3px 0;
  background: rgba(255,255,255,0.03); border-left: 1.5px solid rgba(var(--accent-rgb),0.25);
  border-radius: 0 6px 6px 0; line-height: 1.7; font-size: 12px;
  letter-spacing: 0.01em; color: var(--text); font-weight: 350;
}

/* === Chat Section === */
.chat-section { margin-top: 6px; display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.chat-messages {
  display: flex; flex-direction: column; gap: 8px; flex: 1;
  overflow-y: auto; padding: 4px 0 8px; -webkit-overflow-scrolling: touch;
}
.message { display: flex; animation: msgIn 0.3s ease-out; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.message.user { justify-content: flex-end; }
.message.user .bubble {
  background: rgba(var(--accent-rgb),0.08); border: 1px solid rgba(var(--accent-rgb),0.2);
  color: var(--text); max-width: 78%; border-radius: 14px 14px 4px 14px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.message.assistant .bubble {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
  max-width: 92%; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.bubble {
  padding: 10px 14px; border-radius: 14px; line-height: 1.6;
  font-size: 13px; word-break: break-word; letter-spacing: 0.01em;
}
.bubble p { margin-bottom: 5px; }
.bubble p:last-child { margin-bottom: 0; }

.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  padding: 7px 16px; border-radius: 999px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text); font-size: 12px; letter-spacing: 0.02em;
  cursor: pointer; transition: all 0.3s cubic-bezier(0.4,0,0.2,1); white-space: nowrap;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent; position: relative;
}
.chip::after {
  content:''; position:absolute; inset:-6px; border-radius:inherit;
  background: radial-gradient(circle at var(--mx,50%) var(--my,50%), rgba(var(--accent-rgb),0.3) 0%, rgba(var(--accent-rgb),0.05) 40%, transparent 70%);
  opacity:0; transition: opacity 0.2s; pointer-events:none;
}
.chip:hover::after { opacity: 1; }
.chip:hover { background: var(--accent); color: #000; border-color: var(--accent); box-shadow: 0 0 20px rgba(var(--accent-rgb),0.3); transform: translateY(-1px); }
.chip:active { transform: scale(0.94); transition: transform 0.1s; }

/* Embedded tracks */
.embedded-tracks { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.embedded-track {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 12px; gap: 6px; backdrop-filter: blur(8px);
  transition: border-color 0.2s;
}
.embedded-track:hover { border-color: rgba(var(--accent-rgb),0.3); }
.embedded-track .et-info { flex: 1; min-width: 0; }
.embedded-track .et-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.embedded-track .et-meta { font-size: 10px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.embedded-track .et-actions { display: flex; gap: 4px; flex-shrink: 0; }
.embedded-track .et-btn {
  width: 32px; height: 32px; min-width: 30px; min-height: 30px;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 12px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); -webkit-tap-highlight-color: transparent;
}
.embedded-track .et-btn:active { background: var(--accent); color: #000; }

/* Chat input */
.chat-input-area {
  position: sticky; bottom: 0; margin-top: auto;
  padding: 4px 8px; padding-bottom: calc(4px + var(--safe-bottom));
  background: transparent; z-index: 10;
}
.input-row { display: flex; gap: 8px; align-items: flex-end; }
textarea {
  flex: 1; resize: none; min-height: 34px; max-height: 60px;
  border: 1px solid var(--line); outline: 0;
  background: var(--panel-2); color: var(--text);
  border-radius: 10px; padding: 10px 14px;
  font: inherit; line-height: 1.4; font-size: 14px;
  transition: border-color 0.3s;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 12px rgba(var(--accent-rgb),0.15); }
textarea::placeholder { color: var(--muted); }
#btnSend {
  width: 42px; height: 38px; border-radius: 10px; border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000; font-size: 18px; font-weight: 700; cursor: pointer;
  flex-shrink: 0; padding: 0; min-height: 38px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.25s;
}
#btnSend:hover { box-shadow: var(--glow); transform: translateY(-1px); }

button {
  border: 0; border-radius: 10px; padding: 10px 18px;
  color: #000; background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-weight: 600; cursor: pointer; font-size: 13px; letter-spacing: 0.02em;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  min-height: 40px; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  position: relative;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
button::after {
  content:''; position:absolute; inset:-3px; border-radius:inherit;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
  opacity:0; transition: opacity 0.3s;
}
button:hover::after { opacity: 1; }
button:hover { box-shadow: 0 0 30px rgba(var(--accent-rgb),0.25), 0 0 60px rgba(var(--accent-rgb),0.08); transform: translateY(-2px); }
button:active { transform: scale(0.95); filter: brightness(0.85); transition: transform 0.1s; }
button.secondary {
  color: var(--text); background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(12px);
}
button.secondary:hover { border-color: var(--accent); box-shadow: 0 0 20px rgba(var(--accent-rgb),0.15); }

/* Loading */
.typing-indicator { display: flex; gap: 5px; padding: 6px 0; }
.typing-indicator span {
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%,80%,100% { transform: scale(0); } 40% { transform: scale(1.2); } }

/* Toast */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--accent);
  color: var(--text); padding: 10px 22px; border-radius: 10px;
  font-size: 13px; z-index: 100;
  animation: toastIn 2.2s ease forwards;
  max-width: 90vw; text-align: center; pointer-events: none;
  backdrop-filter: blur(16px); box-shadow: var(--glow);
}
@keyframes toastIn { 0% { opacity: 0; transform: translateX(-50%) translateY(10px); } 10% { opacity: 1; transform: translateX(-50%) translateY(0); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* Theme Palette */
.palette-popup {
  position: fixed; top: 56px; right: 12px; z-index: 100;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px);
  animation: slideDown 0.2s ease-out;
}
.palette-swatch {
  padding: 8px 18px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); color: var(--text); font-size: 13px;
  cursor: pointer; text-align: left; min-height: 34px;
  transition: all 0.2s;
}
.palette-swatch:hover { border-color: var(--accent); background: rgba(var(--accent-rgb),0.08); }

/* === Click Ripple === */
.click-ripple {
  position: fixed; z-index: 9999; pointer-events: none;
  width: 40px; height: 40px; margin-left: -20px; margin-top: -20px;
  border-radius: 50%;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  background: radial-gradient(circle, rgba(var(--accent-rgb),0.3) 0%, rgba(var(--accent-rgb),0.05) 50%, transparent 70%);
  border: 1px solid rgba(var(--accent-rgb),0.25);
  animation: rippleOut 0.5s ease-out forwards;
}
@keyframes rippleOut {
  0% { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb),0.2); border-radius: 2px; }

/* === Responsive === */
/* Tablet portrait: full width single column */
@media (min-width: 768px) and (max-width: 1023px) and (orientation: portrait) {
  .shell { max-width: none; padding: 54px 20px 0; }
  .spectrum { max-width: 500px; }
}

/* Phone landscape / small screens */
@media (min-width: 480px) {
  .message.user .bubble { max-width: 72%; }
  .message.assistant .bubble { max-width: 88%; }
}
@media (min-width: 768px) {
  .message.user .bubble { max-width: 62%; }
}

/* Desktop / Tablet landscape: two-column */
@media (min-width: 1024px), (min-width: 768px) and (orientation: landscape) {
  .shell {
    max-width: none; display: grid;
    grid-template-columns: minmax(320px, 480px) minmax(360px, 680px);
    grid-template-rows: minmax(0, 1fr);
    justify-content: center; align-items: stretch;
    gap: 0 48px; padding: 72px 48px 24px;
    height: 100dvh; min-height: 0;
  }
  .player-section { grid-column: 1; grid-row: 1; align-self: stretch; justify-self: center; text-align: center; padding: 14px 0 4px; max-width: 420px; width: 100%; overflow-y: auto; min-height: 0; }
  .chat-section { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
  .chat-messages { flex: 1; max-height: none; }
  .chat-input-area { position: relative; bottom: auto; margin-top: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); }
  .top-bar { left: 0; right: 0; width: 100%; transform: none; border-radius: 0; padding: 10px 48px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .vinyl-container { width: 240px; height: 175px; }
  .vinyl-bg { width: 220px; height: 220px; }
  .vinyl-disc { width: 190px; height: 190px; top: 10px; }
  .spectrum { width: min(420px, 38vw); height: min(280px, 26vw); }
  .progress-wrap { max-width: 100%; }
}
@media (min-width: 1400px) {
  .shell { padding: 72px 64px 24px; gap: 0 64px; }
  .top-bar { padding: 10px 64px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .player-section { max-width: 480px; }
  .vinyl-container { width: 260px; height: 130px; }
  .vinyl-bg { width: 260px; height: 260px; }
  .vinyl-disc { width: 220px; height: 220px; }
}

/* Small phones */
@media (max-width: 374px) {
  .vinyl-container { width: 100px; height: 50px; }
  .vinyl-bg { width: 100px; height: 100px; }
  .vinyl-disc { width: 82px; height: 82px; top: 6px; }
  .player-controls { gap: 4px; }
  .ctrl-btn { width: 34px; height: 34px; font-size: 13px; }
  .ctrl-play { width: 44px; height: 44px; font-size: 16px; }
  button { padding: 7px 10px; font-size: 12px; min-height: 34px; }
}

/* Mobile: shorter spectrum for more chat space */
@media (max-width: 767px) {
  .spectrum { height: min(180px, 45vw); }
}

/* Phone landscape */
@media (max-width: 767px) and (orientation: landscape) and (max-height: 500px) {
  .player-section { padding: 4px 0 1px; }
  .vinyl-container { width: 80px; height: 40px; }
  .vinyl-bg { width: 80px; height: 80px; }
  .vinyl-disc { width: 66px; height: 66px; top: 4px; }
  .player-section { padding: 1px 0 3px; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; }
  .spectrum { max-width: 280px; height: 22px; }
}
@media (display-mode: standalone) {
  .shell { padding-top: 80px; }
  .clock-time { margin-top: 24px; }
}
