:root {
  --bg: #ffffff;
  --text: #121212;
  --muted: #6f7684;
  --line: #ebedf0;
  --accent: #ffd63f;
  --accent-dark: #f0c400;
  --soft: #f6f7f9;
  --green: #26a65b;
  --red: #e5484d;
  --shadow: 0 20px 45px rgba(18, 18, 18, 0.06);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { font-family: Inter, system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.material-symbols-rounded { font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.app { min-height: 100vh; padding-bottom: 110px; }
.topbar {
  position: sticky; top: 0; z-index: 25; background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.brand-kicker, .section-kicker { color: var(--muted); text-transform: lowercase; letter-spacing: .08em; font-size: 12px; }
.brand-title, h1, h2, h3, .hero-title, .card-title, .account-name, .stat-value { font-family: Unbounded, Inter, sans-serif; }
.brand-title { font-size: 22px; }
.page-shell { max-width: 1240px; margin: 0 auto; padding: 18px 20px 0; }
.view { display: none; }
.view.active { display: block; }
.section { padding: 12px 0 26px; border-bottom: 1px solid var(--line); }
.section:last-child { border-bottom: 0; }
.section-head { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 18px; }
.section-head h2 { margin: 6px 0 0; font-size: clamp(24px, 4vw, 38px); }
.hero { display: grid; grid-template-columns: 1.3fr .9fr; gap: 28px; padding: 12px 0 28px; border-bottom: 1px solid var(--line); }
.hero-copy { padding: 24px 0; }
.hero-title { font-size: clamp(32px, 7vw, 66px); line-height: 1.04; margin: 8px 0 14px; }
.hero-text { color: var(--muted); max-width: 720px; font-size: 16px; line-height: 1.6; }
.hero-side { padding: 18px 0 0; }
.info-lines { display: grid; gap: 12px; }
.info-line { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.info-line:last-child { border-bottom: 0; }
.info-line strong { font-weight: 700; }

.grid-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.track-card, .playlist-card, .stat-card, .simple-card, .history-item {
  padding: 0; border: 0; background: transparent; text-align: left; min-width: 0;
}
.card-visual {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 26px; background: var(--soft); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid #f0f1f4;
}
.card-visual img { width: 100%; height: 100%; object-fit: cover; }
.card-meta { padding: 12px 2px 0; }
.card-title { font-size: 16px; line-height: 1.35; margin: 0 0 5px; }
.card-subtitle, .card-stats, .muted { color: var(--muted); }
.card-stats { font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; }

.playlist-card .card-visual { aspect-ratio: 1.15 / 1; }
.playlist-card .playlist-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--muted); font-size: 12px; }

.btn {
  height: 44px; border-radius: 999px; border: 1px solid transparent; padding: 0 18px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700;
}
.btn.wide { width: 100%; }
.btn.btn-accent { background: var(--accent); color: #151515; }
.btn.btn-accent:hover { background: var(--accent-dark); }
.btn.btn-soft { background: var(--soft); color: var(--text); border-color: var(--line); }
.btn.btn-danger { background: rgba(229,72,77,.12); color: var(--red); border-color: rgba(229,72,77,.15); }
.btn.btn-success { background: rgba(38,166,91,.12); color: var(--green); border-color: rgba(38,166,91,.15); }
.btn.btn-xl { height: 56px; padding: 0 28px; font-size: 18px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn.light { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.25); color: #fff; }

.bottom-nav {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30;
  width: min(720px, calc(100vw - 24px)); background: rgba(255,255,255,.95); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 999px; display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px; box-shadow: var(--shadow);
}
.nav-item {
  min-height: 54px; border: 0; background: transparent; border-radius: 999px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted);
}
.nav-item.active { background: var(--soft); color: var(--text); }
.nav-item span:last-child { font-size: 12px; }

.notice { min-height: 20px; color: var(--muted); font-size: 14px; line-height: 1.45; margin-top: 14px; }
.field { display: grid; gap: 7px; }
.field span { color: var(--muted); font-size: 13px; }
.field input, .field textarea, .field select {
  width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 13px 14px; color: var(--text);
}
.field textarea { min-height: 220px; resize: vertical; }

.modal.hidden, .karaoke-modal.hidden { display: none; }
.modal, .karaoke-modal { position: fixed; inset: 0; z-index: 60; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(18,18,18,.2); backdrop-filter: blur(10px); }
.modal-card {
  position: relative; z-index: 2; width: min(560px, calc(100vw - 24px)); background: #fff; border: 1px solid var(--line); border-radius: 30px; box-shadow: var(--shadow);
  margin: 4vh auto 0; padding: 18px;
}
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.auth-tabs { display: flex; gap: 10px; margin: 18px 0 16px; }
.auth-tab { height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.auth-tab.active { background: var(--soft); color: var(--text); }
.auth-tab.hidden, .auth-form.hidden { display: none; }
.auth-form { display: grid; gap: 14px; }

.karaoke-stage {
  width: 100%; height: 100%; background: radial-gradient(circle at top, rgba(255,214,63,.18), transparent 28%), #101216;
  color: #fff; position: relative; overflow: hidden;
}
.karaoke-topbar {
  position: absolute; inset: 0 0 auto 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px;
}
.karaoke-meta { text-align: center; flex: 1; min-width: 0; }
.karaoke-meta #karaokeTitle { font-weight: 800; font-size: 16px; }
.karaoke-meta #karaokeAuthor { color: rgba(255,255,255,.7); font-size: 13px; margin-top: 4px; }
.karaoke-start-screen, .karaoke-end-screen {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 28px; text-align: center;
}
.karaoke-start-screen { grid-template-columns: minmax(280px, 420px) minmax(320px, 520px); gap: 36px; }
.karaoke-cover { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 36px; box-shadow: 0 26px 60px rgba(0,0,0,.35); }
.karaoke-start-copy h2 { font-size: clamp(34px, 7vw, 68px); line-height: 1.04; margin: 8px 0 12px; }
.karaoke-start-copy p { color: rgba(255,255,255,.72); font-size: 18px; margin: 0 0 24px; }
.karaoke-run-screen { position: absolute; inset: 0; overflow: auto; scrollbar-width: none; }
.karaoke-run-screen::-webkit-scrollbar { display: none; }
.karaoke-lines { min-height: 100%; display: grid; gap: 40px; padding: 26vh 7vw 28vh; }
.k-line {
  color: rgba(255,255,255,.22); text-align: center; font-family: Unbounded, Inter, sans-serif; font-size: clamp(22px, 4vw, 44px); line-height: 1.34;
  transition: .18s ease; transform-origin: center center; font-weight: 700; letter-spacing: .01em;
}
.k-line.active { color: #fff; transform: scale(1.065); text-shadow: 0 10px 34px rgba(0,0,0,.28), 0 0 1px rgba(255,255,255,.65); font-weight: 900; }
.k-line.prev, .k-line.next { color: rgba(255,255,255,.5); }
.k-line.annotation { min-height: 90px; display: grid; place-items: center; }
.k-line.annotation .annotation-text { display: none; }
.k-countdown { display: grid; gap: 10px; place-items: center; }
.k-countdown .dots { display: flex; gap: 12px; }
.k-countdown .dot {
  width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.88); opacity: .5; animation: dotWave 1.05s ease-in-out infinite;
}
.k-countdown .dot:nth-child(2) { animation-delay: .12s; }
.k-countdown .dot:nth-child(3) { animation-delay: .24s; }
.k-countdown .dot:nth-child(4) { animation-delay: .36s; }
.k-countdown .num { display: none; font-size: clamp(52px, 14vw, 96px); line-height: 1; font-family: Unbounded, Inter, sans-serif; }
.k-countdown.show-num .dots { display: none; }
.k-countdown.show-num .num { display: block; }
@keyframes dotWave {
  0%, 60%, 100% { transform: translateY(0) scale(.9); opacity: .45; }
  30% { transform: translateY(-9px) scale(1.12); opacity: 1; }
}
.karaoke-controls {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 4; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
}
.control-btn {
  min-width: 132px; height: 54px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.08); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.control-btn.danger { background: rgba(229,72,77,.2); border-color: rgba(229,72,77,.2); }
.end-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hidden { display: none !important; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.stat-card { padding: 20px 0 6px; border-bottom: 1px solid var(--line); }
.stat-value { font-size: clamp(28px, 4vw, 42px); margin-top: 8px; }
.account-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 28px; }
.list-column { display: grid; gap: 16px; }
.list-item { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.list-item:last-child { border-bottom: 0; }
.account-name { font-size: clamp(28px, 4vw, 44px); margin: 8px 0 0; }
.account-sub { color: var(--muted); margin-top: 8px; }
.actions-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.empty-state { padding: 22px 0; color: var(--muted); }
.search-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 22px; }
.search-row input { flex: 1; min-width: 220px; }
.panel-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 28px; }
.panel-stack { display: grid; gap: 20px; }
.panel-block { padding: 6px 0 22px; border-bottom: 1px solid var(--line); }
.panel-block:last-child { border-bottom: 0; }
.inline-meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; }
.admin-list { display: grid; gap: 0; }
.admin-item { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; gap: 14px; justify-content: space-between; align-items: center; }
.admin-item:last-child { border-bottom: 0; }
.admin-item-main { display: grid; gap: 6px; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.small-cover { width: 64px; height: 64px; border-radius: 18px; object-fit: cover; background: var(--soft); }
.history-list { display: grid; gap: 0; }
.history-item { padding: 16px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 76px 1fr auto; gap: 16px; align-items: center; }
.history-item:last-child { border-bottom: 0; }
.history-meta { display: grid; gap: 5px; min-width: 0; }
.history-title { font-weight: 700; }
.time-badge { color: var(--muted); font-size: 13px; }

@media (max-width: 980px) {
  .hero, .account-grid, .panel-grid { grid-template-columns: 1fr; }
  .grid-cards, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .karaoke-start-screen { grid-template-columns: 1fr; align-content: center; }
  .karaoke-cover { max-width: min(72vw, 360px); margin: 0 auto; }
}

@media (max-width: 720px) {
  .topbar { padding: 14px 14px; }
  .page-shell { padding: 14px 14px 0; }
  .grid-cards, .stats-grid { grid-template-columns: 1fr; }
  .bottom-nav { bottom: 10px; width: calc(100vw - 16px); }
  .karaoke-lines { padding: 23vh 6vw 32vh; }
  .control-btn { min-width: auto; width: calc(33.33% - 8px); }
  .history-item { grid-template-columns: 64px 1fr; }
  .history-item > .btn { grid-column: 1 / -1; width: fit-content; }
}


.admin-editor-card {
  width: min(860px, calc(100vw - 24px));
  max-height: 92vh;
  overflow: auto;
}
.admin-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.admin-editor-grid .field.full {
  grid-column: 1 / -1;
}
.admin-editor-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
}
.admin-editor-preview {
  display: grid;
  gap: 8px;
  padding: 12px 0 2px;
  color: var(--muted);
  font-size: 13px;
}
.admin-editor-preview img {
  width: 88px;
  height: 88px;
  border-radius: 18px;
  object-fit: cover;
  background: var(--soft);
  border: 1px solid var(--line);
}
@media (max-width: 720px) {
  .admin-editor-grid {
    grid-template-columns: 1fr;
  }
  .admin-editor-card {
    width: min(100vw - 16px, 860px);
    margin-top: 2vh;
    border-radius: 24px;
  }
}


/* search, seek and karaoke weight fix */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-search {
  min-width: min(520px, 52vw);
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 14px;
}
.topbar-search .material-symbols-rounded { color: var(--muted); }
.topbar-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--text);
}
.topbar-search .icon-btn {
  width: 40px;
  height: 40px;
}

.karaoke-seek-wrap {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  width: min(820px, calc(100% - 28px));
  z-index: 4;
  display: grid;
  gap: 8px;
}
.karaoke-seek {
  width: 100%;
  accent-color: #ffd63f;
}
.karaoke-seek-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255,255,255,.88);
  font-size: 13px;
}

.k-line,
.k-line.prev,
.k-line.next {
  font-weight: 500;
  color: rgba(255,255,255,.30);
}
.k-line.active {
  font-weight: 900;
  color: #fff;
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }
  .topbar-actions {
    width: 100%;
  }
  .topbar-search {
    min-width: 0;
    flex: 1;
  }
  .karaoke-seek-wrap {
    bottom: 86px;
    width: calc(100% - 20px);
  }
}


.karaoke-inline-icon {
  color: var(--accent);
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95em;
  line-height: 1;
  margin: 0 0.08em;
  transform: translateY(-0.04em);
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 48;
}
