/* ============================================================
   聆譯 — 即時口譯工具  ·  styles
   Steady-ocean palette: deep navy + sky blue + precise teal
   ============================================================ */

:root {
  /* IOHS brand */
  --teal: #36b6b0;          /* logo teal */
  --teal-deep: #1f9c96;     /* actions / emphasis */
  --teal-700: #15807b;
  --yellow: #ffe467;        /* logo yellow */
  --yellow-deep: #f0c63f;   /* yellow text-on-light */

  /* primary (overridable by tweak) */
  --primary: #1f9c96;
  --primary-bright: #36b6b0;
  --primary-soft: #e2f5f3;
  --primary-ring: rgba(31, 156, 150, 0.22);

  /* airy neutral surfaces */
  --surface: #f2faf8;
  --surface-2: #e7f4f2;
  --card: #ffffff;
  --line: #e4efed;
  --line-soft: #eef7f5;

  /* subtitle stage (light, whitespace-forward) */
  --stage: #ffffff;
  --stage-sub: #93aeab;

  /* text — warm dark teal-charcoal, never pure black */
  --text: #173b39;
  --text-2: #5a7672;
  --text-3: #9ab2af;
  --on-dark: #173b39;     /* legacy alias → now stage text (light bg) */
  --on-dark-2: #8aa6a3;

  /* status */
  --ok: #20a59a;
  --warn: #e0a23a;
  --err: #e0695f;

  /* shape (overridable by tweak) */
  --radius: 18px;
  --radius-lg: calc(var(--radius) + 8px);
  --radius-sm: calc(var(--radius) - 8px);

  /* subtitle size (overridable by tweak) */
  --sub-size: 27px;

  --font: "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;

  --shadow-card: 0 1px 2px rgba(20, 80, 76, 0.04), 0 8px 24px rgba(20, 80, 76, 0.07);
  --shadow-pop: 0 18px 50px rgba(16, 70, 66, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 50% -8%, #eafaf7 0%, #e2f4f1 46%, #d7eeeb 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0;
}

/* 讓最外層撐滿視窗寬度,避免內容變窄時整個版面縮成中間細條 */
#root {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------------- device shell ---------------- */
.device {
  position: relative;
  width: 100%;
  max-width: 432px;
  min-height: 100vh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* 手機(未達平板寬度):用滿整個螢幕寬度,不留側邊空白 */
@media (max-width: 539.98px) {
  .device { max-width: none; }
}

@media (min-width: 540px) {
  body { padding: 26px; }
  .device {
    min-height: 0;
    height: min(896px, calc(100vh - 52px));
    border-radius: 46px;
    box-shadow: 0 0 0 10px #ffffff, 0 0 0 12px #d4ece9, var(--shadow-pop);
  }
}

/* status bar */
.statusbar {
  flex: 0 0 auto;
  height: 50px;
  padding: 0 26px 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.2px;
  z-index: 5;
}
.statusbar.on-dark { color: var(--on-dark); }
.statusbar .sb-right { display: flex; align-items: center; gap: 7px; }
.sb-bars { display: flex; align-items: flex-end; gap: 2px; height: 11px; }
.sb-bars i { width: 3px; background: currentColor; border-radius: 1px; }
.sb-batt { width: 23px; height: 12px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; opacity: 0.92; }
.sb-batt::after { content:""; position:absolute; right:-3px; top:3px; width:2px; height:5px; background:currentColor; border-radius:0 1px 1px 0; }
.sb-batt i { position:absolute; inset:1.5px; width:70%; background: currentColor; border-radius:1px; }

/* home indicator */
.home-ind { flex: 0 0 auto; height: 22px; display: flex; align-items: center; justify-content: center; }
.home-ind::after { content:""; width: 132px; height: 5px; border-radius: 3px; background: rgba(13,35,48,0.22); }
.home-ind.on-dark::after { background: rgba(255,255,255,0.3); }

/* app body */
.app { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ---------------- top bar ---------------- */
.topbar {
  flex: 0 0 auto;
  padding: 4px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 30px; width: auto; display: block; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 11px; flex: 0 0 auto;
  border: 1px solid var(--line); background: var(--card); cursor: pointer;
  display: grid; place-items: center; color: var(--text-2); transition: all .18s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { color: var(--primary); border-color: var(--primary-soft); background: var(--primary-soft); }
.icon-btn.active { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.set-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 13px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text-2); transition: all .18s;
}
.set-btn svg { width: 18px; height: 18px; }
.set-btn:hover { color: var(--primary); border-color: var(--primary-soft); background: var(--primary-soft); }
.set-btn.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: 0.5px; color: var(--text); }
.brand-name small { display:block; font-size: 10.5px; font-weight: 500; color: var(--text-3); letter-spacing: 1.5px; margin-top: 1px; }

/* connection pill */
.conn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--text-2);
  cursor: pointer; user-select: none;
  transition: background .2s, border-color .2s;
}
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(26,163,137,0.16); }
.conn .dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(219,138,58,0.18); animation: pulse 1s infinite; }
.conn .dot.err { background: var(--err); box-shadow: 0 0 0 3px rgba(204,86,80,0.18); }
.conn .lat { color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 600; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* ---------------- mode switch ---------------- */
.modeswitch {
  flex: 0 0 auto;
  margin: 2px 18px 14px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 4px;
  position: relative;
}
.modeswitch button {
  position: relative; z-index: 1;
  border: 0; background: transparent;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text-2);
  height: 42px; border-radius: calc(var(--radius) - 4px);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; transition: none;
}
.modeswitch button .mi { width: 17px; height: 17px; opacity: .85; }
.modeswitch button.active { color: var(--text); background: var(--card); box-shadow: var(--shadow-card); }

