:root {
  --bg: #120c08;
  --surface: #1c140e;
  --surface-2: #241a12;
  --border: #3a2a1b;
  --amber: #e8a13d;
  --amber-dim: #a8752c;
  --text: #f4ead9;
  --muted: #a8927c;
  --danger: #d96a5a;
  --good: #6fbf8b;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: radial-gradient(ellipse at top, #241a10 0%, var(--bg) 60%);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; padding-bottom: 3rem; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  position: sticky;
  top: 0;
  background: rgba(18, 12, 8, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-mark {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--amber), var(--amber-dim));
  color: #1a1208;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1.1rem;
}
.brand-name { font-weight: 700; letter-spacing: 0.02em; }

.wallet-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--amber);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}
.wallet-unit { color: var(--muted); font-weight: 500; margin-left: 0.2rem; font-size: 0.75rem; }

main { max-width: 480px; margin: 0 auto; padding: 1rem; }

.view.hidden { display: none; }
.hidden { display: none !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.auth-card { margin-top: 2.5rem; }

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.tab {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.6rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
.tab.active { background: var(--amber); color: #1a1208; border-color: var(--amber); }

.tab-panel { display: none; flex-direction: column; gap: 0.75rem; }
.tab-panel.active { display: flex; }

label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  font-size: 1rem;
}
input:focus { outline: 2px solid var(--amber); outline-offset: 1px; }

.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(145deg, var(--amber), var(--amber-dim)); color: #1a1208; border: none; }
.btn-ghost { background: transparent; }
.btn-small { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.btn-link { background: none; border: none; color: var(--muted); text-decoration: underline; margin: 1rem auto; display: block; }
.btn-round { width: 44px; height: 44px; border-radius: 50%; font-size: 1.3rem; line-height: 1; }

.hint { font-size: 0.8rem; color: var(--muted); text-align: center; }
.hint code { background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 4px; }

.error { color: var(--danger); font-size: 0.85rem; text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }

.section-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--amber);
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.track-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.5rem 0; }
.track-row--big { padding: 0.25rem 0 0.9rem; }
.track-meta { min-width: 0; }
.track-title { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-artist { color: var(--muted); font-size: 0.85rem; }

.volume-row { display: flex; align-items: center; gap: 0.75rem; margin: 0.75rem 0; }
.volume-meter { flex: 1; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.volume-fill { height: 100%; background: linear-gradient(90deg, var(--amber-dim), var(--amber)); transition: width 0.4s ease; }

.row-between { display: flex; justify-content: space-between; align-items: center; }

.up-next-list, .track-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; max-height: 340px; overflow-y: auto; }
.up-next-list li, .track-list li { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.55rem 0.6rem; background: var(--surface-2); border-radius: 10px; }
.li-meta { min-width: 0; }
.li-title { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-artist { color: var(--muted); font-size: 0.78rem; }

.search-box { width: 100%; margin-bottom: 0.75rem; }

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.modal {
  position: fixed; inset: 0;
  background: rgba(10, 7, 4, 0.7);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 1.25rem;
  width: 100%;
  max-width: 480px;
}
.topup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 1rem 0; }
.topup-option { padding: 0.9rem; font-size: 1rem; }

@media (min-width: 520px) {
  .modal { align-items: center; }
  .modal-card { border-radius: 16px; }
}
