/* ==========================================================================
   HeronSpeech — faithful recreation of the product UI
   Values mirror src/renderer/src/{hub,overlay,term,revise} CSS.
   ========================================================================== */

/* ---------------------------- Hub window ---------------------------------- */

.app-window {
  --bg: #f4f5f7;
  --sidebar-bg: #eeeff2;
  --panel: #ffffff;
  --panel-soft: #f7f8fa;
  --panel-hover: #eceff3;
  --line: rgba(20, 23, 30, 0.075);
  --line-strong: rgba(20, 23, 30, 0.14);
  --text: #181a1f;
  --text-dim: #5b5e69;
  --text-faint: #8b8e99;
  --accent: #62bbf3;
  --accent-strong: #1479b8;
  --accent-ink: #0f6d9d;
  --accent-soft: rgba(98, 187, 243, 0.15);
  --accent-line: rgba(98, 187, 243, 0.36);
  --primary-bg: #1479b8;
  --primary-fg: #ffffff;
  --danger: #c53b34;
  --ok: #238a58;
  --shadow-sm: 0 1px 2px rgba(18, 22, 31, 0.05);
  --shadow-md: 0 10px 30px rgba(18, 22, 31, 0.1);
  --card-hover: 0 4px 18px rgba(20, 25, 35, 0.07);
  width: 1120px;
  max-width: 100%;
  height: 780px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(20, 23, 30, 0.14);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI",
    "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  box-shadow:
    0 42px 90px -30px rgba(18, 30, 42, 0.45),
    0 10px 26px -14px rgba(18, 30, 42, 0.28);
}

.app-window *,
.app-window *::before,
.app-window *::after {
  box-sizing: border-box;
}

.app-window button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: default;
}

.app-window svg {
  display: block;
}

/* titlebar */
.app-window .titlebar {
  height: 48px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--sidebar-bg);
  user-select: none;
}

.app-window .traffic-lights {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 2px;
  flex: none;
}

.app-window .traffic-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.18);
}

.app-window .traffic-close { background: #ff5f57; }
.app-window .traffic-min { background: #febc2e; }
.app-window .traffic-zoom { background: #28c840; }

.app-window .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: none;
}

.app-window .brand-mark {
  position: relative;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  background: linear-gradient(145deg, #82d2fb 0%, #2f9bdc 62%, #1c7fbf 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5px;
  box-shadow:
    0 1px 2px rgba(10, 20, 30, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.app-window .brand-mark span {
  width: 2.5px;
  height: 8px;
  border-radius: 2px;
  background: #fff;
  opacity: 0.95;
}

.app-window .brand-mark span:nth-child(2) { height: 13px; }
.app-window .brand-mark span:nth-child(3) { height: 6px; }

.app-window .brand-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.app-window .titlebar-drag {
  flex: 1;
  height: 100%;
}

/* shell + sidebar */
.app-window .shell {
  flex: 1;
  display: flex;
  min-height: 0;
}

.app-window .sidebar {
  width: 232px;
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 12px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
}

.app-window .nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.app-window .nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  text-align: left;
}

.app-window .nav-item.is-active {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.app-window .nav-icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--text-faint);
}

.app-window .nav-item.is-active .nav-icon { color: var(--accent-strong); }

.app-window .nav-label {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.app-window .nav-count {
  flex: none;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--panel-soft);
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 16px;
  text-align: center;
}

.app-window .nav-item.is-active .nav-count {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.app-window .sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.app-window .hotkey-card {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.app-window .hotkey-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-dim);
}

.app-window .hotkey-card-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.app-window .hotkey-card-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 9px;
}

.app-window .kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-bottom-color: color-mix(in srgb, var(--line-strong) 60%, var(--text-faint));
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--line);
}

.app-window .sidebar-version {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 10.5px;
  color: var(--text-faint);
}

/* main / page */
.app-window .main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
}

