/* Strata Aurora Glass — a reversible presentation layer.
   Loaded after the upstream stylesheets; it changes no application behaviour. */

:root,
[data-theme="light"] {
  --st-font: "Outfit", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    "Noto Sans CJK SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --st-font-mono: "Cascadia Code", "SFMono-Regular", "SF Mono", Consolas,
    "Liberation Mono", monospace;
  --st-bg: #eef6f4;
  --st-surface: rgba(255, 255, 255, 0.82);
  --st-surface-2: rgba(237, 246, 245, 0.82);
  --st-line: rgba(54, 96, 101, 0.17);
  --st-line-soft: rgba(54, 96, 101, 0.10);
  --st-ink: #14282c;
  --st-ink-soft: #29464a;
  --st-ink-muted: #60777a;
  --st-icon: #315a5f;
  --st-accent: #0f9f7a;
  --st-accent-hover: #087b5e;
  --st-accent-ink: #ffffff;
  --st-accent-tint: rgba(15, 159, 122, 0.12);
  --st-accent-text: #087b5e;
  --st-focus: #486de8;
  --st-info: #147ee7;
  --st-info-tint: rgba(20, 126, 231, 0.10);
  --st-info-text: #095ca8;
  --st-warn: #d88b0d;
  --st-warn-tint: rgba(216, 139, 13, 0.11);
  --st-warn-text: #875408;
  --st-danger: #d3344d;
  --st-danger-tint: rgba(211, 52, 77, 0.10);
  --st-danger-text: #a72138;
  --st-code-bg: #122226;
  --st-code-ink: #e8f3f0;
  --st-sh-card: 0 18px 50px rgba(32, 75, 80, 0.07),
    0 2px 8px rgba(32, 75, 80, 0.05);
  --st-sh-bar: 0 28px 70px rgba(24, 74, 78, 0.16),
    0 3px 12px rgba(24, 74, 78, 0.08);
  --st-sh-pop: 0 24px 70px rgba(24, 62, 70, 0.20),
    0 2px 8px rgba(24, 62, 70, 0.08);
  color-scheme: light;
}

