:root {
  --bg-deep: #051119;
  --bg-mid: rgba(10, 30, 40, 0.86);
  --bg-card: rgba(7, 22, 31, 0.8);
  --bg-card-strong: rgba(10, 28, 40, 0.92);
  --line-soft: rgba(194, 235, 228, 0.14);
  --line-strong: rgba(194, 235, 228, 0.3);
  --text-main: #f1fbf7;
  --text-soft: #c2d8d4;
  --text-dim: #83a29d;
  --accent-mint: #a8edd5;
  --accent-sand: #f3d59a;
  --accent-water: #93cfe3;
  --accent-calm: #89d3db;
  --accent-playful: #92e48f;
  --accent-reflective: #d7c7ff;
  --accent-sharp: #f6a47d;
  --accent-neutral: #c7d6db;
  --shadow-deep: 0 22px 70px rgba(0, 0, 0, 0.32);
  --radius-card: 28px;
  --radius-pill: 999px;
  --font-display: "Iowan Old Style", "Baskerville", "Palatino Linotype", "Songti SC", "STSong", Georgia, serif;
  --font-body: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Segoe UI", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  color: var(--text-main);
  background:
    radial-gradient(circle at 8% 14%, rgba(138, 199, 218, 0.16), transparent 24%),
    radial-gradient(circle at 86% 18%, rgba(240, 209, 141, 0.16), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(157, 231, 205, 0.16), transparent 28%),
    linear-gradient(180deg, #041119 0%, var(--bg-deep) 50%, #0c1f2c 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(18px);
}

body::before {
  top: 4rem;
  left: 4rem;
  width: 16rem;
  height: 16rem;
  background: radial-gradient(circle, rgba(157, 231, 205, 0.16), transparent 70%);
}

body::after {
  right: 3rem;
  bottom: 3rem;
  width: 24rem;
  height: 24rem;
  background: radial-gradient(circle, rgba(138, 199, 218, 0.14), transparent 70%);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(5, 18, 26, 0.68);
  box-shadow: var(--shadow-deep);
  backdrop-filter: blur(16px);
}

.utility-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.utility-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(168, 237, 213, 0.18);
  background: linear-gradient(135deg, rgba(168, 237, 213, 0.14), rgba(147, 207, 227, 0.08));
  color: var(--accent-mint);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.utility-note {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.locale-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.locale-label {
  color: var(--text-dim);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.locale-buttons {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  gap: 4px;
}

.locale-button {
  appearance: none;
  border: none;
  min-width: 74px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  transition:
    color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.locale-button:hover,
.locale-button:focus-visible {
  color: var(--text-main);
  outline: none;
  transform: translateY(-1px);
}

.locale-button[data-active='true'] {
  color: #062029;
  background: linear-gradient(135deg, var(--accent-mint), #d7fff0);
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise-in 720ms cubic-bezier(0.18, 0.76, 0.29, 1) forwards;
}

.reveal:nth-of-type(2) {
  animation-delay: 80ms;
}

.reveal:nth-of-type(3) {
  animation-delay: 140ms;
}

.reveal:nth-of-type(4) {
  animation-delay: 180ms;
}

.masthead,
.panel,
.stat-card,
.current-hero {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-deep);
  backdrop-filter: blur(14px);
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 22px;
  padding: 28px;
  border-radius: 34px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(9, 25, 34, 0.84), rgba(7, 20, 29, 0.72)),
    radial-gradient(circle at 82% 18%, rgba(240, 209, 141, 0.12), transparent 20%);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-mint);
}

.masthead h1,
.panel h2,
.current-hero h2,
.gateway-card h3 {
  font-family: var(--font-display);
}

.masthead h1 {
  margin: 0;
  max-width: 10ch;
  font-size: clamp(2.7rem, 4vw, 4.9rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.intro {
  max-width: 58ch;
  margin: 18px 0 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.button,
.locale-button,
.badge,
.meta-pill,
.type-pill,
.tone-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-soft);
  font: inherit;
}

.button {
  cursor: pointer;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.button-primary {
  background: linear-gradient(135deg, rgba(157, 231, 205, 0.18), rgba(138, 199, 218, 0.14));
}

.badge,
.meta-pill,
.type-pill,
.tone-chip {
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.84rem;
}

.badge[data-tone='ok'] {
  color: var(--accent-playful);
}

.badge[data-tone='error'] {
  color: var(--accent-sharp);
}

.current-hero {
  position: relative;
  border-radius: var(--radius-card);
  padding: 24px;
  overflow: hidden;
}

.current-hero::before {
  content: "";
  position: absolute;
  inset: auto -20% 18% -20%;
  height: 84px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(138, 199, 218, 0.26), rgba(157, 231, 205, 0.3), transparent);
  transform: rotate(-9deg);
  animation: tide-drift 16s linear infinite;
}

.current-hero > * {
  position: relative;
  z-index: 1;
}

.current-hero h2 {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 0.95;
}

.current-summary {
  margin: 14px 0 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.meta-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.current-window {
  margin: 16px 0 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.stat-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
  padding: 22px;
  border-radius: var(--radius-card);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: auto -12% 0 auto;
  width: 55%;
  height: 65%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 237, 213, 0.12), transparent 70%);
  pointer-events: none;
}

.stat-card strong {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
}

.stat-card span {
  color: var(--text-soft);
  line-height: 1.6;
}

.guide-strip {
  margin-top: 22px;
  padding: 24px;
  border-radius: var(--radius-card);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-deep);
  backdrop-filter: blur(14px);
}

.guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.guide-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.02;
}

