:root {
  --wall: #1a2428;
  --wall-deep: #12191c;
  --lamp: #f0c27a;
  --mist: #b7c2bc;
  --paper: #f4efe6;
  --moss: #7f9a78;
  --line: rgba(244, 239, 230, 0.16);
  --serif: "Noto Serif", Georgia, serif;
  --sans: "Noto Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--wall-deep);
  color: var(--paper);
  font-family: var(--sans);
}

button,
a,
input {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.stage {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  position: relative;
  overflow: hidden;
  background: #000;
}

.stage.is-off {
  background: #000;
}

.stage.is-off .desk,
.stage.is-off .top,
.stage.is-off .status {
  opacity: 0.4;
}

.top,
.status,
.desk {
  transition: opacity 0.7s ease;
}

.stage.is-idle #dim,
.stage.is-idle .timer:not(.is-running),
.stage.is-idle .status,
.stage.is-idle .desk {
  opacity: 0;
  pointer-events: none;
}

.stage.is-idle,
.stage.is-idle * {
  cursor: none;
}

body.dim {
  --lamp: #c9a15d;
}

.top,
.status,
.desk {
  position: relative;
  z-index: 2;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 28px 0;
}

.timer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  transition: opacity 0.45s ease;
}

.timer.is-running {
  opacity: 0.3;
}

.timer.is-running:hover,
.timer.is-running:focus-within {
  opacity: 1;
}

.timer-face {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mist);
}

.timer-mark {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.7;
}

.timer-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.timer-options.is-open {
  opacity: 1;
  transform: none;
}

.timer-options[hidden] {
  display: none;
}

.timer-options button,
.timer-options input {
  color: var(--mist);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.timer-options button:hover {
  color: var(--paper);
}

.timer-options input {
  width: 52px;
  border: 0;
  border-bottom: 1px solid rgba(244, 239, 230, 0.28);
  background: transparent;
  outline: none;
}

.sat,
.status,
.credit,
.volume span {
  margin: 0;
  color: var(--mist);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.status {
  align-self: end;
  min-height: 1.4em;
  margin: 0 0 8px;
  text-align: center;
  color: var(--lamp);
}

.desk {
  padding: 6px 28px 22px;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.transport,
.desk-row,
.stations {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.stations,
.desk-row {
  display: none;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--paper);
}

.icon-btn.play {
  width: 52px;
  background: rgba(240, 194, 122, 0.12);
  border-color: rgba(240, 194, 122, 0.4);
}

.shuffle {
  display: grid;
  place-items: center;
  opacity: 0.42;
}

.shuffle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shuffle[aria-pressed="true"],
.shuffle[aria-pressed="true"]:hover {
  opacity: 1;
  color: var(--lamp);
  border-color: rgba(240, 194, 122, 0.85);
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 6;
  margin: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.18em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

.toast.is-on {
  animation: toast 2.8s ease forwards;
}

@keyframes toast {
  0% {
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.volume {
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume input {
  width: 120px;
  accent-color: var(--lamp);
}

.station {
  letter-spacing: 0.16em;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--mist);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}

.station[aria-selected="true"] {
  color: var(--paper);
  border-bottom-color: var(--lamp);
}

.text-btn,
.credit {
  letter-spacing: 0.12em;
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

#dim {
  opacity: 0.3;
  transition: opacity 0.45s ease;
}

#dim:hover,
#dim:focus-visible {
  opacity: 1;
}

.text-btn:hover,
.credit:hover,
.station:hover,
.icon-btn:hover {
  color: var(--paper);
}

.frame {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #000;
  opacity: 0;
  transition: opacity 500ms ease;
}

.stage.is-picture .frame,
.stage.is-picture.is-live .frame {
  opacity: 1;
}

.stage.is-picture.is-switching .frame {
  opacity: 0;
}

.frame iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw;
  min-width: 177.78vh;
  min-height: 100vh;
  transform: translate(-50%, -50%) scale(1.5);
  pointer-events: none;
  border: 0;
  object-fit: cover;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 500ms ease;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.62) 0%,
    rgba(0, 0, 0, 0.34) 36%,
    rgba(0, 0, 0, 0.22) 58%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

.stage.is-picture .scrim,
.stage.is-picture.is-live .scrim {
  opacity: 1;
}

body.dim .scrim {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.78) 0%,
    rgba(0, 0, 0, 0.62) 46%,
    rgba(0, 0, 0, 0.7) 100%
  );
}

.stage.is-picture .sat {
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.55);
}

.stage.is-immersive.is-idle #dim,
.stage.is-immersive.is-idle .timer:not(.is-running),
.stage.is-immersive.is-idle .status,
.stage.is-immersive.is-idle .desk {
  opacity: 0;
  pointer-events: none;
}

.veil {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: var(--wall-deep);
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
}

.stage.is-switching .veil,
.stage.is-switching .frame {
  opacity: 0;
}

.stage.is-switching .veil {
  opacity: 1;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #12191c;
  text-align: center;
}

.gate[hidden] {
  display: none;
}

.gate-title {
  display: inline-flex;
  align-items: center;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: 0.14em;
}

.caret {
  width: 0.07em;
  height: 0.85em;
  margin-left: 0.08em;
  background: var(--paper);
  animation: caret 1s steps(1) infinite;
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

:focus-visible {
  outline: 1px solid var(--lamp);
  outline-offset: 3px;
}

@media (max-width: 700px) {
  .top,
  .desk {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .top,
  .status,
  .desk,
  .veil,
  .frame,
  .scrim,
  .caret {
    transition: none;
    animation: none;
  }

  .toast.is-on {
    animation: none;
    opacity: 1;
  }
}
