:root {
  --bg: #111111;
  --surface: #1a1a1a;
  --surface-2: #252525;
  --border: #444444;
  --primary: #e0c070;
  --primary-h: #c9a857;
  --text: #f0f0f0;
  --text-2: #888888;
  --success: #22c55e;
  --error: #ef4444;
  --warn: #f59e0b;
  --r: 10px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.skip-link { position: absolute; left: -9999px; top: 4px; padding: 8px 16px; background: var(--primary); color: #111; font-weight: 600; border-radius: var(--r); z-index: 9999; text-decoration: none; }
.skip-link:focus { left: 4px; }

h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r); border: none;
  cursor: pointer; font-size: 14px; font-weight: 500;
  transition: background .15s, opacity .15s; white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: #111; }
.btn-primary:hover { background: var(--primary-h); }
.btn-ghost    { background: transparent; color: var(--text-2); border: 1.5px solid var(--border); }
.btn-ghost:hover  { background: var(--surface-2); color: var(--text); }
.btn-danger   { background: #3a1a1a; color: var(--error); border: 1px solid #7a2e2e; }
.btn-danger:hover { background: #4a2020; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Form ── */
label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; display: block; }
input[type=text], input[type=email], input[type=password], input[type=color], select, textarea {
  width: 100%; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--r); color: var(--text); padding: 9px 12px;
  font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input[type=color] { height: 38px; padding: 4px 8px; cursor: pointer; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(224,192,112,.18);
}
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Alerts ── */
.alert { padding: 10px 14px; border-radius: var(--r); font-size: 13px; margin-bottom: 14px; }
.alert-error   { background: #3a1a1a; color: var(--error);   border: 1px solid #7a2e2e; }
.alert-success { background: #163322; color: var(--success); border: 1px solid #2a6644; }
.alert-warn    { background: #352514; color: var(--warn);    border: 1px solid #6e5020; }

/* ── Nav ── */
nav {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100; overflow: visible;
}
.nav-brand { font-weight: 700; font-size: 16px; color: var(--text); text-decoration: none; }
.nav-right  { display: flex; align-items: center; gap: 10px; overflow: visible; }

/* Nav dropdowns */
.nav-drop-wrap { position: relative; }
.nav-drop-btn {
  font-size: 11px; font-weight: 700; letter-spacing: .4px; padding: 6px 12px;
  border-radius: 6px; cursor: pointer; font-family: inherit; line-height: 1;
  transition: opacity .15s; white-space: nowrap;
  display: inline-flex; align-items: center;
}
.nav-drop-btn:hover { opacity: .8; }
.nav-user-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); width: 32px; height: 32px; padding: 0;
  display: flex; align-items: center; justify-content: center; border-radius: 8px;
  cursor: pointer; transition: color .15s, border-color .15s;
}
.nav-user-btn:hover { color: var(--text); border-color: rgba(255,255,255,.3); }
.nav-drop-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; min-width: 220px; z-index: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
}
.nav-drop-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }

/* ── Language selector ── */
.lang-wrap { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid var(--border); border-radius: 7px;
  color: var(--text-2); padding: 5px 10px; font-size: 12px; font-weight: 500;
  cursor: pointer; font-family: inherit; white-space: nowrap; transition: color .15s, border-color .15s;
}
.lang-btn:hover { color: var(--text); border-color: rgba(255,255,255,.3); }
.lang-panel {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px; min-width: 140px; z-index: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
}
.lang-panel a {
  display: block; padding: 7px 12px; border-radius: 6px;
  font-size: 13px; color: var(--text-2); text-decoration: none; transition: background .12s, color .12s;
}
.lang-panel a:hover { background: var(--surface-2); color: var(--text); }
.lang-panel a.lang-active { color: var(--primary); font-weight: 600; }

/* ── Badge ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.badge-free    { background: var(--surface-2); color: var(--text-2); }
.badge-premium { background: #2d2010; color: var(--warn); border: 1px solid #5c4020; }

/* ── Card ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; box-shadow: 0 4px 20px rgba(0,0,0,.35); }

/* ── Page ── */
.page { padding: 32px 24px; max-width: 1100px; margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Auth page ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-box  { width: 100%; max-width: 400px; }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo h1 { font-size: 26px; }
.auth-logo p  { color: var(--text-2); font-size: 13px; margin-top: 4px; }

.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 18px; cursor: pointer; color: var(--text-2); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.google-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); cursor: pointer; font-size: 14px;
  font-weight: 500; text-decoration: none; transition: background .15s; margin-bottom: 16px;
}
.google-btn:hover { background: #2a2a2a; text-decoration: none; }

.sep { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; color: var(--text-2); font-size: 12px; }
.sep::before, .sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Dashboard ── */
.players-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.player-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 20px; cursor: pointer; transition: border-color .15s, background .15s;
  text-decoration: none; display: block; color: var(--text);
}
.player-card:hover { border-color: var(--primary); background: var(--surface-2); text-decoration: none; }
.player-card .pc-title  { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.player-card .pc-slug   { font-size: 12px; color: var(--text-2); font-family: monospace; margin-bottom: 8px; }
.player-card .pc-meta   { font-size: 12px; color: var(--text-2); }
.player-card .pc-actions { display: flex; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.pc-action-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text-2); font-size: 12px; font-weight: 500;
  cursor: pointer; text-decoration: none; letter-spacing: .15px;
  transition: border-color .18s, color .18s, background .18s;
  white-space: nowrap; font-family: inherit;
}
.pc-action-btn:hover { border-color: rgba(240,240,240,.35); color: var(--text); background: var(--surface-2); }
.pc-action-btn.pc-visit { border-color: rgba(224,192,112,.35); color: var(--primary); }
.pc-action-btn.pc-visit:hover { border-color: var(--primary); background: rgba(224,192,112,.08); color: var(--primary); }