[data-theme="dark"] {
  --st-bg: #071016;
  --st-surface: rgba(14, 26, 34, 0.80);
  --st-surface-2: rgba(24, 42, 50, 0.72);
  --st-line: rgba(154, 210, 205, 0.15);
  --st-line-soft: rgba(154, 210, 205, 0.08);
  --st-ink: #eefcf8;
  --st-ink-soft: #c8ddd9;
  --st-ink-muted: #8fa9a8;
  --st-icon: #b8d6d2;
  --st-accent: #55e6b3;
  --st-accent-hover: #75f3c7;
  --st-accent-ink: #03271d;
  --st-accent-tint: rgba(85, 230, 179, 0.12);
  --st-accent-text: #75f3c7;
  --st-focus: #94a6ff;
  --st-info: #60b8ff;
  --st-info-tint: rgba(96, 184, 255, 0.12);
  --st-info-text: #8dceff;
  --st-warn: #f3b94f;
  --st-warn-tint: rgba(243, 185, 79, 0.12);
  --st-warn-text: #ffd276;
  --st-danger: #ff657a;
  --st-danger-tint: rgba(255, 101, 122, 0.12);
  --st-danger-text: #ff9baa;
  --st-code-bg: #071015;
  --st-code-ink: #e9f8f4;
  --st-sh-card: 0 18px 52px rgba(0, 0, 0, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
  --st-sh-bar: 0 30px 80px rgba(0, 0, 0, 0.44),
    0 2px 12px rgba(0, 0, 0, 0.28);
  --st-sh-pop: 0 28px 90px rgba(0, 0, 0, 0.60),
    0 3px 10px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

html,
body {
  background: var(--st-bg);
}

body {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(1000px 700px at 10% -15%, rgba(31, 191, 153, 0.18), transparent 63%),
    radial-gradient(900px 650px at 100% 6%, rgba(76, 103, 232, 0.15), transparent 66%),
    radial-gradient(800px 560px at 50% 115%, rgba(22, 153, 175, 0.10), transparent 68%),
    var(--st-bg);
}

[data-theme="light"] body {
  background:
    radial-gradient(1100px 720px at 5% -18%, rgba(69, 207, 174, 0.22), transparent 61%),
    radial-gradient(900px 660px at 102% 8%, rgba(108, 132, 244, 0.15), transparent 66%),
    radial-gradient(740px 560px at 48% 118%, rgba(37, 161, 182, 0.12), transparent 69%),
    var(--st-bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(125, 188, 183, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 188, 183, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

.st-header {
  background: color-mix(in srgb, var(--st-surface) 88%, transparent);
  border-bottom-color: var(--st-line);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(22px) saturate(135%);
  -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.st-header__brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding-left: 19px;
  font-size: 19px;
  letter-spacing: 0.025em;
}

.st-header__brand::before {
  content: "";
  position: absolute;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 4px 10px 4px 10px;
  background: linear-gradient(140deg, #76f6cb, #5d84ff);
  box-shadow: 0 0 22px rgba(85, 230, 179, 0.58);
  transform: rotate(-8deg);
}

.st-tabs {
  padding: 4px;
  background: color-mix(in srgb, var(--st-surface-2) 74%, transparent);
  border-color: var(--st-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(14px);
}

.st-tab {
  white-space: nowrap;
  border-radius: 10px;
  transition:
    color var(--st-dur) var(--st-ease),
    background var(--st-dur) var(--st-ease),
    box-shadow var(--st-dur) var(--st-ease);
}

.st-tab[aria-selected="true"] {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--st-surface) 94%, white 6%), var(--st-surface));
  color: var(--st-accent-text);
  box-shadow:
    0 5px 16px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.st-card,
.st-composer,
.chat-sidebar,
.st-drawer {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--st-surface) 96%, white 4%), var(--st-surface));
  border-color: var(--st-line);
  box-shadow: var(--st-sh-card);
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
}

.st-card {
  transition:
    border-color 180ms var(--st-ease),
    transform 180ms var(--st-ease),
    box-shadow 180ms var(--st-ease);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--st-accent) 28%, var(--st-line));
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.chat-empty {
  position: relative;
  animation: aurora-rise 480ms var(--st-ease) both;
}

.chat-empty::before {
  content: "LOCAL INTELLIGENCE  ·  本地推理";
  display: block;
  width: fit-content;
  margin: 0 auto 18px;
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--st-accent) 32%, var(--st-line));
  border-radius: var(--st-r-pill);
  background: color-mix(in srgb, var(--st-accent-tint) 72%, transparent);
  color: var(--st-accent-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.chat-empty__title {
  font-size: clamp(38px, 4.4vw, 58px);
  letter-spacing: -0.045em;
  background: linear-gradient(110deg, var(--st-ink) 18%, var(--st-accent-text) 65%, #83a4ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 10px 30px rgba(50, 210, 174, 0.08));
}

.chat-empty__sub {
  width: fit-content;
  max-width: 100%;
  margin: 18px auto 0;
  padding: 8px 13px;
  border: 1px solid var(--st-line-soft);
  border-radius: var(--st-r-pill);
  background: color-mix(in srgb, var(--st-surface-2) 64%, transparent);
  color: var(--st-ink-muted);
  font-size: var(--st-fs-sm);
  backdrop-filter: blur(12px);
}

.st-composer {
  position: relative;
  border-color: color-mix(in srgb, var(--st-accent) 22%, var(--st-line));
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--st-surface) 98%, white 2%), var(--st-surface));
  box-shadow: var(--st-sh-bar);
}

.st-composer::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(120deg, rgba(85, 230, 179, 0.55), transparent 35%, rgba(105, 128, 255, 0.42));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.72;
}

