:root {
  --bg: #070d1a;
  --navy: #0f172a;
  --surface: #111c33;
  --surface-2: #172540;
  --border: rgba(148, 163, 184, 0.14);
  --border-hi: rgba(20, 184, 166, 0.45);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #14b8a6;
  --accent-2: #2dd4bf;
  --accent-deep: #0d9488;
  --green: #34d399;
  --amber: #f59e0b;
  --red: #f87171;
  --blue: #38bdf8;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(20, 184, 166, 0.16), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, var(--bg) 52%);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand {
  font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: -0.015em;
}

.hidden { display: none !important; }
.wrap { max-width: 960px; margin: 0 auto; padding: 16px 16px 110px; }

/* Top Nav */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; margin-bottom: 18px;
  background: rgba(15, 23, 42, 0.84); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: var(--radius);
  position: sticky; top: 10px; z-index: 40;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 18px; letter-spacing: -0.02em;
  color: #ffffff; text-decoration: none;
}
.brand-mark { width: 28px; height: 25px; display: block; flex-shrink: 0; }
.brand-fx { color: var(--accent); margin-left: 1px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Cards */
.card {
  background: rgba(17, 28, 51, 0.86);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card-hi { border-color: var(--border-hi); }
.card-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.card-sub { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Buttons */
button, .btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 12px; padding: 10px 15px; font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none;
}
button:hover:not(:disabled), .btn:hover { background: #1f3154; border-color: rgba(148, 163, 184, 0.28); }
button:active:not(:disabled), .btn:active { transform: scale(0.985); }
button:disabled { opacity: 0.48; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #042f2e; border: 1px solid rgba(45, 212, 191, 0.35); font-weight: 750;
  box-shadow: 0 6px 20px -6px rgba(20, 184, 166, 0.5);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-2) 0%, var(--accent) 100%);
  border-color: rgba(94, 234, 212, 0.6);
}
.btn-green { background: rgba(52, 211, 153, 0.16); border-color: rgba(52, 211, 153, 0.4); color: #86efac; }
.btn-danger { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.35); color: #fca5a5; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: #ffffff; background: rgba(255,255,255,0.05); }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 20px; font-size: 15.5px; width: 100%; }

/* Pills & Badges */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.pill-green { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.35); color: #6ee7b7; }
.pill-amber { background: rgba(20, 184, 166, 0.14); border-color: rgba(20, 184, 166, 0.38); color: #5eead4; }
.pill-red { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.35); color: #fca5a5; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* Inputs */
input[type="text"], input[type="email"], input[type="password"], input[type="time"], textarea, select {
  width: 100%; background: #0a1222; color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 13px; font-size: 15px; outline: none; font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16);
}
textarea { resize: vertical; min-height: 76px; }
label.field-label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 5px; font-weight: 600; }

/* Auth / Hero */
.auth-box {
  max-width: 440px; margin: 40px auto; text-align: center;
  padding: 28px 24px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.65);
}
.auth-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-decoration: none; margin-bottom: 18px;
}
.auth-back:hover { color: var(--accent-2); }
.auth-logo-wrap {
  width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 18px;
  background: var(--navy); border: 1px solid var(--border-hi);
  display: grid; place-items: center;
  box-shadow: 0 10px 28px -8px rgba(20, 184, 166, 0.35);
}
.auth-logo-wrap img { width: 42px; height: 37px; display: block; }
.code-input {
  text-align: center; font-size: 26px !important; letter-spacing: 6px;
  font-weight: 800; text-transform: uppercase;
}

/* House Bar */
.house-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.house-thumb {
  width: 84px; height: 48px; border-radius: 10px; object-fit: cover;
  background: #05070d; border: 1px solid var(--border); flex-shrink: 0;
}
.house-meta { flex: 1; min-width: 180px; }
.house-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.house-stats { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Preview Stage */
.preview-frame {
  width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  background: #04060b; border: 1px solid var(--border); position: relative;
  display: grid; place-items: center; margin-bottom: 12px;
}
.preview-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 20px; }

/* Sharpness Meter */
.meter-bar {
  height: 10px; border-radius: 999px; background: #0a1222; overflow: hidden; border: 1px solid var(--border);
}
.meter-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #f87171, #f59e0b, var(--accent));
  transition: width 0.25s ease;
}

/* Tabs */
.tabs {
  display: flex; gap: 6px; padding: 5px; background: #0a1222;
  border-radius: 13px; border: 1px solid var(--border); margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  flex: 1; min-width: 100px; border: none; background: transparent; color: var(--muted);
  padding: 9px 12px; border-radius: 9px; font-size: 13px; font-weight: 600;
}
.tab.active {
  background: var(--surface-2); color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.3);
}

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.preset-btn {
  text-align: left; justify-content: flex-start; flex-direction: column; align-items: flex-start;
  padding: 12px; background: #0d1629; border: 1px solid var(--border);
}
.preset-btn.selected { border-color: var(--accent); background: rgba(20, 184, 166, 0.12); }
.preset-icon { font-size: 22px; }
.preset-title { font-size: 14px; font-weight: 700; color: var(--text); }
.preset-desc { font-size: 12px; color: var(--muted); font-weight: 400; line-height: 1.35; }

/* Show Cards */
.show-card {
  background: #0d1629; border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column;
}
.show-card.playing { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.45); }
.show-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #04060b; }
.show-body { padding: 11px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.show-title { font-size: 14px; font-weight: 700; }
.show-actions { display: flex; gap: 6px; margin-top: auto; }

/* Overlay Chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.chip {
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: #0d1629; border: 1px solid var(--border); color: var(--muted); cursor: pointer;
}
.chip.on { background: rgba(20, 184, 166, 0.18); border-color: var(--accent); color: #5eead4; }

/* Progress Bar */
.prog-wrap { margin-top: 12px; }
.prog-track { height: 8px; background: #0a1222; border-radius: 999px; overflow: hidden; }
.prog-bar { height: 100%; background: linear-gradient(90deg, var(--accent-deep), var(--accent-2)); transition: width 0.3s ease; }
.prog-msg { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Sticky Now Playing Bar */
.now-playing {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  width: min(928px, calc(100% - 24px)); z-index: 50;
  background: rgba(15, 23, 42, 0.94); backdrop-filter: blur(16px);
  border: 1px solid rgba(20, 184, 166, 0.48); border-radius: 16px;
  padding: 12px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.np-info { flex: 1; min-width: 160px; }
.np-title { font-weight: 700; font-size: 14px; }
.np-sub { font-size: 12px; color: var(--accent-2); }
.np-slider { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.np-slider input[type="range"] { width: 110px; accent-color: var(--accent); }

/* Toast */
.toast {
  position: fixed; top: 76px; right: 18px; z-index: 90;
  background: #172540; border: 1px solid var(--border-hi); color: var(--text);
  padding: 11px 15px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); max-width: 340px;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 6, 12, 0.72); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px; z-index: 80;
}
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px; max-height: 90vh; overflow-y: auto; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.code-block {
  background: #060b16; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: #5eead4; overflow-x: auto; user-select: all;
}
