:root {
  --page: rgb(5, 50, 110);
  --surface: #ffffff;
  --ink: white;
  --muted: #ebf3ff;
  --line: #202020;
  --accent: #0f5f6f;
  --accent-dark: #0a404b;
  --error: #a40022;
  --success: #146c43;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

.menubar {
  position: relative;
  top: 0;
  height: 8vh;
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-content: center;
  align-items: center;
}

.menubar .logo {
  position: relative;
  display: flex;
  height: 100%;
  width: 20%;
  max-width: 200px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

button,
input,
textarea,
mux-player,
.player-frame,
.question-item {
  border-radius: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 48px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  padding: 12px 18px;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-secondary {
  background: transparent;
  color: var(--ink);
}

.button-secondary:hover:not(:disabled),
.button-secondary:focus-visible:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.site-shell {
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px);
}

.site-shell--download {
  max-width: 980px;
}

.event-layout {
  display: grid;
  gap: clamp(24px, 4vw, 44px);
  align-items: start;
}

.stream-column {
  min-width: 0;
}

.event-intro {
  margin-bottom: clamp(20px, 4vw, 40px);
}

.event-intro--under-player {
  margin-top: 18px;
  margin-bottom: clamp(24px, 4vw, 38px);
}

.event-intro--compact {
  margin-bottom: 28px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 920px;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

h2 {
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  letter-spacing: 0;
  line-height: 1.15;
}

h3 {
  font-size: 1rem;
  letter-spacing: 0;
}

.subtitle {
  max-width: 760px;
  margin-top: 8px;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.6vw, 1.12rem);
}

.subtitle strong {
  display: block;
  color: var(--ink);
  font-weight: 800;
}

.player-section {
  width: 100%;
}

.player-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000000;
}

mux-player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  overflow: hidden;
  --media-background-color: #000000;
  --media-object-fit: contain;
  --media-primary-color: #ffffff;
  --media-secondary-color: #111111;
  --media-accent-color: #ffffff;
}

.player-frame--small {
  max-width: 760px;
}

.download-player-section {
  margin-bottom: 24px;
}

.player-frame--download {
  margin-bottom: 0;
}

.join-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(16, 16, 16, 0.72);
  padding: 24px;
}

.join-button {
  min-width: min(100%, 360px);
  min-height: 68px;
  padding: 20px 30px;
  border: 2px solid #ffffff;
  background: #ffffff;
  color: #111111;
  font-size: clamp(1.15rem, 2.4vw, 1.8rem);
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.join-button:hover:not(:disabled),
.join-button:focus-visible:not(:disabled) {
  background: #3b4142;
  border-color: #3b4142;
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
  transform: translateY(-2px);
}

.countdown-overlay,
.event-done-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: #101010;
  color: #ffffff;
  padding: clamp(18px, 4vw, 42px);
  text-align: center;
}

.event-done-overlay {
  font-size: clamp(1.8rem, 5vw, 4.5rem);
  font-weight: 800;
  line-height: 1;
}

.countdown-content {
  display: grid;
  gap: 10px;
  justify-items: center;
  max-width: 100%;
}

.countdown-kicker,
.countdown-date {
  color: rgba(255, 255, 255, 0.76);
  font-size: clamp(0.85rem, 1.4vw, 1rem);
}

.countdown-time {
  max-width: 100%;
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.question-section {
  display: grid;
  gap: 14px;
  align-self: start;
  max-width: none;
  margin-top: 0;
  padding-left: clamp(18px, 3vw, 28px);
  border-left: 1px solid var(--line);
}

.question-form {
  display: grid;
  gap: 16px;
  width: 100%;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  color: var(--ink);
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 12px 14px;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(15, 95, 111, 0.35);
  outline-offset: 2px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.system-message {
  color: var(--muted);
  min-height: 1.4em;
}

.system-message[data-state="error"] {
  color: var(--error);
}

.system-message[data-state="success"] {
  color: var(--success);
}

.bot-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.auth-panel,
.download-panel {
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

.download-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.download-toolbar p {
  color: var(--muted);
  margin-top: 6px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.question-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.stats-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.stat-box {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-box strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
  line-height: 1;
}

.dashboard-section {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.section-heading--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-note {
  color: var(--muted);
  margin-top: 5px;
}

.text-link {
  color: var(--ink);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  margin-top: 16px;
}

.table-wrap--spaced {
  margin-top: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

th,
td {
  border-bottom: 1px solid rgba(32, 32, 32, 0.2);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #edf1f3;
  font-size: 0.9rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td:last-child {
  min-width: 260px;
}

.question-item {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
}

.question-item time {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

.question-item p {
  margin-top: 12px;
  white-space: pre-wrap;
}

.empty-state {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
}

[hidden] {
  display: none !important;
}

noscript {
  display: block;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 56px 32px;
  color: var(--error);
}

@media (max-width: 760px) {
  .site-shell {
    padding: 22px 14px 36px;
  }

  .event-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  h1 {
    font-size: clamp(1.25rem, 5vw, 1.55rem);
  }

  .event-intro--under-player {
    margin-top: 14px;
    margin-bottom: 24px;
  }

  .question-section {
    padding-top: clamp(22px, 4vw, 34px);
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .countdown-time {
    font-size: 1.7rem;
  }

  .stats-dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading--row {
    display: grid;
  }

  .form-actions {
    display: grid;
    width: 100%;
  }

  .form-actions button {
    width: 100%;
  }

  .download-toolbar {
    display: grid;
    width: 100%;
  }

  .toolbar-actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .toolbar-actions button {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 10px 12px;
    white-space: nowrap;
  }

  noscript {
    padding: 0 14px 28px;
  }
}

@media (max-width: 480px) {
  .countdown-time {
    font-size: 1.35rem;
  }

  .stats-dashboard {
    grid-template-columns: 1fr;
  }
}
