:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-muted: #f0f0ef;
  --surface-ink: #111113;
  --text: #1d1d1f;
  --muted: #707078;
  --faint: #a2a2a8;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --accent: #111111;
  --accent-text: #ffffff;
  --rose: #6f2437;
  --moss: #496050;
  --rain: #5d7088;
  --user: #ededeb;
  --danger: #b42318;
  --bio-light-start: #f7c9a8;
  --bio-light-end: #b85f47;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
  --soft-shadow: 0 10px 30px rgba(20, 20, 20, 0.06);
  --sidebar-width: 292px;
  --bottom-nav-height: 72px;
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
}

.bio-card {
  overflow: hidden;
}

.bio-lover-grid,
.bio-metric-grid,
.bio-trend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bio-lover-meter,
.bio-metric,
.bio-event-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.bio-lover-meter > div:first-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 4px 10px;
}

.bio-metric {
  display: grid;
  gap: 4px;
}

.bio-lover-meter span,
.bio-metric span,
.bio-trend-grid span {
  color: var(--muted);
  font-size: 12px;
}

.bio-lover-meter strong,
.bio-metric strong {
  color: var(--text);
  font-size: 17px;
  letter-spacing: 0;
}

.bio-lover-meter em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.bio-lover-meter p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.bio-soft-track,
.bio-mini-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
}

.bio-soft-track i,
.bio-mini-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--bio-light-start), var(--bio-light-end));
}

.bio-state-line,
.bio-check-list,
.bio-debug-actions,
.bio-sim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.bio-debug-summary {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.bio-lover-headline {
  display: grid;
  gap: 4px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(184, 95, 71, 0.08);
}

.bio-lover-headline strong {
  font-size: 20px;
  color: var(--text);
}

.bio-lover-headline span {
  color: var(--muted);
  font-size: 13px;
}

.bio-lover-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bio-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bio-v2-sexual-card {
  display: grid;
  gap: 14px;
}

.bio-v2-balance {
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.bio-v2-sexual-grid,
.bio-v2-context-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.bio-v2-metric small,
.bio-v2-context-metric small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.bio-v2-metric.unavailable {
  opacity: 0.68;
}

.bio-v2-context-metric {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 12px;
}

.bio-v2-context-metric span {
  color: var(--muted);
  font-size: 12px;
}

.bio-v2-context-metric strong {
  color: var(--text);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.bio-metric.warm .bio-mini-track i {
  background: linear-gradient(90deg, var(--bio-light-start), var(--bio-light-end));
}

.bio-metric.focus .bio-mini-track i {
  background: linear-gradient(90deg, var(--bio-light-start), var(--bio-light-end));
}

.bio-metric.stress .bio-mini-track i {
  background: linear-gradient(90deg, var(--bio-light-start), var(--bio-light-end));
}

.bio-metric.fatigue .bio-mini-track i {
  background: linear-gradient(90deg, var(--bio-light-start), var(--bio-light-end));
}

.bio-event-list {
  display: grid;
  gap: 8px;
}

.bio-event-list article p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.bio-trend-grid > div {
  display: grid;
  min-height: 92px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.68);
}

.bio-trend-wave {
  display: block;
  width: 100%;
  height: 56px;
  overflow: visible;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(247, 201, 168, 0.18), rgba(255, 255, 255, 0));
}

.bio-trend-wave.empty {
  min-height: 56px;
  border-radius: 8px;
  background: rgba(184, 95, 71, 0.05);
}

.bio-trend-line {
  fill: none;
  stroke: var(--bio-light-end);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.bio-trend-line.shadow {
  stroke: rgba(247, 201, 168, 0.8);
  stroke-width: 5.6;
}

.bio-hormone-science {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.bio-hormone-science-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.bio-hormone-science-head strong {
  color: var(--muted);
  font-size: 12px;
}

.bio-hormone-science-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.bio-hormone-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 10px;
}

.bio-hormone-row span {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.bio-hormone-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.bio-hormone-row strong {
  color: var(--text);
  font-size: 12px;
}

.bio-hormone-row .bio-mini-track {
  grid-column: 1 / -1;
  height: 6px;
}

.bio-debug-actions button,
.bio-sim-actions button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
}

.bio-reason-grid,
.bio-debug-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.bio-debug-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

  .bio-reason-panel,
  .bio-debug-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.bio-reason-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
}

.bio-reason-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.bio-reason-row strong {
  color: var(--text);
  font-size: 12px;
}

.bio-reason-row .bio-mini-track {
  grid-column: 1 / -1;
}

.bio-raw-details {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.62);
}

.bio-raw-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
}

.bio-raw-details:not([open]) .bio-raw {
  display: none;
}

.instruction-pre.bio-raw {
  max-height: 520px;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.instruction-pre.compact {
  max-height: 260px;
}

@media (prefers-color-scheme: dark) {
  .bio-lover-meter,
  .bio-metric,
  .bio-event-list article,
  .bio-trend-grid > div,
  .bio-reason-panel,
  .bio-debug-panel,
  .bio-hormone-row,
  .bio-raw-details,
  .bio-debug-actions button,
  .bio-sim-actions button {
    background: rgba(255, 255, 255, 0.06);
  }

  .bio-v2-context-metric {
    background: rgba(255, 255, 255, 0.06);
  }

  .bio-soft-track,
  .bio-mini-track {
    background: rgba(255, 255, 255, 0.1);
  }
}

@media (max-width: 760px) {
  .bio-lover-grid,
  .bio-metric-grid,
  .bio-trend-grid,
  .bio-lover-grid.compact,
    .bio-reason-grid,
    .bio-hormone-science-grid,
    .bio-debug-grid,
    .bio-v2-sexual-grid,
    .bio-v2-context-grid {
      grid-template-columns: 1fr;
    }

  .bio-lover-meter,
  .bio-metric,
  .bio-event-list article {
    padding: 10px;
  }
}

.sentence-reaction-popover {
  position: fixed;
  z-index: 90;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(340px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid rgba(23, 31, 38, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(23, 31, 38, 0.18);
}

.sentence-reaction-popover button {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  border: 1px solid rgba(23, 31, 38, 0.12);
  border-radius: 999px;
  background: #f5f4ef;
  cursor: pointer;
  font: inherit;
  font-size: 20px;
  line-height: 1;
}

.sentence-reaction-popover.trait-picker {
  border-radius: 18px;
}

.persona-trait-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sentence-reaction-popover .persona-trait-options button {
  width: auto;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.persona-edit-field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.persona-edit-field span {
  color: rgba(43, 47, 51, 0.64);
  font-size: 12px;
  font-weight: 700;
}

.persona-edit-field textarea,
.persona-edit-field input {
  width: 100%;
  min-height: 92px;
  border: 1px solid rgba(23, 31, 38, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  color: inherit;
  font: inherit;
  padding: 10px;
}

.persona-edit-field.compact input {
  min-height: 0;
}

.persona-sample-group {
  margin-top: 14px;
}

.persona-tag-bucket {
  border-top: 1px solid rgba(23, 31, 38, 0.08);
  padding: 10px 0;
}

.persona-tag-bucket ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

/* 光遇操作台：VPS 上的 Aevi 是驾驶者，Mac 只作为身体桥。 */
.sky-console-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  min-height: 180px;
  border-radius: 22px;
  padding: 26px;
  color: #f8f7ff;
  background:
    radial-gradient(circle at 82% 12%, rgba(222, 207, 255, 0.48), transparent 24%),
    radial-gradient(circle at 12% 108%, rgba(113, 204, 207, 0.34), transparent 42%),
    linear-gradient(135deg, #242138 0%, #433d67 52%, #1e5261 100%);
  box-shadow: 0 20px 55px rgba(30, 33, 64, 0.24);
}

.sky-console-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 18% 24%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 66% 32%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 88% 70%, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle at 42% 76%, #fff 0 1px, transparent 1.5px);
  opacity: 0.6;
}

.sky-console-copy,
.sky-connection-orb {
  position: relative;
  z-index: 1;
}

.sky-console-copy {
  max-width: 650px;
}

.sky-console-copy .card-kicker {
  color: rgba(255, 255, 255, 0.7);
}

.sky-console-copy h1 {
  margin: 6px 0 8px;
  font-size: clamp(28px, 4.4vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.sky-console-copy p {
  max-width: 600px;
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.6;
}

.sky-connection-orb {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 112px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 12px;
}

.sky-connection-orb > span {
  width: 56px;
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 26px rgba(255, 255, 255, 0.16), 0 0 0 8px rgba(255, 255, 255, 0.04);
}

.sky-connection-orb.online > span {
  background: #8be6c8;
  box-shadow: 0 0 34px rgba(139, 230, 200, 0.8), 0 0 0 8px rgba(139, 230, 200, 0.12);
}

.sky-connection-orb.waiting > span {
  background: #f3d38b;
  box-shadow: 0 0 30px rgba(243, 211, 139, 0.6), 0 0 0 8px rgba(243, 211, 139, 0.1);
}

.sky-console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.sky-live-card,
.sky-pilot-card,
.sky-control-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.sky-live-card {
  overflow: hidden;
}

.sky-live-card > header,
.sky-pilot-head,
.sky-control-card {
  padding: 16px;
}

.sky-live-card > header,
.sky-pilot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sky-live-card h2,
.sky-pilot-head h2,
.sky-control-card h2 {
  margin: 3px 0 0;
  font-size: 18px;
}

.sky-frame-wrap {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  min-height: 260px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(115, 101, 167, 0.36), transparent 32%),
    linear-gradient(180deg, #171827 0%, #0d1118 100%);
}

.sky-frame-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #090b10;
}

.sky-frame-empty {
  display: grid;
  justify-items: center;
  gap: 7px;
  max-width: 340px;
  padding: 28px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.sky-frame-empty > span {
  font-size: 36px;
  color: #e9ddff;
  text-shadow: 0 0 24px rgba(233, 221, 255, 0.7);
}

.sky-frame-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.sky-frame-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 14px 14px;
}

.sky-frame-meta span,
.sky-ocr-list span {
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  padding: 6px 9px;
  font-size: 12px;
}

.sky-pilot-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 16px;
}

.sky-pilot-toggle {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 9px 12px;
  cursor: pointer;
}

.sky-pilot-toggle.active {
  border-color: rgba(79, 182, 146, 0.4);
  background: rgba(79, 182, 146, 0.14);
  color: #2f9a75;
}

.sky-intent {
  margin: 0 16px 14px;
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(99, 84, 158, 0.12), rgba(56, 130, 143, 0.08));
  padding: 14px;
}

.sky-intent span,
.sky-goal span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.sky-intent strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
  line-height: 1.35;
}

.sky-intent p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.sky-goal {
  display: grid;
  gap: 7px;
  margin: 0 16px 12px;
}

.sky-goal textarea,
.sky-chat-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--text);
  outline: none;
}

.sky-goal textarea {
  resize: vertical;
  min-height: 82px;
  padding: 10px 11px;
  line-height: 1.45;
}

.sky-pilot-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 16px;
}

.sky-pilot-actions button,
.sky-action-grid button,
.sky-dpad button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
}

.sky-pilot-actions button {
  padding: 10px;
}

.sky-emergency {
  margin: 12px 16px 0;
  border: 1px solid rgba(185, 64, 64, 0.24);
  border-radius: 12px;
  background: rgba(185, 64, 64, 0.08);
  color: var(--danger);
  padding: 11px;
  cursor: pointer;
}

.sky-control-card {
  display: grid;
  gap: 16px;
}

.sky-controls {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(280px, 1.3fr);
  gap: 18px;
  align-items: center;
}

.sky-dpad {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(2, 52px);
  justify-content: center;
  gap: 7px;
}

