:root {
  color-scheme: light;
  --bg: #f2f0ec;
  --paper: #fffdf9;
  --panel: rgba(255, 253, 249, .88);
  --text: #1f2522;
  --muted: #66716b;
  --line: rgba(48, 56, 52, .16);
  --line-strong: rgba(48, 56, 52, .28);
  --accent: #357e6f;
  --danger: #c95761;
  --ink-soft: #33423d;
  --mood-a: #ee8c6b;
  --mood-b: #49a078;
  --mood-c: #fff6ee;
  --shadow: 0 14px 40px rgba(54, 47, 38, .08);
  --soft-shadow: 0 1px 2px rgba(54, 47, 38, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--mood-c) 72%, #ffffff), rgba(245, 248, 244, .82) 42%, #f1f4f7 100%),
    var(--bg);
  color: var(--text);
  font: 14px/1.48 "Noto Sans SC", "Microsoft YaHei UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .82);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
  box-shadow: var(--soft-shadow);
}

button:hover {
  border-color: var(--line-strong);
  background: #ffffff;
}

button:disabled {
  cursor: wait;
  opacity: .6;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 248, 243, .84);
  backdrop-filter: blur(16px);
}

.brand {
  display: grid;
  grid-template-columns: 30px minmax(0, auto);
  column-gap: 10px;
  align-items: center;
}

.brandMark {
  grid-row: span 2;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(31, 37, 34, .18);
  border-radius: 50%;
  background: conic-gradient(from 210deg, #d85f6a, #f2b84b, #49a078, #5c9ded, #7f6bdc, #d85f6a);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .72), 0 6px 20px rgba(60, 44, 80, .16);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 24px;
  font-weight: 760;
  line-height: 1.05;
}

h2 {
  font-size: 16px;
  font-weight: 760;
}

h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

p,
.label {
  color: var(--muted);
}

.auth {
  display: flex;
  align-items: center;
  gap: 8px;
}

.buttonGroup {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth input {
  width: 240px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .88);
  padding: 0 10px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, .95fr) minmax(360px, 1.25fr);
  gap: 14px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 18px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.moodSurface {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--mood-a) 24%, #ffffff), rgba(255, 255, 255, .84) 42%),
    var(--panel);
}

.overview,
.settings {
  grid-column: span 1;
}

.weather,
.relationship,
.thoughts,
.consolidation,
.activity {
  grid-column: span 2;
}

.panelHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.pill,
.moodBadge {
  min-width: 72px;
  border-radius: 999px;
  padding: 5px 11px;
  text-align: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--mood-a), var(--mood-b));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--mood-a) 25%, transparent);
}

.pill.muted,
.moodBadge.muted {
  color: var(--muted);
  background: #e9ece8;
  box-shadow: none;
}

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

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

.smallMetrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 12px;
}

.metrics div,
.weatherTile {
  min-width: 0;
  border: 1px solid rgba(48, 56, 52, .12);
  border-radius: 6px;
  padding: 10px;
  background: rgba(255, 255, 255, .58);
}

.metrics strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 13px;
}

.syncLine {
  margin-top: 10px;
  border-left: 4px solid var(--mood-a);
  padding: 8px 10px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .48);
  border-radius: 0 6px 6px 0;
}

.switchList {
  display: grid;
  gap: 10px;
}

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

.switchRow input {
  width: 36px;
  height: 20px;
  accent-color: var(--accent);
}

.switchRow strong {
  display: block;
}

.switchRow p {
  margin-top: 2px;
  font-size: 12px;
}

.sourceBadge {
  color: var(--muted);
  font-size: 12px;
}

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

.weatherTile {
  border-color: color-mix(in srgb, var(--mood-a) 24%, var(--line));
}

.weatherTile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.weatherTile strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 3px;
}

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

.gaugeLabel {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted);
}

.gauge {
  position: relative;
  height: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(90deg, #dce4f8, #eef0e8 48%, #fdebd6);
}

.gauge .zero {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: rgba(24, 32, 38, .34);
}

.fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  background: linear-gradient(90deg, #49a078, #f2b84b);
}

.fill.hot {
  background: linear-gradient(90deg, #f2b84b, #ef6f6c);
}

.fill.neg {
  left: auto;
  right: 50%;
  background: linear-gradient(90deg, #7f6bdc, #5c9ded);
}

.weatherText {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 112px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .62);
  padding: 12px;
  color: var(--ink-soft);
}

.curveWrap {
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .74), rgba(255, 255, 255, .36)),
    linear-gradient(135deg, rgba(239, 111, 108, .11), rgba(73, 160, 120, .12) 45%, rgba(111, 125, 232, .12));
  padding: 8px;
}

