:root {
  --bg: #070d18;
  --bg-2: #0c1526;
  --panel: rgba(255, 255, 255, .055);
  --panel-strong: rgba(255, 255, 255, .09);
  --line: rgba(255, 255, 255, .12);
  --text: #e9f1fb;
  --muted: #92a6c4;
  --cyan: #38d6c4;
  --cyan-2: #19a7ff;
  --danger: #ff6b6b;
  --warn: #ffc857;
  --ok: #3ddc97;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(900px 620px at 88% -8%, rgba(25, 167, 255, .30), transparent 62%),
    radial-gradient(760px 560px at 0% 100%, rgba(56, 214, 196, .16), transparent 60%),
    linear-gradient(160deg, #060b14 0%, var(--bg-2) 58%, #0a1a2d 100%);
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

.shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 26px 18px 40px;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 52px; height: 52px; flex: 0 0 auto;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 24px;
  background: linear-gradient(145deg, var(--cyan), var(--cyan-2));
  box-shadow: 0 14px 34px rgba(25, 167, 255, .38);
  color: #041018;
}

.brand h1 { margin: 0; font-size: 24px; letter-spacing: .5px; }
.brand p { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; }
.brand.small .brand-mark { width: 40px; height: 40px; border-radius: 12px; font-size: 19px; }
.brand.small h1 { font-size: 18px; }
.brand.small p { font-size: 11.5px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
}

.login-card { display: flex; flex-direction: column; gap: 14px; padding: 22px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 4px; }
.field label { font-size: 12px; color: var(--muted); letter-spacing: .4px; }

input, select {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(4, 10, 20, .55);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus {
  border-color: rgba(56, 214, 196, .7);
  box-shadow: 0 0 0 3px rgba(56, 214, 196, .14);
}

select option { background: #0c1526; color: var(--text); }

.btn {
  height: 46px;
  border: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: #041018;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-2));
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(25, 167, 255, .28);
  transition: transform .12s, filter .12s;
}

.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.block { width: 100%; }

.ghost-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.ghost-btn:hover { background: rgba(255, 255, 255, .1); }

.error {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 107, 107, .12);
  border: 1px solid rgba(255, 107, 107, .35);
  color: #ffb3b3;
  font-size: 12.5px;
  line-height: 1.6;
}

.hint, .foot { color: var(--muted); font-size: 11.5px; line-height: 1.7; margin: 0; }
.foot { text-align: center; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0 18px;
}

.top-actions { display: flex; align-items: center; gap: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--muted);
  white-space: nowrap;
}

.badge.dot::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

.badge.green { color: var(--ok); border-color: rgba(61, 220, 151, .4); background: rgba(61, 220, 151, .1); }
.badge.blue { color: var(--cyan-2); border-color: rgba(25, 167, 255, .4); background: rgba(25, 167, 255, .1); }
.badge.red { color: var(--danger); border-color: rgba(255, 107, 107, .4); background: rgba(255, 107, 107, .1); }
.badge.grey { color: var(--muted); }

.console { display: flex; flex-direction: column; gap: 16px; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title { font-size: 15px; font-weight: 700; }
.card-sub { margin-top: 4px; color: var(--muted); font-size: 11.5px; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  background: rgba(4, 10, 20, .55);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.segmented button {
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: .15s;
}

.segmented button.on {
  background: linear-gradient(135deg, rgba(56, 214, 196, .9), rgba(25, 167, 255, .85));
  color: #041018;
  font-weight: 700;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.stat {
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(4, 10, 20, .45);
  border: 1px solid rgba(255, 255, 255, .07);
}

.stat-k { display: block; color: var(--muted); font-size: 10.5px; margin-bottom: 5px; }
.stat-v { font-size: 13px; font-weight: 700; }

.notice {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 12px;
  line-height: 1.65;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--muted);
}

.notice.warn { border-color: rgba(255, 200, 87, .38); background: rgba(255, 200, 87, .09); color: #ffe0a3; }
.notice.red { border-color: rgba(255, 107, 107, .38); background: rgba(255, 107, 107, .09); color: #ffb3b3; }

.ptt-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 26px 18px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    radial-gradient(320px 200px at 50% 0%, rgba(25, 167, 255, .18), transparent 70%),
    var(--panel);
}

.ptt-mode {
  width: 100%;
  max-width: 280px;
}

.ptt {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  border: 1px solid rgba(56, 214, 196, .5);
  background: radial-gradient(circle at 35% 28%, rgba(56, 214, 196, .32), rgba(9, 22, 38, .96) 68%);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  user-select: none;
  touch-action: none;
  transition: transform .12s, box-shadow .2s, border-color .2s;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .35), inset 0 0 30px rgba(56, 214, 196, .12);
}

.ptt:not([disabled]):hover { border-color: var(--cyan); }
.ptt:not([disabled]):active, .ptt.live {
  transform: scale(.97);
  border-color: var(--cyan);
  box-shadow: 0 0 0 12px rgba(56, 214, 196, .08), 0 0 60px rgba(56, 214, 196, .35);
}

.ptt[disabled] { opacity: .45; cursor: not-allowed; }

.ptt-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(56, 214, 196, .22);
  animation: breathe 2.6s ease-in-out infinite;
}

.ptt.live .ptt-ring { border-color: rgba(56, 214, 196, .7); animation: pulse 1.1s ease-out infinite; }

@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .5; } 50% { transform: scale(1.04); opacity: 1; } }
@keyframes pulse {
  0% { transform: scale(1); opacity: .8; }
  100% { transform: scale(1.18); opacity: 0; }
}

