  :root {
    --bg: #0a0a0a;
    --surface: #111111;
    --surface2: #1a1a1a;
    --surface3: #222222;
    --border: #2a2a2a;
    --accent: #e8ff3c;
    --accent2: #ff6b35;
    --text: #f0f0f0;
    --text2: #888;
    --text3: #555;
    --red: #ff4444;
    --green: #44ff88;
    --radius: 8px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Syne', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    user-select: none;
  }
  /* HEADER */
  header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }
  .logo {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
  }
  .logo span { color: var(--accent); }
  .header-actions { display: flex; gap: 8px; align-items: center; }
  .badge {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 20px;
    background: var(--surface3);
    color: var(--text2);
    border: 1px solid var(--border);
  }
  .badge.online { color: var(--green); border-color: var(--green); background: rgba(68,255,136,0.08); }
  .badge.offline { color: var(--red); border-color: var(--red); background: rgba(255,68,68,0.08); }

  /* MAIN LAYOUT */
  main {
    display: grid;
    grid-template-columns: 1fr 340px;
    overflow: hidden;
  }

  /* LEFT — Queue */
  .queue-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
  }
  .panel-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
  }
  .panel-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text2);
  }
  .queue-count {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--text3);
  }

  /* Add URL bar */
  .add-bar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
  }
  .url-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.2s;
  }
  .url-input::placeholder { color: var(--text3); }
  .url-input:focus { border-color: var(--accent); }
  .url-input.loading { border-color: var(--accent2); animation: pulse 1s infinite; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.6} }
  .btn-add {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius);
    padding: 8px 14px;
    font-family: 'Syne', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    white-space: nowrap;
  }
  .btn-add:hover { opacity: 0.85; }
  .btn-add:active { transform: scale(0.96); }
  .btn-add:disabled { opacity: 0.4; cursor: default; }

  /* Queue list */
  .queue-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
  }
  .queue-list::-webkit-scrollbar { width: 4px; }
  .queue-list::-webkit-scrollbar-track { background: transparent; }
  .queue-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  .queue-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--text3);
  }
  .queue-empty .icon { font-size: 40px; opacity: 0.3; }
  .queue-empty p { font-size: 13px; text-align: center; line-height: 1.6; }

  .queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 0;
    transition: background 0.15s;
    position: relative;
    border-left: 3px solid transparent;
  }
  .queue-item:hover { background: var(--surface2); }
  .queue-item.active {
    background: var(--surface2);
    border-left-color: var(--accent);
  }
  .queue-item.dragging { opacity: 0.4; }
  .queue-item.drag-over { border-top: 2px solid var(--accent); }

  .queue-thumb {
    width: 42px;
    height: 42px;
    border-radius: 4px;
    background: var(--surface3);
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
  }
  .queue-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .queue-thumb .play-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
  }
  .queue-item.active .play-overlay,
  .queue-item:hover .play-overlay { opacity: 1; }

  .queue-info { flex: 1; min-width: 0; }
  .queue-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
  }
  .queue-item.active .queue-title { color: var(--accent); }
  .queue-meta {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--text3);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .drag-handle {
    color: var(--text3);
    font-size: 14px;
    cursor: grab;
    padding: 4px;
    opacity: 0;
    transition: opacity 0.2s;
  }
  .queue-item:hover .drag-handle { opacity: 1; }
  .drag-handle:active { cursor: grabbing; }

  .btn-remove {
    background: none;
    border: none;
    color: var(--text3);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    line-height: 1;
    flex-shrink: 0;
  }
  .queue-item:hover .btn-remove { opacity: 1; }
  .btn-remove:hover { color: var(--red); }

  /* RIGHT — Now Playing */
  .now-playing {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
  }
  .np-art {
    flex-shrink: 0;
    aspect-ratio: 16/9;
    background: var(--surface2);
    position: relative;
    overflow: hidden;
  }
  .np-art img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: opacity 0.4s;
  }
  .np-art-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 48px;
    color: var(--surface3);
  }
  .playing-indicator {
    position: absolute;
    bottom: 10px; left: 10px;
    display: flex; gap: 3px; align-items: flex-end;
    height: 20px;
    opacity: 0;
    transition: opacity 0.3s;
  }
  .playing-indicator.active { opacity: 1; }
  .playing-indicator span {
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
    animation: bar 0.8s ease-in-out infinite;
  }
  .playing-indicator span:nth-child(1) { height: 8px; animation-delay: 0s; }
  .playing-indicator span:nth-child(2) { height: 16px; animation-delay: 0.15s; }
  .playing-indicator span:nth-child(3) { height: 12px; animation-delay: 0.3s; }
  .playing-indicator span:nth-child(4) { height: 18px; animation-delay: 0.1s; }
  @keyframes bar { 0%,100%{transform:scaleY(0.4)} 50%{transform:scaleY(1)} }

  .np-info {
    padding: 16px 20px 10px;
    flex-shrink: 0;
  }
  .np-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
    min-height: 42px;
  }
  .np-channel {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--text2);
    margin-top: 6px;
  }

  /* Player controls */
  .player-controls {
    padding: 0 20px 16px;
    flex-shrink: 0;
  }
  /* Progress */
  .progress-wrap {
    margin-bottom: 10px;
  }
  .progress-times {
    display: flex;
    justify-content: space-between;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--text3);
    margin-bottom: 6px;
  }
  .progress-bar {
    width: 100%;
    height: 3px;
    background: var(--surface3);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
  }
  .progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s linear;
    pointer-events: none;
  }
  .progress-bar:hover .progress-fill { background: var(--accent); }
  .progress-thumb {
    width: 10px; height: 10px;
    background: var(--text);
    border-radius: 50%;
    position: absolute;
    top: 50%; transform: translateY(-50%);
    left: 0%;
    margin-left: -5px;
    opacity: 0;
    transition: opacity 0.2s, left 0.5s linear;
    pointer-events: none;
  }
  .progress-bar:hover .progress-thumb { opacity: 1; }

  /* Control buttons */
  .controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
  }
  .ctrl-btn {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
  }
  .ctrl-btn:hover { color: var(--text); background: var(--surface2); }
  .ctrl-btn.active { color: var(--accent); }
  .ctrl-btn:disabled { opacity: 0.3; cursor: default; }
  .ctrl-btn svg { width: 18px; height: 18px; }

  .play-btn {
    width: 48px; height: 48px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: #000;
    font-size: 20px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s, opacity 0.2s;
    flex-shrink: 0;
  }
  .play-btn:hover { opacity: 0.85; }
  .play-btn:active { transform: scale(0.93); }
  .play-btn svg { width: 22px; height: 22px; }

  /* Volume */
  .volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .vol-icon { font-size: 14px; color: var(--text3); cursor: pointer; }
  input[type=range] {
    -webkit-appearance: none;
    flex: 1;
    height: 3px;
    background: var(--surface3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
  }
  input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px; height: 12px;
    background: var(--text2);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
  }
  input[type=range]:hover::-webkit-slider-thumb { background: var(--text); }

  /* Saved section */
  .saved-panel {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    padding: 12px 0;
    min-height: 0;
  }
  .saved-panel::-webkit-scrollbar { width: 4px; }
  .saved-panel::-webkit-scrollbar-thumb { background: var(--border); }
  .saved-header {
    padding: 0 20px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text3);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .btn-clear {
    background: none; border: none;
    font-size: 10px;
    color: var(--text3);
    cursor: pointer;
    font-family: 'Space Mono', monospace;
    letter-spacing: 0;
    text-transform: none;
    padding: 2px 4px;
  }
  .btn-clear:hover { color: var(--red); }

  .saved-item {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 20px;
    cursor: pointer;
    transition: background 0.15s;
  }
  .saved-item:hover { background: var(--surface2); }
  .saved-item-thumb {
    width: 32px; height: 32px;
    border-radius: 4px;
    background: var(--surface3);
    overflow: hidden; flex-shrink: 0;
  }
  .saved-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .saved-item-info { flex: 1; min-width: 0; }
  .saved-item-title {
    font-size: 12px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .saved-item-meta { font-family: 'Space Mono', monospace; font-size: 10px; color: var(--text3); }
  .btn-load {
    background: none; border: 1px solid var(--border);
    border-radius: 4px; color: var(--text3);
    font-size: 10px; padding: 3px 8px;
    cursor: pointer; font-family: 'Space Mono', monospace;
    transition: all 0.2s;
  }
  .btn-load:hover { border-color: var(--accent); color: var(--accent); }

  /* BOTTOM — status bar */
  footer {
    padding: 8px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    color: var(--text3);
  }
  .status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--text3);
    flex-shrink: 0;
  }
  .status-dot.playing { background: var(--green); box-shadow: 0 0 6px var(--green); }
  .status-dot.loading { background: var(--accent2); box-shadow: 0 0 6px var(--accent2); animation: pulse 1s infinite; }
  .status-msg { flex: 1; }
  .kbd {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 3px; padding: 1px 5px; font-size: 9px;
    color: var(--text3);
  }

  /* YouTube iframe hidden */
  #yt-frame { position: fixed; top: -9999px; left: -9999px; width: 1px; height: 1px; }

  /* Toast */
  #toast {
    position: fixed; bottom: 60px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--surface3); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px 18px;
    font-size: 13px; color: var(--text);
    opacity: 0; transition: opacity 0.3s, transform 0.3s;
    pointer-events: none; z-index: 100;
    white-space: nowrap;
  }
  #toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  #toast.success { border-color: var(--accent); color: var(--accent); }
  #toast.error { border-color: var(--red); color: var(--red); }

  /* Context menu */
  #ctx-menu {
    position: fixed; display: none;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 6px 0;
    z-index: 200; min-width: 160px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  }
  .ctx-item {
    padding: 8px 16px; font-size: 13px; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    transition: background 0.15s;
  }
  .ctx-item:hover { background: var(--surface3); }
  .ctx-item span { font-size: 14px; }
  .ctx-divider { height: 1px; background: var(--border); margin: 4px 0; }

  /* Responsive tweaks */
  @media (max-width: 600px) {
    main { grid-template-columns: 1fr; }
    .now-playing { display: none; }
  }