#relationshipCurve {
  display: block;
  width: 100%;
  height: 240px;
}

.curveArea {
  fill: url(#areaGradient);
}

.curveLine {
  fill: none;
  stroke: url(#curveGradient);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.curveAxis,
.curveMid {
  stroke: rgba(31, 37, 34, .2);
  stroke-width: 1;
}

.curveMid {
  stroke-dasharray: 5 7;
}

.curvePoint {
  stroke: #fffdf9;
  stroke-width: 3;
  fill: var(--mood-a);
}

.curvePoint.warm {
  fill: #ee8c6b;
}

.curvePoint.calm {
  fill: #49a078;
}

.curvePoint.low {
  fill: #5c9ded;
}

.curvePoint.ache {
  fill: #d85f6a;
}

.curvePoint.spark {
  fill: #f2b84b;
}

.axisLabel,
.dateLabel,
.emptySvg {
  fill: var(--muted);
  font-size: 12px;
}

.emptySvg {
  text-anchor: middle;
  font-size: 14px;
}

.curveLegend,
.curveEvents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legendDot,
.curveEvent {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .62);
  padding: 4px 9px;
  color: var(--muted);
  font-size: 12px;
}

.legendDot::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}

.legendDot.warm {
  color: #c6694f;
}

.legendDot.calm {
  color: #357e6f;
}

.legendDot.ache {
  color: #c95761;
}

.legendDot.spark {
  color: #c08a20;
}

.curveEvents {
  margin-top: 10px;
}

.curveEvent {
  display: inline-flex;
  max-width: 100%;
  gap: 6px;
  border-color: color-mix(in srgb, var(--item-a) 32%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--item-a) 15%, #ffffff), rgba(255, 255, 255, .72));
  color: var(--ink-soft);
}

.curveEvent strong,
.curveEvent span {
  overflow-wrap: anywhere;
}

.curveEvent strong {
  flex: 0 0 auto;
  white-space: nowrap;
}

.curveEvent span {
  min-width: 0;
}

.list,
.compactList {
  display: grid;
  gap: 10px;
}

.handoffList {
  margin-bottom: 16px;
}

.sectionKicker {
  margin: 2px 0 10px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .62);
  padding: 10px;
}

.moodItem {
  border-color: color-mix(in srgb, var(--item-a) 34%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--item-c) 64%, #ffffff), rgba(255, 255, 255, .62)),
    #ffffff;
  box-shadow: inset 4px 0 0 var(--item-a);
}

.itemHead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.itemHead span:last-child {
  text-align: right;
}

.itemText {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  border: 1px solid rgba(48, 56, 52, .16);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, .72);
  font-size: 12px;
}

.moodTag {
  border-color: color-mix(in srgb, var(--item-a) 46%, var(--line));
  color: color-mix(in srgb, var(--item-a) 72%, #1f2522);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.compactList .item {
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 30px rgba(24, 32, 38, .16);
  padding: 12px 14px;
}

@media (max-width: 900px) {
  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .auth {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
  }

  .auth input {
    width: 100%;
  }

  .layout,
  .metrics,
  .weatherSummary,
  .gaugeGrid,
  .split {
    grid-template-columns: 1fr;
  }

  .weather,
  .relationship,
  .thoughts,
  .consolidation,
  .activity {
    grid-column: span 1;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 12px;
  }

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

  .auth input {
    grid-column: span 2;
  }

  .layout {
    padding: 10px;
  }

  .panelHead,
  .itemHead {
    align-items: stretch;
    flex-direction: column;
  }

  .moodBadge,
  .pill {
    width: fit-content;
  }
}

/* Long-term relationship archive. */
.tabPanel > .milestonesPanel,
.tabPanel > .invisibleLightPanel,
.tabPanel > .dreamRingsPanel,
.tabPanel > .archiveIntro {
  grid-column: 1 / -1;
}

.archiveIntro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  min-height: 148px;
  border-bottom: 1px solid var(--line);
  padding: 26px 10px 24px;
  background:
    linear-gradient(105deg, color-mix(in srgb, #5c9ded 10%, transparent), transparent 35%, color-mix(in srgb, #d85f6a 9%, transparent) 68%, color-mix(in srgb, #f2b84b 10%, transparent));
}

.archiveIntro h2 {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 30px;
  line-height: 1.15;
}

.archiveIntro p {
  max-width: 680px;
  margin-top: 7px;
  color: var(--muted);
}

.archiveStats {
  display: flex;
  flex: 0 0 auto;
  gap: 20px;
}

.archiveStat {
  min-width: 72px;
  text-align: right;
}

.archiveStat strong,
.archiveStat span {
  display: block;
}

.archiveStat strong {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 28px;
  line-height: 1;
}

.archiveStat span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.rangeBadge {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, .68);
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.milestoneJourneyWrap {
  min-height: 250px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .34)),
    linear-gradient(110deg, rgba(92, 157, 237, .14), rgba(127, 107, 220, .1) 28%, rgba(216, 95, 106, .12) 58%, rgba(242, 184, 75, .1) 78%, rgba(73, 160, 120, .12));
}