.app-window .main-inner {
  max-width: 1010px;
  min-height: 100%;
  margin: 0 auto;
  padding: 28px 32px 44px;
}

.app-window .page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.app-window .page-heading { min-width: 0; }

.app-window .page-head h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.app-window .page-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 12px;
}

.app-window .page-actions {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* search */
.app-window .search {
  position: relative;
  display: flex;
  align-items: center;
  width: 250px;
  max-width: 100%;
}

.app-window .search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-faint);
  pointer-events: none;
}

.app-window .search-value {
  display: flex;
  align-items: center;
  width: 100%;
  height: 38px;
  padding: 0 68px 0 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text-faint);
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
}

.app-window .search input {
  width: 100%;
  height: 38px;
  padding: 0 68px 0 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color 0.13s ease, box-shadow 0.13s ease, background 0.13s ease;
}

.app-window .search input:focus {
  border-color: var(--accent-strong);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.app-window .search input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.app-window .search input::placeholder { color: var(--text-faint); }

.app-window .search-hint {
  position: absolute;
  right: 8px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-soft);
  color: var(--text-faint);
  font-size: 10px;
  line-height: 16px;
  opacity: 0.9;
}

/* buttons */
.app-window .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.app-window .btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-faint);
}

.app-window .btn-icon:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.app-window .btn-icon-danger:hover {
  background: rgba(197, 59, 52, 0.1);
  color: var(--danger);
}

/* history */
.app-window .history-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.app-window .group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px 7px;
}

.app-window .group-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.app-window .group-count {
  min-width: 20px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--panel);
  color: var(--text-faint);
  font-size: 10.5px;
  text-align: center;
}

.app-window .group-line {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.app-window .history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-window .history-card {
  position: relative;
  padding: 12px 14px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.app-window .card-top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
}

.app-window .app-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 170px;
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app-window .app-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 10%, transparent);
}

.app-window .mode-chip {
  padding: 1px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 16px;
}

.app-window .card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.app-window .meta-sep { opacity: 0.6; }

.app-window .card-actions {
  display: flex;
  flex: none;
  gap: 1px;
  margin-left: auto;
  opacity: 0.75;
}

.app-window .history-text {
  margin: 9px 0 0;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.app-window .history-text.is-clamped {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.app-window .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.app-window .chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 650;
}

.app-window .chip-note {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text-dim);
}

.app-window .raw-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  color: var(--text-faint);
  font-size: 11px;
  width: 100%;
}

.app-window .raw-toggle svg { transition: transform 0.14s ease; }

/* ---------------------------- Overlay window ------------------------------ */

.overlay-demo {
  --accent: #62bbf3;
  --danger: #ff6b6b;
  --ok: #5bd18b;
  --text: rgba(255, 255, 255, 0.94);
  --dim: rgba(255, 255, 255, 0.5);
  /* Capsule scale unit: the listening pill is drawn 1:1 (34 px, like the real
     overlay) and the hero spotlights it at 1.5× — every capsule metric is
     expressed through this so proportions never drift. */
  --bar-scale: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.overlay-demo.is-hidden {
  opacity: 0;
  transform: translateY(8px);
}

.overlay-demo .timeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: calc(100% - 16px);
  padding: 0 4px;
  overflow: hidden;
}

.overlay-demo .timeline-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 168px;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(28, 28, 30, 0.94);
  border: 1px solid rgba(98, 187, 243, 0.28);
  color: #9adcff;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.overlay-demo .timeline-chip.is-note {
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.72);
}

.overlay-demo .timeline-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.overlay-demo .timeline-chip.is-note .timeline-dot {
  background: rgba(255, 255, 255, 0.55);
}

.overlay-demo .draft-shell {
  position: relative;
  width: min(464px, calc(100% - 16px));
  pointer-events: none;
}

