/* VocalRoom — оформление */

:root {
  --bg: #070b12;
  --bg-2: #0d1420;
  --card: #121b2a;
  --card-2: #16203049;
  --line: #23314a;
  --line-soft: #1b2637;
  --text: #e8eef8;
  --muted: #8ea0bd;
  --accent: #57e6b3;
  --accent-2: #4a8cff;
  --warn: #ffc857;
  --bad: #ff5f6d;
  --good: #43d17a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 12% -10%, #16233a 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #10263a 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: .2px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
p { margin: 6px 0; }
ul, ol { margin: 6px 0; padding-left: 20px; }
li { margin: 3px 0; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 8px 0; }

/* ---------- шапка ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(12, 19, 30, .95), rgba(10, 16, 26, .75));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 40px; height: 40px; }
.brand-text b { display: block; font-size: 18px; letter-spacing: .4px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pill {
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: #1c2a41; border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.pill-ghost { background: transparent; }
.pill[data-state="ok"] { color: #0b1a12; background: var(--accent); border-color: transparent; }
.pill[data-state="wait"] { color: #1a1407; background: var(--warn); border-color: transparent; }
.pill[data-state="err"] { color: #2a0a0d; background: var(--bad); border-color: transparent; }
.pill[data-state="live"] { color: #04121a; background: var(--accent-2); border-color: transparent; }

/* ---------- вкладки ---------- */

.tabs {
  display: flex; gap: 6px; padding: 10px 20px 0; flex-wrap: wrap;
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 65px; z-index: 20;
  background: rgba(8, 12, 20, .82); backdrop-filter: blur(8px);
}
.tab-btn {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 9px 16px; border-radius: 10px 10px 0 0; cursor: pointer; font: inherit; font-weight: 600;
  border-bottom: 2px solid transparent;
}
.tab-btn:hover { color: var(--text); background: #121b2a80; }
.tab-btn.is-active { color: var(--text); border-bottom-color: var(--accent); background: #121b2a; }

main { padding: 18px 20px 60px; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.grid-2 {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  align-items: start;
}

/* ---------- карточки ---------- */

.card {
  background: linear-gradient(180deg, var(--card), #0f1725);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { flex: 1; min-width: 0; }

/* ---------- поля ---------- */

.field { display: flex; flex-direction: column; gap: 5px; min-width: 130px; font-size: 12.5px; color: var(--muted); }
.field-grow { flex: 1 1 200px; }
.field > span { display: flex; justify-content: space-between; gap: 8px; }
.field-buttons { flex-direction: row; align-items: flex-end; gap: 8px; }

input[type="text"], input[type="number"], select, textarea {
  background: #0b1220; color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 13.5px;
  width: 100%; min-width: 0;
}
textarea { resize: vertical; font-family: Consolas, "Courier New", monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #4a8cff55; border-color: var(--accent-2); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 24px; background: transparent; width: 100%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid #0b1220; margin-top: -5px; cursor: pointer;
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: #2a3b57; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: #fff; }

.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- кнопки ---------- */

.btn {
  background: #1b2740; color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 14px; font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; transition: .14s; white-space: nowrap;
}
.btn:hover { background: #24344f; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #38b98d); color: #04231a; border-color: transparent; }
.btn-primary:hover { background: linear-gradient(135deg, #66f2c1, #3ecb9b); }
.btn-ghost { background: transparent; }
.btn-rec { background: #3a1520; border-color: #7a2b3a; color: #ffbcc6; }
.btn-rec.is-on { background: var(--bad); color: #fff; border-color: transparent; animation: pulse 1.1s infinite; }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
@keyframes pulse { 50% { opacity: .62; } }

/* ---------- студия ---------- */

.studio-grid {
  display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: start;
}
@media (max-width: 1080px) { .studio-grid { grid-template-columns: 1fr; } }

.tiles {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.tile {
  position: relative; border-radius: var(--radius-sm); overflow: hidden;
  background: #060a11; border: 1px solid var(--line);
  aspect-ratio: 16 / 10; min-height: 150px;
}
.tile.tile-audio-only { aspect-ratio: auto; min-height: 110px; }
.tile-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #060a11; }
.tile-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; color: #4c5c76;
  font-size: 12.5px; background: repeating-linear-gradient(45deg, #0a121d, #0a121d 10px, #0c1523 10px, #0c1523 20px);
}
.tile-placeholder[hidden] { display: none; }
.tile-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 8px; font-size: 12px; background: linear-gradient(0deg, #04070ce8, transparent);
}
.tile-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-badge { color: var(--accent); font-weight: 600; }
.tile-badge[data-state="bad"] { color: var(--bad); }
.tile-badge[data-state="wait"] { color: var(--warn); }
.tile-level { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: #ffffff10; }
.tile-level > i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--warn), var(--bad)); transition: width .06s linear; }
.tile-actions {
  position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: .15s;
}
.tile:hover .tile-actions { opacity: 1; }
.tile-btn {
  background: #0b1220cc; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; width: 30px; height: 28px; cursor: pointer; font-size: 13px;
}
.tile-btn:hover { background: #1b2740; }
.tile-note {
  position: absolute; right: 8px; top: 40px; font-size: 26px; font-weight: 700;
  color: var(--accent); text-shadow: 0 2px 12px #000; letter-spacing: 1px;
}
.tile.speaking { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* ---------- HUD ---------- */

.hud-card { position: sticky; top: 120px; }
@media (max-width: 1080px) { .hud-card { position: static; } }

.hud-note-wrap { display: flex; align-items: baseline; gap: 12px; margin: 6px 0 10px; }
.hud-note {
  font-size: 54px; font-weight: 700; letter-spacing: 1px; line-height: 1;
  color: var(--accent); text-shadow: 0 6px 24px #57e6b355; min-width: 120px;
}
.hud-note.is-off { color: var(--warn); }
.hud-note.is-bad { color: var(--bad); }
.hud-note-meta { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 12.5px; }

.cents { margin-bottom: 12px; }
.cents-scale {
  position: relative; height: 16px; border-radius: 999px; overflow: hidden;
  background: linear-gradient(90deg, var(--bad), #b98234 28%, var(--good) 44%, var(--good) 56%, #b98234 72%, var(--bad));
  border: 1px solid var(--line);
}
.cents-center { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: #ffffffcc; transform: translateX(-50%); }
.cents-needle {
  position: absolute; top: -3px; bottom: -3px; width: 4px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 10px #fff, 0 0 3px #000; left: 50%; transform: translateX(-50%);
  transition: left .07s linear;
}
.cents-labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.cents-verdict { text-align: center; font-weight: 600; font-size: 13px; margin-top: 4px; color: var(--muted); }
.cents-verdict[data-state="in"] { color: var(--good); }
.cents-verdict[data-state="close"] { color: var(--warn); }
.cents-verdict[data-state="out"] { color: var(--bad); }

.target-box {
  display: grid; gap: 5px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: #0b1220; border: 1px solid var(--line-soft); margin-bottom: 12px;
}
.target-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.target-row > span { color: var(--muted); }
.target-row > b { font-variant-numeric: tabular-nums; }

.pitch-canvas, .keyboard { width: 100%; height: auto; border-radius: var(--radius-sm); background: #080d16; border: 1px solid var(--line-soft); display: block; }
.canvas-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin: 6px 0 12px; }
.canvas-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-in { background: var(--good); }
.lg-out { background: var(--bad); }
.lg-target { background: var(--accent-2); }
.lg-you { background: var(--accent); }
.lg-vocal { background: #ff78be; }
.lg-keys { background: #5ac8ff; }

.hud-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.hud-controls .field-buttons { grid-column: 1 / -1; }
.hud-controls .chk-automic { grid-column: 1 / -1; }
@media (max-width: 420px) { .hud-controls { grid-template-columns: 1fr; } }

/* ---------- пульт ---------- */

.transport-card { margin-top: 14px; }
.transport { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.transport-group { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.transport-sliders { flex: 1 1 320px; flex-direction: column; align-items: stretch; }
.progress { height: 6px; border-radius: 999px; background: #0b1220; overflow: hidden; margin-top: 12px; border: 1px solid var(--line-soft); }
.progress > i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
#playTime { margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- комната ---------- */

.room-code {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  background: #0b1220; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; margin: 10px 0;
}
.room-code-value { display: block; font-size: 20px; letter-spacing: 2px; font-family: Consolas, monospace; color: var(--accent); }

.level-meter { height: 8px; border-radius: 999px; background: #0b1220; overflow: hidden; border: 1px solid var(--line-soft); margin: 8px 0; }
.level-meter > i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--good), var(--warn), var(--bad)); transition: width .05s linear; }

.peer-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.peer-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #0b1220; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13.5px;
}
.peer-list .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; margin-right: 8px; }
.peer-list .dot[data-state="ok"] { background: var(--good); }
.peer-list .dot[data-state="wait"] { background: var(--warn); }
.peer-list .dot[data-state="err"] { background: var(--bad); }

.chat-card { display: flex; flex-direction: column; }
.chat-log {
  flex: 1; min-height: 160px; max-height: 280px; overflow-y: auto; display: grid; gap: 6px; align-content: start;
  background: #0b1220; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px; font-size: 13.5px;
}
.chat-msg { display: grid; gap: 1px; }
.chat-msg .who { font-size: 11.5px; color: var(--muted); }
.chat-msg.mine .who { color: var(--accent); }
.chat-msg .txt { background: #16203a; border-radius: 10px; padding: 6px 10px; justify-self: start; max-width: 90%; word-break: break-word; }
.chat-msg.mine .txt { background: #1d3b52; justify-self: end; }
.chat-row { align-items: stretch; }
.chat-row input { flex: 1; }

.steps { color: var(--muted); }
.steps b { color: var(--text); }

/* ---------- текст песни ---------- */

code {
  font-family: Consolas, "Courier New", monospace; font-size: 12px;
  background: #0c1422; border: 1px solid var(--line-soft); border-radius: 5px; padding: 1px 5px;
}

.lyrics-card { margin-top: 16px; }

.lyrics-view {
  max-height: 260px; overflow-y: auto; padding: 10px 12px;
  background: #0a121e; border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  scroll-behavior: smooth;
}
.lyrics-line {
  padding: 4px 10px; border-radius: 8px; margin: 2px 0;
  color: var(--muted); font-size: 15px; line-height: 1.5;
  transition: color .15s, background .15s, font-size .15s;
  white-space: pre-wrap; word-break: break-word;
}
.lyrics-line.is-past { color: #5a6a86; }
.lyrics-line.is-current {
  color: #06121a; font-weight: 700; font-size: 18px;
  background: linear-gradient(90deg, var(--accent), #8ef0c6);
  box-shadow: 0 4px 18px rgba(87, 230, 179, .28);
}

/* ---------- минусовки ---------- */

.drop-zone {
  display: grid; gap: 8px; place-items: center; text-align: center;
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 26px 16px; background: #0b1220; transition: .15s;
}
.drop-zone.is-over { border-color: var(--accent); background: #10201c; }
.drop-zone .btn { position: relative; }

/* ---------- папка для минусовок и текстов ---------- */

.folder-box {
  margin-top: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #0b1320;
}
.folder-head { display: flex; gap: 10px; align-items: flex-start; }
.folder-ico { font-size: 22px; line-height: 1.1; flex: none; }
.folder-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.folder-info b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-info span { line-height: 1.35; }
.folder-actions { margin: 9px 0 0; gap: 6px; }
.folder-files {
  list-style: none; margin: 9px 0 0; padding: 0;
  display: grid; gap: 5px; max-height: 220px; overflow-y: auto;
}
.folder-file {
  display: flex; align-items: center; gap: 8px; width: 100%;
  text-align: left; padding: 6px 8px; border-radius: 8px;
  background: #101a2b; color: var(--text); border: 1px solid var(--line-soft);
  font: inherit; font-size: 12.5px; cursor: pointer; transition: .12s;
}
.folder-file:hover { border-color: var(--accent-2); background: #142137; }
.folder-file .ff-ico { flex: none; }
.folder-file .ff-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-file .ff-meta { margin-left: auto; flex: none; font-size: 11.5px; }
.folder-empty { padding: 3px 2px; }
.folder-more { padding: 2px; }
#folderHint { line-height: 1.35; }

.track-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.track-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: #0b1220; border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
}
.track-item.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.track-item .t-main { flex: 1; min-width: 0; }
.track-item .t-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-item .t-meta { font-size: 11.5px; color: var(--muted); }
.track-item .t-actions { display: flex; gap: 4px; }
.tag {
  font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #1c2a41; color: var(--muted);
  border: 1px solid var(--line); white-space: nowrap;
}
.tag.karaoke { color: #d9f7ea; background: #1d3f34; border-color: #2c6a55; }
.tag.generated { color: #dbe8ff; background: #1d2f4d; border-color: #33508a; }

/* ---------- таблицы ---------- */

.results { width: 100%; border-collapse: collapse; font-size: 13px; }
.results th, .results td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line-soft); }
.results th { color: var(--muted); font-weight: 600; font-size: 12px; }
.results tr.is-good td:first-child { color: var(--good); }

.checklist { color: var(--muted); }

/* ---------- справка ---------- */

.help { max-width: 900px; }
.help h3 { color: var(--accent); }

/* ---------- всплывающие сообщения ---------- */

.toasts {
  position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 100;
  max-width: min(420px, 90vw);
}
.toast {
  background: #16203a; border: 1px solid var(--line); border-left: 3px solid var(--accent-2);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13.5px; box-shadow: var(--shadow);
  animation: slide .2s ease;
}
.toast.ok { border-left-color: var(--good); }
.toast.warn { border-left-color: var(--warn); }
.toast.err { border-left-color: var(--bad); }
@keyframes slide { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
