:root {
  color-scheme: light;
  --paper: #f8f0e4;
  --paper-raised: #fffdf8;
  --paper-soft: rgba(255, 253, 248, 0.78);
  --ink: #463d34;
  --ink-soft: #6c6155;
  --muted: #938779;
  --line: rgba(142, 114, 82, 0.18);
  --line-soft: rgba(142, 114, 82, 0.11);
  --lamp: #f29c5a;
  --lamp-bright: #ffd9ac;
  --lamp-deep: #cf7440;
  --amber: #e67e22;
  --sage: #84a579;
  --danger: #c05d55;
  --shadow: 0 18px 42px rgba(125, 94, 64, 0.11);
  --radius: 8px;
  font-family: "LXGW WenKai", "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}

html[data-theme="dusk"] {
  color-scheme: dark;
  --paper: #211a15;
  --paper-raised: rgba(62, 50, 41, 0.78);
  --paper-soft: rgba(43, 34, 27, 0.74);
  --ink: #f1e4d3;
  --ink-soft: #d3c0ab;
  --muted: #a9937d;
  --line: rgba(242, 205, 164, 0.17);
  --line-soft: rgba(242, 205, 164, 0.1);
  --lamp-bright: #ffd2a1;
  --shadow: 0 24px 64px rgba(7, 4, 2, 0.46);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  overflow-x: hidden;
  background: linear-gradient(180deg, #fdf8f0 0%, #f8ecd9 52%, #f1e0ca 100%);
  color: var(--ink);
  transition: background 1.1s ease, color 0.65s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.72;
  background-image:
    repeating-linear-gradient(90deg, rgba(150, 117, 80, 0.035) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(0deg, rgba(150, 117, 80, 0.03) 0 1px, transparent 1px 8px);
}

body.dimmed #app {
  opacity: 0.54;
  transition: opacity 2.6s ease;
}

html[data-theme="dusk"] body {
  background:
    linear-gradient(155deg, rgba(255, 205, 150, 0.07) 0%, transparent 36%),
    linear-gradient(180deg, #2b211a 0%, #262019 48%, #181210 100%);
}

html[data-theme="dusk"] body::before {
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(90deg, rgba(247, 206, 159, 0.025) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(0deg, rgba(247, 206, 159, 0.02) 0 1px, transparent 1px 9px);
}

#app {
  position: relative;
  width: min(100%, 460px);
  height: 100dvh;
  margin: 0 auto;
  padding: 0 20px 70px;
  overflow: hidden auto;
  opacity: 1;
  transition: opacity 0.4s ease;
  transition: opacity 0.4s ease, background 0.9s ease, border-color 0.9s ease, box-shadow 0.9s ease;
}

html[data-theme="dusk"] #app {
  background:
    linear-gradient(168deg, rgba(64, 52, 41, 0.82) 0%, rgba(46, 36, 29, 0.76) 48%, rgba(31, 24, 19, 0.82) 100%);
  border-color: rgba(244, 211, 173, 0.11);
  box-shadow:
    0 32px 78px rgba(5, 3, 2, 0.5),
    inset 0 1px 0 rgba(255, 231, 198, 0.07);
}

#app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 249, 240, 0.5) 0%, transparent 23%, rgba(122, 91, 61, 0.05) 100%);
}

html[data-theme="dusk"] #app::before {
  background: linear-gradient(180deg, rgba(255, 209, 161, 0.07) 0%, transparent 27%, rgba(0, 0, 0, 0.26) 100%);
}

#app > * {
  position: relative;
  z-index: 1;
}

#app > .ambient-toggle,
#app > .dock {
  position: fixed;
  z-index: 28;
}

#app > .ambient-toggle {
  top: calc(env(safe-area-inset-top) + 10px);
  right: 10px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: screen-arrive 0.52s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.dock[hidden] {
  display: none;
}

.lamp-screen,
.content-screen {
  min-height: 100%;
}

.lamp-stage {
  display: flex;
  min-height: inherit;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.lamp {
  position: relative;
  width: 184px;
  height: 184px;
  margin-bottom: 20px;
}

.lamp-halo {
  position: absolute;
  top: 52%;
  left: 50%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 182, 112, 0.34) 0%, rgba(255, 182, 112, 0.11) 39%, transparent 68%);
  transform: translate(-50%, -50%);
  animation: halo-breathe 5.2s ease-in-out infinite;
}

