:root {
  --bg: #101418;
  --panel: #1a2026;
  --panel2: #222a32;
  --text: #e8edf2;
  --muted: #8899aa;
  --accent: #2f81f7;
  --tx: #e5484d;
  --rx: #46a758;
  --warn: #f5a623;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid #2c3640;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand h1 { font-size: 18px; margin: 0; }
.brand .sub { color: var(--muted); font-size: 12px; }

.conn-state {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #333;
}
.conn-state.online { background: #1c3b26; color: #7ee2a8; }
.conn-state.offline { background: #3b1c1c; color: #f0a0a0; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 12px 60px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid #2c3640;
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card h2 { font-size: 15px; margin: 0 0 10px; color: #b9c7d4; }
.card h3 { font-size: 13px; margin: 0 0 6px; color: #9fb0c0; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.row.space-between { justify-content: space-between; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; color: var(--text); font-size: 13px; }

input[type=text], select {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid #37424d;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 15px;
  min-width: 140px;
}

button {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid #37424d;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
}
button:hover { border-color: #4a5866; }
button.primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
button:disabled { opacity: .45; cursor: default; }

.hint { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 6px 0 0; }

/* --- 運用パネル --- */
.talk-status {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  padding: 10px;
  border-radius: 8px;
  background: var(--panel2);
  margin-bottom: 12px;
}
.talk-status.idle { color: var(--muted); }
.talk-status.tx { background: #3d1518; color: #ff8f93; animation: pulse 1.2s infinite; }
.talk-status.rx { background: #14301c; color: #7ee2a8; }
@keyframes pulse { 50% { opacity: .65; } }

.ptt-wrap { display: flex; justify-content: center; margin: 10px 0 16px; }
.ptt {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 6px solid #37424d;
  background: radial-gradient(circle at 35% 30%, #2b343d, #171d23);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  user-select: none;
  touch-action: none;
}
.ptt .ptt-label { font-size: 34px; font-weight: 800; letter-spacing: 2px; }
.ptt .ptt-sub { font-size: 12px; color: var(--muted); }
.ptt.tx {
  border-color: var(--tx);
  background: radial-gradient(circle at 35% 30%, #5a2023, #2a1012);
  box-shadow: 0 0 24px #e5484d66;
}
.ptt.tx .ptt-sub { color: #ffb3b6; }

.meters { display: flex; gap: 16px; margin: 6px 0; }
.meter { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.meter .bar { flex: 1; height: 10px; background: #10161c; border-radius: 5px; overflow: hidden; }
.meter .bar div { height: 100%; width: 0%; border-radius: 5px; transition: width .08s linear; }
#txMeter { background: var(--tx); }
#rxMeter { background: var(--rx); }

.slider-label { flex-direction: row; align-items: center; gap: 8px; }
input[type=range] { width: 160px; accent-color: var(--accent); }

.sos {
  background: #3d1518;
  border-color: #7a2a2e;
  color: #ff8f93;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}
.sos small { font-size: 10px; font-weight: 400; color: #c98a8d; }
.sos.arming { animation: pulse .4s infinite; }

.members-box { flex: 1; }
.members-box ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.members-box li {
  background: var(--panel2);
  border: 1px solid #37424d;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
}
.members-box li.talking { border-color: var(--rx); color: #7ee2a8; }
.members-box li.me { border-color: var(--accent); }

.sub-block { border-top: 1px dashed #2c3640; padding-top: 10px; margin-top: 10px; }
.sub-block:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }

.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.pill.on { background: #1c3b26; color: #7ee2a8; }
.pill.off { background: #333b43; color: var(--muted); }

.log, .devlog {
  background: #0c1014;
  border: 1px solid #232c34;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: Consolas, "BIZ UDゴシック", monospace;
  font-size: 12px;
  line-height: 1.7;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.log .warn { color: var(--warn); }
.log .err { color: #ff8f93; }
.log .ok { color: #7ee2a8; }

details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 8px; }

.sos-banner {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: #c62828;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  padding: 12px 28px;
  border-radius: 10px;
  box-shadow: 0 4px 24px #000a;
  z-index: 100;
  animation: pulse .6s infinite;
}

@media (max-width: 480px) {
  .ptt { width: 230px; height: 230px; }
  input[type=text], select { min-width: 120px; width: 100%; }
}