.sky-dpad button {
  font-weight: 700;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.sky-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.sky-action-grid button {
  display: grid;
  gap: 4px;
  min-height: 68px;
  padding: 10px;
}

.sky-action-grid span {
  color: var(--muted);
  font-size: 11px;
}

.sky-chat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.sky-chat-row input {
  padding: 10px 12px;
}

.sky-observation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.sky-ocr-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.sky-log-list,
.sky-event-list {
  display: grid;
  gap: 8px;
}

.sky-log-row,
.sky-event-list article {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.sky-log-row:last-child,
.sky-event-list article:last-child {
  border-bottom: 0;
}

.sky-log-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.sky-log-row span,
.sky-event-list span,
.sky-event-list p {
  color: var(--muted);
  font-size: 12px;
}

.sky-event-list article {
  display: grid;
  grid-template-columns: auto 1fr auto;
}

.sky-event-list p {
  margin: 0;
  white-space: pre-wrap;
}

.sky-command-status {
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  padding: 4px 7px;
  font-style: normal;
  font-size: 11px;
}

.sky-command-status.done {
  color: #2f9a75;
}

.sky-command-status.error {
  color: var(--danger);
}

@media (max-width: 920px) {
  .sky-console-grid,
  .sky-observation-grid {
    grid-template-columns: 1fr;
  }

  .sky-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .sky-console-hero {
    min-height: 210px;
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .sky-connection-orb {
    grid-template-columns: auto 1fr;
    justify-items: start;
    min-width: 0;
  }

  .sky-connection-orb > span {
    width: 24px;
    height: 24px;
  }

  .sky-frame-wrap {
    min-height: 190px;
  }

  .sky-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sky-chat-row {
    grid-template-columns: 1fr;
  }

  .sky-event-list article {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  .sky-console-hero {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
  }

  .sky-pilot-toggle.active {
    color: #8be6c8;
  }
}

.memory-maintenance-sections {
  display: grid;
  gap: 10px;
}

.memory-maintenance-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.memory-maintenance-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
}

.memory-maintenance-section[open] summary {
  border-bottom: 1px solid var(--line);
}

.memory-summary-item p,
.memory-maintenance-about {
  white-space: pre-wrap;
}

.memory-switch.compact {
  min-width: 78px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #171717;
    --bg-2: #1d1d1d;
    --surface: rgba(31, 31, 31, 0.84);
    --surface-solid: #222222;
    --surface-muted: #2b2b2b;
    --surface-ink: #f2f2f2;
    --text: #ececec;
    --muted: #aaaab0;
    --faint: #77777d;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.18);
    --accent: #f4f4f4;
    --accent-text: #171717;
    --rose: #d299aa;
    --moss: #a7baa8;
    --rain: #9daec3;
    --user: #303030;
    --danger: #ff8a80;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
    --soft-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 10% -10%, rgba(255, 255, 255, 0.9), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(93, 112, 136, 0.12), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 62%, #f4f4f2 100%);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(circle at 12% -10%, rgba(92, 92, 92, 0.28), transparent 28%),
      radial-gradient(circle at 86% 14%, rgba(111, 36, 55, 0.16), transparent 30%),
      linear-gradient(180deg, #202020 0%, var(--bg) 64%, #141414 100%);
  }
}

button,
textarea,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden {
  display: none !important;
}

.loading-overlay {
  position: fixed;
  z-index: 260;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 255, 255, 0.92), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 247, 245, 0.94) 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

.loading-overlay[data-visible="true"] {
  opacity: 1;
  visibility: visible;
}

.loading-overlay[data-mode="task"] {
  inset: auto 12px calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 12px) 12px;
  display: block;
  padding: 0;
  background: transparent;
}

.loading-card {
  width: min(430px, 100%);
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  padding: 15px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.loading-overlay[data-mode="task"] .loading-card {
  width: min(430px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 12px;
  box-shadow: var(--soft-shadow);
}

.loading-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.loading-orbit {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background:
    conic-gradient(from 0deg, #111 0 28%, rgba(17, 17, 17, 0.1) 28% 100%);
  animation: loadingSpin 1s linear infinite;
}

.loading-orbit::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: var(--surface-solid);
}

.loading-orbit span {
  position: absolute;
  inset: 12px;
  z-index: 1;
  border-radius: inherit;
  background: #111;
  animation: loadingPulse 1.2s ease-in-out infinite;
}

.loading-copy {
  flex: 1 1 auto;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.loading-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-percent {
  flex: 0 0 auto;
  min-width: 42px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.loading-meter {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.08);
}

.loading-meter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: translateX(-100%);
  animation: loadingSweep 1.35s ease-in-out infinite;
}

.loading-meter span {
  position: relative;
  z-index: 1;
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #111;
  transition: width 180ms ease;
}

@keyframes loadingSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loadingPulse {
  0%,
  100% {
    transform: scale(0.72);
    opacity: 0.55;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes loadingSweep {
  0% {
    transform: translateX(-100%);
  }
  55%,
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-orbit,
  .loading-orbit span,
  .loading-meter::after {
    animation: none;
  }
}

body[data-site-auth="locked"] {
  overflow: hidden;
}

body[data-site-auth="locked"] .app-shell,
body[data-site-auth="locked"] .mobile-scrim,
body[data-site-auth="locked"] .tool-scrim,
body[data-site-auth="locked"] .modal-layer {
  display: none !important;
}

.site-auth-gate {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 4%, rgba(255, 255, 255, 0.9), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  padding: 22px;
}

.site-auth-card {
  display: grid;
  gap: 14px;
  width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.site-auth-card h1 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.25;
}

.site-auth-card input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.site-auth-card input:focus {
  border-color: var(--line-strong);
}

.site-auth-card p {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: rgba(246, 246, 244, 0.78);
  backdrop-filter: blur(18px);
  padding: 12px;
}

@media (prefers-color-scheme: dark) {
  .sidebar {
    background: rgba(24, 24, 24, 0.82);
  }
}

.main-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.sidebar-top,
.topbar,
.top-actions,
.composer-actions {
  display: flex;
  align-items: center;
}

.sidebar-top {
  gap: 8px;
}

.new-chat-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.new-chat-button:hover {
  border-color: var(--line-strong);
  background: var(--bg-2);
}

.new-chat-button:active,
.icon-button:active,
.send-button:active,
.bottom-nav-item:active {
  transform: scale(0.96);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.icon-button:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.icon-button.subtle {
  width: 34px;
  height: 34px;
}

.only-mobile {
  display: none;
}

.conversation-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0;
}

.conversation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 8px 8px 10px;
  text-align: left;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.conversation-item:hover,
.conversation-item.active {
  background: var(--surface-solid);
  color: var(--text);
}

.chat-trash-list {
  display: grid;
  gap: 12px;
}

.chat-trash-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-muted);
}

.chat-trash-item > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.chat-trash-item strong,
.chat-trash-item small {
  overflow-wrap: anywhere;
}

.chat-trash-item small {
  color: var(--muted);
}

.chat-trash-bring-back {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .chat-trash-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .chat-trash-item .dark-inline {
    width: 100%;
  }
}

.conversation-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.conversation-count {
  color: var(--faint);
  font-size: 12px;
}

.sidebar-bottom {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.setting-line {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.setting-line input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface-solid);
  color: var(--text);
  padding: 0 10px;
}

.setting-line input:focus {
  border-color: var(--line-strong);
}

.bridge-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.bridge-pill.ok .status-dot {
  background: #20a36b;
}

.bridge-pill.bad .status-dot {
  background: var(--danger);
}

.topbar {
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 64px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(18px);
  padding: 0 18px;
}

@media (prefers-color-scheme: dark) {
  .topbar {
    background: rgba(24, 24, 24, 0.66);
  }
}

.top-actions {
  gap: 2px;
}

.title-stack {
  min-width: 0;
  flex: 1;
}

.app-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 680;
}

.app-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.page-host {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 20px 28px;
}

.page-host > * {
  width: min(1120px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.page-host.doudizhu-active {
  position: relative;
  overflow: hidden;
  padding: 0;
  background: #203f31;
}

.page-host.doudizhu-active > * {
  width: 100%;
  max-width: none;
  margin: 0;
}

.page-host.doudizhu-active > .settings-back-button {
  position: absolute;
  z-index: 10;
  top: 10px;
  left: 10px;
  min-height: 34px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(11, 24, 19, 0.64);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
}

.doudizhu-nest-shell {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.doudizhu-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #203f31;
}

/* 斗地主进入巢后接管可用视口；返回按钮仍属于新家，游戏设置留在牌桌内部。 */
.app-shell[data-active-section="doudizhu"] {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell[data-active-section="doudizhu"] .sidebar,
.app-shell[data-active-section="doudizhu"] .main-area > .topbar,
.app-shell[data-active-section="doudizhu"] .main-area > .bottom-nav {
  display: none;
}

.app-shell[data-active-section="doudizhu"] .main-area {
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
}

.app-shell[data-active-section="doudizhu"] .page-host.doudizhu-active {
  width: 100vw;
  height: 100dvh;
}

.app-shell[data-active-section="doudizhu"] .page-host.doudizhu-active > .settings-back-button {
  display: none;
}

.app-shell[data-active-section="doudizhu"] .doudizhu-frame {
  height: 100dvh;
}

.page-hero {
  display: grid;
  gap: 8px;
  padding: 14px 0 18px;
}

.eyebrow,
.card-kicker,
.species-kicker {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.app-shell[data-active-tab="settings"] #pageHost .card-kicker {
  display: none;
}

.app-shell[data-active-tab="settings"] #pageHost .card-title-row > .mini-chip {
  display: none;
}

.page-hero h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 720;
  line-height: 1.08;
}

.page-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.section-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  padding: 4px 0 14px;
  scrollbar-width: none;
}

.section-tabs::-webkit-scrollbar {
  display: none;
}

.section-tab {
  flex: none;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.section-tab.active {
  border-color: rgba(0, 0, 0, 0.16);
  background: var(--surface-ink);
  color: var(--accent-text);
}

.settings-menu-list {
  display: grid;
  gap: 10px;
}

.settings-menu-item {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-solid);
  color: var(--text);
  text-align: left;
  padding: 14px 16px;
  cursor: pointer;
}

.settings-menu-item strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.settings-menu-item small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-menu-arrow {
  color: var(--faint);
  font-size: 30px;
  line-height: 1;
}

.settings-back-button {
  min-height: 36px;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--muted);
  padding: 0 14px;
  cursor: pointer;
}

@media (prefers-color-scheme: dark) {
  .section-tab {
    background: rgba(34, 34, 34, 0.72);
  }

  .section-tab.active {
    border-color: rgba(255, 255, 255, 0.24);
  }
}

.dashboard-grid,
.species-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.feature-card,
.info-card,
.species-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
}

.feature-card,
.info-card {
  display: grid;
  gap: 12px;
  grid-column: span 6;
  align-content: start;
  padding: 16px;
}

.feature-card.wide {
  grid-column: span 12;
}

.feature-card h2,
.info-card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.aevi-now-text {
  color: var(--muted);
  font-weight: 400;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.mini-edit-button {
  min-height: 28px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  cursor: pointer;
  padding: 0 10px;
  font-size: 12px;
}

.mini-edit-button.ghost {
  background: transparent;
}

.mini-edit-button.danger {
  border-color: rgba(154, 46, 50, 0.28);
  background: rgba(154, 46, 50, 0.08);
  color: #8c2a2e;
}

.mini-edit-button.danger:disabled {
  cursor: default;
  opacity: 0.55;
}

.feature-card p,
.info-card p,
.species-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.next-card {
  border-color: rgba(111, 36, 55, 0.18);
}

.chip-row {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.chip-row.wrap {
  flex-wrap: wrap;
  overflow: visible;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.mini-chip.strong {
  border-color: rgba(32, 105, 72, 0.34);
  background: rgba(32, 105, 72, 0.1);
  color: #1f6847;
}

@media (prefers-color-scheme: dark) {
  .mini-chip {
    background: rgba(255, 255, 255, 0.06);
  }
}

.status-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.status-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 10px;
  align-items: center;
  min-height: 40px;
  background: rgba(255, 255, 255, 0.74);
  padding: 9px 11px;
}

@media (prefers-color-scheme: dark) {
  .status-row {
    background: rgba(35, 35, 35, 0.78);
  }
}

.status-row span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-row strong {
  overflow-wrap: anywhere;
  font-weight: 620;
}

.moment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.moment-control-card {
  grid-column: span 12;
}

.moment-city-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.moment-city-row label {
  display: grid;
  gap: 6px;
}

.moment-city-row input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.moment-city-row button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  padding: 0 16px;
}

.muted-note {
  color: var(--muted);
  font-size: 14px;
}

.prompt-preview {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 13px/1.6 "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

.section-heading-row,
.copy-block {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.section-heading-row h2 {
  margin: 4px 0 0;
}

.section-heading-row button,
.copy-block button {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
}

.copy-block {
  align-items: center;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.025);
  padding: 10px;
}

.copy-block > div {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.copy-block code {
  overflow-wrap: anywhere;
  color: var(--text);
  font: 12px/1.55 "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

.compact-details {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.compact-details summary {
  cursor: pointer;
  font-weight: 650;
}

.setup-steps {
  margin: 10px 0;
  color: var(--muted);
  line-height: 1.7;
}

@media (prefers-color-scheme: dark) {
  .moment-city-row input {
    background: rgba(255, 255, 255, 0.06);
  }

  .prompt-preview {
    background: rgba(255, 255, 255, 0.05);
  }

  .copy-block {
    background: rgba(255, 255, 255, 0.04);
  }
}

.breath-protocol-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.breath-protocol-card {
  display: grid;
  gap: 8px;
  min-height: 148px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  padding: 14px;
  box-shadow: var(--soft-shadow);
}

.breath-protocol-card.active {
  border-color: rgba(0, 0, 0, 0.38);
  background: var(--surface-solid);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), var(--soft-shadow);
}

.breath-protocol-card strong {
  font-size: 17px;
  line-height: 1.2;
}

.breath-protocol-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.breath-steps {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}

.breath-session-card {
  gap: 18px;
}

.breath-stage {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.breath-orb-wrap {
  display: grid;
  min-height: 240px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.52);
}

.breath-orb {
  position: relative;
  isolation: isolate;
  display: grid;
  width: 164px;
  height: 164px;
  place-items: center;
  border: 2px solid var(--text);
  border-radius: 999px;
  background: var(--surface-solid);
  box-shadow: inset 0 0 0 12px rgba(0, 0, 0, 0.035);
  transform: translateZ(0) scale(var(--breath-scale, 1));
  transition:
    border-color 300ms ease,
    box-shadow 300ms ease,
    background 300ms ease;
  will-change: transform;
}

.breath-orb::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -22px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: inherit;
  opacity: var(--breath-aura, 0.2);
  transform: translateZ(0) scale(var(--breath-aura-scale, 1.18));
  transition:
    border-color 300ms ease,
    opacity 120ms linear;
  will-change: transform, opacity;
}

.breath-orb::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 46%, rgba(0, 0, 0, 0.05), transparent 58%),
    radial-gradient(circle at 50% 50%, transparent 58%, rgba(0, 0, 0, 0.06) 60%, transparent 63%);
  pointer-events: none;
}

.breath-orb span {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-size: 20px;
  font-weight: 720;
}

.breath-orb.phase-exhale {
  border-color: var(--muted);
  box-shadow: inset 0 0 0 18px rgba(0, 0, 0, 0.025), 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.breath-orb.phase-hold-full,
.breath-orb.phase-hold-empty {
  border-style: dashed;
}

.breath-orb.phase-done {
  border-color: rgba(32, 105, 72, 0.64);
}

.breath-readout {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.breath-readout h2 {
  margin: 0;
  font-size: 26px;
}

.breath-clock {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1;
}

.breath-progress {
  overflow: hidden;
  height: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
}

.breath-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--surface-ink);
  transition: width 500ms linear;
}

.breath-meta {
  margin-top: 2px;
}

.breath-actions {
  align-items: center;
}

.breath-note-card {
  grid-column: span 12;
}

.focus-session-card {
  grid-column: span 12;
}

.focus-stage {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.focus-ring-wrap {
  display: grid;
  place-items: center;
  min-height: 300px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.05), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.34));
}