.guide-note {
  max-width: 38ch;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.guide-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-card-strong);
}

.guide-card h3 {
  margin: 0;
  font-size: 1rem;
}

.guide-card p {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.65;
  font-size: 0.92rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.82fr);
  gap: 22px;
  margin-top: 22px;
}

.thread-deck {
  display: grid;
  grid-template-columns: minmax(300px, 0.84fr) minmax(0, 1.16fr);
  gap: 22px;
  margin-top: 22px;
}

.side-stack {
  display: grid;
  gap: 22px;
}

.panel {
  border-radius: var(--radius-card);
  padding: 24px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.02;
}

.panel-note {
  max-width: 24ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: right;
}

.feed-list,
.gateway-list,
.thread-root-list {
  display: grid;
  gap: 14px;
}

.condition-panel {
  display: grid;
  gap: 14px;
}

.feed-item,
.gateway-card,
.thread-root-card,
.thread-note,
.condition-panel,
.empty-state {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  background: var(--bg-card-strong);
}

.feed-item,
.gateway-card,
.thread-root-card,
.thread-note,
.condition-panel {
  padding: 18px;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.feed-item:hover,
.gateway-card:hover,
.thread-root-card:hover,
.thread-note:hover,
.condition-panel:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(11, 31, 42, 0.96);
}

.empty-state {
  padding: 22px;
  color: var(--text-soft);
  line-height: 1.6;
}

.feed-topline,
.feed-bottomline,
.gateway-topline,
.gateway-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.feed-topline time,
.gateway-meta,
.scene-tag {
  color: var(--text-dim);
  font-size: 0.84rem;
}

.feed-summary,
.feed-detail,
.gateway-bio {
  margin: 12px 0 0;
  line-height: 1.65;
}

.condition-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.condition-summary p,
.condition-time {
  margin: 0;
  line-height: 1.65;
}

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

.condition-item {
  padding: 12px 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.condition-item span,
.condition-time {
  color: var(--text-dim);
  font-size: 0.84rem;
}

.condition-item strong {
  display: block;
  margin-top: 6px;
}

.feed-detail {
  color: var(--text-soft);
}

.feed-gateway {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.feed-gateway span {
  color: var(--text-dim);
}

.thread-shell,
.thread-stack {
  display: grid;
  gap: 14px;
}

.thread-root-card[data-active='true'] {
  border-color: rgba(168, 237, 213, 0.32);
  background: rgba(12, 34, 45, 0.98);
}

.thread-root-copy {
  display: grid;
  gap: 10px;
}

.thread-root-preview,
.thread-note-body,
.thread-note-meta,
.thread-note-summary {
  margin: 0;
  line-height: 1.65;
}

.thread-note-summary,
.thread-root-preview {
  color: var(--text-soft);
}

.thread-note-meta {
  color: var(--text-dim);
  font-size: 0.88rem;
}

.thread-note.is-reply {
  margin-left: 26px;
}

.thread-note-head,
.thread-root-head,
.thread-note-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.thread-note-actions {
  justify-content: flex-start;
}

.thread-panel {
  min-height: 280px;
}

.thread-author {
  margin: 0;
  color: var(--accent-mint);
}

.thread-window-note {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.inline-button {
  appearance: none;
  border: 1px solid rgba(168, 237, 213, 0.18);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(168, 237, 213, 0.08);
  color: var(--accent-mint);
  cursor: pointer;
  font: inherit;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.inline-button:hover,
.inline-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(168, 237, 213, 0.32);
  background: rgba(168, 237, 213, 0.12);
  outline: none;
}

.inline-button[data-active='true'] {
  color: #062029;
  background: linear-gradient(135deg, var(--accent-mint), #d7fff0);
}

.system-gateway {
  color: var(--accent-water);
}

.gateway-card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.gateway-handle {
  margin: 6px 0 0;
  color: var(--accent-mint);
}

.gateway-meta {
  margin-top: 14px;
}

.tone-calm {
  color: var(--accent-calm);
}

.tone-playful {
  color: var(--accent-playful);
}

.tone-reflective {
  color: var(--accent-reflective);
}

.tone-sharp {
  color: var(--accent-sharp);
}

.tone-neutral {
  color: var(--accent-neutral);
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tide-drift {
  from {
    transform: translateX(-4%) rotate(-9deg);
  }
  to {
    transform: translateX(4%) rotate(-9deg);
  }
}

@media (max-width: 1024px) {
  .utility-bar {
    border-radius: 30px;
  }

  .masthead,
  .content-grid,
  .thread-deck,
  .stat-band,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .panel-note {
    text-align: left;
  }

  .condition-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 20px, 1320px);
    padding-top: 18px;
  }

  .utility-bar,
  .utility-copy,
  .locale-switch {
    align-items: flex-start;
  }

  .utility-bar {
    flex-direction: column;
    padding: 16px;
  }

  .masthead,
  .panel,
  .guide-strip,
  .current-hero,
  .stat-card {
    padding: 20px;
    border-radius: 24px;
  }

  .masthead h1 {
    max-width: none;
    font-size: 2.6rem;
  }

  .hero-actions,
  .meta-row,
  .guide-head,
  .feed-topline,
  .feed-bottomline,
  .thread-note-head,
  .thread-root-head,
  .gateway-topline,
  .gateway-meta {
    align-items: flex-start;
  }

  .button,
  .locale-button,
  .badge,
  .meta-pill,
  .type-pill,
  .tone-chip {
    width: 100%;
    justify-content: flex-start;
  }
}
