:root {
  --bg: #15181c; --panel: #1f242a; --edge: #2e353d; --text: #dfe5ea; --dim: #8a96a1;
  --amber: #ffb43b; --green: #44d07b; --red: #e5484d; --blue: #4aa3ff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
.hidden { display: none !important; }
button, select, input { font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--edge); border-radius: 8px; padding: 8px 12px; }
button { cursor: pointer; }
button:hover { border-color: var(--blue); }
button.on { background: var(--blue); color: #000; border-color: var(--blue); }
button.small { padding: 4px 10px; font-size: 13px; }
.dim { color: var(--dim); font-size: 13px; }
.err { color: var(--red); min-height: 1.2em; }

.panel { max-width: 340px; margin: 12vh auto; padding: 28px; background: var(--panel);
  border: 1px solid var(--edge); border-radius: 14px; }
.panel h1 { margin: 0; } .sub { color: var(--dim); margin-top: 2px; }
.panel label { display: block; margin: 14px 0; }
.panel input { width: 100%; margin-top: 4px; }
.panel button { width: 100%; background: var(--blue); color: #000; border: 0; }

main { max-width: 720px; margin: 0 auto; padding: 10px 12px 40px; }
header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.brand { font-weight: 700; } .spacer { flex: 1; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--edge); }
.pill.ok { background: #1d4d33; color: var(--green); }
.pill.bad { background: #4d1d20; color: #ff9a9d; }

.display { position: relative; margin: 12px 0; padding: 40px 16px 14px; background: #0c0e10; border: 1px solid var(--edge);
  border-radius: 12px; }
.freq { font: 600 clamp(38px, 11vw, 64px)/1.1 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--amber); text-align: center; user-select: none; letter-spacing: 1px;
  text-shadow: 0 0 12px rgba(255,180,59,.35); }
.freq.txmode { color: #ff6b70; text-shadow: 0 0 12px rgba(229,72,77,.45); }
.freq .d { cursor: ns-resize; display: inline-block; }
.freq .d:hover { background: rgba(255,180,59,.12); border-radius: 4px; }
.freq .sep { opacity: .6; }
.freq small { font-size: .4em; color: var(--dim); margin-left: 6px; }
.dispRow { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.mode { font-weight: 700; color: var(--amber); min-width: 60px; }
.meter { flex: 1; position: relative; height: 18px; background: #23292f; border-radius: 4px; overflow: hidden; }
#smeterBar { height: 100%; width: 0; background: var(--green); transition: width .2s; }
#smeterBar.over { background: var(--amber); }
#smeterBar.tx { background: var(--red); }
#smeterLbl { position: absolute; right: 6px; top: 0; font-size: 12px; line-height: 18px; }

section { margin: 12px 0; }
.row { display: flex; gap: 6px; align-items: center; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
.row #direct { flex: 1; min-width: 90px; }
.bandrow { display: flex; gap: 6px; margin: 6px 0; }
.bandrow button { flex: 1 1 0; min-width: 0; padding: 6px 2px; font-size: 14px; white-space: nowrap; }
button.func.on { background: var(--amber); border-color: var(--amber); color: #000; }
.meter { cursor: pointer; }
#smeterBar.bad { background: var(--red); }
/* Mode + function buttons: equal-width grid so no button stretches */
.btngrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin: 8px 0; }
.btngrid button { padding: 6px 4px; font-size: 14px; white-space: nowrap; }
.btngrid .func { border-color: #3d4650; }
.btngrid .func.on { background: var(--amber); border-color: var(--amber); color: #000; }
.sliders label { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.sliders input { flex: 1; }
.audio { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.audio .vol { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 220px; }
.audio .vol input { flex: 1; min-width: 80px; }
.audio #bufInfo { white-space: nowrap; min-width: 90px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center;
  justify-content: center; z-index: 10; padding: 12px; }
.dlg { background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; padding: 18px;
  width: 100%; max-width: 480px; }
.dlg h3 { margin: 0 0 4px; }
.dlg .dim { margin: 0 0 10px; }
.dlgfreq { font-size: clamp(32px, 9vw, 44px); color: #ff8a8d; background: #0c0e10; border-radius: 10px;
  padding: 8px; text-shadow: none; }
.dlg .row input { flex: 1; min-width: 80px; }
.dlgbtns { justify-content: flex-end; margin-top: 14px; }
button.primary { background: var(--blue); color: #000; border-color: var(--blue); font-weight: 600; }
.chk { display: flex; gap: 6px; align-items: center; }

.ptt { width: 100%; padding: 26px; font-size: 20px; font-weight: 700; letter-spacing: 1px;
  background: #3a1416; border: 2px solid var(--red); color: #ffd3d4; touch-action: none; user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none; }
.ptt.active { background: var(--red); color: #fff; }
/* Top-right corner of the frequency window: ATU button + TX dot.
   Absolutely positioned and always present, so nothing shifts on PTT. */
.corner { position: absolute; top: 8px; right: 10px; display: flex; gap: 10px; align-items: center; }
.txdot { width: 16px; height: 16px; border-radius: 50%; background: #3a2224; border: 1px solid #5a3033; }
.txdot.on { background: var(--red); border-color: #ff8a8d; box-shadow: 0 0 10px var(--red);
  animation: pulse .8s infinite alternate; }
@keyframes pulse { to { opacity: .6; } }
body.guest .ownerOnly { visibility: hidden; }

body.guest .owner { opacity: .45; pointer-events: none; }
body.guest .txzone { display: none; }
.users ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.users li { background: var(--panel); border: 1px solid var(--edge); padding: 2px 10px; border-radius: 99px; font-size: 13px; }
.users li.owner { border-color: var(--amber); }
.users h3 { font-size: 13px; color: var(--dim); font-weight: 500; margin: 0 0 6px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #333a;
  backdrop-filter: blur(6px); border: 1px solid var(--edge); padding: 8px 16px; border-radius: 10px; }
