:root {
  color-scheme: dark;
  --bg: #030712;
  --panel: #111827;
  --panel-2: #1f2937;
  --line: #374151;
  --muted: #9ca3af;
  --text: #f9fafb;
  --purple: #a855f7;
  --purple-dark: #6b21a8;
  --purple-soft: #d8b4fe;
  --green: #16a34a;
  --blue: #2563eb;
  --yellow: #ca8a04;
  --red: #b91c1c;
  --radius: 1rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 18% 8%, #2e0752 0, transparent 27rem), radial-gradient(circle at 90% 85%, #0b2458 0, transparent 30rem), var(--bg); color: var(--text); }
body.plain-bg { background: var(--bg); }
a { color: var(--purple-soft); text-decoration: none; }
a:hover { color: #fff; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid #c084fc; outline-offset: 2px; }

.container { width: min(100% - 2rem, 70rem); margin-inline: auto; }
.container.narrow { width: min(100% - 2rem, 34rem); }
.page { padding-block: 2rem 4rem; }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.stack { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 1.5rem; }
.row { display: flex; align-items: center; gap: .75rem; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.justify-center { justify-content: center; }
.center { text-align: center; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.tiny { font-size: .76rem; }
.small { font-size: .9rem; }
.large { font-size: 1.2rem; }
.hidden { display: none !important; }
.error-text { color: #fca5a5 !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-nav { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(55,65,81,.8); background: rgba(3,7,18,.9); backdrop-filter: blur(14px); }
.site-nav .container { min-height: 3.7rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: #fff; font-weight: 900; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: .7rem; background: linear-gradient(135deg, #7e22ce, #c026d3); box-shadow: 0 8px 24px rgba(168,85,247,.28); }
.nav-links { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.nav-links a { padding: .55rem .75rem; border-radius: .65rem; color: #d1d5db; font-size: .88rem; font-weight: 700; }
.nav-links a:hover { background: #1f2937; color: #fff; }

.impersonation { background: #78350f; border-bottom: 1px solid #d97706; color: #fef3c7; padding: .65rem 1rem; text-align: center; }
.impersonation form { display: inline; margin-left: 1rem; }
.link-button { border: 0; padding: 0; color: inherit; background: none; text-decoration: underline; font-weight: 800; }

.card { background: rgba(17,24,39,.92); border: 1px solid rgba(55,65,81,.8); border-radius: var(--radius); padding: 1.35rem; box-shadow: 0 20px 55px rgba(0,0,0,.24); }
.card.soft { background: rgba(31,41,55,.7); box-shadow: none; }
.card.purple-border { border-color: #7e22ce; }
.card.green-border { border-color: #15803d; }
.card h2, .card h3 { margin-top: 0; }
.hero-icon { font-size: 3.7rem; line-height: 1; filter: drop-shadow(0 8px 12px rgba(0,0,0,.25)); }
h1 { margin: 0 0 .4rem; font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.08; letter-spacing: -.035em; }
h2 { line-height: 1.15; letter-spacing: -.02em; }
h3 { line-height: 1.2; }
p { line-height: 1.55; }

.alert { width: min(100% - 2rem, 70rem); margin: 1rem auto 0; padding: .85rem 1rem; border-radius: .8rem; border: 1px solid; font-weight: 650; }
.alert.success { color: #bbf7d0; background: rgba(20,83,45,.6); border-color: #15803d; }
.alert.error { color: #fecaca; background: rgba(127,29,29,.55); border-color: #b91c1c; }
.inline-alert { padding: .8rem 1rem; border: 1px solid #92400e; border-radius: .75rem; background: rgba(120,53,15,.35); color: #fde68a; }

.field { display: grid; gap: .42rem; }
.field label, .field-label { color: #d1d5db; font-size: .9rem; font-weight: 750; }
.field small { color: var(--muted); line-height: 1.45; }
input, select, textarea { width: 100%; color: #fff; background: #1f2937; border: 1px solid #4b5563; border-radius: .8rem; padding: .82rem .92rem; }
textarea { min-height: 7rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: #6b7280; }
input[type="checkbox"], input[type="radio"] { width: 1.12rem; height: 1.12rem; flex: 0 0 auto; accent-color: var(--purple); }
input[type="file"] { padding: .65rem; }
.choice { display: flex; align-items: flex-start; gap: .75rem; padding: .85rem; border: 1px solid #374151; border-radius: .8rem; background: rgba(17,24,39,.55); }
.choice:has(input:checked) { border-color: var(--purple); background: rgba(88,28,135,.32); }
.choice strong, .choice span { display: block; }
.choice small { display: block; color: var(--muted); margin-top: .18rem; line-height: 1.35; }
.fieldset { margin: 0; padding: 1rem; border: 1px solid #374151; border-radius: .9rem; display: grid; gap: .8rem; }
.fieldset legend { padding-inline: .4rem; color: #fff; font-weight: 850; }

.button, button.button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.75rem; border: 0; border-radius: .8rem; padding: .75rem 1rem; font-weight: 850; color: #fff; background: #4b5563; text-align: center; }
.button:hover { filter: brightness(1.12); color: #fff; }
.button.primary { background: linear-gradient(135deg, #9333ea, #c026d3); }
.button.green { background: var(--green); }
.button.blue { background: var(--blue); }
.button.yellow { background: var(--yellow); }
.button.red { background: var(--red); }
.button.dark { background: #1f2937; border: 1px solid #374151; }
.button.outline { background: transparent; border: 1px solid #4b5563; color: #d1d5db; }
.button.big { width: 100%; min-height: 4.7rem; border-radius: 1rem; font-size: 1.28rem; }
.button.full { width: 100%; }
.button.small { min-height: 2.15rem; padding: .45rem .7rem; font-size: .78rem; border-radius: .55rem; }

.auth-shell { width: min(100%, 31rem); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; padding: .3rem; background: #1f2937; border-radius: .8rem; }
.auth-tab { border: 0; border-radius: .6rem; padding: .7rem; color: #9ca3af; background: transparent; font-weight: 800; }
.auth-tab.active { color: #fff; background: #9333ea; }

.dashboard-actions { display: grid; gap: .8rem; }
.status-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .32rem .6rem; border-radius: 999px; background: #1f2937; color: #d1d5db; font-size: .75rem; font-weight: 800; }
.status-pill.active { color: #bbf7d0; background: #14532d; }
.status-pill.warning { color: #fde68a; background: #713f12; }
.status-pill.purple { color: #e9d5ff; background: #581c87; }

.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.price { font-size: 2rem; font-weight: 950; margin: .7rem 0; }
.feature-list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .55rem; color: #d1d5db; }
.feature-list li::before { content: "✓"; color: #4ade80; margin-right: .55rem; font-weight: 900; }
.interval-toggle { display: inline-grid; grid-template-columns: 1fr 1fr; gap: .25rem; padding: .25rem; border-radius: .75rem; background: #111827; border: 1px solid #374151; }
.interval-toggle button { border: 0; padding: .6rem 1rem; border-radius: .55rem; background: transparent; color: #9ca3af; font-weight: 800; }
.interval-toggle button.active { color: #fff; background: #9333ea; }

.link-grid { display: grid; grid-template-columns: minmax(6rem, .7fr) minmax(0, 2fr); gap: .55rem; }
.code-box { display: block; padding: .75rem; border-radius: .7rem; color: #d8b4fe; background: #1f2937; word-break: break-all; font-size: .78rem; }

.show-screen { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.show-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; background: #111827; border-bottom: 1px solid #374151; }
.show-brand { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.show-logo { width: 3.2rem; height: 3.2rem; border-radius: .75rem; object-fit: contain; background: #581c87; }
.show-title { margin: 0; font-size: 1.12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.show-subtitle { margin: .15rem 0 0; color: #9ca3af; font-size: .76rem; }
.qr-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; padding: .8rem; border-bottom: 1px solid #2c1941; background: rgba(46,16,101,.25); }
.qr-item { width: 8rem; text-align: center; }
.qr-item canvas { display: block; width: 7rem; height: 7rem; margin: auto; background: #fff; padding: .2rem; border-radius: .45rem; image-rendering: pixelated; }
.qr-item.qr-failed canvas { display: none; }
.qr-item a { display: block; margin-top: .3rem; color: #d1d5db; font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lineup { flex: 1; overflow: auto; }
.lineup-heading { margin: 0; padding: .85rem 1rem .55rem; color: var(--purple-soft); font-size: 1rem; }
.singer-list { list-style: none; padding: 0; margin: 0; }
.singer-row { display: grid; grid-template-columns: 2.3rem minmax(0, 1fr) auto; align-items: center; gap: .7rem; padding: .8rem 1rem; border-top: 1px solid rgba(55,65,81,.55); }
.singer-row.current { background: rgba(88,28,135,.62); border-left: 4px solid #c084fc; }
.singer-position { text-align: center; color: #6b7280; font-size: 1.4rem; font-weight: 950; }
.singer-row.current .singer-position { color: #d8b4fe; }
.singer-name { margin: 0; font-size: 1.02rem; font-weight: 900; }
.singer-song { margin: .18rem 0 0; color: #9ca3af; font-size: .84rem; }
.singer-wait { margin: .18rem 0 0; color: #d8b4fe; font-size: .74rem; font-weight: 800; }
.empty-lineup { padding: 3rem 1rem; text-align: center; color: #c084fc; font-size: 1.3rem; font-weight: 850; }

.signup-dock { border-top: 1px solid #374151; background: #111827; padding: 1rem; max-height: 67vh; overflow-y: auto; }
.signup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.signup-grid .wide { grid-column: 1 / -1; }
.consent-box { display: flex; align-items: flex-start; gap: .7rem; padding: .8rem; border: 1px solid #4b5563; border-radius: .75rem; color: #d1d5db; font-size: .76rem; line-height: 1.4; }
.confirmation { padding: 2rem 1rem; text-align: center; }
.confirmation .position { color: #d8b4fe; font-size: 1.3rem; font-weight: 900; }
.ended-screen { flex: 1; display: grid; place-items: center; text-align: center; padding: 2rem; background: radial-gradient(circle, #3b0764, #030712 65%); }
.ended-screen h1 { color: #d8b4fe; }

.host-controls { padding: 1rem; display: flex; flex-wrap: wrap; gap: .6rem; background: rgba(17,24,39,.85); border-bottom: 1px solid #374151; }
.host-body { flex: 1; overflow: auto; }
.host-singer-actions { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.pending-panel { margin: 1rem; border: 1px solid #92400e; background: rgba(120,53,15,.25); border-radius: .8rem; padding: 1rem; }
.countdown { font: 900 1.6rem ui-monospace, SFMono-Regular, Menlo, monospace; color: #d8b4fe; }

.modal { width: min(100% - 2rem, 32rem); border: 1px solid #4b5563; border-radius: 1rem; padding: 0; color: #fff; background: #111827; box-shadow: 0 30px 90px rgba(0,0,0,.7); }
.modal::backdrop { background: rgba(0,0,0,.75); }
.modal-inner { padding: 1.25rem; }
.form-top-gap { margin-top: 1rem; }
.kiosk-exit-dot { position: fixed; left: .45rem; bottom: .35rem; z-index: 15; width: 1.75rem; height: 1.75rem; color: #4b5563; text-decoration: none; opacity: .22; }
.kiosk-exit-dot:focus-visible { opacity: 1; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.stat { padding: 1rem; border-radius: .8rem; background: #1f2937; }
.stat span { display: block; color: #9ca3af; font-size: .75rem; }
.stat strong { display: block; margin-top: .2rem; font-size: 1.55rem; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(20rem, .75fr); gap: 1rem; align-items: start; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: .7rem; border-bottom: 1px solid #374151; text-align: left; vertical-align: top; }
th { color: #9ca3af; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.definition-list { display: grid; grid-template-columns: minmax(8rem, .35fr) 1fr; gap: .45rem 1rem; }
.definition-list dt { color: #9ca3af; }
.definition-list dd { margin: 0; }
.policy { width: min(100% - 2rem, 50rem); margin-inline: auto; }
.policy h2 { margin-top: 2rem; }
.policy li { margin-bottom: .45rem; line-height: 1.5; }
.footer { padding: 2rem 1rem; color: #6b7280; text-align: center; font-size: .78rem; }
.footer a { color: #9ca3af; margin-inline: .35rem; }

@media (max-width: 800px) {
  .plans, .admin-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-links .optional { display: none; }
}

@media (max-width: 520px) {
  .container { width: min(100% - 1.25rem, 70rem); }
  .page { padding-top: 1rem; }
  .card { padding: 1rem; }
  .site-nav .container { min-height: 3.25rem; }
  .brand-text { display: none; }
  .signup-grid { grid-template-columns: 1fr; }
  .signup-grid .wide { grid-column: auto; }
  .show-header { padding: .7rem; }
  .show-logo { width: 2.6rem; height: 2.6rem; }
  .singer-row { padding-inline: .7rem; }
  .host-controls .button { flex: 1 1 calc(50% - .5rem); }
  .link-grid { grid-template-columns: 1fr; }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 950px) {
  .kiosk-screen::before { content: "Please rotate to portrait mode"; position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #030712; color: #fff; font-size: 1.5rem; font-weight: 900; }
}

.email-body { min-height: 18rem; resize: vertical; }
.email-preview { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.admin-grid > * { min-width: 0; }
.nav-links form { margin: 0; }

@media print {
  .site-nav, .footer, .button, button { display: none !important; }
  body { background: #fff; color: #111; }
  .card { background: #fff; color: #111; border-color: #bbb; box-shadow: none; }
  a { color: #111; text-decoration: underline; }
}