.lamp-shade {
  position: absolute;
  top: 42px;
  left: 39px;
  width: 106px;
  height: 40px;
  border-radius: 999px;
  background:
    linear-gradient(168deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 227, 194, 0.9) 38%, rgba(247, 177, 118, 0.92) 100%);
  box-shadow:
    inset 0 -8px 18px rgba(207, 116, 64, 0.16),
    inset 3px 4px 12px rgba(255, 255, 255, 0.9),
    0 8px 24px rgba(159, 104, 55, 0.12);
  animation: shade-breathe 5.2s ease-in-out infinite;
}

.lamp-shade::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 16px;
  width: 13px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0));
  transform: rotate(9deg);
}

.lamp-shade::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(207, 116, 64, 0.34);
}

.lamp-glass {
  position: absolute;
  top: 50px;
  left: 58px;
  width: 68px;
  height: 68px;
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 38%, #fff8ec 0%, #ffd9ad 45%, var(--lamp) 78%, #e08547 100%);
  box-shadow:
    0 0 22px rgba(242, 156, 90, 0.45),
    inset 3px 5px 14px rgba(255, 255, 255, 0.82),
    inset -5px -8px 18px rgba(198, 106, 53, 0.2);
  animation: glass-breathe 5.2s ease-in-out infinite;
}

.lamp-wick {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 9px;
  height: 15px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: linear-gradient(180deg, #fffdf7, #ffedbe);
  box-shadow: 0 0 11px rgba(255, 217, 172, 0.9);
  transform: translateX(-50%);
  animation: flame-sway 4.2s ease-in-out infinite;
}

.lamp-gleam {
  position: absolute;
  top: 14px;
  left: 13px;
  width: 8px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  transform: rotate(12deg);
  filter: blur(0.4px);
}

.lamp-stem {
  position: absolute;
  top: 116px;
  left: 88px;
  width: 8px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, #c89a68, #9c6c41);
}

.lamp-base {
  position: absolute;
  top: 132px;
  left: 56px;
  width: 72px;
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(180deg, #e6caa6, #b58257 64%, #8c5f38);
  box-shadow:
    0 8px 16px rgba(150, 106, 65, 0.2),
    inset 0 2px 5px rgba(255, 255, 255, 0.55);
}

.lamp-base::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 10px;
  width: 42px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.44);
}

body.alert-mode .lamp-halo {
  background: radial-gradient(circle, rgba(230, 126, 34, 0.36) 0%, rgba(230, 126, 34, 0.12) 40%, transparent 68%);
}

body.alert-mode .lamp-glass {
  background:
    radial-gradient(circle at 50% 38%, #fff4e0 0%, #ffcf92 42%, var(--amber) 78%, #b45f12 100%);
  box-shadow:
    0 0 28px rgba(230, 126, 34, 0.52),
    inset 3px 5px 14px rgba(255, 255, 255, 0.72),
    inset -5px -8px 18px rgba(145, 68, 8, 0.22);
}

@keyframes halo-breathe {
  0%,
  100% {
    opacity: 0.62;
    transform: translate(-50%, -50%) scale(0.97);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }
}

@keyframes glass-breathe {
  0%,
  100% {
    box-shadow:
      0 0 18px rgba(242, 156, 90, 0.36),
      inset 3px 5px 14px rgba(255, 255, 255, 0.82),
      inset -5px -8px 18px rgba(198, 106, 53, 0.2);
  }
  50% {
    box-shadow:
      0 0 30px rgba(242, 156, 90, 0.55),
      inset 3px 5px 14px rgba(255, 255, 255, 0.9),
      inset -5px -8px 18px rgba(198, 106, 53, 0.2);
  }
}

@keyframes shade-breathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-1px) scale(1.012);
  }
}

@keyframes flame-sway {
  0%,
  100% {
    transform: translateX(-50%) rotate(-3deg) scale(0.98);
  }
  50% {
    transform: translateX(-50%) rotate(3deg) scale(1.05);
  }
}