/* ---------------- content scroll ---------------- */
.content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ================= INDIVIDUAL ================= */
.iv { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0 13px; }

/* source + lang strip */
.strip { flex: 0 0 auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.seg {
  display: flex; gap: 4px; background: var(--surface-2);
  padding: 4px; border-radius: 14px;
}
.seg button {
  flex: 1; border: 0; background: transparent; font-family: inherit;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  height: 34px; border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .18s;
}
.seg button svg { width: 15px; height: 15px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow-card); }

.langbar {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 8px 10px;
}
.langchip {
  flex: 1; display: flex; align-items: center; gap: 9px;
  background: transparent; border: 0; cursor: pointer;
  font-family: inherit; text-align: left; padding: 5px 10px; border-radius: 10px;
  transition: background .15s; min-width: 0;
}
.langchip:hover { background: var(--surface); }
.langchip .code {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--primary-soft); color: var(--primary);
}
.langchip.out .code { background: #fff4cc; color: var(--yellow-deep); }
.langchip .lc-txt { flex: 1 1 auto; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.langchip .lc-role { font-size: 10.5px; font-weight: 700; color: var(--primary); letter-spacing: .4px; }
.langchip.out .lc-role { color: var(--yellow-deep); }
.langchip .lc-name { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.langchip .lc-name .caret { display:inline-block; margin-left: 5px; color: var(--text-3); font-size: 10px; vertical-align: middle; }
.lang-arrow { flex: 0 0 auto; color: var(--text-3); display: grid; place-items: center; }
.lang-arrow svg { width: 18px; height: 18px; }

/* subtitle stage */
.stage {
  flex: 1 1 auto; min-height: 0; position: relative;
  background: var(--stage);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.stage::before {
  content:""; position: absolute; inset: 0;
  background: radial-gradient(120% 56% at 50% 0%, rgba(54,182,176,0.07), transparent 62%);
  pointer-events: none;
}
.stage-head {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  height: 46px; padding: 0 18px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, rgba(255,255,255,0.96) 30%, transparent);
  font-size: 11.5px; color: var(--text-2); font-weight: 600; letter-spacing: .3px;
}
.stage-head .live { display: flex; align-items: center; gap: 6px; white-space: nowrap; flex: 0 1 auto; overflow: hidden; font-size: 11px; }
.stage-head .live .ld { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.stage-head .live.active .ld { background: #ee5d5d; box-shadow: 0 0 0 3px rgba(238,93,93,.18); animation: pulse 1.3s infinite; }
.stage-head .badges { display:flex; align-items:center; gap: 6px; flex: 0 0 auto; white-space: nowrap; }
.sbadge { display:inline-flex; align-items:center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 10px; font-weight: 600; white-space: nowrap; }
.sbadge svg { width: 12px; height: 12px; }
.sbadge.mimic { color: var(--teal-700); background: var(--primary-soft); }

.subs {
  position: absolute; inset: 0;
  padding: 58px 14px 30px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 46px, #000 calc(100% - 22px), transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 46px, #000 calc(100% - 22px), transparent 100%);
}
.subs::-webkit-scrollbar { width: 0; }
.sub-line {
  font-size: var(--sub-size); line-height: 1.46; font-weight: 500;
  color: var(--on-dark); letter-spacing: .2px;
  text-wrap: pretty;
  animation: subin .45s cubic-bezier(.2,.7,.3,1) both;
}
.sub-line .src { display:block; font-size: calc(var(--sub-size) * 0.5); color: var(--text-3); font-weight: 400; margin-top: 8px; }
.sub-line.partial { color: var(--text-2); }
.sub-line.partial::after { content:"▍"; color: var(--primary-bright); animation: caret 1s steps(1) infinite; margin-left: 2px; }
@keyframes caret { 50% { opacity: 0; } }
@keyframes subin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- 段落泡泡(個人用) ---- */
.subs { gap: 20px; }
.bubble { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 100%; animation: subin .45s cubic-bezier(.2,.7,.3,1) both; }
.bub-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; padding-left: 6px; letter-spacing: .3px; }
.bub-text {
  font-size: var(--sub-size); line-height: 1.55; font-weight: 500;
  font-family: var(--sub-font, var(--font)); color: var(--sub-color, var(--text));
  background: var(--surface-2); border-radius: 6px 20px 20px 20px;
  padding: 13px 16px; max-width: 100%; width: fit-content; letter-spacing: .2px; text-wrap: pretty;
}
.bubble.partial .bub-text { color: var(--text-2); background: var(--primary-soft); }
.bubble.partial .bub-text::after { content: "▍"; color: var(--primary-bright); animation: caret 1s steps(1) infinite; margin-left: 2px; }

/* ---- 段落泡泡(對話用,較小) ---- */
.win-subs { gap: 13px; }
.win-bubble { gap: 4px; }
.win-bubble .bub-time { font-size: 10.5px; padding-left: 4px; }
.win-bubble .bub-text {
  font-size: clamp(17px, calc(var(--sub-size) * 0.72), 24px); line-height: 1.5;
  padding: 10px 13px; border-radius: 5px 15px 15px 15px; max-width: 100%; width: fit-content;
}

.stage-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 30px;
  text-align: center; color: var(--on-dark-2);
}
.stage-empty .ring {
  width: 76px; height: 76px; border-radius: 50%;
  border: 2px solid var(--line);
  display: grid; place-items: center; color: var(--primary);
}
.stage-empty .ring svg { width: 30px; height: 30px; }
.stage-empty h4 { font-size: 16px; font-weight: 700; color: var(--text); }
.stage-empty p { font-size: 12.5px; line-height: 1.6; max-width: 230px; }

/* listening waveform */
.wave { display: flex; align-items: center; gap: 3px; height: 16px; }
.wave i { width: 3px; height: 30%; background: var(--primary-bright); border-radius: 2px; animation: wv 1s ease-in-out infinite; }
.wave i:nth-child(2){animation-delay:.15s} .wave i:nth-child(3){animation-delay:.3s}
.wave i:nth-child(4){animation-delay:.45s} .wave i:nth-child(5){animation-delay:.6s}
@keyframes wv { 0%,100%{height:25%} 50%{height:100%} }

/* ---------------- controls dock ---------------- */
.dock {
  flex: 0 0 auto;
  padding: 14px 18px 16px;
  display: flex; align-items: center; gap: 12px;
}
.btn-power {
  flex: 1; height: 58px; border: 0; border-radius: var(--radius);
  font-family: inherit; font-size: 16px; font-weight: 700; letter-spacing: .5px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--primary); color: #fff;
  box-shadow: 0 8px 22px var(--primary-ring); transition: all .2s;
}
.btn-power svg { width: 20px; height: 20px; }
.btn-power:active { transform: scale(.98); }
.btn-power.stop { background: #fff; color: var(--err); box-shadow: var(--shadow-card); border: 1.5px solid #f1dad8; }
.btn-icon {
  flex: 0 0 auto; width: 58px; height: 58px; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--card);
  cursor: pointer; display: grid; place-items: center; color: var(--text-2);
  transition: all .2s; position: relative;
}
.btn-icon svg { width: 22px; height: 22px; }
.btn-icon.on { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-icon .duck {
  position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 700; color: var(--primary);
  background: var(--card); padding: 1px 5px; border-radius: 6px; white-space: nowrap;
  box-shadow: var(--shadow-card);
}

/* ================= CONVERSATION ================= */
.cv { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0 12px 10px; gap: 10px; }
.cv-windows { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.win {
  position: relative;
  flex: 1 1 50%; min-height: 0; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-card);
}
/* 翻轉:只旋轉字幕文字朝向對方(由 win-stage 內聯 transform 處理),
   標題與控制按鈕維持朝向我,方便我操作。 */
.win-inner { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.win-top {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-bottom: 1px solid var(--line-soft);
}
.win-top .who { display: flex; align-items: center; gap: 8px; }
.win-top .who .av {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.win-top .who .av.me { background: var(--primary); }
.win-top .who .av.them { background: var(--teal); }
.win-top .who .wt-txt { display: flex; flex-direction: column; line-height: 1.15; }
.win-top .who .wt-role { font-size: 13px; font-weight: 700; color: var(--text); }
.win-mini-lang {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 4px 9px; font-family: inherit;
  font-size: 11.5px; font-weight: 600; color: var(--text-2);
}
.win-mini-lang b { color: var(--text); font-weight: 700; }
.win-mini-lang .ar { color: var(--text-3); }

.win-stage {
  flex: 1 1 auto; min-height: 0; position: relative;
  background: var(--stage);
  overflow: hidden;
}
.win-subs {
  position: absolute; inset: 0; padding: 13px 12px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 11px; scroll-behavior: smooth;
}
.win-subs::-webkit-scrollbar { width: 0; }
.win-sub {
  font-size: clamp(18px, calc(var(--sub-size) * 0.78), 26px); line-height: 1.4; font-weight: 500;
  color: var(--text); text-wrap: pretty;
  animation: subin .4s cubic-bezier(.2,.7,.3,1) both;
}
.win-sub.partial { color: var(--text-2); }
.win-sub.partial::after { content:"▍"; color: var(--primary-bright); animation: caret 1s steps(1) infinite; margin-left: 2px; }
.win-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; color: var(--text-3); font-size: 12.5px; padding: 20px; line-height: 1.6;
}
.win-bottom {
  flex: 0 0 auto; display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border-top: 1px solid var(--line-soft);
}
.win-power {
  flex: 1; height: 40px; border: 0; border-radius: 11px; font-family: inherit;
  font-size: 13.5px; font-weight: 700; cursor: pointer; color: #fff; background: var(--primary);
  display: flex; align-items: center; justify-content: center; gap: 7px; transition: all .2s;
}
.win-power svg { width: 16px; height: 16px; }
.win-power.stop { background: #fff; color: var(--err); border: 1.5px solid #f1dad8; }
.win-vbtn {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer;
  display: grid; place-items: center; color: var(--text-2); transition: all .2s;
}
.win-vbtn svg { width: 18px; height: 18px; }
.win-vbtn.on { background: var(--primary-soft); border-color: transparent; color: var(--primary); }

.cv-foot { flex: 0 0 auto; display: flex; justify-content: center; }
.flip-btn {
  display: inline-flex; align-items: center; gap: 9px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow-card); transition: all .2s;
}
.flip-btn svg { width: 18px; height: 18px; color: var(--primary); transition: transform .4s; }
.flip-btn.flipped svg { transform: rotate(180deg); }
.flip-btn:active { transform: scale(.97); }

/* ---- 自動 / 手動 切換 ---- */
.convmode { display: inline-flex; gap: 3px; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.convmode button { border: 0; background: transparent; font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2); padding: 6px 16px; border-radius: 999px; cursor: pointer; }
.convmode button.on { background: var(--card); color: var(--primary); box-shadow: var(--shadow-card); }

/* ---- 自動模式:狀態列 ---- */
.auto-status { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px 4px; }
.auto-stat { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--teal-700); white-space: nowrap; }
.auto-stat .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(32,165,154,.16); flex: 0 0 auto; }
.auto-stat.gated { color: #9a6a1c; }
.auto-stat.gated .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(224,162,58,.2); animation: pulse 1s infinite; }

/* ---- 自動模式:控制列 ---- */
.auto-foot { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; justify-content: center; }
.auto-power {
  flex: 1 1 auto; max-width: 340px; height: 54px; border: 0; border-radius: var(--radius);
  font-family: inherit; font-size: 15.5px; font-weight: 700; letter-spacing: .5px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--primary); color: #fff; box-shadow: 0 8px 22px var(--primary-ring); transition: all .2s;
}
.auto-power svg { width: 19px; height: 19px; }
.auto-power:active { transform: scale(.98); }
.auto-power.stop { background: #fff; color: var(--err); box-shadow: var(--shadow-card); border: 1.5px solid #f1dad8; }
.auto-vbtn {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer;
  display: grid; place-items: center; color: var(--text-2); transition: all .2s;
}
.auto-vbtn svg { width: 20px; height: 20px; }
.auto-vbtn.on { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.win-mini-lang.static { cursor: default; }

/* ============================================================
   精簡對話模式(is-focus)+ 角落語言徽章 + 全螢幕 / PWA
   ============================================================ */
/* 角落語言徽章:平常隱藏,精簡模式才顯示 */
.win-lang-badge {
  display: none; position: absolute; top: 8px; right: 10px; z-index: 5;
  font-size: 11.5px; font-weight: 800; letter-spacing: .5px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  box-shadow: 0 1px 5px rgba(16,70,66,.12);
  pointer-events: none;
}

/* 收起非核心元素,讓兩個對話框佔滿畫面 */
.is-focus .statusbar,
.is-focus .topbar,
.is-focus .modeswitch,
.is-focus .home-ind,
.is-focus .appbar { display: none !important; }
.is-focus .app { padding: 0; }
.is-focus .content { padding: 0; }
.is-focus .cv { padding: 8px 8px 10px; gap: 8px; }
.is-focus .convmode { display: none; }
.is-focus .auto-status { padding: 2px 2px 6px; justify-content: center; }
.is-focus .win-top { display: none; }              /* 隱藏整行角色/語言標籤 */
.is-focus .win-lang-badge { display: inline-flex; } /* 改用角落小徽章 */
.is-focus .win-subs { padding-top: 28px; }          /* 預留徽章空間 */

/* 控制列縮成底部一小排 */
.is-focus .auto-foot { gap: 8px; }
.is-focus .auto-power { height: 48px; font-size: 14.5px; }
.is-focus .auto-vbtn { width: 48px; height: 48px; }
.is-focus .flip-btn { height: 40px; padding: 0 14px; font-size: 12.5px; }
.is-focus .win-bottom { padding: 7px 10px; }
.is-focus .win-power { height: 38px; font-size: 13px; }

/* 個人模式精簡:收起來源/語言列,字幕台佔滿,控制列縮成底部一小排 */
.is-focus .strip { display: none; }
.is-focus .iv { padding: 8px 10px 0; }
.is-focus .dock { padding: 8px 10px 10px; gap: 10px; }
.is-focus .btn-power { height: 50px; font-size: 15px; }
.is-focus .btn-icon { width: 50px; height: 50px; }
/* 桌機個人精簡:改單欄、拉高 */
.is-focus.is-desktop .iv {
  grid-template-columns: 1fr; grid-template-areas: "stage" "dock";
  height: calc(100vh - 40px); max-width: 1500px; column-gap: 0; row-gap: 14px;
}

/* 桌機精簡:對話框拉到接近滿版 */
.is-focus .deskmain { padding: 12px; align-items: stretch; }
.is-focus .is-desktop .cv { height: calc(100vh - 24px); max-width: 1500px; }

/* 全螢幕按鈕 */
.fs-btn { padding: 0 13px; }
.fs-btn svg { width: 18px; height: 18px; }

/* PWA standalone / 全螢幕:隱藏模擬狀態列與 home 指示,並避開瀏海 */
@media (display-mode: standalone), (display-mode: fullscreen) {
  .device { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .device .statusbar { display: none; }
  .device .home-ind { display: none; }
}

/* ---------------- language picker sheet ---------------- */
.sheet-scrim {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(6,24,35,0.42);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-end;
  animation: fade .2s both;
}
@keyframes fade { from{opacity:0} to{opacity:1} }
.sheet {
  width: 100%; max-height: 76%; background: var(--card);
  border-radius: 26px 26px 0 0; display: flex; flex-direction: column;
  animation: sheetup .32s cubic-bezier(.2,.8,.25,1) both;
  box-shadow: 0 -10px 40px rgba(6,24,35,0.3);
}
@keyframes sheetup { from{ transform: translateY(100%);} to{ transform:none;} }
.sheet-grab { height: 22px; display: grid; place-items: center; flex: 0 0 auto; }
.sheet-grab::after { content:""; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-head { flex: 0 0 auto; padding: 2px 20px 12px; }
.sheet-head h3 { font-size: 17px; font-weight: 700; }
.sheet-head p { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.sheet-search {
  margin: 4px 16px 8px; flex: 0 0 auto; display: flex; align-items: center; gap: 9px;
  background: var(--surface); border-radius: 12px; padding: 0 12px; height: 42px;
}
.sheet-search svg { width: 17px; height: 17px; color: var(--text-3); }
.sheet-search input { flex: 1; border: 0; background: transparent; font-family: inherit; font-size: 14px; color: var(--text); outline: none; }
.sheet-list { flex: 1 1 auto; overflow-y: auto; padding: 4px 12px 24px; }
.sheet-sec { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: 1px; padding: 12px 10px 6px; }
.lang-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 0; background: transparent; cursor: pointer; font-family: inherit; text-align: left;
  padding: 11px 10px; border-radius: 12px; transition: background .12s;
}
.lang-row:hover { background: var(--surface); }
.lang-row.sel { background: var(--primary-soft); }
.lang-row .lr-code {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--text-2);
}
.lang-row.sel .lr-code { background: var(--primary); color: #fff; }
.lang-row .lr-txt { flex: 1; min-width: 0; }
.lang-row .lr-native { font-size: 14.5px; font-weight: 600; color: var(--text); }
.lang-row .lr-en { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.lang-row .lr-check { color: var(--primary); opacity: 0; }
.lang-row.sel .lr-check { opacity: 1; }
.lang-row .lr-check svg { width: 19px; height: 19px; }

/* connection popover */
.conn-wrap { position: relative; display: inline-flex; }
.conn-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 45;
  width: 230px; background: var(--card); border-radius: 16px;
  box-shadow: var(--shadow-pop); border: 1px solid var(--line);
  padding: 6px; animation: fade .15s both;
}
.conn-pop .cp-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; }
.conn-pop .cp-row .d { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.conn-pop .cp-row .cp-t { font-size: 13px; font-weight: 600; color: var(--text); }
.conn-pop .cp-row .cp-s { font-size: 11px; color: var(--text-3); margin-left: auto; }
.conn-pop .cp-row.cur { background: var(--surface); }

/* tiny helper */
.hint { font-size: 11px; color: var(--text-3); text-align: center; padding: 2px 0 0; }

/* ============================================================
   SETTINGS (後台設定)
   ============================================================ */
.settings { position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--surface); }
.settings.embedded { position: relative; inset: auto; z-index: 1; background: transparent; border-radius: var(--radius-lg); overflow: hidden; }
.st-top {
  flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
  padding: 16px 18px 12px; background: var(--card);
}
.settings.embedded .st-top { background: transparent; border: 0; padding: 4px 4px 18px; }
.st-title h2 { font-size: 21px; font-weight: 700; letter-spacing: .5px; }
.st-title p { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }

.st-tabs { flex: 0 0 auto; display: flex; gap: 6px; padding: 4px 16px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.settings.embedded .st-tabs { background: transparent; border: 0; padding: 2px 2px 16px; }
.st-tab {
  flex: 1; height: 40px; border: 0; border-radius: 12px; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: 14px;
  background: var(--surface-2); color: var(--text-2); transition: none;
}
.st-tab:hover:not(.on) { color: var(--text); }
.st-tab.on { background: var(--primary); color: #fff; box-shadow: 0 6px 16px var(--primary-ring); }
.st-scroll { flex: 1 1 auto; overflow-y: auto; padding: 8px 16px 40px; }
.settings.embedded .st-scroll { padding: 0 2px 8px; }
.st-scroll::-webkit-scrollbar { width: 0; }

.st-group { margin-top: 26px; }
.st-group:first-child { margin-top: 12px; }
.st-group-head { padding: 0 6px 10px; }
.st-group-head h3 { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 1.5px; }
.st-group-head p { font-size: 12px; line-height: 1.6; color: var(--text-3); margin-top: 5px; max-width: 52ch; }
.st-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.st-row {
  display: flex; align-items: center; gap: 13px; padding: 15px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.st-row.last, .st-row:last-child { border-bottom: 0; }
.st-row.tap { cursor: pointer; }
.st-row.tap:hover { background: var(--surface); }
.st-ic { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--primary); }
.st-ic svg { width: 18px; height: 18px; }
.st-rtxt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-label { font-size: 14.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.st-sub { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.st-ctrl { flex: 0 0 auto; display: flex; align-items: center; }
.st-muted { font-size: 12.5px; color: var(--text-3); font-weight: 600; }

.st-toggle {
  width: 46px; height: 28px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--surface-2); position: relative; transition: background .22s; flex: 0 0 auto;
}
.st-toggle.on { background: var(--primary); }
.st-knob { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .22s; }
.st-toggle.on .st-knob { transform: translateX(18px); }

.st-slider { display: flex; align-items: center; gap: 10px; }
.st-slider input[type=range] { -webkit-appearance: none; appearance: none; width: 92px; height: 5px; border-radius: 3px; background: var(--surface-2); outline: none; }
.st-slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); cursor: pointer; box-shadow: 0 1px 3px var(--primary-ring); }
.st-slider input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--primary); cursor: pointer; }
.st-val { font-size: 12.5px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }

.st-select { position: relative; display: inline-flex; align-items: center; }
.st-select select {
  -webkit-appearance: none; appearance: none; font-family: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 30px 8px 12px; cursor: pointer; outline: none; max-width: 190px;
}
.st-caret { position: absolute; right: 9px; pointer-events: none; color: var(--text-3); display: grid; }
.st-caret svg { width: 15px; height: 15px; }

/* 字幕顯示:分級切換 / 色票 / 預覽 */
.st-seg2 { display: inline-flex; gap: 3px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.st-seg2 button { border: 0; background: transparent; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.st-seg2 button.on { background: var(--card); color: var(--primary); box-shadow: var(--shadow-card); }
.st-swatches { display: inline-flex; gap: 8px; }
.st-sw { width: 30px; height: 30px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; display: grid; place-items: center; padding: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset; }
.st-sw svg { width: 16px; height: 16px; color: #fff; }
.st-sw.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.sub-preview { padding: 14px 16px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sub-preview .sp-time { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; padding-left: 4px; }
.sub-preview .sp-text {
  font-family: var(--sub-font, var(--font)); color: var(--sub-color, var(--text));
  font-size: var(--sub-size); line-height: 1.5; font-weight: 500;
  background: var(--surface-2); border-radius: 5px 16px 16px 16px; padding: 10px 14px; max-width: 100%;
}

.st-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.st-pill.ok { background: var(--primary-soft); color: var(--teal-700); }
.st-pill.soon { background: #fff4cc; color: #a9851f; margin-left: 8px; }

/* language pair card */
.pair-card { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line-soft); }
.pair-card:last-of-type { border-bottom: 0; }
.pair-col { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.pair-tag { font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: .3px; }
.pair-lang {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 11px 13px; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--text);
  cursor: pointer; transition: all .15s; white-space: nowrap; overflow: hidden;
}
.pair-lang:hover { border-color: var(--primary-soft); background: var(--primary-soft); }
.pair-lang .code { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--primary-soft); color: var(--primary); flex: 0 0 auto; }
.pair-lang.out .code { background: #fff4cc; color: var(--yellow-deep); }
.pair-lang .pc { margin-left: auto; color: var(--text-3); display: grid; }
.pair-lang .pc svg { width: 15px; height: 15px; }
.pair-arrow { align-self: center; color: var(--text-3); transform: rotate(90deg); }
.pair-arrow svg { width: 18px; height: 18px; }
.st-note { display: flex; align-items: center; gap: 9px; padding: 13px 16px; background: var(--surface); font-size: 12px; color: var(--text-2); line-height: 1.5; }
.st-note svg { width: 16px; height: 16px; color: var(--primary); flex: 0 0 auto; }

/* custom voice */
.voice-adv { padding: 16px; border-top: 1px solid var(--line-soft); }
.va-head { margin-bottom: 12px; }
.va-title { display: flex; align-items: center; font-size: 14px; font-weight: 700; color: var(--text); }
.va-desc { display: block; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 26px 20px; border: 1.5px dashed var(--line); border-radius: 14px; background: var(--surface); opacity: .85;
}
.dz-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--card); display: grid; place-items: center; color: var(--primary); box-shadow: var(--shadow-card); }
.dz-ic svg { width: 20px; height: 20px; }
.dz-t { font-size: 13px; font-weight: 600; color: var(--text-2); margin-top: 4px; }
.dz-s { font-size: 11px; color: var(--text-3); }

/* meeting records */
.rec-list { border-top: 1px solid var(--line-soft); padding: 6px 8px 8px; }
.rec-row { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 12px; cursor: pointer; }
.rec-row:hover { background: var(--surface); }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); flex: 0 0 auto; }
.rec-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rec-meta b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.rec-meta span { font-size: 11.5px; color: var(--text-3); }
.rec-act { display: flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 600; color: var(--primary); }
.rec-act .pc svg { width: 15px; height: 15px; }

/* 會後摘要 */
.sum-text { white-space: pre-wrap; font-size: 13.5px; line-height: 1.78; color: var(--text); }
.sum-loading { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); padding: 12px 2px; }
.sum-loading svg { width: 16px; height: 16px; color: var(--primary); }

/* usage */
.usage { padding: 16px; border-bottom: 1px solid var(--line-soft); }
.usage-head { display: flex; align-items: baseline; justify-content: space-between; }
.usage-head span { font-size: 13px; color: var(--text-2); font-weight: 600; }
.usage-head b { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.usage-bar { height: 8px; border-radius: 5px; background: var(--surface-2); margin: 11px 0 7px; overflow: hidden; }
.usage-bar span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--teal), var(--primary)); }
.usage-foot { font-size: 11.5px; color: var(--text-3); }

