:root {
  --bg: #140e1c;
  --panel: #1f1729;
  --panel-2: #2a2036;
  --line: #3a2e49;
  --text: #f4eef8;
  --muted: #a99bb8;
  --accent: #ff5d4f;
  --accent-ink: #1a0b09;
  --gold: #ffc66b;
  --ok: #6fdc9a;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(900px 420px at 50% -120px, #3a1c3f 0%, transparent 70%), var(--bg);
  color: var(--text);
  font:
    16px/1.5 system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px 8px;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

h1 em {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--gold);
}

h2 {
  margin: 0;
  font-size: 1.15rem;
  text-wrap: balance;
}

nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--panel);
  border-radius: 999px;
}

.tab {
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.tab[aria-current='page'] {
  background: var(--panel-2);
  color: var(--text);
}

#takeCount:not(:empty) {
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8rem;
  font-weight: 700;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 16px 48px;
}

.drop {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
}

.drop:hover,
.drop:focus-within {
  border-color: var(--accent);
}

.drop input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.drop strong {
  color: var(--gold);
}

.drop span,
.hint,
.meta,
.empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty {
  margin: 28px 8px;
  text-align: center;
  text-wrap: pretty;
}

.list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.card-head {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-head strong {
  overflow-wrap: anywhere;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar {
  margin-top: 8px;
}

.btn {
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--muted);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.btn.big {
  flex: 1;
  min-height: 56px;
  font-size: 1.1rem;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--muted);
  font-size: 0.9rem;
}

.field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.field output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.field-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}

input[type='text'],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

/* Scène */
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lyrics-wrap {
  position: relative;
  margin: 12px 0;
}

.lyrics {
  height: min(52dvh, 480px);
  overflow-y: auto;
  padding: 40% 12px;
  border-radius: var(--radius);
  background: #0d0913;
  text-align: center;
  font-size: clamp(1.3rem, 5vw, 1.9rem);
  font-weight: 600;
  line-height: 1.35;
  scrollbar-width: none;
}

.lyrics.plain {
  padding: 24px 12px;
}

.lyrics p {
  margin: 0 0 0.6em;
  min-height: 0.6em;
  color: var(--muted);
  text-wrap: balance;
  transition: color 0.2s;
}

.lyrics.plain p,
.lyrics p.on {
  color: var(--text);
}

.lyrics p.on {
  color: var(--gold);
}

.lyrics p.past {
  opacity: 0.45;
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgb(13 9 19 / 0.82);
  color: var(--gold);
  font-size: 6rem;
  font-weight: 800;
}

.bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-2);
}

.bar > * {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.bar.small {
  display: inline-block;
  width: 90px;
  vertical-align: middle;
}

.bar.small > * {
  background: var(--ok);
}

.stage-info {
  display: flex;
  justify-content: space-between;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

#view-stage .row {
  margin: 12px 0;
}

/* Studio */
.take audio {
  width: 100%;
}

.status {
  color: var(--muted);
  font-size: 0.9rem;
}

.status.ok {
  color: var(--ok);
}

dialog {
  width: min(92vw, 560px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.6);
}

dialog form {
  display: grid;
  gap: 12px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: 90vw;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