@keyframes screen-arrive {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ambient-toggle {
  position: fixed;
  z-index: 28;
  top: calc(env(safe-area-inset-top) + 10px);
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 7px 18px rgba(135, 101, 66, 0.08);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.ambient-toggle[hidden] {
  display: none;
}

.ambient-toggle svg {
  width: 15px;
  height: 15px;
}

.ambient-toggle span {
  display: none;
}

.ambient-toggle[aria-pressed="true"] {
  border-color: rgba(242, 156, 90, 0.52);
  background: #fff4e5;
  color: #a85f22;
}

.lamp-line {
  max-width: 300px;
  margin: 0;
  font-size: 20px;
  line-height: 1.68;
  color: #55493e;
  text-wrap: balance;
}

.breath-hint {
  margin: 12px 0 0;
  color: #988a79;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.now-actions {
  display: flex;
  min-height: 116px;
  margin-top: 22px;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.quiet-button,
.primary-button,
.text-button,
.tiny-quiet,
.hotline-button {
  border: 0;
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease, box-shadow 0.2s ease;
}

.quiet-button {
  min-width: 136px;
  min-height: 40px;
  padding: 9px 18px;
  border: 1px solid rgba(160, 125, 84, 0.16);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: #5a4e42;
  box-shadow: 0 6px 16px rgba(138, 103, 68, 0.07);
}

.quiet-button.subtle {
  min-width: 116px;
  min-height: 35px;
  padding: 7px 15px;
  font-size: 14px;
  background: rgba(255, 253, 248, 0.66);
  color: #7b6d5d;
  box-shadow: none;
}

.tiny-quiet {
  padding: 4px 10px;
  border-radius: 999px;
  background: transparent;
  color: #9c8c79;
  font-size: 13px;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 24px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f6a967, #e38b4c);
  color: #fff8ef;
  font-weight: 650;
  box-shadow: 0 12px 24px rgba(197, 122, 62, 0.17);
}

.primary-button:disabled {
  background: #e2d5c3;
  color: #a4957f;
  cursor: not-allowed;
  box-shadow: none;
}

.quiet-button:hover,
.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.quiet-button:active,
.primary-button:active,
.text-button:active,
.tiny-quiet:active,
.hotline-button:active {
  transform: scale(0.98);
}

.content-screen {
  padding-top: 16px;
}

.screen-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.screen-head h1 {
  flex: 1;
  margin: 0;
  color: #4d4338;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 640;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: #6a5c4d;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(134, 100, 66, 0.06);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.mini-lamp {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 205, 154, 0.2);
}

.mini-lamp span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 36%, #fff6e8 0%, var(--lamp-bright) 46%, var(--lamp) 82%);
  box-shadow: 0 0 11px rgba(242, 156, 90, 0.68);
  animation: halo-breathe 5.2s ease-in-out infinite;
}

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

.mood-seed {
  display: grid;
  min-width: 0;
  min-height: 84px;
  padding: 13px 4px 10px;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.68);
  color: #6d6152;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(138, 103, 68, 0.05);
  transition: border-color 0.22s ease, background 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.mood-seed.unclear {
  grid-column: span 4;
  grid-auto-flow: column;
  justify-content: center;
  min-height: 56px;
}

.mood-seed svg {
  width: 23px;
  height: 23px;
}

.mood-seed:hover {
  transform: translateY(-1px);
}

.mood-seed[aria-pressed="true"] {
  border-color: rgba(242, 156, 90, 0.68);
  background: #fff3e3;
  color: #9c5a1f;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(197, 122, 62, 0.14);
}

.field {
  display: block;
  margin-top: 22px;
}

.field span:first-child {
  display: block;
  margin-bottom: 8px;
  color: #7d7060;
  font-size: 14px;
}

textarea {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  resize: none;
  background: rgba(255, 253, 248, 0.82);
  color: var(--ink);
  font: inherit;
  line-height: 1.55;
  box-shadow: 0 5px 14px rgba(134, 100, 66, 0.05);
}

textarea:focus,
input:focus {
  border-color: rgba(242, 156, 90, 0.7);
  outline: none;
}

.field small {
  display: block;
  margin-top: 5px;
  color: #a1917e;
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.warm-response {
  margin-top: 20px;
  padding: 17px;
  border: 1px solid rgba(160, 125, 84, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.88);
  color: #564b3f;
  box-shadow: var(--shadow);
}

.warm-response p {
  min-height: 46px;
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.62;
}

.warm-response .quiet-button {
  background: #5a4e42;
  color: var(--paper-raised);
}

.talk-stream {
  height: min(52dvh, 430px);
  margin-bottom: 14px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

#screen-talk {
  position: relative;
  isolation: isolate;
  background: url("./assets/cafe-corner.svg") center bottom / cover no-repeat;
}

#screen-talk::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(253, 248, 240, 0.9) 0%, rgba(253, 246, 236, 0.72) 33%, rgba(247, 231, 210, 0.32) 72%, rgba(190, 140, 92, 0.18) 100%);
}

#screen-talk > * {
  position: relative;
  z-index: 1;
}

html[data-theme="dusk"] #screen-talk::before {
  background: linear-gradient(180deg, rgba(32, 25, 20, 0.9) 0%, rgba(38, 30, 24, 0.7) 34%, rgba(43, 31, 22, 0.38) 75%, rgba(18, 12, 8, 0.32) 100%);
}