.overlay-demo .draft {
  pointer-events: none;
  width: 100%;
  max-height: 152px;
  padding: 8px 13px 9px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 16px;
  background: rgba(24, 24, 26, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px) saturate(140%);
  overflow: hidden;
}

.overlay-demo .draft-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12.5px;
  line-height: 21px;
  color: rgba(255, 255, 255, 0.9);
}

.overlay-demo .draft-text {
  min-width: 0;
  flex: 1 1 auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.overlay-demo .draft-line.streaming .draft-text,
.overlay-demo .draft-line.polishing .draft-text {
  color: rgba(255, 255, 255, 0.55);
}

.overlay-demo .draft-line.raw .draft-text {
  color: rgba(255, 255, 255, 0.42);
}

.overlay-demo .draft-spin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(98, 187, 243, 0.25);
  border-top-color: var(--accent);
  animation: hs-spin 0.8s linear infinite;
  flex: none;
  margin-top: 5px;
}

.overlay-demo .bar {
  pointer-events: none;
  min-width: calc(150px * var(--bar-scale));
  max-width: calc(280px * var(--bar-scale));
  height: calc(34px * var(--bar-scale));
  padding: 0 calc(6px * var(--bar-scale));
  display: flex;
  align-items: center;
  gap: calc(6px * var(--bar-scale));
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 calc(8px * var(--bar-scale)) calc(20px * var(--bar-scale)) rgba(0, 0, 0, 0.26),
    0 calc(2px * var(--bar-scale)) calc(6px * var(--bar-scale)) rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(20px) saturate(140%);
  color: var(--text);
  /* Clip the hold fill / waveform to the pill rounding, like the real capsule. */
  overflow: hidden;
}

/* Hero spotlight: the same 34 px capsule rendered at 1.25× (user-confirmed).
   All capsule sizes scale together (button 30, waveform slot 70×30, timer 15 px,
   padding 7.5), so it stays the Typeless pill shape instead of the old
   oversized 52 px bar. */
.overlay-hero-demo { --bar-scale: 1.25; }

.overlay-demo .wave-slot {
  width: calc(56px * var(--bar-scale));
  height: calc(24px * var(--bar-scale));
  display: flex;
  align-items: center;
  overflow: hidden;
  flex: none;
}

.overlay-demo .wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(1.5px * var(--bar-scale));
  width: 100%;
  height: 100%;
}