.st-end { text-align: center; font-size: 11.5px; color: var(--text-3); letter-spacing: .5px; padding: 32px 0 8px; }

/* connection tab */
.st-fieldrow { padding: 15px 16px; border-bottom: 1px solid var(--line-soft); }
.st-fieldrow:last-child { border-bottom: 0; }
.st-flabel { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 9px; white-space: nowrap; }
.st-flabel .fl-ic { color: var(--primary); display: grid; }
.st-flabel .fl-ic svg { width: 16px; height: 16px; }
.fl-hint { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 8px; }
.st-field { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 0 6px 0 13px; height: 46px; transition: border-color .15s; }
.st-field:focus-within { border-color: var(--primary); background: var(--card); }
.st-field input { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; font-family: inherit; font-size: 14px; color: var(--text); outline: none; letter-spacing: .3px; }
.st-eye { flex: 0 0 auto; width: 34px; height: 34px; border: 0; background: transparent; color: var(--text-3); cursor: pointer; display: grid; place-items: center; border-radius: 8px; }
.st-eye:hover { background: var(--surface-2); color: var(--text-2); }
.st-eye svg { width: 18px; height: 18px; }

.st-testrow { display: flex; align-items: center; gap: 14px; padding: 14px 16px; flex-wrap: wrap; }
.st-testbtn { flex: 0 0 auto; height: 42px; padding: 0 18px; border-radius: 11px; border: 0; background: var(--primary); color: #fff; font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: none; }
.st-testbtn svg { width: 17px; height: 17px; }
.st-testbtn:disabled { opacity: .65; cursor: default; }
.st-teststatus { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.st-teststatus svg { width: 16px; height: 16px; }
.st-teststatus.ok { color: var(--ok); }
.st-teststatus.fail { color: var(--err); }
.st-teststatus.testing, .st-teststatus.idle { color: var(--text-3); }

.st-note.safe { color: var(--teal-700); background: var(--primary-soft); }
.st-note.safe svg { color: var(--teal-700); }
.st-note.warn { color: #9a6a1c; background: #fdf3dc; }
.st-note.warn svg { color: var(--warn); }

.st-danger { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1.5px solid #f0d6d4; background: var(--card); color: var(--err); font-family: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: none; }
.st-danger:hover { background: #fdf0ef; }
.st-danger.done { color: var(--ok); border-color: var(--primary-soft); background: var(--primary-soft); }
.st-danger svg { width: 16px; height: 16px; }

/* custom voice extras */
.va-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 44px; margin-top: 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--text-2); font-family: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.va-btn svg { width: 17px; height: 17px; }
.va-btn:disabled { opacity: .6; cursor: default; }
.va-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-size: 11.5px; line-height: 1.6; color: var(--text-3); }
.va-note svg { width: 14px; height: 14px; color: var(--text-3); flex: 0 0 auto; margin-top: 1px; }

/* usage hero + history */
.usage-hero { display: flex; align-items: stretch; padding: 18px 16px; gap: 14px; border-bottom: 1px solid var(--line-soft); }
.uh-col { flex: 1 1 0; display: flex; flex-direction: column; gap: 6px; }
.uh-k { font-size: 12px; font-weight: 600; color: var(--text-3); }
.uh-v { font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.uh-v.cost { color: var(--primary); }
.uh-div { width: 1px; background: var(--line); }
.hist-list { padding: 6px 8px 8px; }
.hist-row { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 10px; }
.hist-row:hover { background: var(--surface); }
.hist-date { flex: 0 0 auto; width: 44px; font-size: 12px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.hist-name { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-min { flex: 0 0 auto; font-size: 12px; color: var(--text-3); }
.hist-cost { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ============================================================
   DESKTOP / LANDSCAPE layout (網頁橫式佈局)
   ============================================================ */
.deskshell { width: 100%; min-height: 100vh; display: flex; flex-direction: column; }
.appbar {
  flex: 0 0 auto; height: 70px; display: flex; align-items: center; gap: 20px;
  padding: 0 30px; background: rgba(255,255,255,0.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.appbar .brand-logo { height: 34px; }
.appbar .ab-spacer { flex: 1 1 auto; }
.appbar .modeswitch { margin: 0; width: 300px; flex: 0 0 auto; }
.appbar-right { display: flex; align-items: center; gap: 10px; }

.deskmain { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 34px 30px 44px; }
.deskstage { width: 100%; display: flex; align-items: stretch; justify-content: center; }

/* individual desktop: big stage + side control rail */
.is-desktop .iv {
  max-width: 1160px; width: 100%; margin: 0 auto; padding: 0;
  height: min(720px, calc(100vh - 150px));
  display: grid; grid-template-columns: 1fr 332px;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "stage strip" "stage gap" "stage dock";
  column-gap: 28px;
}
.is-desktop .iv .stage { grid-area: stage; border-radius: var(--radius-lg); }
.is-desktop .iv .strip { grid-area: strip; flex-direction: column; align-items: stretch; gap: 12px; margin: 0; }
.is-desktop .iv .seg { flex: 0 0 auto; }
.is-desktop .iv .langbar { flex: 0 0 auto; }
.is-desktop .iv .dock { grid-area: dock; flex-direction: column; gap: 12px; padding: 0; }
.is-desktop .subs { padding: 64px 40px 40px; gap: 22px; }
.is-desktop .iv .btn-power { flex: 0 0 auto; width: 100%; height: 60px; font-size: 17px; }
.btn-voice {
  width: 100%; height: 52px; border-radius: var(--radius); border: 1.5px solid var(--line);
  background: var(--card); color: var(--text-2); font-family: inherit; font-weight: 600; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; transition: none;
}
.btn-voice svg { width: 20px; height: 20px; }
.btn-voice.on { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.rail-label { grid-area: strip; }
.dock-hint { font-size: 11.5px; color: var(--text-3); text-align: center; }

/* conversation desktop: side-by-side windows */
.is-desktop .cv { max-width: 1180px; width: 100%; margin: 0 auto; padding: 0; height: min(700px, calc(100vh - 150px)); gap: 16px; }
.is-desktop .cv-windows { flex-direction: row; gap: 16px; }
.is-desktop .win { flex: 1 1 50%; }
.is-desktop .win-subs { padding: 20px 24px; gap: 14px; }
.is-desktop .win-bottom { padding: 12px 16px; }
.is-desktop .win-power { height: 46px; font-size: 14.5px; }

/* settings as desktop page */
.deskmain .settings.embedded { max-width: 760px; width: 100%; height: min(78vh, 820px); display: flex; flex-direction: column; background: transparent; }
.deskmain .settings.embedded .st-scroll { padding: 4px 6px 16px; }

@media (min-width: 1024px) {
  body { align-items: stretch; }
}