.st-composer:focus-within {
  border-color: color-mix(in srgb, var(--st-accent) 70%, var(--st-line));
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.38),
    0 0 0 3px color-mix(in srgb, var(--st-accent) 12%, transparent);
}

.st-btn--primary {
  background: linear-gradient(135deg, var(--st-accent), #5ec8fb);
  color: var(--st-accent-ink);
  box-shadow:
    0 10px 25px rgba(32, 201, 162, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
}

.st-btn--primary:hover {
  background: linear-gradient(135deg, var(--st-accent-hover), #73d9ff);
  box-shadow:
    0 12px 28px rgba(32, 201, 162, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

.st-message,
.st-msg--assistant .st-bubble {
  backdrop-filter: blur(16px);
}

.st-msg--assistant .st-bubble {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--st-surface) 96%, white 4%), var(--st-surface));
  border-color: var(--st-line);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.09);
}

.st-msg--user .st-bubble {
  background: linear-gradient(135deg, #15a984, #1385a9);
  box-shadow:
    0 12px 32px rgba(12, 137, 133, 0.19),
    inset 0 1px 0 rgba(255, 255, 255, 0.20);
}

.st-progress {
  border-color: transparent;
  background: color-mix(in srgb, var(--st-surface-2) 75%, transparent);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.st-progress__bar {
  background: linear-gradient(90deg, var(--st-accent), #62c8ff);
  box-shadow: 0 0 12px color-mix(in srgb, var(--st-accent) 32%, transparent);
}

.st-badge {
  border-color: var(--st-line-soft);
}

.st-table th {
  letter-spacing: 0.075em;
}

.st-table tr:hover td {
  background: color-mix(in srgb, var(--st-accent-tint) 35%, transparent);
}

.st-input {
  background: color-mix(in srgb, var(--st-surface-2) 62%, transparent);
  border-width: 1px;
}

.st-input:focus {
  background: var(--st-surface);
}

.st-drawer {
  box-shadow: -24px 0 80px rgba(0, 0, 0, 0.44);
}

.chat-sidebar {
  border-right-color: var(--st-line);
}

.scrim {
  background: rgba(2, 12, 18, 0.44);
  backdrop-filter: blur(5px);
}

#lang-btn {
  min-width: 44px;
  padding: 0 10px;
  color: var(--st-accent-text);
  border-color: color-mix(in srgb, var(--st-accent) 34%, var(--st-line));
  background: var(--st-accent-tint);
  font-size: var(--st-fs-xs);
  font-weight: var(--st-fw-bold);
  letter-spacing: 0.04em;
}

#lang-btn:hover {
  background: color-mix(in srgb, var(--st-accent-tint) 70%, var(--st-surface));
}

/* Hardware overview */
.overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--st-s-3);
  padding-inline: 2px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--st-ink-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.live-indicator > span:first-child {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--st-accent);
  box-shadow: 0 0 0 4px var(--st-accent-tint), 0 0 14px var(--st-accent);
  animation: live-pulse 2.2s ease-in-out infinite;
}

.hardware-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1.34fr) minmax(0, 1fr);
  gap: var(--st-s-4);
}

.sys-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 18px;
}

.sys-card::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -76px;
  top: -92px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--st-accent-tint), transparent 68%);
  pointer-events: none;
}

.sys-card[data-tone="warn"] {
  border-color: color-mix(in srgb, var(--st-warn) 42%, var(--st-line));
}

.sys-card[data-tone="danger"] {
  border-color: color-mix(in srgb, var(--st-danger) 52%, var(--st-line));
}

.sys-card__head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
}

.sys-card__title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--st-ink);
  font-size: var(--st-fs-sm);
  font-weight: 700;
}

.sys-card__glyph {
  display: inline-grid;
  place-items: center;
  min-width: 35px;
  height: 24px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--st-accent) 30%, var(--st-line));
  border-radius: 7px;
  background: var(--st-accent-tint);
  color: var(--st-accent-text);
  font: 700 9px/1 var(--st-font-mono);
  letter-spacing: 0.06em;
}

