:root {
  color-scheme: light;
  --yellow: #ffd700;
  --charcoal: #1b1b1b;
  --charcoal-3: #3a3a3a;
  --lcd-bg: #1a2e05;
  --lcd-green: #39ff14;
  --lcd-muted: #87b870;
  --alert-red: #ff1f14;
  --alert-red-off: #3d0f0f;
  --orange: #ff7a1a;
  --orange-dark: #9b3c00;
  --button-radius: 10px;
  --device-width: min(390px, calc(100vw - 24px));
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--yellow);
  color: #f7f4e8;
  font-family: "Arial", "Helvetica", sans-serif;
  min-height: 100svh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

button {
  font: inherit;
}

button,
button *,
.hardware-button,
.hardware-button *,
.language-toggle,
.language-toggle *,
.lcd,
.lcd *,
.brand-row,
.brand-row * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.device-stage {
  height: 100svh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
}

.walkie {
  width: var(--device-width);
  position: relative;
  padding-top: 88px;
}

.antenna {
  position: absolute;
  top: 0;
  left: 42px;
  width: 42px;
  height: 132px;
  background: #101010;
  border-radius: 8px 8px 0 0;
  box-shadow:
    inset -5px 0 0 rgba(0, 0, 0, 0.45),
    inset 3px 0 0 rgba(255, 255, 255, 0.08);
}

.antenna::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 7px;
  width: 28px;
  height: 12px;
  background: #0a0a0a;
  border-radius: 8px 8px 2px 2px;
}

.antenna-rib,
.antenna-rib::before,
.antenna-rib::after {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.antenna-rib {
  top: 26px;
}

.antenna-rib::before,
.antenna-rib::after {
  content: "";
}

.antenna-rib::before {
  top: 18px;
}

.antenna-rib::after {
  top: 36px;
}

.chassis {
  position: relative;
  z-index: 1;
  min-height: 700px;
  padding: 30px 26px 28px;
  background: var(--charcoal);
  border: 5px solid #111;
  border-radius: 34px;
  box-shadow:
    0 20px 0 #6f5d00,
    0 30px 32px rgba(0, 0, 0, 0.42),
    inset 0 2px 0 rgba(255, 255, 255, 0.08),
    inset 0 -10px 0 rgba(0, 0, 0, 0.38);
}

.chassis::before,
.chassis::after {
  content: "";
  position: absolute;
  top: 76px;
  bottom: 88px;
  width: 8px;
  background: #0f0f0f;
  border-radius: 6px;
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.05);
}

.chassis::before {
  left: -7px;
}

.chassis::after {
  right: -7px;
}

.brand-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 0 8px 16px;
}

.brand-mark {
  display: grid;
  gap: 1px;
  color: #ffffff;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.status-controls {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.language-toggle {
  appearance: none;
  min-width: 38px;
  min-height: 24px;
  padding: 4px 8px;
  background: #303030;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  box-shadow:
    0 3px 0 #090909,
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  touch-action: manipulation;
}

.language-toggle:active {
  transform: translateY(2px);
  background: #282828;
  box-shadow:
    0 1px 0 #090909,
    inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

.tx-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.62);
  font-family: "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tx-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--alert-red-off);
  border: 1px solid #120000;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.8),
    0 0 0 transparent;
}

.tx-led.is-active {
  background: var(--alert-red);
  box-shadow:
    0 0 9px var(--alert-red),
    0 0 2px #ffffff,
    inset 0 1px 1px rgba(255, 255, 255, 0.55);
}

.tx-led.is-receiving {
  background: var(--lcd-green);
  box-shadow:
    0 0 9px var(--lcd-green),
    0 0 2px #ffffff,
    inset 0 1px 1px rgba(255, 255, 255, 0.55);
}

.lcd {
  padding: 20px 18px 18px;
  background: var(--lcd-bg);
  border: 5px solid #090909;
  border-radius: 12px;
  box-shadow:
    inset 0 5px 10px rgba(0, 0, 0, 0.72),
    inset 0 -2px 0 rgba(255, 255, 255, 0.08);
  color: var(--lcd-green);
  font-family: "Courier New", "JetBrains Mono", monospace;
}

.lcd-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--lcd-muted);
  text-shadow: 0 0 4px rgba(57, 255, 20, 0.45);
}

.lcd-kicker,
.ready-pill {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lcd-channel {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
}

.ready-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ready-dot {
  width: 7px;
  height: 7px;
  background: var(--lcd-green);
  border-radius: 50%;
  box-shadow: 0 0 7px rgba(57, 255, 20, 0.8);
}

.frequency-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  min-width: 0;
  width: 100%;
  gap: 6px;
  white-space: nowrap;
}