.overlay-demo .wave span {
  display: block;
  width: calc(2.5px * var(--bar-scale));
  height: calc(18px * var(--bar-scale));
  border-radius: 99px;
  background: linear-gradient(180deg, #9adcff, var(--accent));
  transform-origin: center;
  opacity: 0.92;
  transform: scaleY(0.2);
  transition: transform 90ms linear;
}

.overlay-demo .timer {
  font-size: calc(12px * var(--bar-scale));
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
  min-width: calc(24px * var(--bar-scale));
}

.overlay-demo .actions {
  display: flex;
  align-items: center;
  gap: calc(4px * var(--bar-scale));
  margin-left: auto;
  flex: none;
}

.overlay-demo .icon-btn {
  width: calc(24px * var(--bar-scale));
  height: calc(24px * var(--bar-scale));
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}

.overlay-demo .icon-btn.stop svg {
  width: calc(14px * var(--bar-scale));
  height: calc(14px * var(--bar-scale));
}

.overlay-demo .icon-btn.cancel svg {
  width: calc(13px * var(--bar-scale));
  height: calc(13px * var(--bar-scale));
}

.overlay-demo .icon-btn.stop { background: var(--accent); color: #0a0a0b; }
.overlay-demo .icon-btn.cancel { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.72); }

.overlay-demo .spinner {
  width: calc(14px * var(--bar-scale));
  height: calc(14px * var(--bar-scale));
  border-radius: 50%;
  border: calc(1.5px * var(--bar-scale)) solid rgba(98, 187, 243, 0.24);
  border-top-color: var(--accent);
  animation: hs-spin 0.8s linear infinite;
  flex: none;
}

.overlay-demo .copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.overlay-demo .copy strong {
  font-size: calc(12.5px * var(--bar-scale));
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.overlay-demo .sub {
  font-size: calc(10px * var(--bar-scale));
  line-height: 1.2;
  color: var(--dim);
  white-space: nowrap;
}

.overlay-demo .icon-orb {
  width: calc(22px * var(--bar-scale));
  height: calc(22px * var(--bar-scale));
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: calc(12px * var(--bar-scale));
  flex: none;
}

.overlay-demo .icon-orb.ok { background: rgba(91, 209, 139, 0.16); color: var(--ok); }

.overlay-demo .revise-chip {
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: calc(4px * var(--bar-scale)) calc(8px * var(--bar-scale));
  font-size: calc(11px * var(--bar-scale));
  line-height: 1;
  flex: none;
}

.overlay-demo .bar-done {
  min-width: 0;
  max-width: calc(380px * var(--bar-scale));
}
/* ---------------------------- Term window --------------------------------- */

.term-demo {
  --accent: #62bbf3;
  /* Input tokens mirror the Hub's canonical `.input` (src/renderer/src/hub/hub.css)
     mapped onto the dark theme because these mock windows are dark. Values are
     the hub dark-theme tokens: --panel-soft/--panel/--line-strong/--text/
     --text-faint/--accent-strong/--accent-soft/--panel-hover. */
  --field-bg: #1f1d1e;
  --field-bg-focus: #242121;
  --field-border: rgba(255, 255, 255, 0.14);
  --field-text: #f3f0ea;
  --field-faint: #807a74;
  --field-accent: #7ac8f5;
  --field-accent-soft: rgba(98, 187, 243, 0.14);
  --field-hover: #2c2829;
  width: 460px;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(28, 28, 30, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px);
  color: rgba(255, 255, 255, 0.92);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI",
    "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.term-demo * { box-sizing: border-box; }

.term-demo .term-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.term-demo .term-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  flex: none;
}

.term-demo .term-clock {
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.2px;
}

.term-demo .term-title {
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.term-demo .term-close {
  margin-left: auto;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  flex: none;
}

.term-demo .term-kinds {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 9px;
}

.term-demo .term-kind {
  height: 22px;
  padding: 0 10px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
  font-size: 10.5px;
  font-weight: 600;
}

.term-demo .term-kind.is-on {
  background: rgba(98, 187, 243, 0.18);
  border-color: rgba(98, 187, 243, 0.44);
  color: #9adcff;
}

.term-demo .term-kind-hint {
  margin-left: auto;
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.34);
  white-space: nowrap;
}

.term-demo .term-input-row {
  position: relative;
  margin-top: 10px;
}

.term-demo .term-input {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 11px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  outline: none;
  background: var(--field-bg);
  color: var(--field-text);
  font-size: 13.5px;
  transition: border-color 0.13s ease, box-shadow 0.13s ease, background 0.13s ease;
}

.term-demo .term-input:focus {
  border-color: var(--field-accent);
  background: var(--field-bg-focus);
  box-shadow: 0 0 0 3px var(--field-accent-soft);
}

.term-demo .term-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.term-demo .term-input::placeholder { color: var(--field-faint); }

/* Return-key affordance: the Hub `.input-with-action` / `.input-action` pattern
   (transparent 30px hit area inside the field, accent colour only on hover). */
.term-demo .term-enter-btn {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--field-faint);
  transition: background 0.13s ease, color 0.13s ease;
}

.term-demo .term-enter-btn:hover {
  background: var(--field-hover);
  color: var(--field-text);
}

.term-demo .term-chips {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  min-height: 16px;
  flex-wrap: wrap;
}

.term-demo .term-chip {
  padding: 1px 8px;
  border-radius: 99px;
  background: rgba(98, 187, 243, 0.16);
  border: 1px solid rgba(98, 187, 243, 0.3);
  color: #9adcff;
  font-size: 10px;
}

.term-demo .term-empty {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
}

/* ---------------------------- Revise window -------------------------------- */

.revise-demo {
  --accent: #62bbf3;
  --warn: #f0c674;
  /* Same Hub `.input` dark-theme token mapping as `.term-demo` above. */
  --field-bg: #1f1d1e;
  --field-bg-focus: #242121;
  --field-border: rgba(255, 255, 255, 0.14);
  --field-text: #f3f0ea;
  --field-faint: #807a74;
  --field-accent: #7ac8f5;
  --field-accent-soft: rgba(98, 187, 243, 0.14);
  --field-hover: #2c2829;
  width: 520px;
  max-width: 100%;
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 20px;
  background: rgba(24, 24, 26, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(20px) saturate(140%);
  color: rgba(255, 255, 255, 0.94);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI",
    "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.revise-demo * { box-sizing: border-box; }

.revise-demo .revise-head {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.revise-demo .scene-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 200px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(98, 187, 243, 0.16);
  color: #9adcff;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.revise-demo .chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.revise-demo .chip-app { color: rgba(154, 220, 255, 0.75); }

.revise-demo .revise-title {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.revise-demo .icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.08);
  flex: none;
}

.revise-demo .revise-text {
  flex: 1 1 auto;
  min-height: 96px;
  max-height: 300px;
  padding: 10px 12px;
  overflow-y: auto;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  transition: opacity 0.3s ease;
}

.revise-demo .revise-text.is-swapping { opacity: 0; }

.revise-demo .revise-text mark {
  background: rgba(98, 187, 243, 0.26);
  color: #c9ecff;
  border-radius: 3px;
  padding: 0 1px;
  box-shadow: inset 0 -1px 0 rgba(98, 187, 243, 0.6);
}

.revise-demo .revise-original {
  flex: none;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.52);
}

.revise-demo .revise-original summary {
  cursor: pointer;
  color: rgba(255, 255, 255, 0.35);
}

.revise-demo .revise-original p {
  margin: 4px 0 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  max-height: 64px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.revise-demo .revise-input-row {
  flex: none;
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.revise-demo .revise-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 84px;
  padding: 9px 11px;
  resize: none;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  outline: none;
  background: var(--field-bg);
  color: var(--field-text);
  font-size: 13.5px;
  line-height: 1.5;
  transition: border-color 0.13s ease, box-shadow 0.13s ease, background 0.13s ease;
}

.revise-demo .revise-input:focus {
  border-color: var(--field-accent);
  background: var(--field-bg-focus);
  box-shadow: 0 0 0 3px var(--field-accent-soft);
}

.revise-demo .revise-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.revise-demo .revise-input::placeholder { color: var(--field-faint); }

.revise-demo .voice-icon-btn {
  flex: none;
  width: 38px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--field-faint);
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease;
}

.revise-demo .voice-icon-btn:hover {
  background: var(--field-hover);
  color: var(--field-text);
}

.revise-demo .voice-icon-btn:focus-visible {
  outline: none;
  border-color: var(--field-accent);
  box-shadow: 0 0 0 3px var(--field-accent-soft);
}

.revise-demo .revise-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.revise-demo .revise-hint {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.revise-demo .revise-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.revise-demo .btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 600;
}

.revise-demo .btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.82);
}

.revise-demo .btn.primary {
  background: var(--accent);
  color: #08131c;
}

.revise-demo .btn.primary:disabled { opacity: 0.5; }

.revise-toast {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(20, 34, 26, 0.97);
  border: 1px solid rgba(91, 209, 139, 0.45);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
  color: #a9f0c6;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.revise-toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------------------- shared motion -------------------------------- */

@keyframes hs-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .overlay-demo *,
  .term-demo *,
  .revise-demo * {
    animation: none !important;
    transition: none !important;
  }
}
