/* CWAF — Android phone mockup + recreated app screens.

   Everything inside .phone mirrors the app's Compose code, 1 CSS px = 1 dp:
     colours   cwaf/app/src/main/kotlin/radio/ks3ckc/cwaf/theme/Color.kt (DarkPalette)
     screens   .../ui/cw/OperateScreen.kt, TrainerScreen.kt, CwScreens.kt
     nav bar   .../ui/cw/CwNavBar.kt
   The app's own accent is amber and its "signal" colour is cyan — only brand
   surfaces (icon, wordmark, store art, this site's chrome) are signal red.
   Keep these values in step with the app, not with the site tokens. */

/* Scale wrapper: .phone is laid out at 436 x 916 (a 412 x 892 dp screen, the
   size of a current Pixel) and scaled to fit. */
.phone-fit {
  --s: 0.72;
  width: calc(436px * var(--s));
  height: calc(916px * var(--s));
  flex-shrink: 0;
  position: relative;
}
.phone-fit > .phone { transform: scale(var(--s)); transform-origin: top left; }

/* ───── Device frame ───── */
.phone {
  --a-bg: #07090f;
  --a-surface: #0e131e;
  --a-surface2: #161c2b;
  --a-border: rgba(148,163,184,0.08);
  --a-text: #e7ecf3;
  --a-muted: #8a96b1;
  --a-faint: #5a647e;
  --a-dim: #3e4862;
  --a-accent: #ffaf5e;
  --a-accent-glow: #ffd7a0;
  --a-signal: #5cd6e8;
  --a-signal-soft: rgba(92,214,232,0.14);
  --a-ok: #4ade80;
  --a-warn: #facc15;
  --a-bad: #ef4444;
  --a-ui: 'Inter', 'Geist', system-ui, sans-serif;
  --a-mono: 'Geist Mono', ui-monospace, monospace;

  width: 436px;
  height: 916px;
  border-radius: 54px;
  background: linear-gradient(160deg, #20262f, #0c0f15 55%);
  padding: 12px;
  box-shadow:
    0 40px 90px -30px rgba(0,0,0,0.85),
    0 0 0 1px rgba(255,255,255,0.05),
    inset 0 0 0 1.5px rgba(0,0,0,0.6);
  position: relative;
  flex-shrink: 0;
  text-align: left;
}
.phone::after {
  content: '';
  position: absolute;
  right: -2px; top: 200px;
  width: 3px; height: 72px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #2a313c, #161b22);
}
.phone-screen {
  width: 100%; height: 100%;
  border-radius: 42px;
  overflow: hidden;
  background: var(--a-bg);
  color: var(--a-text);
  font-family: var(--a-ui);
  font-feature-settings: 'zero';
  line-height: 1.3;
  display: flex;
  flex-direction: column;
}
.phone-screen .m { font-family: var(--a-mono); }

/* system status bar (the app draws edge-to-edge under it) */
.phone-statusbar {
  flex: 0 0 34px;
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 24px 0;
  font-size: 12.5px; font-weight: 600;
  color: var(--a-text);
}
.phone-statusbar .cam {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: #05070b; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.08);
}
.phone-statusbar .sb-right { display: flex; align-items: center; gap: 6px; }
.phone-statusbar .sb-right svg { width: 15px; height: 15px; }

.app { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ───── Shared screen title (ScreenTitle / Operate header) ───── */
.scr-title { font-size: 24px; font-weight: 600; line-height: 29px; }
.scr-sub { font-size: 13px; color: var(--a-muted); margin-top: 4px; line-height: 17px; }
.scr-head { padding: 12px 16px 4px; }

/* ───── OPERATE ───── */
.op-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 8px; }
.op-head .utc { font-family: var(--a-mono); font-size: 13px; color: var(--a-muted); line-height: 17px; }
.op-chips { display: flex; align-items: center; gap: 8px; }
.a-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--a-surface); border: 1px solid var(--a-border);
  color: var(--a-muted); font-size: 11px; font-weight: 600; line-height: 14px;
}
.a-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--a-ok); }
.a-wpm {
  padding: 6px 10px; border-radius: 999px; background: var(--a-signal-soft);
  color: var(--a-signal); font: 600 11px/14px var(--a-mono);
}