html[data-theme="dusk"] #screen-talk {
  background-blend-mode: luminosity;
}

.message {
  max-width: 84%;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(160, 125, 84, 0.1);
  border-radius: var(--radius);
  color: #524739;
  font-size: 15px;
  line-height: 1.62;
  overflow-wrap: anywhere;
  box-shadow: 0 6px 16px rgba(138, 103, 68, 0.055);
}

.message.xiaonuan {
  --cloud-color: #fffdf8;
  --cloud-edge: rgba(160, 125, 84, 0.12);
  position: relative;
  border: 0;
  border-radius: 28px 28px 28px 10px;
  background: linear-gradient(180deg, var(--cloud-color) 0%, #faf2e5 100%);
  box-shadow: 0 9px 24px rgba(138, 103, 68, 0.1);
}

.message.xiaonuan::before,
.message.xiaonuan::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  background: var(--cloud-color);
  box-shadow: 0 6px 18px rgba(138, 103, 68, 0.08);
}

.message.xiaonuan::before {
  left: -11px;
  bottom: -7px;
  width: 24px;
  height: 24px;
}

.message.xiaonuan::after {
  left: 16px;
  top: -10px;
  width: 17px;
  height: 17px;
}

.message.user {
  margin-left: auto;
  border-color: rgba(242, 156, 90, 0.2);
  background: #fff0de;
  color: #6c4420;
}

.message.typing::after {
  content: "|";
  margin-left: 2px;
  color: #c98249;
  animation: caret 0.9s steps(2) infinite;
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

.talk-form {
  display: flex;
  width: min(100%, 86%);
  margin-left: auto;
  gap: 9px;
  align-items: center;
}

.talk-form input {
  flex: 1;
  min-width: 0;
  min-height: 45px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.82);
  color: var(--ink);
  font: inherit;
  box-shadow: 0 5px 14px rgba(134, 100, 66, 0.05);
}

.send-button {
  flex: 0 0 38px;
}

.send-button:disabled,
#talk-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.safety-foot {
  margin: 15px 2px 0;
  color: #a2937f;
  font-size: 12px;
  line-height: 1.55;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 17px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.62);
}

.segment {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8b7c69;
  font: inherit;
  cursor: pointer;
}

.segment.active {
  background: #fff8ee;
  color: #5c503f;
  box-shadow: 0 4px 10px rgba(134, 100, 66, 0.08);
}

.journal-view {
  min-height: 360px;
}

.day-card {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 9px;
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
}

.mood-dot {
  flex: 0 0 16px;
  height: 16px;
  border-radius: 50%;
}

.day-meta strong {
  display: block;
  margin-bottom: 2px;
  color: #574c3f;
  font-size: 15px;
}

.day-meta span,
.summary-line {
  color: #8a7c6b;
  font-size: 13px;
  line-height: 1.55;
}

.empty-note,
.journal-note {
  color: #968876;
  font-size: 13px;
  line-height: 1.65;
}

.empty-note {
  margin-top: 34px;
  text-align: center;
}

.journal-note {
  margin: 14px 0 0;
}

.mood-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
}

.mood-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #948674;
  font-size: 12px;
}

.mood-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chart-wrap,
.rings-wrap {
  display: grid;
  place-items: center;
  padding: 16px 0;
}

.trend-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin-top: 18px;
}

.trend-day {
  display: grid;
  min-width: 0;
  min-height: 46px;
  place-items: center;
  align-content: center;
  gap: 5px;
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.68);
  color: #928574;
  font-size: 12px;
}

.eco-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.eco-item {
  display: grid;
  min-width: 0;
  padding: 12px 4px;
  place-items: center;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.68);
  color: #6d6152;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(138, 103, 68, 0.05);
}

.eco-item svg {
  width: 20px;
  height: 20px;
}

.eco-item.lit {
  border-color: rgba(242, 156, 90, 0.3);
  color: #a26428;
}

.eco-item.locked {
  color: #b1a38f;
  box-shadow: none;
}

