:root {
  --blue: #0b3a8d;
  --blue-2: #1f5bc6;
  --blue-soft: #e8effc;
  --gold: #d4a437;
  --gold-2: #f2c95c;
  --gold-soft: #fdf4dc;
  --red: #c8141b;
  --ink: #142449;
  --muted: #5d6a86;
  --line: #e3e8f3;
  --card: #ffffff;
  --bg: #f4f6fb;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
kbd {
  display: inline-block; min-width: 1.5em; padding: 0 .35em; margin: 0 1px;
  border: 1px solid #c9d2e6; border-bottom-width: 2px; border-radius: 5px;
  background: #fff; font: 600 .78em/1.6 inherit; text-align: center; color: var(--ink);
}
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top {
  background: linear-gradient(115deg, var(--blue) 0%, var(--blue-2) 70%, #3b78e0 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.top::after {
  content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px;
  border-radius: 50%; background: radial-gradient(circle, rgba(242, 201, 92, .35), transparent 65%);
}
.top-in {
  max-width: 1180px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 12px; position: relative; z-index: 1;
}
.logo { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 50%; padding: 3px; }
.logo50 { width: auto; border-radius: 12px; padding: 4px 6px; }
.brand { flex: 1; min-width: 0; }
.brand-1 { font-weight: 800; font-size: 1.35rem; letter-spacing: .3px; }
.brand-2 { font-size: .9rem; opacity: .92; color: #ffe7a6; }

/* ---------- layout ---------- */
.wrap { max-width: 1180px; width: 100%; margin: 18px auto 24px; padding: 0 16px; display: grid; gap: 18px; flex: 1; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 6px 22px rgba(11, 58, 141, .06); }

/* ---------- player ---------- */
.now { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; }
.now strong { color: var(--blue); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #c3cbe0; }
.dot.on { background: var(--red); box-shadow: 0 0 0 0 rgba(200, 20, 27, .6); animation: pulse 1.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(200, 20, 27, 0); } 100% { box-shadow: 0 0 0 0 rgba(200, 20, 27, 0); } }
.now-k { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 14px; }

.controls { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfe; }
.group-k { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
#vol { width: 130px; accent-color: var(--blue-2); }
.vol-val { width: 3em; font-weight: 600; font-size: .9rem; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 12px; border-radius: 10px; font: 600 .9rem inherit; cursor: pointer; transition: .15s;
}
.btn:hover:not(:disabled) { border-color: var(--blue-2); color: var(--blue-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-2); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.btn.ghost { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .4); }
.btn.ghost:hover { background: rgba(255, 255, 255, .25); color: #fff; border-color: #fff; }
.icon-btn { border: 0; background: transparent; color: var(--blue); font-size: 1.05rem; cursor: pointer; padding: 4px; }

.progress { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfe; font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--muted); }
.progress input { flex: 1; accent-color: var(--gold); }

.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 16px 0 10px; }
.cue {
  position: relative; min-height: 104px; border-radius: var(--radius); border: 1.5px solid var(--line); background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px 8px 10px;
  cursor: pointer; font: 600 .98rem inherit; color: var(--ink); transition: .15s; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.cue i.ico { font-size: 1.55rem; color: var(--blue-2); }
.cue .k { position: absolute; top: 7px; left: 10px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.cue .sub { font-size: .72rem; font-weight: 500; color: var(--muted); }
.cue:hover { border-color: var(--blue-2); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(31, 91, 198, .12); }
.cue.playing { background: linear-gradient(160deg, var(--blue) 0%, var(--blue-2) 100%); color: #fff; border-color: var(--blue); }
.cue.playing i.ico, .cue.playing .k, .cue.playing .sub { color: var(--gold-2); }
.cue.off { opacity: .55; }
.cue .edit { position: absolute; top: 5px; right: 6px; border: 0; background: var(--gold-soft); color: #9a6b00; border-radius: 7px; width: 26px; height: 26px; cursor: pointer; font-size: .75rem; }
.keys { text-align: center; color: var(--muted); font-size: .85rem; line-height: 2; }

/* ---------- playlist ---------- */
.pl-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.pl-head h2 { margin: 0; font-size: 1.15rem; color: var(--blue); display: flex; gap: 8px; align-items: center; }
.pl-head h2 i { color: var(--gold); }
.pl-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); cursor: pointer; }
.search { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; margin-bottom: 10px; }
.playlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.track { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.track.playing { background: var(--blue-soft); border-color: var(--blue-2); }
.track .no { width: 1.8em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.track .play { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; cursor: pointer; flex: none; }
.track.playing .play { background: var(--red); }
.track .ttl { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track .ops { display: flex; gap: 4px; }
.track .ops button { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 32px; height: 32px; cursor: pointer; color: var(--muted); }
.track .ops button:hover { color: var(--blue-2); border-color: var(--blue-2); }
.track .ops button.del:hover { color: var(--red); border-color: var(--red); }
.empty { color: var(--muted); text-align: center; margin: 14px 0 4px; }
body:not(.admin) .admin-only { display: none !important; }
.upload-bar { position: relative; height: 26px; border-radius: 8px; background: var(--blue-soft); overflow: hidden; margin-bottom: 10px; }
#upload-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue-2), var(--gold)); transition: width .2s; }
#upload-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: .82rem; font-weight: 600; }

.foot { text-align: center; padding: 16px; color: #fff; background: var(--blue); font-size: .88rem; }

/* ---------- dialogs / toast ---------- */
.dlg { border: 0; border-radius: 16px; padding: 22px; width: min(420px, 92vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dlg::backdrop { background: rgba(10, 22, 50, .45); }
.dlg h3 { margin: 0 0 12px; color: var(--blue); }
.dlg input[type=password], .dlg input[type=text] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.dlg input[type=file] { width: 100%; font: inherit; font-size: .9rem; }
.lbl { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: 10px 0 4px; }
.muted { color: var(--muted); font-size: .9rem; }
.err { color: var(--red); font-size: .88rem; min-height: 1.2em; margin: 8px 0 0; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; font-size: .92rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- presentation overlay ---------- */
.present { position: fixed; inset: 0; z-index: 40; background: radial-gradient(circle at 50% 30%, #1f5bc6 0%, #0b3a8d 55%, #071f52 100%); color: #fff; display: grid; place-items: center; }
.present-close { position: absolute; top: 18px; right: 22px; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.3rem; cursor: pointer; }
.present-in { width: min(1000px, 92vw); text-align: center; }
.present-logos { display: flex; justify-content: center; gap: 18px; margin-bottom: 18px; }
.present-logos img { height: 96px; background: #fff; border-radius: 18px; padding: 6px; }
.present-icon { font-size: 3.4rem; color: var(--gold-2); margin-bottom: 10px; }
.present-title { font-size: clamp(2rem, 5.4vw, 4.4rem); font-weight: 800; line-height: 1.15; color: #fff; text-shadow: 0 4px 18px rgba(0, 0, 0, .3); }
.present-status { margin: 12px 0 24px; font-size: 1.3rem; color: #ffe7a6; }
.viz { display: flex; justify-content: center; align-items: flex-end; gap: 8px; height: 70px; margin-bottom: 22px; }
.viz span { width: 12px; border-radius: 6px; background: linear-gradient(var(--gold-2), var(--gold)); height: 8px; transition: height .12s; }
.present-bar { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .2); overflow: hidden; }
#present-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.present-time { margin-top: 10px; font-size: 1.2rem; font-variant-numeric: tabular-nums; opacity: .9; }

@media (max-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cue { min-height: 88px; font-size: .86rem; }
  .brand-1 { font-size: 1rem; }
  .brand-2 { font-size: .75rem; }
  .logo { width: 42px; height: 42px; }
  #admin-btn span, .keys { display: none; }
  .wrap { padding: 0 10px; }
  .panel { padding: 14px; }
}