.create-card {
  border: 2px dashed var(--border); border-radius: var(--r); padding: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; color: var(--text-2); min-height: 120px;
  transition: border-color .15s, color .15s; background: transparent;
}
.create-card:hover { border-color: var(--primary); color: var(--primary); }
.create-icon { font-size: 28px; line-height: 1; }

/* ── Player editor ── */
.editor-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }

.sidebar-section { margin-bottom: 20px; }
.sidebar-section h3 { margin-bottom: 12px; color: var(--text-2); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; }

.playlist-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  transition: background .1s; margin-bottom: 3px; position: relative;
}
.playlist-item:hover { background: var(--surface-2); }
.playlist-item.active { background: var(--surface-2); }
.playlist-item.active::before { content: ''; position: absolute; left: 0; top: 20%; height: 60%; width: 3px; background: var(--primary); border-radius: 0 2px 2px 0; }
.pl-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--primary); }
.pl-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-actions { display: none; gap: 4px; }
.playlist-item:hover .pl-actions { display: flex; }
.pl-btn { background: transparent; border: none; color: var(--text-2); cursor: pointer; padding: 2px 4px; border-radius: 4px; font-size: 14px; line-height: 1; }
.pl-btn:hover { background: var(--border); color: var(--text); }

/* ── Track list ── */
.track-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); margin-bottom: 5px;
}
.track-num  { color: var(--text-2); font-size: 12px; min-width: 20px; text-align: right; }
.track-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-size { font-size: 11px; color: var(--text-2); }
.track-del  { background: transparent; border: none; color: var(--text-2); cursor: pointer; padding: 3px 6px; border-radius: 4px; font-size: 14px; }
.track-del:hover { background: #2d1515; color: var(--error); }

/* ── Upload ── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--r);
  padding: 28px; text-align: center; cursor: pointer; color: var(--text-2);
  transition: border-color .15s, color .15s; margin-bottom: 16px;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--primary); color: var(--primary); }
.upload-zone input[type=file] { display: none; }
.upload-zone p { margin-top: 6px; font-size: 12px; }

.progress-wrap { margin-bottom: 8px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.progress-bar { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); width: 0; transition: width .2s; }

/* ── Modal ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 100; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 24px; width: 100%; max-width: 420px; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 24px; width: 100%; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-close { background: transparent; border: none; color: var(--text-2); cursor: pointer; font-size: 20px; line-height: 1; padding: 0; }

/* ── Utilities ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-2); }
.text-center { text-align: center; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty-state p { margin-top: 8px; font-size: 13px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--surface-2); border-radius: 20px; font-size: 12px; color: var(--text-2); }

.spin { animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
  .editor-layout { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  /* Nav */
  nav { padding: 0 12px; }
  .nav-right { gap: 8px; }
  .nav-brand-text { display: none; }

  /* Page */
  .page { padding: 18px 12px; }

  /* Modals */
  .modal-overlay { padding: 12px; }
  .modal, .modal-box { padding: 18px 14px; }
}

/* ── Theme toggle button ── */
.theme-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 7px;
  color: var(--text-2); width: 32px; height: 32px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: color .15s, border-color .15s; flex-shrink: 0;
}
.theme-btn:hover { color: var(--text); border-color: rgba(255,255,255,.3); }
[data-theme="light"] .theme-btn:hover { border-color: rgba(0,0,0,.25); }
.theme-btn .icon-sun  { display: block; }
.theme-btn .icon-moon { display: none; }
[data-theme="light"] .theme-btn .icon-sun  { display: none; }
[data-theme="light"] .theme-btn .icon-moon { display: block; }
@media (max-width: 640px) { .theme-btn-nav { display: none !important; } }

/* ── Light mode ── */
[data-theme="light"] {
  --bg: #f4f4f7;
  --surface: #ffffff;
  --surface-2: #eaeaef;
  --border: #d0d0dc;
  --primary: #8c6800;
  --primary-h: #6e5200;
  --text: #111111;
  --text-2: #60606e;
}
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .btn-danger { background: #fff0f0; border-color: #fca5a5; }
[data-theme="light"] .btn-danger:hover { background: #fee2e2; }
[data-theme="light"] .alert-error   { background: #fef2f2; border-color: #fca5a5; }
[data-theme="light"] .alert-success { background: #f0fdf4; border-color: #86efac; }
[data-theme="light"] .alert-warn    { background: #fffbeb; border-color: #fcd34d; }
[data-theme="light"] .badge-premium { background: #fffbeb; border-color: #fbbf24; }
[data-theme="light"] .track-del:hover { background: #fee2e2; }
[data-theme="light"] .google-btn:hover { background: #ebebf0; }
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,.4); }
[data-theme="light"] .card { box-shadow: 0 4px 20px rgba(0,0,0,.08); }
[data-theme="light"] .nav-drop-panel,
[data-theme="light"] .lang-panel { box-shadow: 0 8px 32px rgba(0,0,0,.12); }
[data-theme="light"] .skip-link { color: #111; }
[data-theme="light"] .nav-logo { filter: invert(1); }