.focus-ring {
  --focus-progress: 0;
  display: grid;
  place-items: center;
  width: min(62vw, 270px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--surface) 0 59%, transparent 60%),
    conic-gradient(var(--surface-ink) calc(var(--focus-progress) * 1%), rgba(0, 0, 0, 0.08) 0);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.05),
    0 20px 45px rgba(0, 0, 0, 0.08);
  transition: background 320ms linear;
}

.focus-ring-core {
  display: grid;
  place-items: center;
  width: 73%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  text-align: center;
  padding: 18px;
}

.focus-ring-core span,
.focus-ring-core em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.focus-ring-core strong {
  margin: 4px 0;
  color: var(--text);
  font-size: clamp(44px, 10vw, 70px);
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  line-height: 1;
  letter-spacing: 0;
}

.focus-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.focus-setting-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.focus-setting-grid label,
.focus-label-input {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.focus-setting-grid input,
.focus-label-input input,
.focus-label-editor textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

.focus-setting-grid input,
.focus-label-input input {
  height: 38px;
}

.focus-label-editor textarea {
  display: block;
  min-height: 78px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 10px;
  resize: vertical;
}

.focus-label-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.focus-label-chip {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--muted);
  padding: 0 11px;
  font-size: 13px;
}

.focus-label-chip.active {
  border-color: var(--surface-ink);
  background: var(--surface-ink);
  color: var(--surface);
}

.focus-actions {
  align-items: center;
}

.focus-stats-card {
  grid-column: span 12;
}

.focus-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.focus-stat-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.46);
  padding: 10px;
}

.focus-stat-grid span,
.focus-session-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.focus-stat-grid strong {
  color: var(--text);
  font-size: 18px;
}

.focus-label-bars,
.focus-session-list {
  display: grid;
  gap: 8px;
}

.focus-label-bar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.56);
}

.focus-label-bar span,
.focus-label-bar strong {
  position: relative;
  z-index: 1;
}

.focus-label-bar i {
  position: absolute;
  inset: auto auto 0 0;
  height: 3px;
  border-radius: 0 999px 999px 0;
  background: var(--surface-ink);
}

.focus-session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.46);
  padding: 9px 10px;
}

.focus-session-row span {
  overflow-wrap: anywhere;
}

@media (prefers-color-scheme: dark) {
  .breath-protocol-card.active {
    border-color: rgba(255, 255, 255, 0.34);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), var(--soft-shadow);
  }

  .breath-orb-wrap {
    background: rgba(255, 255, 255, 0.04);
  }

  .breath-orb {
    box-shadow: inset 0 0 0 12px rgba(255, 255, 255, 0.04);
  }

  .breath-orb::before {
    border-color: rgba(255, 255, 255, 0.2);
  }

  .breath-orb::after {
    background:
      radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.06), transparent 58%),
      radial-gradient(circle at 50% 50%, transparent 58%, rgba(255, 255, 255, 0.08) 60%, transparent 63%);
  }

  .focus-ring-wrap,
  .focus-stat-grid div,
  .focus-label-bar,
  .focus-session-row {
    background: rgba(255, 255, 255, 0.05);
  }

  .focus-ring {
    background:
      radial-gradient(circle at 50% 50%, var(--surface) 0 59%, transparent 60%),
      conic-gradient(#f4f4f4 calc(var(--focus-progress) * 1%), rgba(255, 255, 255, 0.12) 0);
  }

  .focus-ring-core {
    background: rgba(18, 18, 18, 0.86);
  }
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: var(--text);
}

.settings-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.settings-grid input {
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-solid);
  color: var(--text);
  padding: 0 10px;
}

.proactive-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.46);
}

.proactive-row strong {
  display: block;
  margin: 2px 0 4px;
  font-size: 15px;
}

.proactive-row p {
  margin: 0;
}

.trace-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.trace-list.single {
  grid-template-columns: 1fr;
}

.aevi-wall-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.aevi-wall-category-box {
  min-width: 0;
}

.aevi-wall-past {
  grid-column: 1 / -1;
}

.aevi-wall-past > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.aevi-wall-past > summary::-webkit-details-marker {
  display: none;
}

.aevi-wall-past strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
}

.aevi-wall-past-groups {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.aevi-wall-past-group {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.aevi-wall-past-group h3 {
  margin: 0;
  font-size: 16px;
}

.day-summary {
  margin: 0;
  border-left: 3px solid #111;
  color: var(--text);
  padding: 2px 0 2px 10px;
  line-height: 1.55;
}

.day-summary.failed {
  border-left-color: #9a2e32;
  color: var(--muted);
}

.trace-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  padding: 16px;
}

.trace-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.trace-badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.trace-card h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 19px;
  line-height: 1.35;
}

.trace-content {
  color: var(--text);
  line-height: 1.7;
}

.trace-content p {
  margin: 0 0 8px;
}

.trace-content p:last-child {
  margin-bottom: 0;
}

.markdown-content {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.markdown-content > :first-child {
  margin-top: 0;
}

.markdown-content > :last-child {
  margin-bottom: 0;
}

.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 14px 0 8px;
  color: var(--text);
  font-weight: 720;
  line-height: 1.35;
  letter-spacing: 0;
}

.markdown-content h3 {
  font-size: 1.08em;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  font-size: 1em;
}

.markdown-content ul,
.markdown-content ol {
  margin: 8px 0 12px;
  padding-left: 1.35em;
}

.markdown-content li {
  margin: 3px 0;
  padding-left: 0.1em;
}

.markdown-content blockquote {
  margin: 10px 0 12px;
  border-left: 3px solid var(--line-strong);
  padding: 2px 0 2px 12px;
  color: var(--muted);
}

.markdown-content hr {
  height: 1px;
  margin: 14px 0;
  border: 0;
  background: var(--line);
}

.markdown-content a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-content code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.04);
  padding: 0.06em 0.32em;
}

.markdown-content pre code {
  border: 0;
  background: transparent;
  padding: 0;
}

.markdown-code {
  position: relative;
}

.code-language {
  position: absolute;
  top: 6px;
  right: 8px;
  color: var(--faint);
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
}

.markdown-table-wrap {
  width: 100%;
  margin: 10px 0 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.markdown-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 0.93em;
}

.markdown-table th,
.markdown-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 9px;
  text-align: left;
  vertical-align: top;
}

.markdown-table th {
  background: var(--surface-muted);
  font-weight: 680;
}

.markdown-table tr:last-child td {
  border-bottom: 0;
}

.task-list-item {
  list-style: none;
  margin-left: -1.2em;
}

.task-list-item input {
  width: auto;
  margin: 0 6px 0 0;
  vertical-align: -0.12em;
}

.trace-content-expand {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
  overflow: hidden;
}

.trace-content-expand > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.trace-content-expand > summary::-webkit-details-marker {
  display: none;
}

.trace-content-expand[open] > summary {
  border-bottom: 1px solid var(--line);
}

.trace-content-expand[open] > summary .mini-chip {
  color: var(--text);
}

.trace-content-preview {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trace-expand-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #111;
  color: #fff;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.trace-expand-close {
  display: none;
}

.trace-content-expand[open] .trace-expand-open {
  display: none;
}

.trace-content-expand[open] .trace-expand-close {
  display: inline;
}

.trace-content-full {
  padding: 10px;
  overflow: visible;
}

.trace-original-expand {
  border-color: transparent;
  background: transparent;
  overflow: visible;
}

.trace-original-expand > summary {
  min-height: 0;
  padding: 0;
  align-items: flex-start;
}

.trace-original-expand[open] > summary {
  margin-bottom: 8px;
  border-bottom: 0;
}

.trace-original-expand .trace-content-preview {
  padding: 2px 0;
  font-size: 14px;
  line-height: 1.55;
}

.trace-original-expand .trace-expand-button {
  min-height: 24px;
  margin-top: 1px;
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
}

.trace-original-expand .trace-content-full {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
}

.wall-reply-item .trace-content,
.wall-reply-item .trace-content-preview {
  font-size: 13.5px;
  line-height: 1.55;
}

.mini-chip.warning {
  background: rgba(154, 46, 50, 0.11);
  color: #8c2a2e;
}

.wall-lock-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  flex: none;
  border-radius: 999px;
  background: #111;
  color: #fff;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
}

.trace-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
  overflow: hidden;
}

.trace-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  cursor: pointer;
  color: var(--muted);
  padding: 0 10px;
  list-style: none;
  font-size: 13px;
}

.trace-details summary::-webkit-details-marker {
  display: none;
}

.trace-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.trace-details[open] summary .mini-chip {
  color: var(--text);
}

.trace-fold-token {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.trace-details[open] .trace-fold-token {
  color: var(--text);
}

.trace-meta-grid {
  display: grid;
  grid-template-columns: minmax(88px, 0.48fr) minmax(0, 1fr);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--line);
  gap: 1px;
}

.trace-meta-grid span,
.trace-meta-grid strong {
  min-width: 0;
  background: rgba(255, 255, 255, 0.74);
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.45;
}

.trace-meta-grid span {
  color: var(--muted);
}

.trace-meta-grid strong {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.cache-hit-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.cache-hit-panel h2 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1;
}

.cache-record-heading {
  display: none;
}

.cache-record-list {
  display: grid;
  gap: 8px;
}

.cache-record-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.cache-record-row summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 10px;
  cursor: pointer;
  list-style: none;
}

.cache-record-row summary::-webkit-details-marker {
  display: none;
}

.cache-record-time {
  flex: 1 1 136px;
  min-width: 136px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cache-record-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cache-record-hit {
  border-color: rgba(17, 17, 17, 0.2);
  background: rgba(17, 17, 17, 0.9);
  color: #fff;
}

.cache-record-state {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.cache-record-arrow {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  transition: transform 160ms ease;
}

.cache-record-row[open] .cache-record-arrow,
.cache-debug-details[open] > summary .cache-record-arrow {
  transform: rotate(180deg);
}

.cache-hit-meter {
  height: 3px;
  overflow: hidden;
  border-radius: 0;
  background: rgba(17, 17, 17, 0.08);
}

.cache-hit-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #111;
  transition: width 220ms ease;
}

.cache-hit-grid {
  border-radius: var(--radius);
}

.cache-record-detail {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.46);
}

.cache-record-detail-grid {
  border-radius: 8px;
}

.cache-debug-details {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.cache-debug-details > summary {
  min-height: 34px;
  padding: 8px 10px;
}

.cache-layout-details {
  background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 760px) {
  .cache-record-row summary {
    flex-wrap: wrap;
    gap: 7px;
  }

  .cache-record-time {
    flex-basis: 100%;
    min-width: 0;
  }

  .cache-record-state {
    margin-left: auto;
  }
}

.muted-line {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.filter-row > span {
  color: var(--muted);
  font-size: 13px;
  line-height: 30px;
}

.aurex-wall-compose {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.aurex-wall-box {
  cursor: pointer;
}

.aurex-wall-box .trace-card,
.aurex-wall-box .aurex-wall-compose {
  cursor: default;
}

.wall-reply-thread {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.wall-reply-head,
.wall-reply-meta,
.wall-reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.wall-reply-head {
  color: var(--muted);
  font-size: 13px;
}

.wall-reply-list {
  display: grid;
  gap: 8px;
}

.wall-reply-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  padding: 10px;
}

.wall-reply-item.aevi {
  border-color: rgba(50, 70, 95, 0.16);
}

.wall-reply-item.aurex {
  border-color: rgba(60, 120, 86, 0.18);
}

.wall-reply-meta strong {
  font-size: 13px;
  font-weight: 650;
}

.wall-reply-meta span {
  color: var(--muted);
  font-size: 12px;
}

.wall-reply-content {
  overflow-wrap: anywhere;
  font-size: 13.5px;
  line-height: 1.55;
}

.wall-reply-compose {
  display: grid;
  gap: 8px;
}

.wall-reply-compose textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  line-height: 1.5;
}

.aurex-wall-compose-trigger {
  min-height: 36px;
  padding: 0 12px;
  touch-action: manipulation;
}

.wall-compose-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wall-compose-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.wall-compose-field.wide {
  grid-column: 1 / -1;
}

.wall-compose-field input,
.wall-compose-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  outline: none;
  padding: 10px 12px;
}

.wall-compose-field textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.6;
}

.wall-compose-field input:focus,
.wall-compose-field textarea:focus {
  border-color: var(--line-strong);
}

.aurex-wall-compose-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.aurex-wall-compose-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  color: var(--muted);
  font-size: 13px;
}

.aurex-wall-compose-options input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.aevi-wall-filters,
.developer-instructions-card {
  grid-column: 1 / -1;
}

.instruction-pre {
  max-height: 520px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12.5px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.aevi-wall-test-card {
  grid-column: 1 / -1;
}

.test-result-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.test-result-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  cursor: pointer;
  list-style: none;
  padding: 0 10px;
}

.test-result-details > summary::-webkit-details-marker {
  display: none;
}

.test-result-list {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 10px;
}

.test-result-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  padding: 10px;
}

.test-result-item.failed {
  border-color: rgba(154, 46, 50, 0.24);
}

.test-result-item p {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12.5px;
}