#milestoneJourney {
  display: block;
  width: 100%;
  height: 250px;
}

.milestoneArea {
  fill: url(#milestoneAreaGradient);
}

.milestoneLine {
  fill: none;
  stroke: url(#milestoneGradient);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.milestoneAxis,
.milestoneMid {
  stroke: rgba(31, 37, 34, .18);
  stroke-width: 1;
}

.milestoneMid {
  stroke-dasharray: 5 7;
}

.milestonePoint {
  stroke: #fffdf9;
  stroke-width: 3;
  filter: drop-shadow(0 4px 6px rgba(30, 36, 34, .18));
}

.milestoneDate {
  fill: var(--muted);
  font-size: 10px;
  text-anchor: middle;
}

.milestoneCards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(270px, 31%);
  gap: 10px;
  overflow-x: auto;
  margin-top: 12px;
  padding: 1px 1px 9px;
  scroll-snap-type: x proximity;
  scrollbar-color: color-mix(in srgb, var(--mood-a) 30%, var(--line)) transparent;
}

.milestoneCard {
  min-width: 0;
  min-height: 184px;
  border: 1px solid color-mix(in srgb, var(--item-a) 28%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--item-c) 70%, #ffffff), rgba(255, 255, 255, .76)),
    #ffffff;
  box-shadow: inset 4px 0 0 var(--item-a);
  padding: 13px 14px;
  scroll-snap-align: start;
}

.milestoneCardTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.milestoneNumber {
  color: color-mix(in srgb, var(--item-a) 78%, var(--text));
  font-size: 14px;
  font-weight: 800;
}

.milestoneCard h3 {
  margin: 12px 0 7px;
  color: var(--text);
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 15px;
  line-height: 1.35;
  text-transform: none;
}

.milestoneCard p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  color: var(--ink-soft);
  font-size: 12px;
}

.lightHead {
  align-items: center;
}

.segmented.lightSegments {
  grid-template-columns: repeat(3, minmax(74px, auto));
}

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

.lightCard {
  position: relative;
  min-width: 0;
  min-height: 142px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--light-accent) 28%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--light-wash) 72%, #ffffff), rgba(255, 255, 255, .76)),
    #ffffff;
  padding: 16px;
}

.lightCard::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--light-accent), transparent 76%);
  content: "";
}

.lightIndex {
  color: color-mix(in srgb, var(--light-accent) 72%, var(--muted));
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
}

.lightCard h3 {
  position: relative;
  z-index: 1;
  margin: 8px 0 7px;
  color: var(--text);
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 16px;
  line-height: 1.3;
  text-transform: none;
}

.lightCard p {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
}

.dreamRingsGrid {
  display: grid;
  grid-template-columns: minmax(250px, .8fr) minmax(0, 1.7fr);
  gap: 28px;
  align-items: center;
}

