:root {
  --page: #0f0d0b;
  --amber: #f0a74b;
  --amber-hot: #ffc46e;
  --amber-dim: #9f6728;
  --ink: #c7bca9;
  --ink-dim: #71695e;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% -15%, rgba(255,255,255,.055), transparent 38%),
    linear-gradient(180deg, #191612 0%, #0d0c0a 58%, #090807 100%);
}
button { font: inherit; }

.page-watermark {
  position: fixed;
  z-index: 0;
  right: -34vw;
  bottom: -24vh;
  width: min(82vw, 1450px);
  aspect-ratio: 1;
  pointer-events: none;
  background: url("pyratedial-ship.png") center / contain no-repeat;
  opacity: .05;
  filter: invert(72%) sepia(24%) saturate(640%) hue-rotate(350deg) brightness(78%) contrast(90%);
  transform: rotate(-2deg);
}
.page-shell { position: relative; z-index: 1; }

.page-shell {
  width: min(100%, 680px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 18px max(36px, env(safe-area-inset-bottom));
}
.masthead {
  display: flex; align-items: end; justify-content: space-between; gap: 22px;
  width: min(100%, 520px); margin: 0 auto 22px; padding: 0 5px; color: #a99e8d;
}
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 54px; height: 42px; display: grid; place-items: center; overflow: hidden;
  border-bottom: 1px solid #5b5248; opacity: .88;
}
.brand-mark img {
  width: 60px; height: 60px; object-fit: contain; opacity: .95;
  filter: invert(76%) sepia(20%) saturate(560%) hue-rotate(350deg) brightness(88%) contrast(84%);
}
.masthead h1 { margin: 0; font-size: 20px; line-height: .95; font-weight: 700; letter-spacing: .18em; }
.masthead p {
  margin: 6px 0 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 7px; letter-spacing: .26em; color: var(--ink-dim);
}
.build-mark {
  text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 7px; line-height: 1.5; letter-spacing: .2em; color: #625b52;
}
.receiver {
  position: relative; width: min(100%, 520px); margin: 0 auto; padding: 18px 18px 17px;
  border: 1px solid #171512; border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.022), transparent 4%, rgba(255,255,255,.018) 11%, transparent 20%, rgba(0,0,0,.025) 32%, transparent 41%, rgba(255,255,255,.016) 53%, transparent 66%, rgba(0,0,0,.04) 84%, transparent),
    repeating-linear-gradient(0deg, rgba(255,255,255,.014) 0, rgba(255,255,255,.014) 1px, rgba(0,0,0,.012) 1px, rgba(0,0,0,.012) 3px),
    linear-gradient(180deg, #514c46 0%, #383530 11%, #302d29 58%, #262421 100%);
  box-shadow: inset 0 1px rgba(255,255,255,.16), inset 0 -1px #100f0d,
    inset 11px 0 22px rgba(255,255,255,.018), inset -14px 0 24px rgba(0,0,0,.10), 0 23px 55px rgba(0,0,0,.42);
}
.receiver::before, .receiver::after {
  content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; top: 10px;
  background: radial-gradient(circle at 35% 35%, #858078 0 12%, #37332e 31%, #11100e 72%);
  box-shadow: 0 0 0 1px rgba(0,0,0,.5);
}
.receiver::before { left: 10px; } .receiver::after { right: 10px; }
.receiver-topline, .receiver-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 7px; letter-spacing: .17em;
  color: #1d1b18; text-shadow: 0 1px rgba(255,255,255,.08); user-select: none;
}
.receiver-topline { margin: 1px 10px 10px; } .receiver-footer { margin: 14px 8px 0; }
.display {
  position: relative; overflow: hidden; min-height: 148px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 16px 16px 15px; border: 2px solid #18130f;
  border-radius: 2px;
  background:
    repeating-linear-gradient(0deg, rgba(255,190,94,.025) 0, rgba(255,190,94,.025) 1px, transparent 1px, transparent 4px),
    radial-gradient(ellipse at 50% 44%, rgba(244,163,67,.065), transparent 48%),
    linear-gradient(180deg, #100b07, #170f09 49%, #0b0806 100%);
  box-shadow: inset 0 0 0 1px rgba(255,177,77,.055), inset 0 12px 35px rgba(0,0,0,.84),
    inset 0 -7px 23px rgba(0,0,0,.76), 0 1px rgba(255,255,255,.075);
}
.display-glass {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(106deg, transparent 0 24%, rgba(255,255,255,.028) 24.2% 34%, transparent 34.2% 100%),
    linear-gradient(180deg, rgba(255,255,255,.022), transparent 26%); mix-blend-mode: screen;
}
.frequency-row { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 100%; }
.frequency {
  font-family: "Courier New", ui-monospace, monospace; font-size: clamp(58px, 16vw, 82px);
  font-weight: 400; line-height: .88; letter-spacing: -.105em; color: var(--amber-hot);
  text-shadow: 0 0 3px rgba(255,194,102,.58), 0 0 12px rgba(240,167,75,.30), 0 0 28px rgba(240,130,25,.13);
  font-variant-numeric: tabular-nums; transform: scaleY(1.03);
}
.unit {
  margin: 0 0 7px 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px; letter-spacing: .16em; color: var(--amber-dim);
}
.station-name {
  position: relative; width: 100%; min-height: 1.25em; margin-top: 12px; overflow: hidden;
  text-align: center; text-overflow: ellipsis; white-space: nowrap; color: #d99b51;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(12px, 3.4vw, 15px);
  line-height: 1.2; letter-spacing: .12em; text-transform: uppercase; text-shadow: 0 0 7px rgba(240,167,75,.17);
}
.signal-status {
  margin-top: 8px; min-height: 1em; color: #76522e;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 7px; letter-spacing: .28em;
}

.monitor-bay {
  width: 232px;
  margin: 14px auto 0;
  padding: 8px 8px 10px;
  border: 1px solid #171512;
  border-radius: 3px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0, rgba(255,255,255,.012) 1px, rgba(0,0,0,.015) 1px, rgba(0,0,0,.015) 3px),
    linear-gradient(180deg, #3b3833, #292622);
  box-shadow:
    inset 0 1px rgba(255,255,255,.09),
    inset 0 -2px 4px rgba(0,0,0,.34),
    0 2px 6px rgba(0,0,0,.2);
}
.monitor-labels {
  display: flex;
  justify-content: space-between;
  margin: 0 4px 6px;
  color: #1d1b18;
  text-shadow: 0 1px rgba(255,255,255,.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 6px;
  letter-spacing: .17em;
}
.monitor-bezel {
  width: 216px;
  height: 216px;
  margin: 0 auto;
  padding: 7px;
  border-radius: 14px;
  border: 1px solid #12100e;
  background:
    linear-gradient(135deg, rgba(255,255,255,.06), transparent 20%, rgba(0,0,0,.15) 72%),
    linear-gradient(180deg, #282521, #151311);
  box-shadow:
    inset 0 1px rgba(255,255,255,.08),
    inset 0 0 0 3px rgba(0,0,0,.3),
    0 1px rgba(255,255,255,.035);
}
.monitor-screen {
  position: relative;
  width: 200px;
  height: 200px;
  overflow: hidden;
  border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, rgba(240,167,75,.025) 0, rgba(240,167,75,.025) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse at 50% 43%, #1a120b 0%, #0b0907 70%);
  box-shadow:
    inset 0 0 25px rgba(0,0,0,.9),
    0 0 0 1px rgba(240,167,75,.06);
}
.youtube-player,
.monitor-screen iframe {
  display: block;
  width: 200px !important;
  height: 200px !important;
  min-width: 200px;
  min-height: 200px;
  border: 0;
}
.monitor-standby {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: #6f4a27;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px;
  letter-spacing: .28em;
  text-indent: .28em;
  background:
    linear-gradient(108deg, transparent 0 22%, rgba(255,255,255,.02) 22.2% 31%, transparent 31.2% 100%);
}
.monitor-bay.player-ready .monitor-standby { display: none; }

.dial-scale {
  margin: 12px 7px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #1d1b18; text-shadow: 0 1px rgba(255,255,255,.08); user-select: none;
}
.scale-labels { display: flex; justify-content: space-between; padding: 0 1px; font-size: 7px; letter-spacing: .05em; }
.scale-line {
  position: relative; height: 10px; margin-top: 5px; border-top: 1px solid #181613;
  background: repeating-linear-gradient(90deg, #171512 0 1px, transparent 1px 8.5%); background-size: 100% 5px; background-repeat: no-repeat;
}
.scale-marker {
  position: absolute; top: -5px; width: 2px; height: 13px; transform: translateX(-1px);
  background: var(--amber); box-shadow: 0 0 8px rgba(240,167,75,.5); transition: left 380ms cubic-bezier(.2,.8,.2,1);
}
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.seek-button {
  appearance: none; min-height: 69px; border: 1px solid #171512; border-radius: 2px;
  display: flex; align-items: center; justify-content: center; gap: 17px; color: #b0a598;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.015) 20%, rgba(0,0,0,.08) 75%), linear-gradient(180deg, #4b4640, #332f2b);
  box-shadow: inset 0 1px rgba(255,255,255,.14), inset 0 -3px rgba(0,0,0,.28), 0 1px 2px rgba(0,0,0,.32);
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
}
.seek-button:active:not(:disabled) { transform: translateY(1px); background: linear-gradient(180deg, #37332f, #2c2925); box-shadow: inset 0 2px 5px rgba(0,0,0,.45); }
.seek-button:disabled { opacity: .30; cursor: default; }
.button-copy { display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1; }
.button-copy small { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 7px; letter-spacing: .22em; color: #7f776e; }
.button-copy b { margin-top: 4px; font-size: 11px; font-weight: 600; letter-spacing: .18em; }
.arrow { color: #8d8173; font-size: 12px; }
.receiver.seeking .frequency { opacity: .78; filter: blur(.2px); }
.receiver.seeking .station-name { opacity: .30; }
.receiver.seeking .signal-status { color: var(--amber-dim); }
.install-panel {
  width: min(100%, 520px); margin: 34px auto 0; padding: 23px 5px 0; border-top: 1px solid #312c27;
  display: grid; grid-template-columns: 1fr; gap: 19px;
}
.install-kicker {
  margin: 0 0 8px; color: #725d43; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px; letter-spacing: .25em;
}
.install-panel h2 { max-width: 430px; margin: 0; color: #b7ac9c; font-size: 16px; line-height: 1.38; font-weight: 500; letter-spacing: .01em; }
.install-copy { max-width: 480px; margin: 9px 0 0; color: #6f675d; font-size: 12px; line-height: 1.55; }
.install-button {
  display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none;
  width: 100%; min-height: 54px; appearance: none; border: 1px solid #5c482e; border-radius: 2px;
  color: #d69749; background: #17130f; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px; letter-spacing: .16em; cursor: pointer;
}
.install-button:active { background: #211912; }
.site-footer {
  width: min(100%, 520px); margin: 32px auto 0; text-align: center; color: #413b34;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 7px; letter-spacing: .18em;
}
.install-dialog {
  width: min(calc(100% - 34px), 440px); padding: 0; border: 1px solid #564b3e; border-radius: 3px;
  color: #c1b5a5; background: #1a1714; box-shadow: 0 20px 75px rgba(0,0,0,.72);
}
.install-dialog::backdrop { background: rgba(0,0,0,.72); }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid #373029;
  color: #9f7545; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; letter-spacing: .22em;
}
.dialog-head button { appearance: none; border: 0; padding: 1px 4px; color: #8b8174; background: none; font-size: 22px; cursor: pointer; }
.dialog-body { padding: 20px 20px 22px; font-size: 13px; line-height: 1.55; }
.dialog-body p { margin: 0 0 10px; }
.dialog-body ol { margin: 0; padding-left: 20px; }
.dialog-body li { margin: 7px 0; }
.dialog-note { margin-top: 17px !important; color: #756c61; }
@media (min-width: 560px) {
  .page-shell { padding-top: 46px; }
  .install-panel { grid-template-columns: 1fr 170px; align-items: end; }
}
@media (max-height: 720px) and (max-width: 560px) {
  .page-shell { padding-top: max(15px, env(safe-area-inset-top)); }
  .masthead { margin-bottom: 14px; }
  .display { min-height: 211px; }
  .receiver { padding-top: 15px; }
}
@media (max-width: 560px) {
  .page-watermark { display: none; }
}
@media (display-mode: standalone) {
  .page-watermark { display: none; }
  .page-shell {
    display: grid; min-height: 100dvh; align-content: center;
    padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
  .masthead { margin-bottom: 16px; }
  .install-panel, .site-footer { display: none; }
}

@media (max-width: 560px) {
  .page-shell { padding-left: 14px; padding-right: 14px; }
  .masthead { margin-bottom: 12px; }
  .receiver { padding: 14px 14px 14px; }
  .receiver-topline { margin-bottom: 7px; }
  .station-readout { min-height: 136px; }
  .monitor-bay { margin-top: 11px; }
  .seek-button { min-height: 62px; }
  .receiver-footer { margin-top: 10px; }
}
@media (display-mode: standalone) and (max-width: 560px) {
  .page-shell { align-content: start; padding-top: max(16px, env(safe-area-inset-top)); }
  .masthead { margin-bottom: 12px; }
}


/* v7 monitor treatment: monochrome CRT + no stale YouTube frame off-station */
.monitor-screen iframe {
  position: relative;
  z-index: 1;
  opacity: 0;
  filter: grayscale(100%) contrast(1.28) brightness(.78);
  transition: opacity 120ms linear;
}
.monitor-bay.player-ready .monitor-screen iframe {
  opacity: 1;
}
.monitor-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,.025) 0,
      rgba(255,255,255,.025) 1px,
      rgba(0,0,0,.055) 1px,
      rgba(0,0,0,.055) 3px
    ),
    radial-gradient(ellipse at 50% 45%, transparent 48%, rgba(0,0,0,.22) 100%);
  box-shadow: inset 0 0 18px rgba(0,0,0,.42);
}
.monitor-standby {
  z-index: 4;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(113deg, rgba(255,255,255,.012) 0 2px, rgba(0,0,0,.03) 2px 5px),
    radial-gradient(ellipse at 50% 43%, #15110d 0%, #090806 72%);
}


/* v12 — physical POWER control. POWER is the one deliberate iPhone audio-unlock gesture. */
.controls {
  grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}
.power-button {
  appearance: none;
  min-height: 69px;
  border: 1px solid #171512;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #766e64;
  background:
    linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.01) 22%, rgba(0,0,0,.12) 78%),
    linear-gradient(180deg, #3b3732, #2b2824);
  box-shadow: inset 0 1px rgba(255,255,255,.11), inset 0 -3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.32);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.power-button:active { transform: translateY(1px); box-shadow: inset 0 2px 5px rgba(0,0,0,.45); }
.power-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #191613;
  border: 1px solid #0d0c0a;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.04), 0 1px rgba(255,255,255,.05);
}
.power-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 7px;
  letter-spacing: .16em;
}
.power-button.is-on { color: #c19a67; }
.power-button.is-on .power-led {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(240,167,75,.72), 0 0 2px rgba(255,224,173,.95) inset;
}
@media (max-width: 560px) {
  .controls { grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr); gap: 8px; }
  .power-button { min-height: 62px; gap: 6px; }
  .power-label { font-size: 6px; }
  .seek-button { gap: 11px; }
}

/* v13 — POWER is deliberately obvious: burnt orange when off, bright amber-orange when on. */
.power-button {
  color: #f3d0a7;
  border-color: #5b2b0e;
  background:
    linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,.015) 24%, rgba(0,0,0,.18) 80%),
    linear-gradient(180deg, #a44e18, #73320f);
  box-shadow:
    inset 0 1px rgba(255,230,190,.22),
    inset 0 -3px rgba(43,15,3,.42),
    0 1px 2px rgba(0,0,0,.36);
}
.power-button .power-label {
  color: #f1c999;
  text-shadow: 0 1px rgba(0,0,0,.45);
}
.power-button .power-led {
  background: #4a1c08;
  border-color: #2b1005;
}
.power-button:active {
  background: linear-gradient(180deg, #824015, #61290d);
}
.power-button.is-on {
  color: #fff0d3;
  border-color: #9c531b;
  background:
    linear-gradient(180deg, rgba(255,255,255,.17), rgba(255,255,255,.02) 22%, rgba(0,0,0,.12) 82%),
    linear-gradient(180deg, #d66b1d, #a74712);
  box-shadow:
    inset 0 1px rgba(255,240,205,.30),
    inset 0 -3px rgba(72,24,3,.38),
    0 0 10px rgba(224,105,24,.17),
    0 1px 2px rgba(0,0,0,.36);
}
.power-button.is-on .power-label { color: #fff1d9; }
.power-button.is-on .power-led {
  background: #ffad42;
  box-shadow: 0 0 10px rgba(255,153,45,.92), 0 0 3px rgba(255,244,206,.95) inset;
}