@media (prefers-color-scheme: dark) {
  .mini-chip.strong {
    background: rgba(83, 186, 129, 0.14);
    color: #8edcae;
  }

  .trace-details {
    background: rgba(35, 35, 35, 0.5);
  }

  .trace-content-expand {
    background: rgba(35, 35, 35, 0.5);
  }

  .trace-original-expand {
    background: transparent;
  }

  .trace-original-expand .trace-content-full {
    background: rgba(35, 35, 35, 0.58);
  }

  .trace-meta-grid span,
  .trace-meta-grid strong,
  .test-result-item,
    .instruction-pre {
    background: rgba(35, 35, 35, 0.78);
  }
}

@media (max-width: 760px) {
  .trace-list {
    grid-template-columns: 1fr;
  }

  .aevi-wall-category-grid {
    grid-template-columns: 1fr;
  }

  .filter-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .wall-compose-grid {
    grid-template-columns: 1fr;
  }

  .filter-row > span {
    line-height: 1.2;
  }

  .trace-meta-grid {
    grid-template-columns: minmax(78px, 0.52fr) minmax(0, 1fr);
  }
}

.emotion-strip,
.action-grid,
.thread-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emotion-strip button,
.soft-action,
.thread-actions button,
.dark-inline {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  cursor: pointer;
  padding: 0 12px;
}

.dark-inline {
  border: 0;
  background: var(--accent);
  color: var(--accent-text);
}

.dark-inline:disabled {
  cursor: default;
  opacity: 0.55;
}

.soft-action.dashed {
  border-style: dashed;
  color: var(--muted);
}

.thread-list,
.timeline-list {
  display: grid;
  gap: 10px;
}

.calendar-card {
  grid-column: 1 / -1;
  margin-bottom: 12px;
}

.calendar-controls {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.calendar-controls button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  cursor: pointer;
  padding: 0 10px;
  font-size: 13px;
}

.month-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekday {
  display: grid;
  place-items: center;
  min-height: 26px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-day {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 78px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  text-align: left;
}

.calendar-day.empty {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.calendar-day.has-record {
  border-color: rgba(111, 36, 55, 0.18);
  background: rgba(255, 255, 255, 0.82);
}

.calendar-date {
  font-size: 13px;
  font-weight: 680;
}

.calendar-mood {
  min-height: 17px;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.calendar-meta {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

.calendar-heat {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--rose);
  opacity: calc(0.25 + var(--heat) * 0.75);
}

.thread-card {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 12px 0 2px;
}

.thread-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.thread-card h3 {
  margin: 3px 0 4px;
  font-size: 16px;
}

.message-preview {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.message-preview:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.message-preview span {
  color: var(--muted);
  font-size: 13px;
}

.empty-panel {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  line-height: 1.6;
  padding: 12px;
}

.route-notice.inline {
  position: static;
  width: max-content;
  max-width: 100%;
  margin: 0 0 12px;
  transform: none;
}

.timeline-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.timeline-item time {
  color: var(--muted);
  font-size: 13px;
}

.proactive-outbox-item {
  grid-template-columns: 84px minmax(0, 1fr);
}

.proactive-outbox-item time {
  display: grid;
  gap: 2px;
  line-height: 1.2;
}

.proactive-outbox-item time span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.proactive-outbox-item time strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.timeline-item span {
  line-height: 1.55;
}

.species-card {
  display: grid;
  grid-column: span 4;
  gap: 7px;
  min-height: 118px;
  padding: 14px;
}

.species-card strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.chat-page {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chat-status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 38px;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  cursor: pointer;
  padding: 0 18px;
  backdrop-filter: blur(16px);
}

.chat-status-bar span {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.chat-status-bar svg {
  width: 17px;
  height: 17px;
  flex: none;
  transition: transform 180ms ease;
}

.chat-status-bar[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.drawer-scrim {
  position: fixed;
  z-index: 51;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  animation: drawer-scrim-in 160ms ease both;
}

.chat-drawer {
  position: fixed;
  z-index: 52;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(720px, calc(100vw - 36px));
  max-height: min(78dvh, 720px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(26px);
  animation: drawer-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.drawer-handle {
  justify-self: center;
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 10px 0 4px;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 6px 14px 12px;
}

.drawer-head h2 {
  margin: 3px 0 0;
  font-size: 17px;
}

.drawer-content {
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}

.drawer-section {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 16px;
  margin-bottom: 16px;
}

.drawer-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

.drawer-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.drawer-section-head p,
.drawer-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-grid.compact {
  gap: 7px;
}

.tag-pill {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.tag-pill.small {
  min-height: 30px;
  color: var(--muted);
  font-size: 13px;
  padding: 0 11px;
}

.tag-pill.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.tag-pill.readonly {
  cursor: default;
  border-color: transparent;
  background: var(--surface-muted);
  color: var(--muted);
}

.tag-pill:active {
  transform: scale(0.97);
}

.current-task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.task-field {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  padding: 10px;
}

.task-field span {
  color: var(--muted);
  font-size: 12px;
}

.task-field strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 600;
}

.messages-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: min(100%, 820px);
  min-height: 100%;
  margin: 0 auto;
  padding: 34px 18px 40px;
}

.history-load-notice {
  align-self: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  padding: 8px 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.history-load-notice:active {
  transform: translateY(1px);
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 22px;
  color: var(--muted);
  pointer-events: none;
  transition:
    opacity 200ms ease,
    transform 200ms ease;
}

.empty-state.hidden {
  opacity: 0;
  transform: translateY(8px);
}

.aevi-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 20px;
  font-weight: 680;
}

.empty-state h1 {
  margin: 0;
  color: var(--text);
  font-size: 26px;
  font-weight: 680;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}

.message-row {
  position: relative;
  display: flex;
  animation: message-in 260ms ease both;
}

.time-separator {
  align-self: center;
  color: var(--faint);
  font-size: 12px;
  line-height: 1;
  padding: 2px 0 4px;
  text-align: center;
  user-select: none;
}

.message-row.user {
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
}

.message-row.assistant {
  flex-direction: column;
  align-items: stretch;
}

.message {
  max-width: min(680px, 100%);
  line-height: 1.72;
  font-size: 15.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  transform-origin: 50% 50%;
  touch-action: pan-y;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition:
    transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 180ms ease,
    filter 180ms ease;
}

.message.assistant {
  cursor: default;
}

.message.assistant .message-selection-surface {
  display: block;
  max-width: 100%;
  cursor: default;
  touch-action: pan-y;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.message.assistant .message-selectable-text {
  background: transparent;
  cursor: text;
  touch-action: auto;
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

.message.user {
  max-width: min(590px, 86%);
  border-radius: 22px;
  background: var(--user);
  padding: 10px 15px;
}

.message.assistant {
  width: 100%;
  color: var(--text);
}

.message p {
  margin: 0 0 12px;
}

.message p:last-child {
  margin-bottom: 0;
}

.message pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  padding: 12px;
  white-space: pre;
  max-width: 100%;
}

.message code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.attachment-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  padding: 8px;
}

.message.user .attachment-card {
  background: rgba(255, 255, 255, 0.54);
}

.attachment-card.compact {
  width: min(260px, 78vw);
  flex: 0 0 auto;
  box-shadow: var(--soft-shadow);
}

.attachment-image-card {
  position: relative;
  display: inline-block;
  max-width: min(280px, 72vw);
  overflow: hidden;
  border-radius: 22px;
}

.attachment-image-card.compact {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  box-shadow: var(--soft-shadow);
}

.attachment-image-card a {
  display: block;
}

.attachment-image-only {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: inherit;
  background: var(--surface-muted);
}

.attachment-image-card.compact .attachment-image-only {
  width: 96px;
  height: 96px;
}

.attachment-remove.image-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.86);
}

.attachment-thumb {
  width: 74px;
  height: 74px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--surface-muted);
}

.attachment-file-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 700;
}

.attachment-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attachment-info strong,
.attachment-info span,
.attachment-info p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
}

.attachment-info strong,
.attachment-info span {
  white-space: nowrap;
}

.attachment-info span,
.attachment-info p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.attachment-analysis-label {
  color: var(--ink);
  font-weight: 650;
}

.attachment-audio {
  grid-column: 1 / -1;
  width: min(340px, 100%);
}

.attachment-open,
.attachment-remove {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}

.attachment-remove {
  font-size: 20px;
  line-height: 1;
}

.message-tools {
  position: fixed;
  z-index: 42;
  top: 0;
  left: 0;
  display: grid;
  align-items: center;
  min-width: 202px;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, -6px, 0) scale(0.96);
  transform-origin: 50% 0;
  transition:
    opacity 150ms ease,
    transform 190ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
  width: max-content;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 26px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f8f9 100%);
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.24),
    0 3px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  overflow: hidden;
  padding: 12px;
}

.message-tools.tools-open,
.message-tools:focus-within {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.message-row.tools-open,
.message-row.press-pending {
  z-index: 41;
}

.message-row.user.press-pending .message,
.message-row.user.tools-open .message {
  background: #ffffff;
  color: #111113;
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.16),
    0 2px 8px rgba(0, 0, 0, 0.06);
  transform: scale(1.025);
}

.message-row.assistant.press-pending .message,
.message-row.assistant.tools-open .message {
  transform: scale(1.006);
}

.message-row.user .message {
  transform-origin: 100% 50%;
}

.message-row.assistant .message {
  transform-origin: 0 50%;
}

.message-tool-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: #050506;
  cursor: pointer;
  padding: 0 12px;
  text-align: left;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.message-tool-item svg {
  width: 24px;
  height: 24px;
  color: #050506;
}

.message-tool-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  font-weight: 650;
}

.message-tool-item:hover {
  background: rgba(0, 0, 0, 0.045);
}

.message-tool-item:active {
  transform: scale(0.98);
}

.tool-scrim {
  display: none;
  position: fixed;
  z-index: 30;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
}

.tools-active .tool-scrim {
  display: block;
  animation: tools-scrim-in 160ms ease both;
}

.tools-active .message-row:not(.tools-open) {
  opacity: 0.48;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
}

.typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
  animation: pulse 900ms ease-in-out infinite;
}

.typing span:nth-child(2) {
  animation-delay: 120ms;
}

.typing span:nth-child(3) {
  animation-delay: 240ms;
}

.composer-zone {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 0 14px 14px;
}

.tools-active .composer-zone {
  position: relative;
  z-index: 43;
}

.attachment-tray {
  display: flex;
  gap: 8px;
  width: min(100%, 820px);
  margin: 0 auto 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
}

.attachment-tray::-webkit-scrollbar {
  display: none;
}

.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.composer {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  width: 100%;
  max-width: 820px;
  min-width: 0;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px 10px 10px 16px;
  backdrop-filter: blur(22px);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.composer:focus-within {
  border-color: var(--line-strong);
}

.composer textarea {
  width: 100%;
  max-height: 190px;
  min-height: 30px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  line-height: 1.55;
  padding: 4px 0;
}

.composer textarea::placeholder {
  color: var(--faint);
}

.voice-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5px;
  width: 100%;
  min-width: 96px;
  min-height: 34px;
  height: 34px;
  padding: 0 4px;
  overflow: hidden;
  color: #191919;
}

.voice-wave span {
  display: block;
  width: 3px;
  height: 28px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.56;
  transform-origin: center;
  transform: scaleY(0.24);
  transition:
    transform 70ms linear,
    opacity 120ms ease;
}

.composer.recording-mode .voice-wave:not(.live) span {
  animation: voiceIdleWave 920ms ease-in-out infinite;
  animation-delay: calc(var(--i) * -38ms);
}

.composer[data-recording="true"] .voice-wave,
.composer[data-recording="true"] .voice-wave.hidden {
  display: flex !important;
  visibility: visible !important;
  grid-column: 3;
}

.voice-wave.live span {
  animation: none;
}

.composer.recording-mode textarea,
.composer[data-recording="true"] textarea {
  display: none !important;
}

@keyframes voiceIdleWave {
  0%,
  100% {
    transform: scaleY(0.22);
  }
  35% {
    transform: scaleY(0.88);
  }
  62% {
    transform: scaleY(0.38);
  }
}

.composer-actions {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 4px;
}

