@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Manrope:wght@300;500;700&display=swap");

:root {
  color-scheme: dark;
  --ink: #e8e4d7;
  --muted: #6e756f;
  --panel: rgba(12, 16, 20, 0.82);
  --line: rgba(232, 228, 215, 0.14);
  --acid: #c7ff55;
  --orange: #ff6339;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background-color: #080b10;
}

body {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding: 28px;
  color: var(--ink);
  font-family: "DM Mono", monospace;
}

body::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.2'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}

button {
  color: inherit;
  font: inherit;
}

#sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.radio-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 640px);
  padding: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  box-shadow: 0 50px 120px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(24px);
}

.radio-shell::after {
  position: absolute;
  top: -140px;
  right: -120px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(199, 255, 85, 0.09);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 80px rgba(199, 255, 85, 0.05) inset;
}

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 34px;
}

.eyebrow,
.display-topline,
.meter-row,
.message-label,
footer,
.dial-wrap > span {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
}

h1 {
  margin: 13px 0 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 300;
  line-height: 0.79;
  letter-spacing: -0.075em;
  text-transform: uppercase;
}

.status {
  display: flex;
  gap: 9px;
  align-items: center;
  padding-top: 3px;
  color: var(--acid);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.status-light {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
  animation: pulse 2s ease-in-out infinite;
}

.display {
  padding: 20px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}

.display-topline,
.meter-row {
  display: flex;
  justify-content: space-between;
}

#bandLabel {
  color: var(--acid);
}

.frequency-row {
  display: flex;
  align-items: baseline;
  margin: 7px 0 3px;
}

#frequency {
  font-size: clamp(42px, 11vw, 76px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.08em;
  font-variant-numeric: tabular-nums;
}

.unit {
  margin-left: 13px;
  color: var(--muted);
  font-size: 12px;
}

#waveform {
  display: block;
  width: 100%;
  height: 72px;
  margin: 6px 0 15px;
}

.meter-row {
  align-items: center;
  gap: 12px;
}

.meter {
  flex: 1;
  height: 3px;
  overflow: hidden;
  background: #282d2d;
}

#meterFill {
  display: block;
  width: 12%;
  height: 100%;
  background: var(--acid);
  box-shadow: 0 0 10px var(--acid);
  transition: width 180ms ease;
}

.message-panel {
  position: relative;
  min-height: 110px;
  padding: 22px 2px 16px;
  border-bottom: 1px solid var(--line);
}

.message {
  max-width: 500px;
  min-height: 29px;
  margin: 13px 0 7px;
  font-family: "Manrope", sans-serif;
  font-size: clamp(17px, 3vw, 22px);
  font-weight: 300;
  line-height: 1.35;
}

.message.locked {
  color: var(--acid);
  text-shadow: 0 0 22px rgba(199, 255, 85, 0.25);
}

.coordinates {
  margin: 0;
  color: #555d5a;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 160px 1fr;
  align-items: center;
  gap: 20px;
  padding: 27px 0;
}

.step-button,
#muteButton {
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, transform 100ms ease;
}

.step-button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-family: "Manrope", sans-serif;
  font-size: 20px;
}

.step-button:last-child {
  justify-self: end;
}

.step-button:hover,
#muteButton:hover {
  color: var(--acid);
  border-color: var(--acid);
}

.step-button:active,
#muteButton:active {
  transform: scale(0.94);
}

.dial-wrap {
  display: grid;
  place-items: center;
  gap: 10px;
}

.dial {
  position: relative;
  width: 132px;
  height: 132px;
  border: 1px solid rgba(232, 228, 215, 0.32);
  border-radius: 50%;
  background: repeating-conic-gradient(from -1deg, rgba(232, 228, 215, 0.35) 0deg 0.7deg, transparent 0.7deg 7deg), radial-gradient(circle at 40% 35%, #272d2d, #0d1012 58%);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55), 0 0 0 8px rgba(232, 228, 215, 0.025);
  cursor: grab;
  touch-action: none;
}

.dial:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 5px;
}

.dial:active {
  cursor: grabbing;
}

.dial-mark {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 2px;
  height: 17px;
  border-radius: 2px;
  background: var(--orange);
  box-shadow: 0 0 9px var(--orange);
  transform: translateX(-50%);
}

.dial-center {
  position: absolute;
  inset: 39%;
  border: 1px solid rgba(232, 228, 215, 0.2);
  border-radius: 50%;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#muteButton {
  padding: 8px 10px;
  border-radius: 1px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.toast {
  position: fixed;
  z-index: 4;
  right: 24px;
  bottom: 24px;
  max-width: calc(100vw - 48px);
  padding: 11px 15px;
  border: 1px solid rgba(199, 255, 85, 0.32);
  color: var(--acid);
  background: rgba(8, 11, 16, 0.88);
  font-size: 10px;
  letter-spacing: 0.1em;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

@media (max-width: 560px) {
  body {
    align-items: start;
    padding: 12px;
  }

  .radio-shell {
    min-height: calc(100dvh - 24px);
    padding: 24px 20px;
  }

  .masthead {
    margin-bottom: 26px;
  }

  .display {
    padding: 16px;
  }

  .controls {
    grid-template-columns: 1fr 132px 1fr;
    gap: 10px;
  }

  .dial {
    width: 112px;
    height: 112px;
  }

  footer > span {
    display: none;
  }

  footer {
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