.wf-card { margin: 0 16px; border-radius: 12px; background: var(--a-surface); border: 1px solid var(--a-border); overflow: hidden; }
.wf-top { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 6px 12px; }
.wf-top .tone { font: 400 11px/14px var(--a-mono); color: var(--a-signal); }
.wf-top .wf-steps { display: flex; align-items: center; gap: 4px; font: 400 11px/14px var(--a-mono); color: var(--a-muted); }
.mini-btn {
  width: 26px; height: 22px; border-radius: 6px; background: var(--a-surface2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--a-signal); font: 700 13px/1 var(--a-ui);
}
.wf { position: relative; height: 108px; }
.wf canvas { display: block; width: 100%; height: 100%; }
.wf-axis {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; padding: 3px 6px;
  font: 400 9px/12px var(--a-mono); color: var(--a-faint);
}

.op-mid { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px 16px; }
.rx {
  flex: 1; min-height: 0; overflow: hidden;
  border-radius: 12px; background: var(--a-surface); border: 1px solid var(--a-border);
  padding: 10px 12px;
  font: 400 13px/20px var(--a-mono); color: var(--a-text);
}
.rx.idle { color: var(--a-dim); }
.keyer {
  flex: 0 0 46px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border-radius: 12px; background: var(--a-surface); border: 1px solid var(--a-border);
}
.keyer .kl { font-size: 10px; font-weight: 600; color: var(--a-faint); }
.keyer .kt { flex: 1; font: 400 13px/17px var(--a-mono); color: var(--a-accent-glow); white-space: nowrap; overflow: hidden; }
.keyer .kt.empty { color: var(--a-dim); }
.keyer.tx { background: var(--a-signal-soft); border-color: var(--a-signal); }
.keyer.tx .kl { color: var(--a-signal); }

.entry { display: flex; align-items: center; gap: 6px; padding: 0 16px; }
.ef {
  flex: 1; min-width: 0; border-radius: 10px; background: var(--a-surface2);
  border: 1px solid var(--a-border); padding: 6px 10px;
}
.ef.call { flex: 1.4; }
.ef.dupe { border-color: var(--a-bad); }
.ef .el { display: flex; justify-content: space-between; font-size: 9px; font-weight: 600; line-height: 12px; color: var(--a-faint); }
.ef .el b { color: var(--a-bad); font-weight: 700; }
.ef .ev { font: 700 18px/23px var(--a-mono); height: 23px; white-space: nowrap; overflow: hidden; }
.ef .ev.sig { color: var(--a-signal); }
.ef .ev.acc { color: var(--a-accent); }
.logbtn {
  flex: 0 0 58px; height: 52px; border-radius: 10px; background: var(--a-surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--a-faint);
}
.logbtn.on { background: var(--a-signal); color: var(--a-bg); }

