@import url("https://fonts.googleapis.com/css2?family=Unbounded:wght@400;600;800&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --bg: #0d0c0a;
  --panel: #15130f;
  --panel-2: #1c1914;
  --line: #2b271f;
  --text: #f1eadc;
  --muted: #9b927f;
  --amber: #ffb347;
  --amber-dim: #7a5524;
  --red: #ff4d3d;
  --green: #7bd88f;
  --radius: 18px;
  --display: "Unbounded", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(255, 179, 71, .09), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(255, 77, 61, .07), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
body::before { /* лёгкое зерно */
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .05; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: var(--amber); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; cursor: pointer; transition: border-color .2s, background .2s;
}
.btn:hover { border-color: var(--amber-dim); }
.btn.primary { background: var(--amber); color: #1a1205; border-color: var(--amber); font-weight: 700; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--red); }
.btn.small { padding: 4px 10px; font-size: 13px; }

input[type=text], input[type=password], input[type=number], textarea, select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  outline: none; width: 100%; transition: border-color .2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--amber-dim); }

/* ---------- top bar ---------- */
.top {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: .02em; }
.brand small { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.lamp {
  width: 12px; height: 12px; border-radius: 50%; background: #3a1512; box-shadow: inset 0 0 0 1px #5a2420;
  transition: background .3s, box-shadow .3s;
}
.lamp.on { background: var(--red); box-shadow: 0 0 12px var(--red), 0 0 30px rgba(255, 77, 61, .5); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 6px var(--red), 0 0 14px rgba(255, 77, 61, .3); } }
.top .meta { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.pill { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }

/* ---------- layout ---------- */
.layout {
  position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 24px;
  padding: 24px 28px; max-width: 1360px; margin: 0 auto; height: calc(100% - 71px);
}
.stage, .chat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.stage { padding: 28px; display: flex; flex-direction: column; overflow: auto; }

.mode {
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px;
}
.mode .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.mode.live { color: var(--red); } .mode.live .dot { background: var(--red); }
.mode.dj { color: var(--amber); } .mode.dj .dot { background: var(--amber); animation: pulse 1.2s infinite; }

.now { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; margin-top: 20px; align-items: center; }
.cover {
  width: 260px; aspect-ratio: 1; border-radius: 14px; overflow: hidden; position: relative;
  background: conic-gradient(from 210deg, #2a2116, #16130e, #3b2a15, #16130e, #2a2116);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8), 0 0 0 1px var(--line);
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .mic {
  position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 800;
  font-size: 92px; color: var(--amber);
  background: radial-gradient(circle at 50% 45%, rgba(255, 179, 71, .25), transparent 60%), #17120b;
}
.title { font-family: var(--display); font-weight: 600; font-size: clamp(24px, 3.2vw, 40px); line-height: 1.12; margin: 0; word-break: break-word; }
.artist { color: var(--muted); font-size: 18px; margin: 10px 0 0; }
.req { display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: 12px; color: var(--amber); border: 1px dashed var(--amber-dim); border-radius: 999px; padding: 3px 10px; }

.progress { height: 4px; background: var(--line); border-radius: 4px; margin-top: 22px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--red)); transition: width .4s linear; }
.times { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; }

.dj-bubble {
  margin-top: 22px; padding: 16px 18px; border-radius: 14px; background: var(--panel-2);
  border: 1px solid var(--amber-dim); position: relative;
}
.dj-bubble .who { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); margin-bottom: 6px; }
.dj-bubble p { margin: 0; font-size: 15px; }

.controls { display: flex; align-items: center; gap: 18px; margin-top: 28px; }
.play {
  width: 72px; height: 72px; border-radius: 50%; border: none; cursor: pointer; background: var(--amber); color: #1a1205;
  display: grid; place-items: center; box-shadow: 0 10px 30px -10px rgba(255, 179, 71, .6); transition: transform .15s;
}
.play:hover { transform: scale(1.04); }
.play svg { width: 28px; height: 28px; }
.play.playing { background: var(--text); }
.vol { display: flex; align-items: center; gap: 10px; color: var(--muted); }
input[type=range] { accent-color: var(--amber); width: 140px; }
.hint { color: var(--muted); font-size: 13px; }
#viz { width: 100%; height: 64px; margin-top: 22px; display: block; }

.queue { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 18px; }
.queue h3, .section-title { font-family: var(--mono); font-weight: 600; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.queue ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.queue li { display: flex; align-items: center; gap: 12px; }
.queue img, .queue .ph { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--panel-2); flex: none; }
.queue .t { font-weight: 600; } .queue .a { color: var(--muted); font-size: 13px; }
.queue .by { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--amber); white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-head b { font-family: var(--display); font-weight: 600; font-size: 15px; display: block; }
.chat-head small { color: var(--muted); font-size: 12px; }
.messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--amber); color: #1a1205; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.error { align-self: center; color: var(--red); font-size: 13px; background: none; }
.msg .action { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-family: var(--mono); font-size: 12px; color: var(--amber); }
.msg .action img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.typing { align-self: flex-start; color: var(--muted); font-size: 13px; font-family: var(--mono); }
.typing::after { content: "…"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 10px; }
.suggest button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 13px; color: var(--muted); cursor: pointer; }
.suggest button:hover { color: var(--text); border-color: var(--amber-dim); }
.chat form { display: flex; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--line); }
.chat textarea { resize: none; max-height: 140px; border-radius: 14px; }
.send { flex: none; width: 46px; border-radius: 14px; border: none; background: var(--amber); color: #1a1205; cursor: pointer; font-size: 18px; font-weight: 800; }
.send:disabled { opacity: .5; cursor: default; }

/* ---------- login ---------- */
.center { min-height: 100%; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.card h1 { font-family: var(--display); font-weight: 800; font-size: 28px; margin: 16px 0 4px; }
.card p { color: var(--muted); margin: 0 0 24px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.err { color: var(--red); font-size: 14px; min-height: 20px; margin: 4px 0 10px; }

/* ---------- admin ---------- */
.admin { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 24px 28px 60px; display: grid; gap: 20px; }
.admin .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; min-width: 0; }
.panel h2 { font-family: var(--display); font-weight: 600; font-size: 18px; margin: 0 0 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.admin { color: var(--amber); border-color: var(--amber-dim); }
.tag.off { color: var(--red); border-color: #5a2420; }
.tag.live { color: var(--green); border-color: #2f5a39; }
.form-row { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 10px; align-items: center; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings .wide { grid-column: 1 / -1; }
.voices { display: flex; gap: 10px; }
.voice-opt { flex: 1; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.voice-opt:has(input:checked) { border-color: var(--amber); background: rgba(255, 179, 71, .06); }
.voice-opt b { font-family: var(--display); font-weight: 600; }
.logs { font-family: var(--mono); font-size: 12px; max-height: 320px; overflow: auto; display: grid; gap: 4px; }
.logs .WARNING { color: var(--amber); } .logs .ERROR { color: var(--red); }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 14px; }
.list li { display: flex; justify-content: space-between; gap: 10px; }
.list .muted, .muted { color: var(--muted); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--amber-dim); padding: 10px 18px; border-radius: 999px; z-index: 10; }

/* ---------- mobile ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; height: auto; padding: 16px; }
  .chat { height: 70vh; }
  .now { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .cover { width: min(300px, 80vw); }
  .controls { justify-content: center; }
  .admin .grid2, .settings, .form-row { grid-template-columns: 1fr; }
  .top { padding: 14px 16px; }
}
