html { -webkit-text-size-adjust: 100%; }
*, *:before, *:after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: #000000;
  color: #ffffff;
  font-family: "Times New Roman", Times, serif;
  font-size: 16px;
}
button, input, label, span, div, a, i, legend, fieldset, p {
  font-family: "Times New Roman", Times, serif;
}
body { min-height: 100vh; overflow-x: hidden; position: relative; }

/* ---- top marquee bar ---- */
#topbar {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 26px;
  background: #000000;
  overflow: hidden;
  white-space: nowrap;
}
#topbar-track {
  display: inline-block;
  white-space: nowrap;
  font-size: 18px;
  line-height: 26px;
  color: #ffffff;
  animation: marquee-right 30s linear infinite;
}
@keyframes marquee-right {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}

/* ---- logo (top left) ---- */
#logo {
  font-size: 40px;
  font-weight: bold;
  color: #ffffff;
  letter-spacing: 1px;
}

/* ---- drifting cv letters ---- */
#drift {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
#drift span {
  position: absolute;
  left: -120px;
  color: #1c1c1c;
  white-space: nowrap;
  animation-name: drift;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes drift {
  from { transform: translateX(0) translateY(0); }
  50%  { transform: translateX(55vw) translateY(14px); }
  to   { transform: translateX(110vw) translateY(-10px); }
}
@media (prefers-reduced-motion: reduce) {
  #topbar-track, #drift span { animation: none !important; }
}

/* ---- page grid: left column (logo + blocks) | main (deck) ---- */
#page {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-rows: auto auto;
  grid-template-areas:
    "logo ."
    "blocks main";
  column-gap: 28px;
  padding: 10px 24px 48px 24px;
}
#logo-cell { grid-area: logo; min-width: 0; padding-bottom: 10px; text-align: left; }
#blocks    { grid-area: blocks; min-width: 0; }
#blocks .block:last-child { margin-bottom: 0; }
#main      { grid-area: main; min-width: 0; display: flex; }

a:link    { color: #5c5cff; text-decoration: underline; }
a:visited { color: #b36bff; }
a:hover   { color: #ffffff; }
a:active  { color: #ff0000; }

/* ---- right-side blocks (old-school fieldset boxes) ---- */
.block {
  display: block;
  min-width: 0;
  margin: 0 0 18px 0;
  padding: 10px 14px 14px 14px;
  background: #101010;
  border: 1px solid #808080;
  border-radius: 0;
  color: #c0c0c0;
  font-size: 18px;
  line-height: 1.5;
}
.block legend {
  padding: 0 6px;
  color: #ffffff;
  font-size: 20px;
  font-weight: bold;
}
.block p { margin: 0; }
.block .muted { color: #808080; }
#xmit-list { max-height: 15em; overflow-y: auto; }
#xmit-list.muted { overflow: visible; }
.sched-item { margin: 0 0 8px 0; }
.sched-item:last-child { margin-bottom: 0; }
.sched-time { color: #ffffff; }
.sched-title { color: #c0c0c0; }
.sched-meta { display: block; font-size: 15px; line-height: 1.3; color: #808080; }
#links { font-size: 22px; }

/* ---- deck: spectrum box above control bar ---- */
#deck {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  text-align: left;
}
#spec {
  position: relative;
  flex: 1 1 auto;
  min-height: 110px;
  margin-bottom: 8px;
  background: #101010;
  border: 1px solid #808080;
}
#spec canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#spec-info {
  position: absolute;
  top: 3px;
  right: 8px;
  z-index: 1;
  font-size: 18px;
  line-height: 18px;
  color: #c0c0c0;
}
#signal-status {
  position: absolute;
  right: 8px;
  bottom: 4px;
  z-index: 1;
  font-size: 15px;
  line-height: 16px;
}
#signal-status.has-signal { color: #b6d6a0; }
#signal-status.no-signal { color: #d08080; }
#signal-status.tuning { color: #d0c28a; }
#spec-label {
  position: absolute;
  top: 3px;
  left: 8px;
  z-index: 1;
  font-size: 16px;
  line-height: 18px;
  color: #808080;
}

/* ---- classic control bar ---- */
#player {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 6px;
  padding: 10px 14px;
  background: #101010;
  border: 1px solid #808080;
  color: #c0c0c0;
  font-size: 20px;
}
#vol-group {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  max-width: 100%;
  white-space: nowrap;
}
#player button {
  background: #c0c0c0;
  color: #000000;
  border: 2px outset #e0e0e0;
  border-radius: 0;
  padding: 4px 18px;
  margin: 0;
  font-size: 20px;
  line-height: 24px;
  min-width: 104px;
  cursor: pointer;
}
#player button:active { border-style: inset; }
#player button:focus { outline: 1px dotted #000000; outline-offset: -4px; }
#player.live #btn-play { border-style: inset; background: #b0b0b0; }
#player:not(.live) #btn-stop { border-style: inset; background: #b0b0b0; }
#player label { margin: 0 8px 0 14px; vertical-align: middle; }

#volume {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  min-width: 90px;
  width: 160px;
  height: 28px;
  background: transparent;
  vertical-align: middle;
  margin: 0;
}
#volume::-webkit-slider-runnable-track {
  height: 6px;
  background: #404040;
  border: 1px inset #808080;
}
#volume::-moz-range-track {
  height: 6px;
  background: #404040;
  border: 1px inset #808080;
}
#volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 26px;
  margin-top: -11px;
  background: #c0c0c0;
  border: 2px outset #e0e0e0;
  border-radius: 0;
}
#volume::-moz-range-thumb {
  width: 10px; height: 22px;
  background: #c0c0c0;
  border: 2px outset #e0e0e0;
  border-radius: 0;
}

/* ---- responsive ---- */
@media (max-width: 1100px) {
  #page { grid-template-columns: 240px minmax(0, 1fr); column-gap: 20px; padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 900px) {
  #page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "logo"
      "main"
      "blocks";
    min-height: 0;
    padding: 8px 16px 32px 16px;
  }
  #logo-cell { padding-bottom: 0; }
  #main { display: block; align-self: start; }
  #blocks { margin-top: 20px; }
  #blocks .block:last-child { margin-bottom: 18px; }
  #deck { display: block; margin-top: 12px; max-width: 640px; }
  #spec { flex: none; height: 120px; min-height: 0; }
  #spec-info { font-size: 16px; line-height: 16px; }
  #spec-label { font-size: 14px; line-height: 16px; }
  #player, #player button, #player label { font-size: 18px; }
  #player button { min-width: 88px; padding: 3px 14px; }
  .block { max-width: 640px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 640px) {
  #page { padding: 6px 12px 28px 12px; }
  #logo { font-size: 34px; }
  #deck { margin-top: 8px; }
  #spec { height: 92px; }
  #spec-info { font-size: 14px; line-height: 14px; right: 6px; }
  #spec-label { font-size: 13px; line-height: 14px; left: 6px; }
  #player, #player button, #player label { font-size: 17px; }
  #player { padding: 8px 10px; }
  #player button { min-width: 80px; }
  #vol-group { flex-basis: 100%; }
  #volume { width: 100%; }
  .block { font-size: 18px; }
  #links { font-size: 22px; }
  .block legend { font-size: 18px; }
}
@media (max-width: 380px) {
  #logo { font-size: 28px; }
  #player { padding: 6px; }
  #player button { min-width: 0; padding: 3px 10px; }
  #spec { height: 80px; }
  #spec-label { font-size: 11px; }
  #spec-info { font-size: 12px; }
}