.composer-icon,
.mode-quick {
  flex: none;
  border: 0;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.composer-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.composer-icon:hover,
.mode-quick:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.composer-icon.recording {
  background: rgba(193, 45, 64, 0.14);
  color: #b51f37;
  animation: recordingPulse 1.1s ease-in-out infinite;
}

@keyframes recordingPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.composer-icon:active,
.mode-quick:active {
  transform: scale(0.96);
}

.mode-quick {
  min-width: 58px;
  height: 34px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
  font-size: 12px;
  padding: 0 10px;
}

.send-button {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  line-height: 0;
  overflow: hidden;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.send-button:disabled {
  cursor: default;
  opacity: 0.34;
}

.stop-icon rect {
  display: none;
}

.send-button svg {
  grid-area: 1 / 1;
  display: block;
  margin: auto;
}

.send-button .stop-icon {
  display: none;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: currentColor;
  stroke: none;
}

.is-streaming .send-button .send-icon {
  display: none;
}

.is-streaming .send-button .stop-icon {
  display: block;
}

.bottom-nav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: var(--bottom-nav-height);
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  padding: 8px max(10px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
}

@media (prefers-color-scheme: dark) {
  .chat-status-bar {
    background: rgba(24, 24, 24, 0.58);
  }

  .chat-drawer {
    background: rgba(32, 32, 32, 0.92);
  }

  .task-field {
    background: rgba(255, 255, 255, 0.04);
  }

  .mode-quick {
    background: rgba(255, 255, 255, 0.08);
  }

  .bottom-nav {
    background: rgba(26, 26, 26, 0.78);
  }
}

.bottom-nav-item {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 50px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 3px;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.bottom-nav-item svg {
  width: 21px;
  height: 21px;
}

.bottom-nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.1;
}

.bottom-nav-item.active {
  background: var(--surface-muted);
  color: var(--text);
}

.mobile-scrim {
  display: none;
}

.voice-call-open {
  overflow: hidden;
}

.voice-call-layer {
  position: fixed;
  z-index: 86;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% 42%, rgba(0, 0, 0, 0.035), transparent 34%),
    var(--bg);
  color: var(--text);
  padding: calc(18px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.voice-call-layer.hidden {
  display: none;
}

.voice-call-head,
.voice-call-foot {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
  width: min(760px, 100%);
  margin: 0 auto;
}

.voice-call-title {
  display: grid;
  gap: 3px;
  text-align: center;
}

.voice-call-title span,
.voice-call-status span {
  color: var(--muted);
  font-size: 12px;
}

.voice-call-title strong {
  font-size: 18px;
  letter-spacing: 0;
}

.voice-call-round,
.voice-call-mic {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(18px);
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.voice-call-round {
  width: 44px;
  height: 44px;
}

.voice-call-round:active,
.voice-call-mic:active {
  transform: scale(0.94);
}

.voice-call-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
}

.voice-call-visual,
.voice-call-subtitles {
  grid-area: 1 / 1;
  width: min(760px, 100%);
  max-height: 100%;
}

.voice-call-visual {
  display: grid;
  place-items: center;
  min-height: min(66dvh, 620px);
}

.voice-call-canvas {
  display: block;
  width: min(78vw, 560px, 66dvh);
  max-width: 100%;
  aspect-ratio: 1;
  height: auto;
  filter: drop-shadow(0 24px 58px rgba(0, 0, 0, 0.18));
  transform: translateZ(0);
  touch-action: manipulation;
}

.voice-call-orb {
  position: relative;
  width: min(42vw, 230px);
  height: min(34vw, 185px);
  filter: drop-shadow(0 22px 50px rgba(0, 0, 0, 0.2));
  animation: callOrbFloat 2800ms ease-in-out infinite;
}

.voice-call-orb span {
  position: absolute;
  inset: 16% 10%;
  border-radius: 46% 54% 52% 48%;
  background: #0b0b0b;
  opacity: 0.96;
  transform-origin: center;
  animation: callOrbMorph 3600ms ease-in-out infinite;
}

.voice-call-orb span:nth-child(2) {
  inset: 8% 24% 20% 2%;
  opacity: 0.88;
  animation-delay: -700ms;
}

.voice-call-orb span:nth-child(3) {
  inset: 18% 0 8% 28%;
  opacity: 0.86;
  animation-delay: -1300ms;
}

.voice-call-orb span:nth-child(4) {
  inset: 5% 16% 26% 18%;
  opacity: 0.78;
  animation-delay: -2100ms;
}

.voice-call-layer[data-state="listening"] .voice-call-orb {
  animation-duration: 1700ms;
}

.voice-call-layer[data-state="responding"] .voice-call-orb,
.voice-call-layer[data-state="speaking"] .voice-call-orb {
  transform: scale(0.82);
  animation-duration: 1200ms;
}

.voice-call-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 86px;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.voice-call-wave span {
  width: 5px;
  height: 54px;
  border-radius: 999px;
  background: #101010;
  transform: scaleY(0.2);
  transform-origin: center;
  animation: callWave 950ms ease-in-out infinite;
  animation-delay: calc(var(--i) * -42ms);
}

.voice-call-layer[data-state="responding"] .voice-call-wave,
.voice-call-layer[data-state="speaking"] .voice-call-wave,
.voice-call-layer[data-state="listening"] .voice-call-wave {
  opacity: 1;
  transform: translateY(0);
}

.voice-call-layer[data-state="listening"] .voice-call-wave span {
  animation-duration: 720ms;
}

.voice-call-subtitles {
  display: none;
  align-self: stretch;
  padding: 8px 0;
  overflow: auto;
  text-align: left;
}

.voice-call-layer[data-mode="subtitle"] .voice-call-visual {
  display: none;
}

.voice-call-layer[data-mode="subtitle"] .voice-call-subtitles {
  display: block;
}

.voice-call-subtitle-list {
  display: grid;
  gap: 12px;
  align-content: end;
  min-height: 100%;
  padding: 10px 0 20px;
}

.voice-call-line {
  display: grid;
  gap: 6px;
  width: min(88%, 620px);
}

.voice-call-line.user {
  justify-self: end;
  text-align: right;
}

.voice-call-line span {
  color: var(--muted);
  font-size: 12px;
}

.voice-call-line p,
.voice-call-empty {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  font-size: clamp(17px, 4.7vw, 24px);
  line-height: 1.55;
  padding: 14px 16px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.07);
  white-space: pre-wrap;
  word-break: break-word;
}

.voice-call-line.live p {
  border-color: rgba(0, 0, 0, 0.28);
}

.voice-call-foot {
  grid-template-columns: 58px minmax(0, 1fr) 58px;
}

.voice-call-mic {
  width: 58px;
  height: 58px;
  background: #111;
  color: #fff;
  border-color: #111;
}

.voice-call-mic .mic-off,
.voice-call-mic.active .mic-on {
  display: none;
}

.voice-call-mic.active .mic-off {
  display: block;
}

.voice-call-mic.active {
  background: #fff;
  color: #111;
  border-color: #111;
}

.voice-call-status {
  display: grid;
  gap: 4px;
  text-align: center;
}

.voice-call-status strong {
  font-size: 15px;
}

#voiceCallAudio {
  display: none;
}

@keyframes callOrbFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-12px) rotate(1deg);
  }
}

@keyframes callOrbMorph {
  0%,
  100% {
    border-radius: 45% 55% 50% 50%;
    transform: scale(1) rotate(0deg);
  }
  33% {
    border-radius: 58% 42% 44% 56%;
    transform: scale(1.08, 0.92) rotate(8deg);
  }
  66% {
    border-radius: 42% 58% 60% 40%;
    transform: scale(0.94, 1.06) rotate(-7deg);
  }
}

@keyframes callWave {
  0%,
  100% {
    transform: scaleY(0.18);
    opacity: 0.42;
  }
  38% {
    transform: scaleY(1);
    opacity: 0.94;
  }
  68% {
    transform: scaleY(0.36);
    opacity: 0.66;
  }
}

.modal-layer {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.22);
  padding: 18px;
}

.modal-card {
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  gap: 12px;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.18);
  padding: 14px;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
}

.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.tag-prompt-card {
  grid-template-rows: auto auto minmax(220px, 1fr) auto auto;
}

.tag-prompt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-prompt-meta span {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 10px;
}

.modal-card textarea {
  width: 100%;
  min-height: 260px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: var(--bg);
  color: var(--text);
  line-height: 1.58;
  padding: 13px;
}

.modal-card textarea:focus {
  border-color: var(--line-strong);
}

.prompt-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.prompt-toggle input {
  width: 18px;
  height: 18px;
}

.memory-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 34px;
  padding: 3px 10px 3px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  background: var(--surface);
}

.memory-switch input {
  appearance: none;
  width: 44px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  position: relative;
  cursor: pointer;
}

.memory-switch input::after {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.16s ease, background 0.16s ease;
}

.memory-switch input:checked {
  background: var(--text);
}

.memory-switch input:checked::after {
  transform: translateX(18px);
  background: var(--surface);
}

.memory-control-stack {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  background: var(--surface);
  color: var(--muted);
}

.status-pill.on {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.status-pill.off {
  background: var(--surface-2);
  color: var(--text);
}

.memory-control-card .trace-meta-grid strong {
  white-space: pre-wrap;
}

.memory-preview-shell {
  grid-column: span 12;
}

.memory-preview-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
}

.memory-preview-card {
  grid-column: span 6;
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 210px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.memory-preview-card h2 {
  margin: 4px 0 8px;
  font-size: 20px;
  line-height: 1.3;
}

.memory-preview-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.memory-preview-card .soft-button {
  justify-self: start;
}

.memory-search-grid {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.memory-search-grid input,
.memory-search-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}

.memory-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.95fr) minmax(320px, 1.25fr);
  gap: 12px;
}

.memory-list-card,
.memory-detail-card {
  grid-column: auto;
}

.memory-record-list {
  display: grid;
  gap: 8px;
  max-height: 68vh;
  overflow: auto;
  padding-right: 2px;
}

.memory-record-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.memory-record-card.active {
  border-color: var(--text);
}

.memory-record-card button {
  display: grid;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding: 12px;
  font: inherit;
}

.memory-record-card strong {
  font-size: 16px;
  line-height: 1.35;
}

.memory-record-card p,
.memory-detail-card p {
  white-space: pre-wrap;
}

.memory-detail-card {
  align-self: start;
}

.memory-detail-card .thread-actions {
  justify-content: flex-end;
}

.memory-legacy-shell {
  width: min(100%, 1180px);
  margin: 0 auto 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  min-height: calc(100dvh - 260px);
}

.memory-legacy-frame {
  display: block;
  width: 100%;
  min-height: calc(100dvh - 260px);
  border: 0;
  background: #fff;
}

.memory-audit-list {
  gap: 10px;
}

.memory-audit-item p {
  white-space: pre-wrap;
  line-height: 1.55;
}

.memory-audit-item .thread-actions {
  flex-wrap: wrap;
}

.music-room-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.music-room-grid > .info-card {
  grid-column: span 6;
}

.music-room-grid > .music-player-card,
.music-room-grid > .music-playlist-card,
.music-room-grid > .music-recent-card,
.music-room-grid > .music-moments-card {
  grid-column: span 12;
}

.music-status-card,
.music-search-card,
.music-player-card,
.music-playlist-card {
  overflow: hidden;
}

.music-status-actions,
.music-overlay-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.music-status-actions .muted-line {
  margin: 0;
}

.music-qr-image {
  width: 160px;
  height: 160px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.music-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.music-search-row input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.music-song-list {
  display: grid;
  gap: 8px;
}

.music-message-card,
.music-song-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.56);
  padding: 9px;
}

.music-message-card {
  margin: 10px 0;
}

.music-cover {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  object-fit: cover;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 750;
}

img.music-cover {
  display: block;
  object-fit: cover;
}

.music-cover.large {
  width: 72px;
  height: 72px;
}

.music-cover-empty {
  font-size: 18px;
}

.music-song-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.music-song-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.music-song-main span,
.music-song-main em {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-style: normal;
}

.music-song-actions,
.music-player-controls,
.music-mini-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.music-icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
}

.music-icon-button.big {
  width: 44px;
  height: 44px;
}

.music-icon-button.dark {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.music-icon-button.danger {
  border-color: rgba(154, 46, 50, 0.24);
  color: #8c2a2e;
}

.music-player-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.music-player-head h2 {
  overflow-wrap: anywhere;
}

.music-player-controls {
  justify-content: center;
}

.music-range {
  width: 100%;
  accent-color: var(--accent);
}

.music-time {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.music-lyrics {
  display: grid;
  gap: 2px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
  padding: 8px;
}

.music-lyrics.compact {
  max-height: 220px;
}

.music-lyrics.empty {
  padding: 14px;
}

.music-lyric-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  padding: 3px;
  text-align: left;
}

.music-lyric-seek {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 0;
  border-radius: calc(var(--radius) - 3px);
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 8px 9px;
  text-align: left;
}

.music-lyric-seek span {
  font-size: 14px;
  line-height: 1.45;
}

.music-lyric-seek em {
  color: var(--faint);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.music-lyric-ask {
  opacity: 0;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 6px 9px;
  font-size: 11px;
  transition: opacity 150ms ease;
}

.music-lyric-line:hover .music-lyric-ask,
.music-lyric-line:focus-within .music-lyric-ask,
.music-lyric-line.active .music-lyric-ask {
  opacity: 0.78;
}

.music-lyric-line.active {
  background: var(--accent);
  color: var(--accent-text);
}

.music-lyric-line.active .music-lyric-seek em {
  color: rgba(255, 255, 255, 0.72);
}

.music-recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.music-shell {
  pointer-events: none;
}

.music-shell.active {
  position: fixed;
  z-index: 44;
  right: 16px;
  bottom: calc(var(--bottom-nav-height) + 14px + env(safe-area-inset-bottom));
  left: calc(var(--sidebar-width) + 16px);
  pointer-events: auto;
}

.music-mini-player {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: min(620px, 100%);
  margin-left: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 7px 9px;
}

.music-mini-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.music-mini-main span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.music-mini-main strong,
.music-mini-main em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-mini-main em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.music-mini-progress {
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 2px;
  overflow: hidden;
  background: transparent;
}

.music-mini-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.music-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: none;
  place-items: end center;
  background: rgba(0, 0, 0, 0.24);
  padding: 18px;
}

.music-shell.overlay-open .music-overlay {
  display: grid;
}

.music-overlay-panel {
  display: grid;
  gap: 12px;
  width: min(760px, 100%);
  max-height: min(82dvh, 760px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.22);
  padding: 14px;
}

.music-overlay-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.music-overlay-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.music-overlay-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.music-moment-list {
  display: grid;
  gap: 8px;
}

.music-moment {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding: 9px 0 0;
}

.music-moment > span,
.music-moment > em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.music-moment p {
  margin: 0;
  line-height: 1.55;
}

.danger-text {
  color: var(--danger) !important;
}

@media (max-width: 760px) {
  .memory-control-card .card-title-row {
    align-items: flex-start;
  }

  .memory-search-grid,
  .memory-workspace {
    grid-template-columns: 1fr;
  }

  .memory-preview-card {
    grid-column: span 12;
    min-height: 0;
  }

  .memory-record-list {
    max-height: none;
  }

  .memory-legacy-shell,
  .memory-legacy-frame {
    min-height: calc(100dvh - 230px);
  }

  .music-room-grid,
  .music-room-grid > .info-card {
    grid-template-columns: 1fr;
    grid-column: span 12;
  }

  .music-search-row {
    grid-template-columns: 1fr;
  }

  .music-song-row,
  .music-message-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .music-song-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .music-shell.active {
    right: 10px;
    bottom: calc(var(--bottom-nav-height) + 12px + env(safe-area-inset-bottom));
    left: 10px;
  }

  .music-mini-player {
    width: 100%;
    border-radius: 18px;
  }

  .music-mini-actions .music-icon-button:not(.dark) {
    display: none;
  }

  .music-overlay {
    padding: 10px;
  }

  .music-overlay-panel {
    max-height: calc(88dvh - env(safe-area-inset-bottom));
    border-radius: 20px;
  }

  .music-lyric-ask {
    opacity: 0.72;
  }

  .music-moment {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .music-moment > em {
    grid-column: 2;
  }

  .focus-stage {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .focus-ring-wrap {
    min-height: 260px;
    border-radius: 20px;
  }

  .focus-ring {
    width: min(72vw, 245px);
  }

  .focus-setting-grid,
  .focus-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .focus-session-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .focus-session-row em {
    grid-column: 1 / -1;
  }
}

.prompt-actions {
  flex-wrap: wrap;
}

.modal-spacer {
  flex: 1 1 auto;
}

.soft-button,
.dark-button {
  min-width: 84px;
  height: 38px;
  border-radius: 999px;
  cursor: pointer;
  padding: 0 16px;
}

.soft-button {
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--text);
}

.dark-button {
  border: 0;
  background: var(--accent);
  color: var(--accent-text);
}

.voice-picker-card {
  grid-column: span 12;
}

.voice-current-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  align-items: baseline;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.54);
  padding: 12px;
}