.eco-caption {
  margin: 8px 2px 22px;
  color: #9d8f7c;
  font-size: 12px;
}

.settings-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.66);
  box-shadow: 0 7px 18px rgba(138, 103, 68, 0.05);
}

.theme-panel {
  background: linear-gradient(160deg, rgba(255, 253, 248, 0.9), rgba(250, 238, 220, 0.68));
}

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

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

.theme-choice {
  min-height: 36px;
  padding: 7px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.66);
  color: #75664f;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.22s ease;
}

.theme-choice[aria-pressed="true"] {
  border-color: rgba(242, 156, 90, 0.58);
  background: #fff3e3;
  color: #9c5a1f;
  box-shadow: 0 8px 18px rgba(197, 122, 62, 0.12);
}

.install-panel {
  place-items: center;
}

.install-button {
  min-width: 200px;
}

.install-panel .journal-note {
  margin: 0;
  text-align: center;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #635748;
  font-size: 15px;
}

.setting-row input[type="checkbox"] {
  width: 42px;
  height: 24px;
  accent-color: var(--lamp);
}

.setting-row input[type="time"] {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-raised);
  color: var(--ink);
  font: inherit;
}

html[data-theme="dusk"] body,
html[data-theme="dusk"] .screen-head h1,
html[data-theme="dusk"] .lamp-line,
html[data-theme="dusk"] .day-meta strong,
html[data-theme="dusk"] .emergency-card h2 {
  color: var(--ink);
}

html[data-theme="dusk"] .breath-hint,
html[data-theme="dusk"] .day-meta span,
html[data-theme="dusk"] .summary-line,
html[data-theme="dusk"] .empty-note,
html[data-theme="dusk"] .journal-note,
html[data-theme="dusk"] .mood-legend span,
html[data-theme="dusk"] .trend-day,
html[data-theme="dusk"] .eco-caption,
html[data-theme="dusk"] .safety-foot,
html[data-theme="dusk"] .setting-row,
html[data-theme="dusk"] .eco-item,
html[data-theme="dusk"] .dock-item,
html[data-theme="dusk"] .text-button {
  color: var(--ink-soft);
}

html[data-theme="dusk"] .ambient-toggle,
html[data-theme="dusk"] .icon-button,
html[data-theme="dusk"] .quiet-button,
html[data-theme="dusk"] .mood-seed,
html[data-theme="dusk"] textarea,
html[data-theme="dusk"] .talk-form input,
html[data-theme="dusk"] .message.xiaonuan,
html[data-theme="dusk"] .warm-response,
html[data-theme="dusk"] .segmented,
html[data-theme="dusk"] .segment.active,
html[data-theme="dusk"] .day-card,
html[data-theme="dusk"] .trend-day,
html[data-theme="dusk"] .eco-item,
html[data-theme="dusk"] .settings-panel,
html[data-theme="dusk"] .setting-row input[type="time"],
html[data-theme="dusk"] .theme-choice {
  border-color: var(--line);
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(5, 3, 2, 0.22);
}

html[data-theme="dusk"] .quiet-button.subtle {
  background: rgba(70, 56, 45, 0.58);
  color: var(--ink-soft);
  box-shadow: none;
}

html[data-theme="dusk"] .message.user {
  border-color: rgba(242, 156, 90, 0.2);
  background: rgba(97, 62, 37, 0.7);
  color: #ffdec0;
}

html[data-theme="dusk"] .segment.active {
  background: rgba(88, 69, 53, 0.9);
  color: var(--ink);
}

html[data-theme="dusk"] .dock {
  border-top-color: rgba(244, 211, 173, 0.1);
  background: rgba(31, 24, 19, 0.86);
  backdrop-filter: blur(18px);
}

html[data-theme="dusk"] .dock-item.active {
  color: var(--lamp-bright);
}

html[data-theme="dusk"] .eco-item.lit,
html[data-theme="dusk"] .mood-seed[aria-pressed="true"],
html[data-theme="dusk"] .ambient-toggle[aria-pressed="true"] {
  border-color: rgba(255, 176, 114, 0.38);
  background: rgba(89, 62, 40, 0.72);
  color: #ffd9ac;
}

html[data-theme="dusk"] .primary-button,
html[data-theme="dusk"] .hotline-button,
html[data-theme="dusk"] .warm-response .quiet-button {
  background: linear-gradient(135deg, #dda26a, #b46e37);
  color: #2b1a0e;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
}

html[data-theme="dusk"] .emergency-overlay {
  background: rgba(24, 18, 14, 0.94);
}

html[data-theme="dusk"] .emergency-card,
html[data-theme="dusk"] .soft-message,
html[data-theme="dusk"] #toast {
  border-color: rgba(244, 211, 173, 0.12);
  background: rgba(44, 35, 28, 0.94);
  color: var(--ink);
}