.ringStage {
  position: relative;
  display: grid;
  place-items: center;
  width: min(310px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
}

.ringStage::before {
  position: absolute;
  inset: 3%;
  border: 1px dashed rgba(48, 56, 52, .13);
  border-radius: 48% 52% 46% 54%;
  content: "";
  transform: rotate(-8deg);
}

.ringOrbit {
  position: absolute;
  border: 2px solid color-mix(in srgb, var(--ring-color) 56%, transparent);
  border-radius: 46% 54% 49% 51%;
  box-shadow: 0 0 22px color-mix(in srgb, var(--ring-color) 8%, transparent);
}

.ringCore {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background:
    linear-gradient(145deg, color-mix(in srgb, #d85f6a 16%, #ffffff), color-mix(in srgb, #5c9ded 14%, #ffffff));
  box-shadow: 0 12px 26px rgba(53, 61, 58, .12);
}

.ringCore strong,
.ringCore span {
  display: block;
}

.ringCore strong {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 27px;
  line-height: 1;
}

.ringCore span {
  margin-top: -22px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.ringMarker {
  position: absolute;
  z-index: 3;
  width: 11px;
  height: 11px;
  border: 2px solid #fffdf9;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(31, 37, 34, .2);
}

.dreamEchoes {
  display: grid;
  gap: 9px;
}

.dreamEcho {
  border-left: 4px solid color-mix(in srgb, #7f6bdc 62%, #d85f6a);
  border-radius: 0 7px 7px 0;
  background:
    linear-gradient(100deg, rgba(127, 107, 220, .1), rgba(255, 255, 255, .54) 68%);
  padding: 11px 13px;
}

.dreamEchoTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.dreamEcho p {
  color: var(--ink-soft);
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 13px;
  line-height: 1.58;
}

.ringNotes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.ringNote {
  min-width: 0;
  padding: 4px 8px;
}

.ringNote time,
.ringNote strong {
  display: block;
}

.ringNote time {
  margin-bottom: 5px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.ringNote strong {
  margin-bottom: 5px;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 13px;
}

.ringNote p {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 900px) {
  .archiveIntro {
    align-items: flex-start;
    flex-direction: column;
  }

  .archiveStats {
    width: 100%;
    justify-content: flex-start;
  }

  .archiveStat {
    text-align: left;
  }

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

  .dreamRingsGrid {
    grid-template-columns: minmax(210px, .75fr) minmax(0, 1.25fr);
  }
}

@media (max-width: 560px) {
  .archiveIntro {
    min-height: 0;
    gap: 18px;
    padding: 22px 5px 18px;
  }

  .archiveIntro h2 {
    font-size: 25px;
  }

  .archiveStats {
    gap: 14px;
  }

  .archiveStat {
    min-width: 58px;
  }

  .archiveStat strong {
    font-size: 23px;
  }

  .milestoneJourneyWrap {
    min-height: 0;
  }

  #milestoneJourney {
    min-height: 0;
  }

  .milestoneCards {
    grid-auto-columns: minmax(260px, 88%);
  }

  .lightHead {
    align-items: stretch;
  }

  .segmented.lightSegments {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .invisibleLightGrid,
  .dreamRingsGrid,
  .ringNotes {
    grid-template-columns: 1fr;
  }

  .lightCard {
    min-height: 124px;
  }

  .ringStage {
    width: min(270px, 100%);
  }

  .ringNotes {
    gap: 12px;
  }

  .ringNote + .ringNote {
    border-top: 1px solid var(--line);
    padding-top: 12px;
  }
}

/* Dashboard v2: emotion-first tabs and richer data views. */
[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(122deg, color-mix(in srgb, var(--mood-c) 68%, #f7faf8), rgba(246, 241, 248, .76) 48%, rgba(236, 246, 245, .9)),
    #f2f0ec;
  letter-spacing: 0;
}

.topbar {
  min-height: 72px;
  background: rgba(250, 249, 246, .9);
}

.layout {
  display: block;
  max-width: 1380px;
  margin: 0 auto;
  padding: 16px 18px 28px;
}

.dashboardTabs {
  position: sticky;
  top: 82px;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(680px, 100%);
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, .88);
  box-shadow: 0 10px 30px rgba(43, 50, 47, .08);
  padding: 4px;
  backdrop-filter: blur(14px);
}

.tabButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 0;
  min-height: 50px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.tabButton:hover {
  border-color: transparent;
  background: rgba(255, 255, 255, .72);
}

.tabButton.isActive {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--mood-a) 14%, #ffffff), color-mix(in srgb, var(--mood-b) 11%, #ffffff));
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mood-a) 22%, var(--line));
}

.tabButton > span:last-child {
  min-width: 0;
  text-align: left;
  font-weight: 760;
}

.tabButton small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.tabSwatch {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .68);
}

.emotionSwatch {
  background: linear-gradient(135deg, #f36f45, #49a078);
}

.memorySwatch {
  background: linear-gradient(135deg, #5c9ded, #d85f6a);
}

.systemSwatch {
  background: linear-gradient(135deg, #49a078, #f2b84b);
}

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

.tabPanel > .relationship,
.tabPanel > .weather,
.tabPanel > .emotionAtlas,
.tabPanel > .memoryFingerprint,
.tabPanel > .latestHappenings,
.tabPanel > .thoughts,
.tabPanel > .consolidation,
.tabPanel > .activity {
  grid-column: 1 / -1;
}

.happeningsHead {
  align-items: flex-end;
}

.timezoneBadge {
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--mood-b) 30%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--mood-c) 62%, #ffffff);
  padding: 7px 10px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  font-weight: 760;
  white-space: nowrap;
}

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

.happeningCard {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 214px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--item-a) 28%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--item-c) 72%, #ffffff), rgba(255, 255, 255, .74) 62%),
    #ffffff;
  box-shadow: inset 0 3px 0 var(--item-a);
  padding: 14px;
}

.happeningCard::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--item-a), var(--item-b));
  content: "";
}

