/* Control room */
body.admin { background: var(--mist); }

/* login */
.login {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--sky);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}
.login-inner { width: 100%; max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(20px, 4vh, 32px); }
.login h1 { font-size: clamp(46px, 13vw, 150px); }
.login form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; width: 100%; max-width: 460px; }
.login form .pill { width: 100%; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.field > span { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.input {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  border: 1.5px solid var(--ink);
  background: #fff;
  padding: 12px 16px;
  font-size: 17px;
  font-weight: 600;
  outline: none;
  transition: box-shadow 0.2s;
}
.input:focus { box-shadow: 0 0 0 4px rgba(17, 18, 20, 0.12); }
textarea.input { min-height: 80px; resize: vertical; line-height: 1.4; }
.pin { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(6px, 2vw, 10px); }
.pin input {
  width: 100%;
  min-width: 0;
  min-height: clamp(52px, 15vw, 64px);
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  border-radius: 16px;
  border: 1.5px solid var(--ink);
  background: #fff;
  outline: none;
  padding: 0;
  caret-color: transparent;
  transition: transform 0.15s var(--spring), background 0.15s;
}
.pin input:focus { background: var(--butter); transform: translateY(-2px); }
.pin.bad { animation: shake 0.5s var(--ease); }
.login .err { color: var(--red); font-weight: 700; min-height: 1.4em; margin: 0; }

/* shell */
.atop {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--sky);
  border-bottom: 1px solid var(--line);
}
.atop-row { display: flex; align-items: center; gap: 10px; padding: 12px 18px; max-width: 1280px; margin: 0 auto; }
.atop-row .spacer { flex: 1; }
.logo small { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; margin-left: 6px; vertical-align: 3px; }
.avatars { display: flex; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  margin-left: -8px;
  text-transform: uppercase;
}
.avatar:first-child { margin-left: 0; }
.avatar.ctl { background: var(--butter); }
.avatar.me { box-shadow: 0 0 0 2px var(--sky), 0 0 0 4px var(--ink); }

.menu { position: relative; }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--ink);
  border-radius: 18px;
  padding: 8px;
  min-width: 200px;
  display: grid;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  animation: pop-in 0.2s var(--spring);
  transform-origin: top right;
}
.menu-list a, .menu-list button {
  color: #fff;
  text-decoration: none;
  background: none;
  border: 0;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}
.menu-list a:hover, .menu-list button:hover { background: var(--ink-3); }

.ctlbar { background: var(--ink); color: #fff; }
.ctlbar-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; max-width: 1280px; margin: 0 auto; flex-wrap: wrap; }
.ctlbar .who { font-weight: 700; flex: 1; min-width: 180px; display: flex; align-items: center; gap: 10px; }
.ctlbar .who .eyebrow { color: var(--sky-on-ink); }
.ctlbar.mine .who .eyebrow::before { background: var(--butter); animation: pulse 1.4s infinite; }
.ctlbar.flash-in { animation: ctl-flash 1s var(--ease); }
@keyframes ctl-flash { 0% { background: var(--butter); color: var(--ink); } }

.tabs { display: flex; gap: 6px; padding: 14px 18px 0; max-width: 1280px; margin: 0 auto; }
.tab {
  border: 1.5px solid var(--ink);
  background: transparent;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 14px;
}
.tab[aria-selected="true"] { background: var(--ink); color: var(--sky-on-ink); }
.tab .count { font-family: var(--mono); font-size: 11px; opacity: 0.7; margin-left: 4px; }