html[data-theme="dusk"] .lamp-shade {
  background:
    linear-gradient(168deg, rgba(255, 244, 229, 0.76) 0%, rgba(255, 202, 150, 0.7) 40%, rgba(203, 119, 59, 0.78) 100%);
}

html[data-theme="dusk"] .theme-panel {
  background: linear-gradient(160deg, rgba(78, 61, 47, 0.52), rgba(44, 34, 27, 0.7));
}

html[data-theme="dusk"] .message.xiaonuan {
  --cloud-color: #3f322a;
  --cloud-edge: rgba(242, 205, 164, 0.12);
  border-color: transparent;
  background: linear-gradient(180deg, #453730 0%, #372c24 100%);
}

.text-button {
  padding: 8px 2px;
  background: transparent;
  color: #6f6252;
  text-align: left;
}

.text-button.danger {
  color: var(--danger);
}

.dock {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 5;
  display: grid;
  width: min(100%, 460px);
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 250, 242, 0.88);
  backdrop-filter: blur(16px);
}

.dock-item {
  display: grid;
  min-width: 0;
  min-height: 44px;
  padding: 2px;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #95876f;
  font-size: 12px;
  cursor: pointer;
}

.dock-item svg {
  width: 19px;
  height: 19px;
}

.dock-item.active {
  color: #c1733a;
}

.emergency-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(250, 237, 222, 0.94);
}

.emergency-overlay[hidden] {
  display: none;
}

.emergency-card {
  width: min(100%, 360px);
  padding: 24px 20px;
  border: 1px solid rgba(230, 126, 34, 0.35);
  border-radius: var(--radius);
  background: var(--paper-raised);
  text-align: center;
  box-shadow: var(--shadow);
}

.emergency-card h2 {
  margin: 0 0 20px;
  color: #634426;
  font-size: 20px;
  line-height: 1.5;
  font-weight: 640;
}

.hotline-button {
  display: block;
  min-height: 52px;
  margin-bottom: 12px;
  padding: 15px 12px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f0a365, #dd7d33);
  color: #fff8ef;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(197, 122, 62, 0.18);
}

.emergency-card p {
  margin: 0 0 14px;
  color: #7b6a56;
  font-size: 14px;
  line-height: 1.6;
}

.soft-message {
  position: fixed;
  right: 16px;
  bottom: 82px;
  left: 16px;
  z-index: 18;
  width: min(100%, 428px);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid rgba(160, 125, 84, 0.12);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: #584c3f;
  box-shadow: var(--shadow);
}

.soft-message p {
  min-height: 42px;
  margin: 0 0 9px;
  font-size: 15px;
  line-height: 1.6;
}

#toast {
  position: fixed;
  right: 20px;
  bottom: 24px;
  left: 20px;
  z-index: 40;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #fffaf2;
  color: #5d5142;
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(226, 141, 75, 0.78);
  outline-offset: 2px;
}

@media (max-width: 360px) {
  #app {
    padding-right: 15px;
    padding-left: 15px;
  }

  .lamp-line {
    max-width: 100%;
    font-size: 19px;
  }

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

  .mood-seed.unclear {
    grid-column: span 3;
  }
}

@media (min-width: 700px) {
  body {
    background: linear-gradient(180deg, #fbf3e7 0%, #f0dfc8 58%, #e8d3ba 100%);
  }

  #app {
    position: relative;
    height: calc(100dvh - 2dvh);
    margin: 2dvh auto 0;
    padding-bottom: 64px;
    overflow: hidden auto;
    border-top: 1px solid rgba(155, 122, 85, 0.14);
    border-right: 1px solid rgba(155, 122, 85, 0.14);
    border-left: 1px solid rgba(155, 122, 85, 0.14);
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    background: rgba(253, 248, 241, 0.72);
    box-shadow: 0 26px 70px rgba(144, 105, 65, 0.14);
    backdrop-filter: blur(8px);
  }

  .ambient-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
  }

  #app > .ambient-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
  }

  .lamp-screen,
  .content-screen {
    min-height: calc(90dvh - 68px);
  }

  #app > .dock {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    transform: none;
  }
}

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