.happeningTop,
.happeningSource,
.happeningState {
  display: flex;
  align-items: center;
}

.happeningTop {
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
}

.happeningSource {
  min-width: 0;
  gap: 6px;
  font-weight: 760;
}

.happeningTop time {
  flex: 0 0 auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  white-space: nowrap;
}

.channelDot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7e8983;
}

.channelDot.telegram {
  background: #5c9ded;
}

.channelDot.operit {
  background: #7f6bdc;
}

.channelDot.official {
  background: #ef6f6c;
}

.channelDot.memory {
  background: #49a078;
}

.happeningState {
  gap: 6px;
  margin: 16px 0 8px;
}

.stateChip,
.moodChip {
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 9px;
  font-weight: 800;
}

.stateChip.settled {
  background: rgba(73, 160, 120, .12);
  color: #357e6f;
}

.stateChip.live {
  background: rgba(216, 95, 106, .12);
  color: #b64754;
}

.moodChip {
  border: 1px solid color-mix(in srgb, var(--item-a) 30%, var(--line));
  color: color-mix(in srgb, var(--item-a) 74%, var(--text));
}

.happeningCard h3 {
  margin: 0 0 7px;
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.happeningCard p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.happeningTags {
  margin-top: auto;
  padding-top: 12px;
}

.panel {
  padding: 18px;
  border-color: rgba(48, 56, 52, .15);
  background: rgba(255, 253, 249, .9);
  box-shadow: 0 12px 34px rgba(48, 52, 48, .075);
}

.panelHead {
  margin-bottom: 16px;
}

.panelHead h2 {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 19px;
  line-height: 1.2;
}

.panelHead p {
  margin-top: 3px;
  font-size: 13px;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: color-mix(in srgb, var(--mood-a) 72%, var(--text));
  font-size: 10px;
  font-weight: 800;
}

.curveWrap {
  min-height: 268px;
  border-color: color-mix(in srgb, var(--mood-a) 18%, var(--line));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, .34)),
    linear-gradient(110deg, rgba(216, 95, 106, .14), rgba(242, 184, 75, .1) 34%, rgba(73, 160, 120, .13) 64%, rgba(92, 157, 237, .14));
}

#relationshipCurve {
  height: 252px;
}

.weather {
  overflow: hidden;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--mood-a) 16%, #ffffff), rgba(255, 255, 255, .9) 42%, color-mix(in srgb, var(--mood-b) 12%, #ffffff)),
    var(--panel);
}

.weatherText {
  min-height: 104px;
  border-color: color-mix(in srgb, var(--mood-b) 20%, var(--line));
  background: rgba(255, 255, 255, .66);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.56;
}

.emotionAtlas {
  overflow: hidden;
}

.atlasLegend,
.atlasLegend span {
  display: flex;
  align-items: center;
}

