:root {
  --bg: rgba(14, 17, 22, 0.82);
  --bg-solid: #0e1116;
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef1f5;
  --muted: #8b95a5;
  --accent: #ff5a1f;
  --accent-soft: rgba(255, 90, 31, 0.16);
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg-solid); color: var(--text); font-family: var(--font); }
.hidden { display: none !important; }

#map { position: fixed; inset: 0; }
#map gmp-map-3d { width: 100%; height: 100%; display: block; }

.day-night { position: fixed; inset: 0; z-index: 5; pointer-events: none; opacity: 0; transition: opacity .3s linear, background .4s linear; }

/* ---------- Panel ---------- */
.panel {
  position: fixed; top: 16px; left: 16px; width: 330px; max-height: calc(100% - 32px);
  display: flex; flex-direction: column;
  background: var(--bg); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  z-index: 10; overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; font-size: 16px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.panel-body { padding: 4px 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.panel.collapsed .panel-body { display: none; }
.panel.collapsed #collapseBtn svg { transform: rotate(180deg); }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04);
  color: var(--text); cursor: pointer; transition: background .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.icon-btn svg { transition: transform .2s; }

/* ---------- Upload ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 20px 12px; border: 1.5px dashed rgba(255, 255, 255, 0.22); border-radius: 12px;
  cursor: pointer; color: var(--muted); transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.drop strong { color: var(--text); font-size: 14px; margin-top: 4px; }
.drop span { font-size: 12.5px; }
.link-btn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 0; align-self: center; }
.link-btn:hover { color: var(--text); }

/* ---------- Track info ---------- */
.track { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.track-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stats > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; background: rgba(255, 255, 255, 0.04); border-radius: 10px; min-width: 0; }
.stats .v { font-family: var(--mono); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.stats .l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

#profile { width: 100%; height: 80px; display: block; cursor: pointer; border-radius: 8px; background: rgba(255, 255, 255, 0.03); touch-action: none; }

.controls { display: flex; align-items: center; gap: 10px; }
.play {
  width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(255, 90, 31, 0.45); transition: transform .1s;
}
.play:active { transform: scale(0.94); }
.play .i-pause { display: none; }
.play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.15); outline: none; accent-color: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opts label, .slider { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--muted); }
.slider span { display: flex; justify-content: space-between; }
.slider b { color: var(--text); font-family: var(--mono); font-weight: 500; }
select {
  font: inherit; font-size: 13px; color: var(--text); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 8px; cursor: pointer;
}
select option { background: #1a1f27; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); }

/* ---------- HUD ---------- */
.hud {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 9; pointer-events: none;
}
.hud > div {
  display: flex; align-items: baseline; gap: 6px; padding: 10px 16px;
  background: var(--bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 12px;
}
.hud span { font-family: var(--mono); font-weight: 600; font-size: 22px; font-variant-numeric: tabular-nums; }
.hud small { color: var(--muted); font-size: 11.5px; }

/* ---------- Toast / modal / drag ---------- */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 30;
  padding: 10px 16px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line);
  backdrop-filter: blur(14px); font-size: 13.5px; max-width: min(520px, calc(100% - 32px));
}
.toast.err { border-color: rgba(255, 80, 80, 0.6); }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(5, 7, 10, 0.7); padding: 16px; }
.modal-card { width: min(420px, 100%); background: #151a21; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.modal-card h2 { margin: 0; font-size: 18px; }
.modal-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.modal-card p b { color: var(--text); font-weight: 600; }
.modal-card .err { color: #ff8a8a; }
.modal-card input { font: inherit; font-family: var(--mono); font-size: 13px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--text); outline: none; }
.modal-card input:focus { border-color: var(--accent); }
.primary { font: inherit; font-weight: 600; padding: 11px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; cursor: pointer; }

.drag-overlay { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; background: rgba(255, 90, 31, 0.12); border: 3px dashed var(--accent); pointer-events: none; }
.drag-overlay div { padding: 14px 22px; border-radius: 12px; background: var(--bg); font-weight: 600; }

/* ---------- Mobil ---------- */
@media (max-width: 640px) {
  .panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 62%; border-radius: var(--radius) var(--radius) 0 0; }
  .panel.collapsed #collapseBtn svg { transform: none; }
  #collapseBtn svg { transform: rotate(180deg); }
  .hud { top: 14px; bottom: auto; }
  .hud > div { padding: 7px 10px; }
  .hud span { font-size: 16px; }
}