.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px 16px; }
.mb {
  height: 44px; border-radius: 10px; background: var(--a-surface2); border: 1px solid var(--a-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.mb b { font-size: 13px; font-weight: 600; line-height: 17px; color: var(--a-text); }
.mb span { font: 400 9px/12px var(--a-mono); color: var(--a-faint); }

.band-row { display: flex; align-items: center; gap: 6px; padding: 0 16px 10px; }
.band {
  flex: 1; height: 44px; border-radius: 12px; background: var(--a-surface); border: 1px solid var(--a-border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 14px;
}
.band .bl { flex-shrink: 0; font-size: 10px; font-weight: 600; color: var(--a-faint); }
.band .bv { font: 400 14px/18px var(--a-mono); color: var(--a-text); text-align: right; }
.testbtn {
  height: 44px; padding: 0 14px; border-radius: 12px; background: var(--a-surface2); border: 1px solid var(--a-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--a-signal);
}
.txbtn {
  flex: 0 0 84px; height: 44px; border-radius: 12px; background: var(--a-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--a-bg);
}
.txbtn.stop { background: var(--a-bad); }

/* ───── TRAINER ───── */
.tr { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px 16px; }
.a-card { border-radius: 14px; background: var(--a-surface); border: 1px solid var(--a-border); padding: 14px; }
.a-card h5 { margin: 0; font-size: 15px; font-weight: 600; line-height: 20px; color: var(--a-text); letter-spacing: 0; }
.a-card .hint { font-size: 12px; line-height: 16px; color: var(--a-muted); margin: 2px 0 8px; }
.step-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; font-size: 13px; color: var(--a-muted); }
.step-row .sv { display: flex; align-items: center; gap: 10px; font: 400 13px/17px var(--a-mono); color: var(--a-text); }
.step-btn {
  height: 28px; padding: 0 12px; border-radius: 8px; background: var(--a-surface2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--a-signal); font: 700 15px/1 var(--a-ui);
}
.act-row { display: flex; gap: 8px; }
.act {
  flex: 1; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--a-bg);
}
.act.accent { background: var(--a-accent); }
.act.signal { background: var(--a-signal); }
.act.quiet { background: var(--a-surface2); color: var(--a-signal); }
.act.off { background: var(--a-surface2); color: var(--a-faint); }
.tfield {
  border-radius: 10px; background: var(--a-surface2); border: 1px solid var(--a-border);
  padding: 10px 12px; font: 700 16px/21px var(--a-mono); color: var(--a-text);
}
.tfield.ph { font-weight: 400; color: var(--a-dim); }
.tr .sent { font: 400 15px/20px var(--a-mono); color: var(--a-text); white-space: pre; }
.tr .score { font-size: 14px; font-weight: 700; line-height: 18px; margin-top: 2px; }
.tr .score.ok { color: var(--a-ok); }
.tr .score.bad { color: var(--a-bad); }
.tr .morse { font: 400 18px/23px var(--a-mono); color: var(--a-signal); margin-top: 8px; white-space: pre-wrap; }
.mt8 { margin-top: 8px; }

/* ───── MACROS ───── */
.mac-list { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.mac-row {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: 12px; background: var(--a-surface); border: 1px solid var(--a-border);
}
.mac-row .mk {
  flex: 0 0 34px; height: 34px; border-radius: 8px; background: var(--a-bg);
  display: flex; align-items: center; justify-content: center;
  font: 600 11px/1 var(--a-mono); color: var(--a-accent);
}
.mac-row .mn { font-size: 14px; font-weight: 500; line-height: 18px; color: var(--a-text); }
.mac-row .mt { font: 400 12px/16px var(--a-mono); color: var(--a-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; }
.mac-row > div:last-child { min-width: 0; flex: 1; }

/* ───── LOG ───── */
.log-list { display: flex; flex-direction: column; gap: 6px; padding: 0 16px; }
.log-row {
  display: flex; align-items: center; padding: 12px;
  border-radius: 12px; background: var(--a-surface); border: 1px solid var(--a-border);
}
.log-row .bar { flex: 0 0 3px; height: 36px; background: #5cd6e8; }
.log-row .lb { flex: 1; min-width: 0; padding-left: 12px; }
.log-row .l1 { display: flex; align-items: flex-end; gap: 8px; }
.log-row .lc { font: 700 16px/21px var(--a-mono); color: var(--a-signal); }
.log-row .lm { font: 400 12px/16px var(--a-mono); color: var(--a-muted); }
.log-row .l2 { font: 400 12px/16px var(--a-mono); color: var(--a-muted); margin-top: 3px; white-space: nowrap; }
.sync {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px;
  background: rgba(250,204,21,0.14); color: var(--a-warn);
  font-size: 10px; font-weight: 600; line-height: 13px;
}
.sync i { width: 6px; height: 6px; border-radius: 50%; background: var(--a-warn); }

/* ───── Bottom nav (CwNavBar) ───── */
.a-nav { flex: 0 0 auto; background: var(--a-surface); border-top: 1px solid var(--a-border); }
.a-nav .items { height: 64px; padding: 0 6px; display: flex; align-items: center; }
.a-nav .it { flex: 1; display: flex; flex-direction: column; align-items: center; color: var(--a-faint); font-size: 11px; font-weight: 500; line-height: 14px; }
.a-nav .it .np { width: 44px; height: 26px; border-radius: 13px; display: flex; align-items: center; justify-content: center; margin-bottom: 3px; }
.a-nav .it svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.a-nav .it.on { color: var(--a-signal); }
.a-nav .it.on .np { background: var(--a-signal-soft); }
.a-nav .gesture { height: 22px; display: flex; align-items: center; justify-content: center; }
.a-nav .gesture::before { content: ''; width: 108px; height: 4px; border-radius: 2px; background: rgba(231,236,243,0.55); }