.atlasLegend {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.atlasLegend span {
  gap: 5px;
}

.atlasLegend i {
  display: block;
  width: 10px;
  height: 10px;
  background: #49a078;
}

.atlasLegend .telegramKey {
  border-radius: 50%;
}

.atlasLegend .operitKey {
  border-radius: 3px;
  background: #5c9ded;
}

.atlasLegend .liveKey {
  border: 2px dashed #d85f6a;
  border-radius: 50%;
  background: transparent;
}

.atlasGrid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(190px, .9fr);
  gap: 18px;
  align-items: stretch;
}

.emotionMapWrap {
  min-height: 330px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(92, 157, 237, .12), transparent 48%, rgba(238, 140, 107, .12)),
    linear-gradient(180deg, rgba(242, 184, 75, .12), transparent 48%, rgba(73, 160, 120, .1)),
    rgba(255, 255, 255, .58);
}

#emotionMap {
  display: block;
  width: 100%;
  height: 330px;
}

.atlasAxis {
  stroke: rgba(31, 37, 34, .22);
  stroke-dasharray: 5 7;
}

.atlasCornerLabel,
.atlasAxisLabel {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.atlasCornerLabel {
  fill: var(--ink-soft);
}

.atlasPoint {
  stroke: #fffdf9;
  stroke-width: 3;
  filter: drop-shadow(0 4px 7px rgba(30, 36, 34, .18));
}

.atlasPoint.live {
  stroke: #fffdf9;
  stroke-width: 4;
  stroke-dasharray: 3 2;
}

.atlasHalo {
  fill: none;
  stroke-width: 2;
  opacity: .28;
}

.moodMix {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  border-left: 1px solid var(--line);
  padding: 10px 4px 6px 20px;
  text-align: center;
}

.moodMix h3 {
  margin: 0;
  color: var(--text);
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 17px;
  text-transform: none;
}

.moodMixRing {
  display: grid;
  place-items: center;
  width: 156px;
  height: 156px;
  margin: 16px 0;
  border-radius: 50%;
  background: conic-gradient(#49a078 0 100%);
  box-shadow: 0 14px 30px rgba(52, 65, 60, .12);
}

.moodMixRing > div {
  display: grid;
  place-items: center;
  width: 102px;
  height: 102px;
  border-radius: 50%;
  background: #fffdf9;
}

.moodMixRing strong,
.moodMixRing span {
  display: block;
}

.moodMixRing strong {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 20px;
}

.moodMixRing span {
  margin-top: -18px;
  color: var(--muted);
  font-size: 10px;
}

.moodMixLegend {
  display: grid;
  width: 100%;
  gap: 7px;
}

.moodMixLegend > div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
}

.moodMixLegend strong {
  color: var(--ink-soft);
}

.mixKey {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.fingerprintGrid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, .75fr);
  gap: 28px;
}

.fingerprintGrid > div + div {
  border-left: 1px solid var(--line);
  padding-left: 28px;
}

.motifBars {
  display: grid;
  gap: 9px;
}

.motifRow {
  display: grid;
  grid-template-columns: minmax(58px, auto) minmax(80px, 1fr) 24px;
  gap: 10px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 12px;
}

.motifRow > span:first-child {
  overflow-wrap: anywhere;
}

.motifTrack {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(48, 56, 52, .08);
}

.motifFill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.motifRow strong {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.sourceRhythm {
  padding-top: 4px;
}

.sourceTrack {
  display: flex;
  height: 18px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(48, 56, 52, .08);
}

.sourceSegment {
  display: block;
  min-width: 3px;
}

.source1,
.sourceKey.source1 {
  background: #49a078;
}

.source2,
.sourceKey.source2 {
  background: #5c9ded;
}

.source3,
.sourceKey.source3 {
  background: #f2b84b;
}

.sourceRhythmLegend {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.sourceRhythmLegend > div {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.sourceKey {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.sourceRhythmLegend strong {
  color: var(--ink-soft);
}

.timelineHead {
  align-items: center;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, auto);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(48, 56, 52, .05);
  padding: 3px;
}

.segment {
  min-height: 30px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.segment.isActive {
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--soft-shadow);
}

.timelineList {
  display: grid;
  gap: 12px;
}

.timelineDay {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--item-a) 30%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(125deg, color-mix(in srgb, var(--item-c) 68%, #ffffff), rgba(255, 255, 255, .72)),
    #ffffff;
  box-shadow: inset 4px 0 0 var(--item-a);
}

.timelineRail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border-right: 1px solid color-mix(in srgb, var(--item-a) 20%, var(--line));
  padding: 15px 16px 15px 8px;
}

.timelineRail time {
  color: var(--ink-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.timelineDot {
  position: absolute;
  top: 18px;
  right: -5px;
  width: 9px;
  height: 9px;
  border: 2px solid #fffdf9;
  border-radius: 50%;
  background: var(--item-a);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--item-a) 55%, var(--line));
}

.timelineBody {
  min-width: 0;
  padding: 14px 16px 15px;
}

.timelineTop,
.timelineEntryMeta,
.statusChips {
  display: flex;
  align-items: center;
}

.timelineTop {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
}

.timelineSources {
  color: var(--muted);
  font-size: 11px;
}

.statusChips {
  gap: 5px;
}

.statusChip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 9px;
  font-weight: 800;
}

.statusChip.live {
  border-color: rgba(216, 95, 106, .34);
  background: rgba(216, 95, 106, .1);
  color: #b64754;
}

.statusChip.settled {
  border-color: rgba(73, 160, 120, .34);
  background: rgba(73, 160, 120, .1);
  color: #357e6f;
}

.timelineEntry {
  padding: 12px 0 2px;
}

.timelineEntry + .timelineEntry {
  margin-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--item-a) 17%, var(--line));
}