.frequency {
  flex: 0 1 auto;
  min-width: 0;
  text-align: right;
  font-family: "Courier New", "JetBrains Mono", monospace;
  font-size: clamp(34px, 12vw, 58px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow:
    0 0 5px rgba(57, 255, 20, 0.9),
    0 0 12px rgba(57, 255, 20, 0.36);
}

.frequency.is-tuning {
  animation: lcd-jitter 180ms steps(2, end);
}

.frequency-unit {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.75;
  text-shadow: 0 0 4px rgba(57, 255, 20, 0.55);
}

.signal-meter {
  display: flex;
  gap: 2px;
  height: 9px;
  margin-top: 18px;
  padding: 1px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 2px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.signal-meter span {
  display: block;
  width: 20%;
  height: 100%;
  background: var(--lcd-green);
  box-shadow: 0 0 6px rgba(57, 255, 20, 0.65);
  opacity: 0.15;
  transition: opacity 200ms ease;
}

.signal-meter span.is-lit {
  opacity: 1;
}

.vu-meter {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 5px;
  height: 26px;
  margin-top: 12px;
  padding: 4px 5px;
  background: rgba(0, 0, 0, 0.32);
  border-radius: 2px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.82);
  opacity: 0.42;
}

.vu-meter span {
  display: block;
  height: 5px;
  background: #235c18;
  border-radius: 1px;
  box-shadow: none;
}

.vu-meter.is-active {
  opacity: 1;
}

.vu-meter.is-active span {
  background: var(--lcd-green);
  box-shadow: 0 0 6px rgba(57, 255, 20, 0.75);
  animation: vu-step 520ms steps(3, end) infinite;
}

.vu-meter.is-active span:nth-child(2) {
  animation-delay: 80ms;
}

.vu-meter.is-active span:nth-child(3) {
  animation-delay: 160ms;
}

.vu-meter.is-active span:nth-child(4) {
  animation-delay: 40ms;
}

.vu-meter.is-active span:nth-child(5) {
  animation-delay: 210ms;
}

.vu-meter.is-active span:nth-child(6) {
  animation-delay: 120ms;
}

.vu-meter.is-active span:nth-child(7) {
  animation-delay: 260ms;
}

.control-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 24px;
}

.tuning-bank {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: #252525;
  border-radius: 12px;
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hardware-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--button-radius);
  cursor: pointer;
  touch-action: manipulation;
  color: #f7f4e8;
  text-transform: uppercase;
  transition:
    transform 80ms ease,
    box-shadow 80ms ease,
    background-color 80ms ease;
}

.hardware-button:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

.tune-button {
  min-height: 60px;
  background: var(--charcoal-3);
  box-shadow:
    0 6px 0 #111,
    0 10px 14px rgba(0, 0, 0, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.12);
  font-size: 28px;
  line-height: 1;
}

.ptt-button {
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: var(--orange);
  color: #1c1304;
  box-shadow:
    0 8px 0 var(--orange-dark),
    0 13px 16px rgba(0, 0, 0, 0.45),
    inset 0 2px 0 rgba(255, 255, 255, 0.25);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.ptt-icon {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: round;
  stroke-width: 3px;
  pointer-events: none;
}

.hardware-button:active,
.hardware-button.is-pressed {
  transform: translateY(5px);
}

.tune-button:active,
.tune-button.is-pressed {
  background: #303030;
  box-shadow:
    0 2px 0 #111,
    0 4px 8px rgba(0, 0, 0, 0.45),
    inset 0 3px 5px rgba(0, 0, 0, 0.35);
}

.ptt-button:active,
.ptt-button.is-pressed {
  background: #e9650a;
  box-shadow:
    0 3px 0 var(--orange-dark),
    0 6px 10px rgba(0, 0, 0, 0.48),
    inset 0 3px 7px rgba(0, 0, 0, 0.26);
}

.volume-strip {
  display: flex;
  gap: 9px;
  margin: 24px auto 22px;
  width: 74%;
}

.volume-strip span {
  display: block;
  height: 8px;
  flex: 1;
  background: rgba(0, 0, 0, 0.72);
  border-radius: 2px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.9);
}

.volume-strip .is-lit {
  background: var(--yellow);
  box-shadow:
    0 0 5px rgba(255, 215, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.speaker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 11px 14px;
  width: 76%;
  margin: 0 auto;
  padding: 18px;
  background: #141414;
  border-radius: 12px;
  box-shadow:
    inset 0 5px 9px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.speaker span {
  aspect-ratio: 1;
  background: #050505;
  border-radius: 50%;
  box-shadow:
    inset 0 2px 3px rgba(0, 0, 0, 0.92),
    0 1px 0 rgba(255, 255, 255, 0.05);
}

@keyframes lcd-jitter {
  0% {
    transform: translate(0, 0);
    opacity: 1;
  }
  20% {
    transform: translate(-2px, 1px);
    opacity: 0.82;
  }
  45% {
    transform: translate(2px, -1px);
    opacity: 0.96;
  }
  70% {
    transform: translate(-1px, -1px);
    opacity: 0.88;
  }
  100% {
    transform: translate(0, 0);
    opacity: 1;
  }
}

@keyframes vu-step {
  0% {
    height: 5px;
  }
  33% {
    height: 18px;
  }
  66% {
    height: 11px;
  }
  100% {
    height: 22px;
  }
}

@media (max-height: 760px) {
  .device-stage {
    align-items: start;
  }

  .walkie {
    transform: scale(0.88);
    transform-origin: top center;
  }
}

@media (max-height: 700px) {
  .walkie {
    transform: scale(0.8);
  }
}

@media (max-height: 640px) {
  .walkie {
    transform: scale(0.74);
  }
}

.ready-dot.is-offline {
  background: #555;
  box-shadow: none;
  opacity: 0.5;
}

.ready-dot.is-connecting {
  animation: ready-blink-slow 1.2s ease-in-out infinite;
}

.ready-dot.is-reconnecting {
  animation: ready-blink-fast 0.5s ease-in-out infinite;
}

.ready-dot.is-busy-flash {
  background: var(--alert-red);
  box-shadow: 0 0 9px var(--alert-red);
  animation: busy-flash 1.2s ease-in-out 1;
}

@keyframes ready-blink-slow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes ready-blink-fast {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

@keyframes busy-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.ptt-button.is-busy {
  animation: ptt-shake 0.3s ease-in-out 1;
}

@keyframes ptt-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.ptt-button[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