.page { max-width: 1280px; margin: 0 auto; padding: 18px 18px 80px; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
.col { display: grid; gap: 16px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

.card { background: #fff; border-radius: 26px; padding: 22px; border: 1.5px solid var(--line); display: grid; gap: 16px; }
.card h2 { font-size: 30px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

/* stage card */
.stagecard { background: var(--ink); color: #fff; border-color: var(--ink); gap: 18px; position: relative; overflow: hidden; }
.stagecard .eyebrow { color: var(--sky-on-ink); }
.stagecard .eyebrow.live::before { background: var(--red); }
.stagecard .act { color: var(--butter); font-size: clamp(40px, 6vw, 72px); min-height: 0.95em; overflow-wrap: anywhere; }
.stagecard .act.muted { color: #fff; }
.stagecard .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.stagecard .chip { background: rgba(255, 255, 255, 0.1); color: #fff; }
.stagecard .hint { color: var(--muted-on-ink); margin: 0; font-weight: 500; }
.stagecard .hint b { color: #fff; }
.stagecard .clock-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stagecard .bigclock { font-weight: 800; font-size: clamp(56px, 9vw, 96px); letter-spacing: -0.04em; line-height: 0.85; }
.stagecard .bigclock.danger { color: var(--red); }
.stagecard .bigclock.paused { opacity: 0.4; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .pill { flex: 1 1 auto; }
.award { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.award .pill { min-height: 60px; font-size: 16px; white-space: normal; text-align: center; line-height: 1.15; }
.stagecard .pill.ghost { color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.stagecard .pill.dark { --pill-bg: var(--ink-3); --pill-fg: #fff; border-color: var(--ink-3); }
.upnext { border: 1.5px dashed rgba(255, 255, 255, 0.25); border-radius: 18px; padding: 14px 16px; display: grid; gap: 4px; }
.upnext .t { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.upnext .s { color: var(--muted-on-ink); font-size: 14px; }
.stagecard .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(255, 255, 255, 0.08); }
.stagecard .bar i { display: block; height: 100%; background: var(--butter); transform-origin: left; transition: transform 0.25s linear; }

/* teams */
.team-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.team-row:first-of-type { border-top: 0; }
.team-row.no-dot { grid-template-columns: minmax(0, 1fr) auto auto; }
.acting-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: #fff;
  display: grid;
  place-items: center;
  padding: 0;
}
.acting-dot.on::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); }
.team-row .name { border: 0; border-bottom: 1.5px dashed transparent; background: transparent; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; padding: 4px 2px; width: 100%; outline: none; border-radius: 0; }
.team-row .name:hover:not(:disabled), .team-row .name:focus { border-bottom-color: var(--ink); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper .n { font-weight: 800; font-size: 28px; min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  transition: transform 0.15s var(--spring);
}
.icon-btn:active { transform: scale(0.9); }
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.icon-btn.ghost { border-color: transparent; color: var(--muted); }
.icon-btn.ghost:hover:not(:disabled) { color: var(--red); }
.inline-form { display: flex; gap: 8px; }

.inline-form .input { min-height: 44px; border-radius: 999px; font-size: 15px; }

/* settings */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
.setting label { font-weight: 700; }
.setting small { display: block; color: var(--muted); font-weight: 500; }
select.input { min-height: 40px; width: auto; border-radius: 999px; padding: 6px 14px; font-size: 15px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #d9dee3; border: 1.5px solid var(--ink); transition: background 0.2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform 0.25s var(--spring); }
.switch input:checked + span { background: var(--butter); }
.switch input:checked + span::after { transform: translateX(20px); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }

/* acts */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .input { flex: 1 1 220px; min-height: 44px; border-radius: 999px; font-size: 15px; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 999px; padding: 3px; background: #fff; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--sky-on-ink); }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.acts { list-style: none; margin: 0; padding: 0; display: grid; }
.act-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}
.act-row.used .t { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.act-row.queued { background: linear-gradient(90deg, var(--butter), transparent 80%); border-radius: 14px; padding-inline: 12px; }
.act-row .t { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.act-row .m { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.act-row .n { color: var(--muted); font-size: 14px; margin-top: 4px; }
.act-row .btns { display: flex; gap: 6px; align-items: center; }
.empty { color: var(--muted); font-weight: 600; padding: 18px 0; }

/* rounds */
.round-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.round-row .rn { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.round-row .t { font-weight: 800; letter-spacing: -0.02em; }
.round-row .s { color: var(--muted); font-size: 13px; }
@media (max-width: 560px) { .round-row { grid-template-columns: 36px minmax(0, 1fr); } .round-row select { grid-column: 2; } }

dialog {
  border: 0;
  border-radius: 28px;
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  background: #fff;
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
dialog::backdrop { background: rgba(17, 18, 20, 0.45); backdrop-filter: blur(3px); }
dialog[open] { animation: pop-in 0.25s var(--spring); }
dialog form { padding: 24px; display: grid; gap: 16px; }

.locked-note { color: var(--muted-on-ink); font-size: 13px; font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }

@media (max-width: 480px) {
  .team-row { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: 4px; }
  .team-row .stepper { grid-column: 2; grid-row: 2; }
  .team-row .icon-btn.ghost { grid-column: 3; grid-row: 1; }
  .team-row.no-dot { grid-template-columns: minmax(0, 1fr) auto; }
  .team-row.no-dot .stepper { grid-column: 1; grid-row: 2; }
  .team-row.no-dot .icon-btn.ghost { grid-column: 2; grid-row: 1; }
  .atop-row, .ctlbar-row, .tabs, .page { padding-inline: 14px; }
  .card { padding: 18px; border-radius: 22px; }
  .act-row { grid-template-columns: 1fr; }
  .act-row .btns { justify-content: flex-start; }
}


/* game setup controls: work on the dark stage card and the white settings card */
.set-group { display: grid; gap: 10px; }
.set-group.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-lbl { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.7; }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 8px; }
.choice button, .opts button {
  border: 1.5px solid color-mix(in srgb, currentColor 28%, transparent);
  background: transparent;
  color: inherit;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s var(--spring);
}
.choice button { text-align: left; border-radius: 18px; padding: 12px 14px; display: grid; gap: 3px; align-content: start; }
.choice button i { font-size: 20px; margin-bottom: 2px; }
.choice button b { font-size: 16px; letter-spacing: -0.01em; }
.choice button small { font-size: 13px; font-weight: 500; opacity: 0.75; line-height: 1.3; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opts button { border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.choice button:active:not(:disabled), .opts button:active:not(:disabled) { transform: scale(0.96); }
.choice button[aria-pressed="true"], .opts button[aria-pressed="true"] { background: var(--butter); color: var(--ink); border-color: var(--butter); }
.card:not(.stagecard) .choice button[aria-pressed="true"], .card:not(.stagecard) .opts button[aria-pressed="true"] { border-color: var(--ink); }
.choice button:disabled, .opts button:disabled { cursor: not-allowed; opacity: 0.45; }
.choice button[aria-pressed="true"]:disabled, .opts button[aria-pressed="true"]:disabled { opacity: 0.8; }
.target { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.target .n { font-weight: 800; font-size: 30px; min-width: 44px; text-align: center; letter-spacing: -0.04em; }
.target .u { font-weight: 600; opacity: 0.75; }
.stagecard .icon-btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.4); }
#settings-body { display: grid; gap: 18px; }
.themes { display: flex; flex-wrap: wrap; gap: 6px; }
.theme-opt { display: inline-flex; align-items: center; gap: 2px; }
.theme-opt [data-set] { border-radius: 999px 0 0 999px; padding: 8px 12px 8px 14px; font-weight: 700; font-size: 14px; border: 1.5px solid color-mix(in srgb, currentColor 28%, transparent); background: transparent; color: inherit; }
.theme-opt [data-set]:only-child { border-radius: 999px; }
.theme-opt [data-set][aria-pressed="true"] { background: var(--butter); color: var(--ink); border-color: var(--butter); }
.card:not(.stagecard) .theme-opt [data-set][aria-pressed="true"] { border-color: var(--ink); }
.theme-opt [data-set]:disabled { opacity: 0.45; cursor: not-allowed; }
.theme-opt .preview { width: 38px; align-self: stretch; border-radius: 0 999px 999px 0; border: 1.5px solid color-mix(in srgb, currentColor 28%, transparent); border-left: 0; background: transparent; color: inherit; display: grid; place-items: center; padding: 0; }
.soundcheck summary { cursor: pointer; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; list-style: none; opacity: 0.8; }
.soundcheck summary::-webkit-details-marker { display: none; }
.soundcheck[open] summary { margin-bottom: 10px; }
.hint-light { margin: 0; color: var(--muted); font-weight: 600; }

/* login on wide-but-short screens (landscape phones): headline beside the form */
@media (max-height: 520px) and (min-width: 640px) {
  .login { align-content: start; }
  .login-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 400px); align-items: center; column-gap: 32px; }
  .login-inner > .eyebrow { grid-column: 1 / -1; }
  .login h1 { font-size: clamp(40px, 9vw, 80px); }
  .login form { gap: 10px; }
  .pin input { min-height: 46px; font-size: 22px; }
  .input { min-height: 44px; }
}