.ptt-label { font-size: 19px; font-weight: 800; letter-spacing: 1px; }
.ptt-sub { font-size: 11px; color: var(--muted); }

.level {
  width: min(320px, 88%);
  height: 8px;
  border-radius: 8px;
  background: rgba(4, 10, 20, .7);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .07);
}

.level > div {
  height: 100%;
  width: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--cyan), var(--cyan-2));
  transition: width .08s linear;
}

.ptt-hint { color: var(--muted); font-size: 12px; text-align: center; line-height: 1.6; }

.caption-card { padding-bottom: 14px; }
.caption-text {
  min-height: 44px;
  font-size: 13.5px;
  line-height: 1.8;
  color: #d7e6f8;
  white-space: pre-wrap;
}

.tips { display: flex; flex-direction: column; gap: 8px; }
.tip {
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}
.tip b { color: #bcd2ec; }

/* 通话页固定一屏，说明内容在独立页面中阅读。 */
body.talk-active {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

.talk-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
}

.talk-shell .topbar {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.talk-shell .brand.small { min-width: 0; }
.talk-shell .brand.small > div:last-child { min-width: 0; }
.talk-shell .brand.small p {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.talk-shell .top-actions { flex: 0 0 auto; gap: 6px; }
.talk-shell .top-actions .ghost-btn { padding: 0 9px; }

.talk-shell .console {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.talk-shell .ptt-card {
  min-height: 0;
  justify-content: space-evenly;
  gap: 10px;
  padding: 18px;
  overflow: hidden;
}

.talk-shell .ptt {
  flex: 0 0 auto;
  width: clamp(110px, 17vh, 150px);
  height: clamp(110px, 17vh, 150px);
}

.talk-shell .ptt-mode,
.talk-shell .level { flex-shrink: 0; }

.help-shell { min-height: 100vh; max-width: 640px; padding-top: 28px; }
.help-header {
  margin-bottom: 20px;
  padding: 4px 2px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.help-header .ghost-btn { height: 36px; padding: 0 13px; font-size: 13px; }
.help-header h1 {
  margin: 28px 0 8px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 1px;
}
.help-header p {
  margin: 0;
  color: #9FB2CC;
  font-size: 14px;
  line-height: 1.7;
  letter-spacing: .2px;
}
.help-tips { gap: 14px; }
.help-tips .tip {
  padding: 18px 17px;
  border-radius: 14px;
  color: #A9BED7;
  font-size: 14px;
  line-height: 1.9;
  letter-spacing: .25px;
}
.help-tips .tip b {
  display: block;
  margin-bottom: 7px;
  color: #DCEBFA;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .5px;
}

@media (max-width: 520px) {
  .shell { padding: 18px 14px 30px; }
  .brand h1 { font-size: 21px; }
  .status-grid { gap: 8px; }
  .talk-shell { padding-bottom: max(14px, env(safe-area-inset-bottom, 0px)); }
  .help-shell { padding: 20px 16px 34px; }
  .help-header { margin-bottom: 16px; padding-bottom: 20px; }
  .help-header h1 { margin-top: 24px; font-size: 26px; }
  .help-tips { gap: 12px; }
  .help-tips .tip { padding: 16px; font-size: 14px; line-height: 1.85; }
}

@media (max-width: 400px) {
  .talk-shell .brand.small p { display: none; }
  .talk-shell .badge { padding: 5px 7px; }
  .talk-shell .top-actions .ghost-btn { padding: 0 7px; font-size: 11px; }
}

@media (max-height: 760px) {
  .talk-shell { padding-top: 10px; }
  .talk-shell .topbar { padding-bottom: 10px; }
  .talk-shell .brand.small .brand-mark { width: 34px; height: 34px; }
  .talk-shell .brand.small h1 { font-size: 17px; }
  .talk-shell .brand.small p { display: none; }
  .talk-shell .console { gap: 10px; }
  .talk-shell .card { padding: 12px; }
  .talk-shell .card-head { margin-bottom: 8px; }
  .talk-shell .card-sub { display: none; }
  .talk-shell .field { gap: 4px; }
  .talk-shell input, .talk-shell select { height: 38px; }
  .talk-shell .status-grid { margin-top: 8px; }
  .talk-shell .stat { padding: 7px 9px; }
  .talk-shell .ptt-card { padding: 10px 14px; gap: 6px; }
  .talk-shell .ptt { width: 104px; height: 104px; }
  .talk-shell .ptt-ring { inset: -6px; }
  .talk-shell .ptt-label { font-size: 16px; }
  .talk-shell .segmented button { height: 30px; }
  .talk-shell .level { height: 6px; }
  .talk-shell .ptt-hint { font-size: 10.5px; }
}