.timelineEntryMeta {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.timelineEntryMeta strong {
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 15px;
}

.entryMood {
  color: color-mix(in srgb, var(--item-a) 72%, var(--text));
  font-size: 11px;
}

.atmosphereTag {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.versionDetails {
  margin-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--item-a) 30%, var(--line));
  padding-top: 8px;
}

.versionDetails summary {
  width: fit-content;
  cursor: pointer;
  color: color-mix(in srgb, var(--item-a) 72%, var(--text));
  font-size: 11px;
  font-weight: 700;
}

.versionText {
  margin-top: 8px;
  border-left: 3px solid color-mix(in srgb, var(--item-a) 55%, var(--line));
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
}

.systemPanel > .overview,
.systemPanel > .settings {
  grid-column: span 1;
}

@media (max-width: 900px) {
  .topbar {
    position: static;
  }

  .dashboardTabs {
    top: 8px;
  }

  .tabPanel.isActive,
  .atlasGrid,
  .fingerprintGrid {
    grid-template-columns: 1fr;
  }

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

  .systemPanel > .overview,
  .systemPanel > .settings {
    grid-column: 1 / -1;
  }

  .moodMix {
    display: grid;
    grid-template-columns: minmax(110px, .8fr) auto minmax(140px, 1fr);
    gap: 16px;
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 20px 4px 4px;
    text-align: left;
  }

  .moodMixRing {
    width: 126px;
    height: 126px;
    margin: 0;
  }

  .moodMixRing > div {
    width: 82px;
    height: 82px;
  }

  .fingerprintGrid > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 20px;
    padding-left: 0;
  }
}

@media (max-width: 560px) {
  .layout {
    padding: 10px 10px 22px;
  }

  .dashboardTabs {
    margin-bottom: 10px;
  }

  .tabButton {
    gap: 5px;
    min-height: 45px;
    padding: 0 5px;
  }

  .tabSwatch {
    width: 9px;
    height: 9px;
  }

  .tabButton > span:last-child {
    font-size: 12px;
  }

  .panel {
    padding: 14px;
  }

  .panelHead {
    gap: 10px;
  }

  .panelHead h2 {
    font-size: 17px;
  }

  .happeningsHead {
    align-items: flex-start;
  }

  .timezoneBadge {
    max-width: 100%;
    white-space: normal;
  }

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

  .happeningCard {
    min-height: 0;
  }

  .curveWrap,
  .emotionMapWrap {
    min-height: 0;
  }

  #relationshipCurve,
  #emotionMap {
    min-height: 0;
  }

  .atlasLegend {
    justify-content: flex-start;
  }

  .moodMix {
    display: flex;
    text-align: center;
  }

  .timelineHead {
    align-items: stretch;
  }

  .segmented {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .timelineRail {
    align-items: flex-start;
    border-right: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--item-a) 20%, var(--line));
    padding: 10px 14px;
  }

  .timelineRail time {
    text-align: left;
  }

  .timelineDot {
    top: auto;
    right: 16px;
    bottom: -5px;
  }

  .timelineBody {
    padding: 12px 14px 14px;
  }
}
