.cwai-win {
  position: fixed;
  left: 8px;
  top: 170px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 480px;
  height: 320px;
  min-width: 300px;
  min-height: 180px;
  max-width: calc(100vw - 8px);
  max-height: calc(100vh - 8px);
  padding: 8px;
  overflow: hidden;
  resize: both;
  background: linear-gradient(165deg, #24282d 0%, #17191d 45%, #0f1114 100%);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 0 0 1px #060708, 0 6px 18px rgba(0, 0, 0, 0.65);
  color: #cfd4d9;
  font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

.cwai-win[hidden] { display: none; }
.cwai-win.dragging { opacity: 0.92; }

.cwai-hdr { display: flex; align-items: center; gap: 5px; padding: 0 2px 6px; cursor: grab; user-select: none; touch-action: none; }
.cwai-win.dragging .cwai-hdr { cursor: grabbing; }
.cwai-led { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #2a3036; box-shadow: inset 0 0 0 1px #11161a; }
.cwai-led.connected { background: #3adb4a; box-shadow: 0 0 7px rgba(60, 220, 80, 0.85); }
.cwai-led.offline, .cwai-led.error { background: #e0402e; box-shadow: 0 0 7px rgba(224, 64, 46, 0.8); }
.cwai-led.lost, .cwai-led.waiting { background: #ffb02e; box-shadow: 0 0 7px rgba(255, 176, 46, 0.7); animation: cwai-blink 1s steps(2) infinite; }
.cwai-title { font-family: var(--font); font-weight: 600; letter-spacing: 0.08em; color: #5db8ff; white-space: nowrap; }
.cwai-sp { flex: 1; }

.cwai-chip {
  min-height: 0;
  padding: 1px 6px;
  border: 0;
  border-radius: 3px;
  background: #10161b;
  box-shadow: 0 0 0 1px #1d242b;
  color: #93a0ab;
  font: inherit;
  font-size: 7.5pt;
  white-space: nowrap;
  cursor: pointer;
}
.cwai-chip:hover { color: #fff; box-shadow: 0 0 0 1px #2e3a45; }
.cwai-chip.on { background: #1d5fae; color: #fff; }
.cwai-chip.clr:hover { background: #7a2820; }
.cwai-chip.ok { background: #1f6b2a; color: #fff; }

.cwai-x {
  flex: none;
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: #93a0ab;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.cwai-x:hover { background: #7a2820; color: #fff; }

.cwai-status { display: flex; gap: 8px; align-items: baseline; padding: 0 2px 6px; font-size: 7.5pt; color: #5b656e; white-space: nowrap; overflow: hidden; }
.cwai-status .cw-st { color: #93a0ab; letter-spacing: 1px; }
.cwai-status .cw-st.connected { color: #3adb4a; }
.cwai-status .cw-st.offline, .cwai-status .cw-st.error { color: #ff6a55; }
.cwai-status .cw-st.lost, .cwai-status .cw-st.waiting { color: #ffb02e; }
.cwai-status .cw-info { overflow: hidden; text-overflow: ellipsis; }

.cwai-lcd {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px 8px;
  border-radius: 5px;
  background: linear-gradient(180deg, #04070a 0%, #0a0f13 70%, #0d1216 100%);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.9), inset 0 0 2px #000;
  scrollbar-width: thin;
  scrollbar-color: #2e343b #0d1013;
}
.cwai-empty { padding: 18px 6px; color: #5b656e; font-size: 8pt; line-height: 1.5; text-align: center; }

.cwai-row { position: relative; margin: 0 0 6px; padding: 5px 8px 6px; background: #05080b; border-radius: 4px; box-shadow: inset 0 0 0 1px #151b21; transition: background-color 0.3s, box-shadow 0.3s; }
.cwai-row.live { background: linear-gradient(180deg, #0c2340 0%, #081628 100%); box-shadow: inset 0 0 0 1px #2a6adf, inset 0 0 18px rgba(42, 106, 223, 0.3), 0 0 10px rgba(42, 106, 223, 0.25); }
.cwai-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; font-size: 7.5pt; line-height: 12px; color: #5b656e; }
.cwai-meta .cw-led { width: 6px; height: 6px; border-radius: 50%; background: #14301c; box-shadow: inset 0 0 0 1px #0a160e; }
.cwai-row.live .cwai-meta .cw-led { background: #3adb4a; box-shadow: 0 0 6px rgba(60, 220, 80, 0.8); }
.cwai-meta .cw-time { color: #93a0ab; }
.cwai-meta .cw-freq { color: #5db8ff; letter-spacing: 0.5px; }
.cwai-row.live .cwai-meta .cw-freq { color: #ffcf40; text-shadow: 0 0 6px rgba(255, 207, 64, 0.4); }
.cwai-meta .cw-tone { color: #4a545e; }
.cwai-meta .cw-sp { flex: 1; }
.cwai-meta .cw-air { display: none; color: #3adb4a; letter-spacing: 1px; }
.cwai-row.live .cwai-meta .cw-air { display: inline; }
.cwai-meta .cw-del { padding: 0 2px 0 6px; color: #4a545e; font-size: 10pt; cursor: pointer; }
.cwai-row:hover .cwai-meta .cw-del { color: #93a0ab; }
.cwai-meta .cw-del:hover { color: #ff6a55 !important; }

.cwai-text { color: #e6edf3; line-height: 1.35; letter-spacing: 0.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cwai-row.live .cwai-text { color: #f2f7ff; text-shadow: 0 0 6px rgba(215, 232, 255, 0.25); }
.cwai-call { color: #ffcf40; font-weight: bold; text-decoration: none; }
a.cwai-call:hover { text-decoration: underline; }
.cwai-call.marked { border-bottom: 1px solid #ffcf40; }
.cwai-kw { color: #3adb4a; }
.cwai-loc { color: #4fd1c5; }
.cwai-rst { color: #5db8ff; border-bottom: 1px dotted #2e5a85; cursor: help; }
.cwai-cursor { display: none; width: 0.55em; height: 1em; margin-left: 1px; vertical-align: text-bottom; background: #5db8ff; animation: cwai-blink 1s steps(2) infinite; }
.cwai-row.live .cwai-cursor { display: inline-block; }

.cwai-foot { display: flex; padding: 5px 2px 0; color: #5b656e; font-size: 7.5pt; white-space: nowrap; }
.cwai-foot span:last-child { margin-left: auto; }

.cwai-menu { display: none; position: absolute; right: 8px; top: 34px; z-index: 3; min-width: 240px; padding: 8px 10px; border-radius: 6px; background: #10161b; box-shadow: 0 0 0 1px #2e3a45, 0 6px 18px rgba(0, 0, 0, 0.7); font-size: 8pt; color: #cfd4d9; }
.cwai-menu.open { display: block; }
.cwai-menu label { display: flex; align-items: center; gap: 6px; padding: 3px 0; white-space: nowrap; cursor: pointer; }
.cwai-menu select { padding: 1px 2px; border: 1px solid #2e3a45; border-radius: 3px; background: #05080b; color: #cfd4d9; font: inherit; }
.cwai-menu .cw-h { margin: 6px 0 3px; color: #93a0ab; letter-spacing: 1px; }
.cwai-menu .cw-calls { max-height: 110px; overflow-y: auto; }
.cwai-menu .cw-call { display: flex; justify-content: space-between; padding: 1px 0; color: #ffcf40; }
.cwai-menu .cw-call span { padding: 0 4px; color: #4a545e; cursor: pointer; }
.cwai-menu .cw-call span:hover { color: #ff6a55; }
.cwai-menu .cw-none { color: #5b656e; }

.cwai-mark { position: fixed; z-index: 61; min-height: 0; padding: 3px 9px; border: 0; border-radius: 4px; background: #ffcf40; color: #10161b; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 8pt; letter-spacing: 1px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); cursor: pointer; }
.cwai-mark[hidden] { display: none; }

@keyframes cwai-blink { 0% { opacity: 1; } 100% { opacity: 0.15; } }

@media (max-width: 760px) {
  .cwai-win { left: 4px !important; right: 4px; width: auto !important; top: auto !important; bottom: 4px; height: 45vh !important; resize: none; }
}