.fan-glyph {
  min-width: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 17px;
  line-height: 1;
}

.sys-chip {
  max-width: 48%;
  overflow: hidden;
  padding: 4px 8px;
  border: 1px solid var(--st-line-soft);
  border-radius: var(--st-r-pill);
  background: color-mix(in srgb, var(--st-surface-2) 68%, transparent);
  color: var(--st-ink-muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sys-hero {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 13px;
}

.sys-hero strong {
  color: var(--st-ink);
  font-size: 35px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.sys-hero span {
  min-width: 0;
  overflow: hidden;
  color: var(--st-ink-muted);
  font: 500 11px/1.35 var(--st-font-mono);
  text-align: right;
  text-overflow: ellipsis;
}

.sys-progress {
  height: 6px;
  border: 0;
}

.sys-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.sys-facts > span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--st-ink-muted);
  font-size: 10px;
}

.sys-facts b {
  overflow: hidden;
  color: var(--st-ink-soft);
  font-size: var(--st-fs-xs);
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sys-facts--stack {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.sys-facts--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.io-facts {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--st-line-soft);
}

.sys-facts--stack > span {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--st-s-3);
}

.sys-facts--stack b {
  text-align: right;
}

.core-meter {
  display: grid;
  grid-template-columns: repeat(16, minmax(2px, 1fr));
  gap: 3px;
  height: 42px;
  margin-top: 14px;
  align-items: end;
}

.core-meter__bar {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 3px;
  background: color-mix(in srgb, var(--st-surface-2) 82%, transparent);
}

.core-meter__bar > i {
  position: absolute;
  inset: auto 0 0;
  min-height: 2px;
  border-radius: inherit;
  background: linear-gradient(to top, var(--st-accent), #66cfff);
  transition: height 350ms var(--st-ease);
}

.core-meter__bar[data-hot="true"] > i {
  background: linear-gradient(to top, var(--st-warn), #f1ca62);
}

.fan-readings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 17px;
  min-height: 54px;
}

.fan-reading {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 30px;
}

.fan-rotor {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--st-accent);
  animation: fan-spin var(--fan-duration, 2.4s) linear infinite;
}

.fan-reading__name {
  overflow: hidden;
  color: var(--st-ink-soft);
  font-size: var(--st-fs-xs);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fan-reading__name small {
  display: block;
  color: var(--st-ink-muted);
  font: 400 9px/1.4 var(--st-font-mono);
}

.fan-reading strong {
  color: var(--st-ink);
  font-size: 17px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.fan-reading strong small {
  margin-left: 3px;
  color: var(--st-ink-muted);
  font-size: 9px;
  font-weight: 500;
}

.fan-empty {
  color: var(--st-ink-muted);
  font-size: var(--st-fs-xs);
}

.compact-facts {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--st-line-soft);
}

.sys-note {
  margin: 9px 0 0;
  color: var(--st-ink-muted);
  font-size: 9px;
  line-height: 1.45;
}

@keyframes live-pulse {
  50% {
    opacity: 0.45;
    box-shadow: 0 0 0 2px var(--st-accent-tint);
  }
}

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

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--st-ink-muted) 40%, transparent);
  background-clip: padding-box;
}

@keyframes aurora-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1180px) {
  .hardware-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 955px) {
  #lang-btn {
    min-width: 38px;
    padding: 0 7px;
  }
}

@media (max-width: 640px) {
  .st-header__brand {
    padding-left: 16px;
  }

  .chat-empty::before {
    margin-bottom: 13px;
    font-size: 9px;
  }

  .chat-empty__title {
    font-size: clamp(36px, 11vw, 48px);
  }

  .chat-empty__sub {
    border-radius: var(--st-r-md);
  }

  .st-card,
  .st-composer,
  .st-drawer {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .hardware-overview {
    grid-template-columns: minmax(0, 1fr);
  }

  .sys-card {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .st-header__brand {
    display: none;
  }

  #lang-btn {
    display: none;
  }
}