.voice-current-box span,
.voice-current-box small {
  color: var(--muted);
}

.voice-current-box strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.voice-current-box small {
  grid-column: 2;
}

.voice-preview-audio {
  width: 100%;
  min-height: 40px;
}

.voice-candidate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.voice-candidate-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.56);
  padding: 12px;
}

.voice-candidate-card.current {
  border-color: rgba(0, 0, 0, 0.44);
  background: rgba(0, 0, 0, 0.04);
}

.voice-candidate-card h3 {
  margin: 3px 0 0;
  font-size: 18px;
  line-height: 1.25;
}

.voice-candidate-card p {
  margin: 8px 0 0;
  font-size: 14px;
}

.voice-candidate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.voice-candidate-actions .soft-button,
.voice-candidate-actions .dark-button {
  min-width: 0;
  flex: 1 1 118px;
}

.app-shell[data-active-tab="studyHome"],
.app-shell[data-active-tab="studyTodo"] {
  display: block;
  background: #fff;
}

.app-shell[data-active-tab="studyHome"] .sidebar,
.app-shell[data-active-tab="studyTodo"] .sidebar,
.app-shell[data-active-tab="studyHome"] .topbar,
.app-shell[data-active-tab="studyTodo"] .topbar {
  display: none;
}

.app-shell[data-active-tab="studyHome"] .main-area,
.app-shell[data-active-tab="studyTodo"] .main-area {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
  background: #fff;
}

.app-shell[data-active-tab="studyHome"] .page-host,
.app-shell[data-active-tab="studyTodo"] .page-host {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 calc(112px + env(safe-area-inset-bottom));
  background: #fff;
  color: #151515;
  animation: studyPageIn 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.app-shell[data-active-tab="studyHome"] .page-host > *,
.app-shell[data-active-tab="studyTodo"] .page-host > * {
  width: 100%;
  max-width: none;
}

.app-shell[data-active-tab="studyHome"] .bottom-nav,
.app-shell[data-active-tab="studyTodo"] .bottom-nav {
  position: fixed;
  z-index: 40;
  right: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(332px, calc(100vw - 56px));
  min-height: 66px;
  transform: translateX(50%);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  padding: 7px;
}

.app-shell[data-active-tab="studyHome"] .bottom-nav-item,
.app-shell[data-active-tab="studyTodo"] .bottom-nav-item {
  min-height: 50px;
  border-radius: 999px;
  color: #575757;
}

.app-shell[data-active-tab="studyHome"] .bottom-nav-item.active,
.app-shell[data-active-tab="studyTodo"] .bottom-nav-item.active {
  background: #efefef;
  color: #111;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.study-root {
  display: block;
  width: min(480px, 100%);
  margin-right: auto;
  margin-left: auto;
  padding-bottom: 10px;
  color: #151515;
  animation: studyPageIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.study-root .study-hero {
  border-radius: 8px 8px 0 0;
  padding-top: 24px;
}

.study-root .study-editor-page,
.study-root .study-duration-page,
.study-root .study-todo-page {
  min-height: min(760px, calc(100dvh - 190px));
}

.study-root .study-todo-page {
  padding-bottom: 24px;
}

.study-local-nav {
  position: sticky;
  z-index: 12;
  bottom: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: min(248px, calc(100% - 42px));
  margin: 16px auto 0;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.12);
  padding: 6px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.study-local-nav button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #5a5a5a;
  cursor: pointer;
  padding: 4px 8px;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.study-local-nav button.active {
  background: #111;
  color: #fff;
}

.study-local-nav button:active {
  transform: scale(0.96);
}

.study-local-nav svg {
  width: 19px;
  height: 19px;
}

.study-local-nav span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 760;
}

.study-hero {
  display: grid;
  gap: 26px;
  min-height: 246px;
  background: #111;
  color: #fff;
  padding: calc(24px + env(safe-area-inset-top)) 22px 28px;
}

.study-hero-top,
.study-schedule-head,
.study-page-head,
.study-month-row,
.study-date-actions,
.study-modal-actions,
.study-todo-sheet-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.study-dday {
  min-width: 64px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 760;
  padding: 6px 10px;
}

.study-date-button,
.study-grid-button,
.study-total-clock,
.study-schedule-head button,
.study-page-head button,
.study-duration-total,
.study-summary-strip,
.study-plan-todo-add,
.study-schedule-actions button,
.study-round,
.study-add-todo-wide {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  transition:
    transform 170ms ease,
    opacity 170ms ease,
    background 170ms ease,
    color 170ms ease;
}

.study-date-button {
  color: #fff;
  font-size: 17px;
  font-weight: 760;
}

.study-grid-button,
.study-round {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
}

.study-grid-button:hover,
.study-round:hover,
.study-schedule-actions button:hover {
  background: rgba(0, 0, 0, 0.06);
}

.study-hero .study-grid-button:hover,
.study-hero .study-round:hover {
  background: rgba(255, 255, 255, 0.1);
}

.study-total-clock {
  justify-self: center;
  color: #f7f7f7;
  font-size: clamp(54px, 14vw, 76px);
  font-weight: 520;
  letter-spacing: 0;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.study-live-hint {
  justify-self: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
}

.study-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid #ededed;
  background: #fff;
}

.study-tab {
  position: relative;
  min-height: 58px;
  border: 0;
  background: #fff;
  color: #9a9a9a;
  cursor: pointer;
  font-size: 16px;
  font-weight: 680;
}

.study-tab::after {
  content: "";
  position: absolute;
  right: 34%;
  bottom: 0;
  left: 34%;
  height: 3px;
  border-radius: 999px;
  background: #111;
  opacity: 0;
  transform: scaleX(0.4);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.study-tab.active {
  color: #151515;
}

.study-tab.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.study-list,
.study-edit-list,
.study-todo-list,
.study-timeline-list {
  display: grid;
  gap: 0;
  background: #fff;
}

.study-subject-row,
.study-edit-row,
.study-todo-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  min-height: 70px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.035);
  padding: 8px 22px;
}

.study-subject-row strong,
.study-edit-row strong,
.study-todo-row strong {
  overflow: hidden;
  color: #1b1b1b;
  font-size: 20px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-play {
  display: grid;
  place-items: center;
  width: 30.4px;
  height: 30.4px;
  border: 0;
  border-radius: 999px;
  background: var(--subject);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--subject) 26%, transparent);
}

.study-play.active {
  outline: 3px solid rgba(0, 0, 0, 0.09);
  transform: scale(1.05);
}

.study-play svg {
  width: 15.2px;
  height: 15.2px;
  stroke-width: 2.5;
}

.study-row-time {
  border: 0;
  background: transparent;
  color: #151515;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.study-dot-menu {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #171717;
  cursor: pointer;
}

.study-edit-subjects {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-self: start;
  min-height: 38px;
  margin: 26px 22px;
  border: 0;
  border-radius: 8px;
  background: #eeeeee;
  color: #4b4b4b;
  cursor: pointer;
  padding: 0 13px;
}

.study-stats,
.study-soft-panel {
  margin: 20px;
}

.study-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.study-stats article,
.study-soft-panel {
  border: 1px solid #ededed;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.035);
}

.study-stats article {
  display: grid;
  gap: 8px;
  min-height: 110px;
  padding: 14px;
}

.study-stats span,
.study-stats em,
.study-soft-panel p {
  color: #858585;
  font-size: 13px;
  font-style: normal;
}

.study-stats strong {
  font-size: 30px;
  line-height: 1;
}

.study-soft-panel {
  padding: 16px;
}

.study-soft-panel h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.study-soft-panel p {
  margin: 0;
  line-height: 1.65;
}

.study-editor-page,
.study-duration-page,
.study-todo-page {
  min-height: calc(100dvh - 112px);
  background: #f7f7fb;
  padding: calc(20px + env(safe-area-inset-top)) 24px 24px;
}

.study-page-head {
  min-height: 46px;
  margin-bottom: 18px;
}

.study-page-head h1 {
  margin: 0;
  font-size: 19px;
}

.study-page-head > span {
  width: 38px;
}

.study-back {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #111;
}

.study-edit-list {
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
}

.study-edit-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 74px;
  padding: 8px 24px;
}

.study-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--subject);
}

.study-add-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 56px;
  border: 0;
  border-top: 1px solid #ececec;
  background: #fff;
  color: #333;
  cursor: pointer;
  padding: 0 20px;
}

.study-add-row span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #f1f1f1;
  color: #555;
  font-size: 24px;
  font-weight: 300;
}

.study-archive {
  margin: 28px 2px 0;
  color: #30303a;
  font-weight: 700;
}

.study-archive-section {
  display: grid;
  gap: 8px;
  margin-top: 26px;
}

.study-archive-section h2 {
  margin: 0 2px 4px;
  color: #30303a;
  font-size: 16px;
}

.study-archive-section .study-archive {
  margin: 0 2px;
  color: #888;
  font-size: 14px;
  font-weight: 600;
}

.study-archive-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  border-radius: 8px;
  background: #fff;
  padding: 8px 14px;
}

.study-archive-row button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: #eeeeee;
  color: #333;
  cursor: pointer;
  padding: 0 12px;
}

.study-modal-backdrop,
.study-sheet-backdrop {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.52);
  padding: 18px;
  animation: studyFadeIn 180ms ease both;
}

.study-subject-modal,
.study-date-modal,
.study-record-modal,
.study-dday-modal,
.study-delete-confirm,
.study-action-sheet,
.study-bottom-sheet,
.study-todo-sheet {
  width: min(440px, 100%);
  background: #f7f7f7;
  color: #161616;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
}

.study-subject-modal {
  display: grid;
  gap: 18px;
  border-radius: 28px;
  padding: 20px;
  animation: studyPopIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.study-dday-modal,
.study-delete-confirm {
  display: grid;
  gap: 20px;
  border-radius: 24px;
  background: #fff;
  padding: 22px;
  animation: studyPopIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.study-dday-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.study-dday-modal header span {
  color: #777;
  font-size: 13px;
  font-weight: 720;
}

.study-dday-modal h2,
.study-delete-confirm h2 {
  margin: 3px 0 0;
  font-size: 23px;
}

.study-dday-modal > label {
  display: grid;
  gap: 8px;
  color: #444;
  font-size: 14px;
  font-weight: 700;
}

.study-dday-modal input {
  width: 100%;
  min-height: 50px;
  border: 1px solid #dddddd;
  border-radius: 10px;
  outline: none;
  background: #fafafa;
  color: #111;
  font: inherit;
  font-size: 17px;
  padding: 0 13px;
}

.study-dday-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  border-radius: 10px;
  background: #f2f2f2;
  padding: 0 14px;
}

.study-dday-preview span,
.study-delete-confirm p {
  color: #666;
}

.study-dday-preview strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.study-delete-confirm p {
  margin: 0;
  line-height: 1.65;
}

.study-action-list button.danger,
.study-modal-actions button.danger {
  color: #c62828;
}

.study-modal-actions button.danger {
  background: #c62828;
  color: #fff;
}

.study-record-modal {
  display: grid;
  gap: 18px;
  border-radius: 28px;
  background: #fff;
  padding: 22px;
  animation: studyPopIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.study-record-modal header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
}

.study-record-modal h2,
.study-record-modal h3 {
  margin: 0;
}

.study-record-modal h2 {
  text-align: center;
  font-size: 18px;
}

.study-record-modal h3 {
  font-size: 22px;
}

.study-record-line,
.study-record-time-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid #eeeeee;
  color: #111;
}

.study-record-line > span,
.study-record-time-row > strong {
  font-size: 17px;
  font-weight: 760;
}

.study-record-line button,
.study-record-line select,
.study-record-time-row input {
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #222;
  font: inherit;
  text-align: right;
}

.study-record-line button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  cursor: pointer;
}

.study-record-line i {
  width: 5px;
  height: 22px;
  border-radius: 999px;
  background: var(--subject);
}

