:root {
  /* Three visible tiers, darkest to lightest: page -> panel -> card. */
  --background: 210 50% 4%;
  --panel: 210 40% 8%;
  --card: 210 28% 14%;
  --card-hover: 210 28% 18%;
  --foreground: 210 8% 98%;
  --border: 210 20% 30%;
  --muted-foreground: 210 10% 65%;

  --accent-blue: #25aae1;
  --accent-purple: #9747ff;
  --accent-lime: #00ff0a;
  --accent-goldenrod: #ff8a00;
  --accent-pink: #ff0084;

  --role-runner: var(--accent-purple);
  --role-host: var(--accent-blue);
  --role-commentator: var(--accent-goldenrod);

  --font-body: Barlow, "Maven Pro", system-ui, sans-serif;
  --font-heading: Lexend, Dosis, system-ui, sans-serif;
  --font-mono: "Miriam Libre", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-body);
  line-height: 1.4;
}

a {
  color: var(--accent-blue);
}

.site-header {
  padding: 2rem 1.5rem 1.5rem;
  background: linear-gradient(180deg, hsl(210 55% 8%), hsl(var(--background)));
  border-bottom: 1px solid hsl(var(--border));
}

.site-header__inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-header__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  margin: 0;
  color: hsl(var(--foreground));
}

.site-header__subtitle {
  margin: 0.35rem 0 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.95rem;
}

.site-header__updated {
  margin: 0.2rem 0 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
}

.site-header__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  padding-top: 0.3rem;
  /* Keeps this pinned to the right even when it wraps onto its own line
     below the title, where justify-content on the parent alone would not
     have anything to space it against and would default to the left. */
  margin-left: auto;
}

.header-action {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.time-format-switch {
  display: inline-flex;
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  overflow: hidden;
}

.time-format-switch__option {
  background: transparent;
  color: hsl(var(--muted-foreground));
  border: none;
  border-radius: 0;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.time-format-switch__option + .time-format-switch__option {
  border-left: 1px solid hsl(var(--border));
}

.time-format-switch__option:hover {
  filter: none;
  background: hsl(var(--card-hover));
}

.time-format-switch__option--active {
  background: var(--accent-blue);
  color: hsl(210 8% 5%);
}

.layout {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}

.site-footer p {
  margin: 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.site-footer p + p {
  margin-top: 0.6rem;
}

.panel {
  background: hsl(var(--panel));
  border: 1px solid hsl(var(--border));
  border-radius: 12px;
  padding: 1.25rem;
}

.panel__heading {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

.panel__empty {
  color: hsl(var(--muted-foreground));
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}

.next-up-panel {
  text-align: center;
  padding: 1.5rem 1.25rem;
}

.next-up-panel--hidden {
  display: none;
}

.next-up-panel__label {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}

.next-up-panel__name {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.3rem;
  overflow-wrap: anywhere;
}

.next-up-panel__countdown {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: hsl(var(--foreground));
  line-height: 1;
}

.settings-panel--hidden {
  display: none;
}

.header-popover {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  padding: 0.6rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  max-width: 90vw;
  z-index: 20;
}

.header-popover--hidden {
  display: none;
}

.header-popover__text {
  max-width: 16rem;
  font-size: 0.85rem;
  color: hsl(var(--foreground));
  margin: 0;
}

input[type='text'] {
  background: hsl(210 45% 6%);
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

#sync-link-input {
  width: 16rem;
  max-width: 60vw;
}

button {
  background: var(--accent-blue);
  color: hsl(210 8% 5%);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: filter 0.15s ease, background-color 0.15s ease;
}

button:hover {
  filter: brightness(1.1);
}

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

.btn--success {
  background: var(--accent-lime);
  color: hsl(210 8% 5%);
}

.hint-text {
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
  margin: 0;
}

.settings-panel__status {
  color: var(--accent-goldenrod);
  font-size: 0.85rem;
  min-height: 1.1em;
  margin: 0.25rem 0;
}

.card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.day-divider {
  margin: 0.75rem 0 0.1rem;
  padding: 0.4rem 0.25rem;
  border-top: 1px solid hsl(var(--border));
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.day-divider:first-child {
  margin-top: 0;
}

.schedule-card {
  display: grid;
  grid-template-columns: minmax(160px, 30%) 1fr auto;
  align-items: stretch;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.schedule-card:hover {
  border-color: var(--accent-blue);
}

.schedule-card--selected {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 1px var(--accent-blue), 0 0 16px rgba(37, 170, 225, 0.25);
}

.schedule-card--orphaned {
  opacity: 0.6;
}

.schedule-card__left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.9rem 1rem;
  text-align: center;
  border-left: 3px solid hsl(var(--border));
  background: hsl(var(--panel));
}

.schedule-card--speedrun .schedule-card__left {
  background: linear-gradient(180deg, rgba(37, 170, 225, 0.16), rgba(37, 170, 225, 0.05));
  border-left-color: var(--accent-blue);
}

.schedule-card--interview .schedule-card__left {
  background: linear-gradient(180deg, rgba(151, 71, 255, 0.18), rgba(151, 71, 255, 0.06));
  border-left-color: var(--accent-purple);
}

.schedule-card__name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.schedule-card__time {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

.schedule-card__time--tbd {
  font-style: italic;
}

.schedule-card__right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.9rem 1.1rem;
}

.schedule-card__info-row {
  display: grid;
  grid-template-columns: 5.5rem auto 1fr;
  align-items: start;
  gap: 0.6rem;
}

.schedule-card__row-label {
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  padding-top: 0.1rem;
}

.schedule-card__row-divider {
  width: 1px;
  align-self: stretch;
  background: hsl(var(--border));
}

.schedule-card__row-content {
  min-width: 0;
  font-size: 0.9rem;
  color: hsl(var(--foreground));
  overflow-wrap: anywhere;
}

.schedule-card__meta .muted {
  color: hsl(var(--muted-foreground));
}

.schedule-card__people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
}

.role {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.role svg {
  flex-shrink: 0;
}

.role--runner {
  color: var(--role-runner);
}

.role--host {
  color: var(--role-host);
}

.role--commentator {
  color: var(--role-commentator);
}

.role span {
  color: hsl(var(--foreground));
}

.schedule-card__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-left: 1px solid hsl(var(--border));
}

.pick-btn {
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  font-size: 0.8rem;
  padding: 0.4rem 0.7rem;
}

.pick-btn--active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: hsl(210 8% 5%);
}

.countdown {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  white-space: nowrap;
}

.countdown--live {
  color: var(--accent-lime);
  text-shadow: 0 0 10px rgba(0, 255, 10, 0.5);
}

.countdown--soon {
  color: var(--accent-goldenrod);
}

.countdown--finished {
  color: hsl(var(--muted-foreground));
}

@media (max-width: 640px) {
  .schedule-card {
    grid-template-columns: 1fr;
  }

  .schedule-card__left {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
    border-left: none;
    border-bottom: 3px solid hsl(var(--border));
  }

  .schedule-card__info-row {
    grid-template-columns: 4.5rem auto 1fr;
  }

  .schedule-card__actions {
    flex-direction: row;
    justify-content: space-between;
    border-left: none;
    border-top: 1px solid hsl(var(--border));
  }
}