.study-record-line em {
  color: #9b9b9b;
  font-style: normal;
}

.study-record-time-row input {
  font-size: 30px;
  font-weight: 320;
}

.study-record-actions {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  padding-top: 6px;
}

.study-record-actions button {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: #111;
  cursor: pointer;
  font-size: 16px;
  font-weight: 720;
  padding: 0 4px;
}

.study-action-sheet {
  display: grid;
  gap: 12px;
  border-radius: 20px 20px 0 0;
  background: #f7f7f7;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: studySheetIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.study-action-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 4px;
}

.study-action-head span {
  width: 6px;
  height: 26px;
  border-radius: 999px;
  background: var(--subject);
}

.study-action-head strong {
  font-size: 18px;
}

.study-action-list {
  display: grid;
  gap: 8px;
}

.study-action-list button,
.study-action-cancel {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #111;
  cursor: pointer;
  font-size: 16px;
  font-weight: 720;
  padding: 0 16px;
}

.study-action-list svg {
  width: 21px;
  height: 21px;
}

.study-action-cancel {
  justify-content: center;
  margin-top: 4px;
  background: #ececec;
}

.study-subject-modal header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
}

.study-subject-modal h2 {
  margin: 0;
  text-align: center;
  font-size: 18px;
}

.study-round {
  background: rgba(0, 0, 0, 0.04);
  color: #111;
}

.study-round.strong {
  opacity: 0.72;
}

.study-subject-name-input,
.study-line-input,
.study-todo-title-input,
.study-summary-note {
  width: 100%;
  border: 0;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: #151515;
  padding: 0 14px;
}

.study-subject-name-input {
  min-height: 52px;
  font-size: 17px;
}

.study-color-current {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  border-radius: 8px;
  background: #fff;
  padding: 0 18px;
}

.study-color-current i {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--subject);
}

.study-color-pop {
  display: grid;
  gap: 18px;
  border-radius: 26px;
  background: #fff;
  padding: 22px 18px 16px;
}

.study-color-pop h3 {
  margin: 0;
  font-size: 19px;
}

.study-color-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 15px;
}

.study-color-choice {
  display: grid;
  place-items: center;
  width: 52px;
  max-width: 100%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 999px;
  background: var(--subject);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--subject) 28%, transparent);
}

.study-color-choice.active {
  transform: scale(1.08);
}

.study-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.study-modal-actions button {
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  background: #e8e8e8;
  color: #111;
  cursor: pointer;
  font-size: 16px;
}

.study-modal-actions button:last-child {
  background: #111;
  color: #fff;
}

.study-schedule {
  position: relative;
  min-height: calc(100dvh - 112px);
  background: #fff;
  padding-bottom: 96px;
}

.study-schedule-head {
  min-height: 96px;
  border-bottom: 1px solid #eeeeee;
  padding: calc(18px + env(safe-area-inset-top)) 36px 14px;
}

.study-schedule-head button {
  color: #161616;
  font-size: 24px;
  font-weight: 610;
}

.study-schedule-total {
  font-weight: 720 !important;
}

.study-summary-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  border-bottom: 1px solid #eeeeee;
  padding: 0 22px;
}

.study-summary-strip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.study-summary-strip span,
.study-summary-strip em {
  color: #1d1d1d;
  font-size: 15px;
  font-style: normal;
  font-weight: 760;
}

.study-schedule-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42%;
  gap: 12px;
  min-height: 780px;
  padding: 18px 14px 20px 18px;
}

.study-plan-list {
  display: grid;
  align-content: start;
  gap: 0;
}

.study-plan-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border-bottom: 1px solid #f0f0f0;
}

.study-plan-row span {
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: var(--subject);
}

.study-plan-row strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-plan-row em {
  color: #666;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.study-plan-todo-add {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  justify-self: start;
  gap: 8px;
  min-height: 42px;
  color: #8d8d8d;
}

.study-plan-todo-add span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #f1f1f1;
  color: #888;
  font-size: 22px;
  line-height: 1;
}

.study-plan-todo {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: #676767;
}

.study-grid-timeline {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  min-height: 760px;
  border: 1px solid #ececec;
  background: #fff;
}

.study-hour-labels {
  position: relative;
  border-right: 1px solid #eeeeee;
  color: #969696;
  font-size: 12px;
}

.study-hour-labels span {
  position: absolute;
  left: 9px;
  transform: translateY(-50%);
}

.study-hour-grid {
  position: relative;
  overflow: hidden;
  background-image:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.055) 1px, transparent 1px),
    linear-gradient(to right, rgba(0, 0, 0, 0.055) 1px, transparent 1px);
  background-size: 100% calc(100% / 24), calc(100% / 6) 100%;
}

.study-schedule-block {
  position: absolute;
  top: var(--top);
  left: calc(2% + var(--lane) * 18%);
  width: 18%;
  height: var(--height);
  min-height: 6px;
  border: 0;
  border-radius: 2px;
  background: color-mix(in srgb, var(--subject) 74%, #fff);
  cursor: pointer;
  opacity: 0.9;
}

.study-schedule-actions {
  position: fixed;
  z-index: 42;
  right: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 44px 44px 76px 52px;
  align-items: center;
  gap: 12px;
  width: min(430px, 100%);
  transform: translateX(50%);
  pointer-events: none;
  padding: 0 24px;
}

.study-schedule-actions button {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
}

.study-sheet-backdrop {
  align-items: end;
  padding: 0;
}

.study-bottom-sheet,
.study-todo-sheet {
  display: grid;
  gap: 18px;
  width: min(480px, 100%);
  border-radius: 12px 12px 0 0;
  background: #f7f7fb;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  animation: studySheetIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.study-bottom-sheet h2 {
  margin: 0;
  text-align: center;
  font-size: 21px;
}

.study-sheet-label {
  display: grid;
  gap: 10px;
  color: #171717;
  font-size: 17px;
  font-weight: 760;
}

.study-dday-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.study-dday-row button,
.study-todo-controls button,
.study-todo-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid #d6dbe0;
  border-radius: 8px;
  background: #fbffff;
  color: #222;
  cursor: pointer;
  padding: 0 14px;
}

.study-range {
  width: 100%;
  accent-color: #111;
}

.study-line-input {
  min-height: 48px;
  font-size: 17px;
}

.study-summary-note {
  min-height: 82px;
  resize: none;
  padding: 12px 14px;
}

.study-save-wide {
  min-height: 56px;
  border: 0;
  border-radius: 7px;
  background: #111;
  color: #fff;
  cursor: pointer;
  font-size: 17px;
  font-weight: 760;
}

.study-date-modal {
  display: grid;
  gap: 22px;
  border-radius: 28px;
  background: #eef3f6;
  padding: 24px 28px 20px;
  animation: studyPopIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.study-date-modal > span {
  color: #30363a;
  font-size: 15px;
  font-weight: 680;
}

.study-picked-date {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 22px;
}

.study-picked-date strong {
  font-size: clamp(36px, 11vw, 52px);
  font-weight: 420;
  letter-spacing: 0;
}

.study-picked-date button,
.study-month-row button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #3c464c;
  cursor: pointer;
}

.study-month-row strong {
  margin-right: auto;
  color: #5a646a;
  font-size: 17px;
  font-weight: 720;
}

.study-week-row,
.study-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
}

.study-week-row {
  color: #30383d;
  font-size: 16px;
  font-weight: 680;
}

.study-calendar-grid {
  gap: 8px 6px;
}

.study-calendar-grid button,
.study-calendar-grid span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #2e363b;
  cursor: pointer;
  font-size: 18px;
}

.study-calendar-grid button.active {
  background: #111;
  color: #fff;
}

.study-date-actions {
  justify-content: flex-end;
  padding-top: 18px;
}

.study-date-actions button {
  min-width: 64px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #1b1b1b;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}

.study-duration-page {
  background: #fff;
}

.study-duration-page .study-page-head {
  margin-bottom: 24px;
}

.study-duration-page .study-page-head button:not(.study-back) {
  font-size: 18px;
  font-weight: 680;
}

.study-duration-total {
  display: block;
  width: 100%;
  margin: 18px 0 28px;
  color: #111;
  font-size: 44px;
  font-weight: 450;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.study-duration-page h2 {
  margin: 0 0 18px;
  text-align: center;
  font-size: 17px;
}

.study-timeline-list {
  gap: 10px;
  background: transparent;
}

.study-gap-row,
.study-timeline-card {
  margin-left: 28px;
}

.study-gap-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 44px;
  border-radius: 6px;
  background: #f1f1f1;
  color: #777;
  padding: 0 12px;
}

.study-gap-row button {
  border: 0;
  background: transparent;
  color: #555;
  cursor: pointer;
  font-size: 22px;
}

.study-timeline-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 112px;
  border: 1px solid #dedede;
  border-radius: 7px;
  background: #fff;
  padding: 16px 14px;
}

.study-timeline-card::before,
.study-gap-row::before {
  content: "";
  position: absolute;
  left: -18px;
  width: 1px;
  background: #dadada;
}

.study-timeline-card i {
  width: 8px;
  min-height: 48px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--subject) 72%, #fff);
}

.study-timeline-card div {
  display: grid;
  gap: 5px;
}

.study-timeline-card strong {
  font-size: 19px;
}

.study-timeline-card span {
  color: #555;
  font-size: 18px;
}

.study-timeline-card em {
  color: #7c7c7c;
  font-size: 13px;
  font-style: normal;
}

.study-timeline-card button {
  border: 0;
  background: transparent;
  color: #777;
}

.study-todo-page {
  background: #fff;
}

.study-todo-page .study-page-head {
  margin-bottom: 8px;
}

.study-todo-page .study-page-head button:not(.study-back) {
  font-size: 18px;
  font-weight: 720;
}

.study-todo-list {
  gap: 8px;
  padding: 10px 0 18px;
}

.study-todo-row {
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  min-height: 62px;
  border: 1px solid #ededed;
  border-radius: 8px;
  padding: 10px 12px;
}

.study-todo-row input {
  width: 20px;
  height: 20px;
  accent-color: #111;
}

.study-todo-row > span {
  width: 5px;
  height: 28px;
  border-radius: 999px;
  background: var(--subject);
}

.study-todo-row em {
  color: #777;
  font-size: 13px;
  font-style: normal;
}

.study-add-todo-wide {
  width: 100%;
  min-height: 52px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-weight: 760;
}

.study-empty {
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1px dashed #d8d8d8;
  border-radius: 8px;
  color: #888;
}

.study-todo-sheet {
  gap: 8px;
  border-radius: 20px 20px 0 0;
  background: #f2f2f4;
  padding-top: 18px;
}

.study-todo-date {
  color: #555;
  font-size: 13px;
  font-weight: 700;
}

.study-todo-title-input {
  min-height: 42px;
  background: transparent;
  color: #111;
  font-size: 22px;
  padding: 0;
}

.study-todo-title-input::placeholder {
  color: #999;
}

.study-todo-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 14px;
}

.study-todo-controls button,
.study-todo-controls label {
  justify-content: center;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #555;
  padding: 0 4px;
}

.study-todo-controls span {
  width: 25px;
  height: 25px;
  border-radius: 7px;
  background: var(--subject);
}

.study-todo-controls input {
  width: 74px;
  border: 0;
  outline: none;
  background: transparent;
  color: #333;
  text-align: center;
}

.study-todo-sheet-actions {
  padding-top: 14px;
}

.study-todo-sheet-actions button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #e8e8e8;
  color: #111;
  cursor: pointer;
  padding: 0 18px;
}

.study-todo-sheet-actions button:last-child {
  background: #111;
  color: #fff;
}

.study-date-button:active,
.study-grid-button:active,
.study-total-clock:active,
.study-play:active,
.study-tab:active,
.study-dot-menu:active,
.study-round:active,
.study-schedule-actions button:active,
.study-add-todo-wide:active {
  transform: scale(0.96);
}

@keyframes studyPageIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes studyFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes studyPopIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes studySheetIn {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes tools-scrim-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes drawer-scrim-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 761px) {
  .app-shell[data-sidebar-open="false"] {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .app-shell[data-sidebar-open="false"] .sidebar {
    overflow: hidden;
    padding-left: 0;
    padding-right: 0;
    border-right: 0;
  }
}

@media (max-width: 920px) {
  .feature-card,
  .info-card {
    grid-column: span 12;
  }

  .species-card {
    grid-column: span 6;
  }
}

@media (max-width: 760px) {
  :root {
    --bottom-nav-height: 72px;
  }

  body {
    background:
      radial-gradient(circle at 50% -18%, rgba(255, 255, 255, 0.96), transparent 32%),
      linear-gradient(180deg, #ffffff 0%, #fbfbfa 56%, var(--bg) 100%);
  }

  .app-shell {
    display: block;
    height: 100dvh;
  }

  .main-area {
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    width: min(84vw, var(--sidebar-width));
    transform: translateX(-102%);
    transition: transform 220ms ease;
    backdrop-filter: none;
  }

  .app-shell[data-sidebar-open="true"] .sidebar {
    transform: translateX(0);
  }

  .app-shell[data-sidebar-open="true"] + .mobile-scrim {
    display: block;
    position: fixed;
    z-index: 45;
    inset: 0;
    background: rgba(0, 0, 0, 0.22);
  }

  .only-mobile {
    display: grid;
  }

  .topbar {
    min-height: 48px;
    align-items: flex-end;
    padding: env(safe-area-inset-top) 14px 4px;
  }

  .topbar > .icon-button,
  .topbar .title-stack,
  .topbar .top-actions {
    margin-bottom: 0;
  }

  .topbar .icon-button {
    width: 36px;
    height: 36px;
  }

  .app-title {
    font-size: 18px;
    line-height: 1.12;
  }

  .app-subtitle {
    margin-top: 4px;
    line-height: 1.15;
  }

  .page-host {
    padding: 16px 14px 22px;
  }

  .page-hero {
    padding-top: 8px;
  }

  .page-hero h1 {
    font-size: 32px;
  }

  .dashboard-grid,
  .species-grid {
    gap: 10px;
  }

  .breath-protocol-grid {
    grid-template-columns: 1fr;
  }

  .breath-protocol-card {
    min-height: 0;
  }

  .breath-stage {
    grid-template-columns: 1fr;
  }

  .breath-orb-wrap {
    min-height: 184px;
  }

  .breath-orb {
    width: 132px;
    height: 132px;
  }

  .breath-readout h2 {
    font-size: 22px;
  }

  .breath-clock {
    font-size: 46px;
  }

  .species-card {
    grid-column: span 12;
    min-height: 94px;
  }

  .feature-card,
  .info-card,
  .species-card {
    backdrop-filter: none;
  }

  .status-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .moment-grid,
  .moment-city-row {
    grid-template-columns: 1fr;
  }

  .section-heading-row,
  .copy-block {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .voice-candidate-grid {
    grid-template-columns: 1fr;
  }

  .voice-current-box {
    grid-template-columns: 1fr;
  }

  .voice-current-box small {
    grid-column: auto;
  }

  .proactive-row {
    grid-template-columns: 1fr;
  }

  .month-calendar {
    gap: 4px;
  }

  .calendar-day {
    min-height: 58px;
    padding: 6px;
  }

  .calendar-mood {
    font-size: 11px;
  }

  .calendar-meta {
    display: none;
  }

  .chat-status-bar {
    min-height: 36px;
    padding: 0 12px;
  }

  .chat-status-bar span {
    font-size: 12.5px;
  }

  .chat-drawer {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(78dvh, 680px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }

  .drawer-content {
    padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  }

  .current-task-grid {
    grid-template-columns: 1fr;
  }

  .messages {
    gap: 22px;
    padding: 24px 18px 34px;
  }

  .message-row {
    /* 抑制进场动画要用 duration: 0s，不能用 animation: none —— none 之后
       重新赋值的动画浏览器不保证重播（webview-native-feel README 坑 13）。 */
    animation-duration: 0s;
  }

  .message {
    font-size: 15px;
  }

  .message.user {
    max-width: 88%;
  }

  .composer-zone {
    padding: 0 12px 10px;
  }

  .composer {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 5px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    backdrop-filter: none;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.1);
    padding: 8px;
  }

  .composer-actions {
    gap: 2px;
    max-width: 100%;
  }

  .composer-icon,
  .icon-button.subtle,
  .send-button {
    width: 32px;
    height: 32px;
  }

  .mode-quick {
    min-width: 48px;
    max-width: 56px;
    height: 32px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    padding: 0 8px;
  }

  .send-button .stop-icon {
    width: 12.5px;
    height: 12.5px;
    border-radius: 4px;
  }

  .bottom-nav {
    min-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding-top: 6px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .bottom-nav-item span {
    font-size: 11.5px;
  }

  .modal-layer {
    align-items: end;
    padding: 10px;
  }

  .modal-card {
    max-height: calc(100vh - 24px);
    border-radius: 20px;
    grid-template-rows: auto minmax(280px, 1fr) auto;
  }

  .modal-card textarea {
    min-height: 340px;
  }
}

.pinned-thread-input,
.pinned-thread-textarea {
  width: 100%;
  border: 0;
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: #151515;
  padding: 10px 14px;
}

.pinned-thread-input {
  min-height: 44px;
}

.pinned-thread-textarea {
  margin-top: 8px;
  resize: vertical;
  line-height: 1.6;
}

/* 置顶线程卡片：白字长进度在 pre-wrap 下会按最长一行撑开 grid 轨道，
   把卡片顶出容器右边。这里只约束置顶线程这一页，不动记忆维护页共用的样式。 */
.pinned-thread-list,
.pinned-thread-item,
.pinned-thread-item > *,
.pinned-thread-item .test-result-details > * {
  min-width: 0;
  max-width: 100%;
}

.pinned-thread-item {
  /* 单列轨道按内容 max-content 算宽会把卡片顶出容器，锁成可收缩的一列。 */
  grid-template-columns: minmax(0, 1fr);
}

.pinned-thread-item .trace-meta-grid {
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
}

.pinned-thread-item p {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* iCloud 定位：真实轮询、设备选择、轨迹与常用地点。 */
.location-status-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  padding: 13px 15px;
}

.location-status-strip > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.location-status-strip small {
  color: var(--muted);
  line-height: 1.45;
}

.location-status-strip button,
.location-place-form button,
.location-device-card select,
.location-map-actions a {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  padding: 0 13px;
  text-decoration: none;
}

.location-status-strip button:disabled,
.location-place-form button:disabled {
  cursor: default;
  opacity: 0.46;
}

.location-status-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #b49a66;
  box-shadow: 0 0 0 5px rgba(180, 154, 102, 0.12);
}

.location-status-dot.connected {
  background: #4f8b68;
  box-shadow: 0 0 0 5px rgba(79, 139, 104, 0.14);
}

.location-status-dot.error,
.location-status-dot.auth_required {
  background: #a65959;
  box-shadow: 0 0 0 5px rgba(166, 89, 89, 0.12);
}

.location-error {
  color: #8b353b;
}

.location-dashboard {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.location-dashboard > .info-card {
  grid-column: span 6;
}

.location-dashboard > .location-current-card,
.location-dashboard > .location-history-card {
  grid-column: span 6;
}

.location-dashboard > .location-device-card,
.location-dashboard > .location-disconnect-card {
  grid-column: span 12;
}

.location-device-card {
  grid-template-columns: minmax(0, 1fr) minmax(210px, 0.55fr);
  align-items: center;
}

.location-device-card select {
  width: 100%;
  background: var(--surface-solid);
}

.location-login-card {
  grid-column: span 12;
}

.location-login-grid,
.location-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.location-login-grid label,
.location-login-row label,
.location-place-form label,
.location-settings-grid label {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.location-login-grid input,
.location-login-row input,
.location-place-form input,
.location-settings-grid input {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--surface-solid);
  color: var(--text);
  padding: 0 11px;
}

.location-login-grid input:focus,
.location-login-row input:focus,
.location-place-form input:focus,
.location-settings-grid input:focus {
  border-color: rgba(102, 74, 89, 0.5);
  box-shadow: 0 0 0 3px rgba(102, 74, 89, 0.08);
}

.location-consent-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 13px;
}

.location-consent-row label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.location-login-row {
  display: grid;
  grid-template-columns: minmax(0, 280px) auto;
  align-items: end;
  gap: 10px;
}

.location-freshness {
  flex: none;
  border-radius: 999px;
  background: rgba(79, 139, 104, 0.12);
  color: #37694d;
  padding: 6px 9px;
  font-size: 12px;
}

.location-freshness.stale {
  background: rgba(166, 89, 89, 0.12);
  color: #8b353b;
}

.location-address {
  overflow-wrap: anywhere;
}

.location-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.location-metric-grid > div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.4);
  padding: 11px;
}

.location-metric-grid span,
.location-nearby > span {
  color: var(--muted);
  font-size: 12px;
}

.location-metric-grid strong {
  font-size: 18px;
}

.location-metric-grid small {
  color: var(--muted);
  line-height: 1.35;
}

.location-nearby {
  display: grid;
  gap: 8px;
}

.location-map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.location-map-actions a {
  display: inline-flex;
  align-items: center;
}

.location-map-actions a.dark-inline {
  border: 0;
  background: var(--accent);
  color: var(--accent-text);
}

.location-coordinates dl {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
}

.location-coordinates dl > div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
}

.location-coordinates dt {
  color: var(--muted);
}

.location-coordinates dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.location-track-map {
  width: 100%;
  height: auto;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 20% 15%, rgba(134, 165, 147, 0.16), transparent 36%),
    linear-gradient(145deg, rgba(248, 246, 244, 0.95), rgba(239, 236, 234, 0.75));
}

.location-map-grid {
  fill: none;
  stroke: rgba(88, 76, 84, 0.09);
  stroke-width: 0.8;
}

.location-track-line {
  fill: none;
  stroke: url("#locationTrackGradient");
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.location-track-end {
  fill: #4f7865;
  stroke: #fff;
  stroke-width: 2.2;
}

.location-track-empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  padding: 30px 14px;
  text-align: center;
}

.location-track-empty.compact {
  padding: 15px 12px;
}

.location-event-list,
.location-place-list {
  display: grid;
  gap: 8px;
}

.location-event-list > div,
.location-place-list > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.location-event-list small,
.location-place-list small {
  color: var(--muted);
}

.location-event-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #8e7b86;
}

.location-event-dot.arrival {
  background: #4f8b68;
}

.location-event-dot.departure {
  background: #aa735f;
}

.location-place-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(115px, 0.42fr) auto;
  align-items: end;
  gap: 8px;
}

.location-place-form label:nth-child(2) {
  grid-template-columns: minmax(0, 1fr) auto;
}

.location-place-form label:nth-child(2) span {
  grid-column: 1 / -1;
}

.location-place-form label:nth-child(2) small {
  align-self: center;
}

.location-place-list > div {
  grid-template-columns: minmax(0, 1fr) auto;
}

.location-place-list > div > span {
  display: grid;
  gap: 2px;
}

.location-settings-grid small {
  line-height: 1.35;
}

@media (max-width: 760px) {
  .location-dashboard > .info-card,
  .location-dashboard > .location-current-card,
  .location-dashboard > .location-history-card {
    grid-column: span 12;
  }

  .location-device-card,
  .location-login-grid,
  .location-login-row,
  .location-settings-grid,
  .location-place-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .location-status-strip {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .location-status-strip button {
    grid-column: 1 / -1;
  }

  .location-metric-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .location-track-map {
    min-height: 140px;
  }
}

/* ── 来电卡 ───────────────────────────────────────────────
   他打过来的时候，整个屏幕只剩这一件事。 */
.incoming-call-layer {
  position: fixed;
  z-index: 96;
  inset: 0;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
}

.incoming-call-layer.hidden {
  display: none;
}

.incoming-call-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 20, 0.28);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  backdrop-filter: blur(16px) saturate(1.1);
}

.incoming-call-card {
  position: relative;
  width: min(88vw, 330px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 24px 26px;
  border-radius: 28px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.24);
  color: var(--text);
  animation: incomingCallIn 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}

@keyframes incomingCallIn {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

.incoming-call-kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
}

.incoming-call-kind i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rose);
  animation: incomingCallBlink 1.4s ease-in-out infinite;
}

@keyframes incomingCallBlink {
  50% { opacity: 0.25; }
}

.incoming-call-avatar {
  position: relative;
  width: 104px;
  height: 104px;
  margin-top: 22px;
  display: grid;
  place-items: center;
}

.incoming-call-face {
  position: relative;
  z-index: 2;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-ink);
  color: #fff;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 1px;
}

.incoming-call-ripple {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1.5px solid var(--rose);
  opacity: 0.55;
  animation: incomingCallRipple 2.2s ease-out infinite;
}

.incoming-call-ripple.r2 { animation-delay: 0.7s; }
.incoming-call-ripple.r3 { animation-delay: 1.4s; }

@keyframes incomingCallRipple {
  from { transform: scale(1); opacity: 0.7; }
  to { transform: scale(1.55); opacity: 0; }
}

.incoming-call-name {
  font-size: 20px;
  font-weight: 600;
  margin-top: 20px;
  letter-spacing: 1px;
}

.incoming-call-reason {
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 10px;
  text-align: center;
}

.incoming-call-countdown {
  font-size: 12px;
  color: var(--faint);
  margin-top: 8px;
  min-height: 16px;
}

.incoming-call-dock {
  margin-top: 22px;
  display: flex;
  gap: 56px;
}

.incoming-call-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.incoming-call-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease;
}

.incoming-call-button:active .incoming-call-icon {
  transform: scale(0.92);
}

.incoming-call-icon svg {
  width: 26px;
  height: 26px;
}

.incoming-call-button.accept .incoming-call-icon {
  background: var(--rose);
  color: #fff;
}

.incoming-call-button.decline .incoming-call-icon {
  background: var(--surface-muted);
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.incoming-call-label {
  font-size: 12px;
  color: var(--muted);
}

.incoming-call-quick {
  margin-top: 16px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
  animation: incomingCallFade 0.25s ease both;
}

.incoming-call-quick.hidden {
  display: none;
}

@keyframes incomingCallFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.incoming-call-chips {
  display: flex;
  gap: 7px;
  justify-content: center;
  flex-wrap: wrap;
}

.incoming-call-chip {
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.incoming-call-note-row {
  display: flex;
  gap: 7px;
}

.incoming-call-note-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.incoming-call-send {
  padding: 9px 15px;
  border-radius: 999px;
  border: 0;
  background: var(--rose);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.incoming-call-skip {
  border: 0;
  background: none;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
  padding: 2px;
  cursor: pointer;
}

/* 留恋窗口：最后一句念完了，线还没断，她随时可以把他叫回来。 */
.voice-call-layer[data-state="lingering"] .voice-call-status strong {
  color: var(--rose);
}

@media (prefers-color-scheme: dark) {
  .incoming-call-backdrop {
    background: rgba(0, 0, 0, 0.5);
  }

  .incoming-call-card {
    background: rgba(32, 32, 34, 0.96);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.6);
  }

  .incoming-call-face {
    background: rgba(255, 255, 255, 0.12);
  }

  .incoming-call-chip,
  .incoming-call-button.decline .incoming-call-icon {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
  }

  .incoming-call-note-row input {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
  }
}
