/* Mon Mode de Vie — styles.css (2026-07-29 v4) */

/* ═══ @font-face ═══ */
@font-face {
  font-family: "LXGW WenKai TC";
  src: url("./assets/fonts/LXGWWenKaiTC-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ═══ Design Tokens ═══ */
:root {
  color-scheme: light;
  --background: 70 49% 92%;
  --foreground: 184 23% 26%;
  --card: 66 60% 98%;
  --card-foreground: 184 23% 26%;
  --secondary: 56 52% 88%;
  --secondary-foreground: 184 23% 26%;
  --muted: 128 31% 89%;
  --muted-foreground: 184 14% 34%;
  --accent: 162 55% 86%;
  --accent-foreground: 173 58% 36%;
  --border: 110 18% 83%;
  --sidebar-background: 132 35% 90%;
  --sidebar-foreground: 184 23% 26%;
  --sidebar-accent: 66 58% 96%;
  --sidebar-accent-foreground: 173 58% 36%;
  --sidebar-border: 126 18% 78%;
  --story-accent: 173 58% 36%;

  --font-serif: "LXGW WenKai TC", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-latin: "Times New Roman", Baskerville, serif;
  --font-display: var(--font-serif);
  --font-body: var(--font-serif);
  --font-ui: var(--font-sans);

  --tracking-brand: 0.08em;
  --tracking-label: 0.08em;
  --tracking-heading: -0.02em;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lead: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: clamp(1.65rem, 3vw, 2.45rem);

  --leading-tight: 1.25;
  --leading-ui: 1.45;
  --leading-body: 1.75;
  --leading-prose: 2;
  --leading-letter: 1.95;

  --left-width: 252px;
  --right-width: 268px;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  --glass-rgb: 255 255 255;
  --glass-panel-alpha: 0.48;
  --glass-border: rgb(255 255 255 / 0.72);

  --shadow-float: 0 8px 26px hsl(170 32% 28% / 0.1);
  --shadow-panel: 0 18px 50px hsl(170 32% 28% / 0.08);

  --motion-fast: 0.15s;
  --motion-base: 0.25s;
  --motion-slow: 0.4s;
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-standard: cubic-bezier(0.2, 0, 0.38, 0.9);
  --ease-enter: cubic-bezier(0.12, 0, 0.32, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

:root[data-mode="dark"] {
  color-scheme: dark;
  --glass-rgb: 17 29 31;
  --glass-panel-alpha: 0.64;
  --glass-border: rgb(224 255 247 / 0.14);
  --shadow-float: 0 10px 32px rgb(0 0 0 / 0.3);
  --shadow-panel: 0 24px 60px rgb(0 0 0 / 0.24);
}

/* ═══ Reset ═══ */
*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; height: 100%; margin: 0; }
body {
  overflow: hidden;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}
button, input { color: inherit; font: inherit; }
button { border: 0; }
button:not(:disabled) { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid hsl(var(--accent-foreground)); outline-offset: 3px; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ═══ App Shell ═══ */
.app-shell {
  width: 100%; height: 100dvh; overflow: hidden;
  background: radial-gradient(circle at 50% -18%, hsl(var(--card) / 0.92), transparent 42%), hsl(var(--background));
}

/* ═══ Top Bar — floating ═══ */
.topbar { position: static; }

/* left toggle — top-left corner */
.topbar-edge--left {
  position: fixed; z-index: 50; top: 14px; left: 14px;
}
/* right toggle — top-right corner */
.topbar-edge--right {
  position: fixed; z-index: 50; top: 14px; right: 14px;
}

.icon-button {
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border-radius: 50%;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--card) / 0.76);
  backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: 0 2px 10px hsl(var(--foreground) / 0.06), 0 0 0 0.5px hsl(var(--border) / 0.5);
  transition: transform var(--motion-slow) var(--ease-spring), opacity var(--motion-base) ease, color var(--motion-fast) ease, background var(--motion-fast) ease;
}
.icon-button:hover { color: hsl(var(--foreground)); background: hsl(var(--secondary) / 0.8); transform: scale(1.1); }
.icon-button:active { transform: scale(0.9); }

.topbar-edge--left.is-hidden,
.topbar-edge--right.is-hidden { transform: translateY(-130%); opacity: 0; pointer-events: none; transition: transform var(--motion-slow) var(--ease-spring), opacity var(--motion-base) ease; }

/* center nav — floating pill at top-center */
.primary-nav {
  position: fixed; z-index: 50; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px;
  padding: 5px 7px;
  border-radius: var(--radius-pill);
  background: hsl(var(--card) / 0.76);
  backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: 0 2px 16px hsl(var(--foreground) / 0.07), 0 0 0 0.5px hsl(var(--border) / 0.55);
  transition: transform var(--motion-slow) var(--ease-spring), opacity var(--motion-base) ease;
}
.primary-nav.is-hidden { transform: translateX(-50%) translateY(-130%); opacity: 0; pointer-events: none; }
.nav-item {
  display: grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  border-radius: 50%;
  color: hsl(var(--muted-foreground)); background: transparent;
  position: relative;
  transition: color var(--motion-fast) ease, background var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { color: hsl(var(--foreground)); background: hsl(var(--secondary) / 0.5); transform: scale(1.08); }
.nav-item:active { transform: scale(0.92); }
.nav-item.is-active { color: hsl(var(--accent-foreground)); }
.nav-item.is-active::after {
  content: ""; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: hsl(var(--accent-foreground));
}

/* ═══ Workspace ═══ */
.workspace {
  display: grid;
  grid-template-columns: var(--left-width) 4px minmax(0, 1fr) 4px var(--right-width);
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns var(--motion-slow) var(--ease-spring);
}
.app-shell[data-left-open="false"] { --left-width: 0px !important; }
.app-shell[data-right-open="false"] { --right-width: 0px !important; }

/* ═══ Side Panels — spring transitions ═══ */
.side-panel {
  min-width: 0; overflow: auto;
  color: hsl(var(--sidebar-foreground));
  background: linear-gradient(180deg, hsl(var(--sidebar-accent) / 0.34), transparent 28%), hsl(var(--sidebar-background) / 0.76);
  scrollbar-width: thin;
  opacity: 1;
  transition: opacity var(--motion-base) var(--ease-out), transform var(--motion-base) var(--ease-spring);
}
.side-panel--left { padding: 70px 22px 24px; }
.side-panel--right { padding: 70px 20px 24px; }
.app-shell[data-left-open="false"] .side-panel--left { opacity: 0; transform: translateX(-20px); pointer-events: none; }
.app-shell[data-right-open="false"] .side-panel--right { opacity: 0; transform: translateX(20px); pointer-events: none; }

.resize-handle {
  background: hsl(var(--sidebar-border) / 0.35); cursor: col-resize;
  transition: background var(--motion-fast) ease;
}
.resize-handle:hover, .resize-handle.is-dragging { background: hsl(var(--accent-foreground) / 0.35); }
.app-shell[data-left-open="false"] .resize-handle--left,
.app-shell[data-right-open="false"] .resize-handle--right { pointer-events: none; opacity: 0; }

.panel-heading { margin-bottom: 12px; }
.panel-heading h2 { margin: 0; font-family: var(--font-display); font-size: var(--text-sm); font-weight: 500; letter-spacing: var(--tracking-heading); }

/* ═══ Left Panel: Music Box ═══ */
.music-box { margin-top: 24px; }
.music-box__header {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: linear-gradient(145deg, hsl(var(--accent) / 0.55), hsl(var(--card) / 0.85));
  border: 1px solid hsl(var(--border) / 0.55); border-bottom: 0;
}
.music-box__disc {
  position: relative; width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%;
  background: conic-gradient(hsl(var(--foreground)/0.12) 0deg, hsl(var(--accent-foreground)/0.3) 90deg, hsl(var(--foreground)/0.12) 180deg, hsl(var(--accent-foreground)/0.3) 270deg, hsl(var(--foreground)/0.12) 360deg);
  box-shadow: 0 2px 8px hsl(var(--foreground) / 0.1);
  animation: disc-spin 4s linear infinite paused;
}
.music-box__disc-inner {
  position: absolute; inset: 33%; border-radius: 50%;
  background: hsl(var(--card));
  box-shadow: 0 0 0 1px hsl(var(--border) / 0.5);
}
.music-box.is-playing .music-box__disc { animation-play-state: running; }
@keyframes disc-spin { to { transform: rotate(360deg); } }
.music-box__meta {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.music-box__label {
  font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 700;
  color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: var(--tracking-label);
}
.music-box__song {
  font-family: var(--font-serif); font-size: var(--text-sm); font-weight: 600;
  color: hsl(var(--foreground)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.music-box__player {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px 14px;
  background: hsl(var(--card) / 0.7);
  border: 1px solid hsl(var(--border) / 0.55); border-top: 0; border-bottom: 0;
}
.music-box__play {
  display: flex; align-items: center; gap: 8px;
  min-width: 80px; height: 38px; padding: 0 16px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, hsl(var(--accent-foreground)), hsl(var(--story-accent)));
  color: hsl(var(--card)); font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 600;
  box-shadow: 0 3px 10px hsl(var(--accent-foreground) / 0.28);
  transition: transform var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) ease, filter var(--motion-fast) ease;
}
.music-box__play:hover { transform: scale(1.04); box-shadow: 0 4px 16px hsl(var(--accent-foreground) / 0.38); filter: brightness(1.08); }
.music-box__play:active { transform: scale(0.96); }
.music-box__play.is-playing { background: linear-gradient(135deg, hsl(var(--story-accent)), hsl(var(--foreground)/0.8)); }
.music-box__play.is-playing .icon-play { display: none; }
.music-box__play.is-playing .icon-pause { display: block; }
.music-box__play:not(.is-playing) .icon-pause { display: none; }
.music-box__play:not(.is-playing) .icon-play { display: block; }
.music-box__play-label { flex-shrink: 0; }
.music-box__wave {
  display: flex; align-items: flex-end; gap: 3px; height: 28px; flex: 1; min-width: 0;
}
.music-box__wave-bar {
  flex: 1; min-width: 3px; max-width: 6px;
  border-radius: 2px;
  background: hsl(var(--accent-foreground) / 0.35);
  animation: wave-bounce 0.9s ease-in-out infinite paused;
  animation-delay: calc(var(--d) * 0.15s);
  height: 20%;
}
.music-box.is-playing .music-box__wave-bar { animation-play-state: running; }
@keyframes wave-bounce {
  0%, 100% { height: 20%; }
  50% { height: 100%; }
}
.music-box__progress {
  height: 4px; border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: hsl(var(--border) / 0.55); overflow: hidden;
}
.music-box__progress-fill {
  height: 100%; width: 0%;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: linear-gradient(90deg, hsl(var(--accent-foreground)), hsl(var(--story-accent)));
  transition: width 0.3s linear;
}
.on-this-day { display: grid; gap: 16px; }
.otd-card {
  display: block; border-radius: var(--radius-md); overflow: hidden;
  background: hsl(var(--card) / 0.5); border: 1px solid hsl(var(--border) / 0.5);
  transition: transform var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
  cursor: pointer;
}
.otd-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-float); }
.otd-cover { aspect-ratio: 4/3; overflow: hidden; }
.otd-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--motion-slow) var(--ease-out); }
.otd-card:hover .otd-cover img { transform: scale(1.03); }
.otd-body { padding: 14px 16px 16px; }
.otd-date { display: block; font-family: var(--font-serif); font-size: var(--text-xl); font-weight: 600; color: hsl(var(--story-accent)); margin-bottom: 6px; }
.otd-excerpt { margin: 0; font-family: var(--font-serif); font-size: var(--text-xs); line-height: 1.65; color: hsl(var(--muted-foreground)); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ═══ Main Stage ═══ */
.main-stage {
  position: relative; min-width: 0; overflow: auto;
  background: radial-gradient(circle at 0 0, hsl(var(--card) / 0.55), transparent 32%), hsl(var(--background));
  padding-top: 64px;
}
.module-view {
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity var(--motion-base) var(--ease-out), transform var(--motion-base) var(--ease-spring);
  position: absolute; inset: 0; overflow: auto; scroll-behavior: smooth;
  scrollbar-width: none;
}
.module-view::-webkit-scrollbar { display: none; }
.module-view.is-active {
  opacity: 1; transform: translateY(0); pointer-events: auto;
  position: relative;
}
.module-sheet {
  width: min(980px, calc(100% - 48px)); min-height: calc(100% - 64px);
  margin: 32px auto; padding: 34px 38px;
  border: 1px solid hsl(var(--border) / 0.72); border-radius: var(--radius-lg);
  background: hsl(var(--card) / 0.62);
  box-shadow: 0 22px 70px hsl(var(--foreground) / 0.045);
}

/* ═══ Home Chat ═══ */
.home-chat {
  width: min(680px, calc(100% - 48px));
  margin: clamp(24px, 5vh, 48px) auto 0;
  padding: 0 4px;
}
.chat-day { margin: 0 0 12px; color: hsl(var(--muted-foreground)); font-family: var(--font-serif); font-size: var(--text-lead); text-align: center; }
.chat-thread {
  display: flex; flex-direction: column; gap: 16px;
  padding-bottom: 33vh;
}
.chat-opening { display: contents; }

.chat-message {
  display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: start;
  gap: 10px;
  animation: msg-enter var(--motion-base) var(--ease-enter) both;
}
.chat-avatar { width: 42px; height: 42px; border-radius: 50%; }
.chat-name { display: block; margin-bottom: 4px; font-size: var(--text-sm); font-weight: 600; color: hsl(var(--muted-foreground)); }
.chat-bubble {
  padding: 12px 18px; border-radius: 4px 16px 16px 16px;
  background: hsl(var(--card) / 0.65); border: 1px solid hsl(var(--border) / 0.35);
  font-size: var(--text-lead); line-height: var(--leading-prose);
  box-shadow: 0 1px 3px hsl(var(--foreground) / 0.03);
  display: inline-block; max-width: 72%;
}
.chat-bubble p { margin: 0; }
.chat-bubble p + p { margin-top: 0.8em; }

.chat-message--guest { grid-template-columns: minmax(0, 1fr) 42px; animation-name: msg-enter-guest; }
.chat-message--guest .chat-avatar { order: 2; }
.chat-message--guest .chat-message__content { order: 1; display: flex; flex-direction: column; align-items: flex-end; }
.chat-message--guest .chat-bubble { border-radius: 16px 4px 16px 16px; background: hsl(var(--accent) / 0.10); }
.chat-message--guest .chat-name { text-align: right; }

.chat-choices {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px;
}
.chat-choice {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 10px 18px;
  border: 1px solid hsl(var(--border) / 0.7); border-radius: var(--radius-pill);
  background: hsl(var(--card) / 0.7); font-size: var(--text-md);
  transition: border-color var(--motion-fast) ease, background var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}
.chat-choice:hover { border-color: hsl(var(--accent-foreground) / 0.5); background: hsl(var(--accent) / 0.3); transform: translateY(-1px); }
.chat-choice:active { transform: scale(0.97); }
.chat-choice--anniversary { border-color: hsl(var(--story-accent) / 0.3); background: hsl(var(--accent) / 0.25); }
.chat-choice__date { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.chat-choice__date b { font-size: var(--text-lead); color: hsl(var(--story-accent)); }
.chat-choice__date small { font-size: 10px; color: hsl(var(--muted-foreground)); }

.chat-typing { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: hsl(var(--muted-foreground)); font-size: var(--text-sm); }
.chat-hint { margin: 0 0 20px; color: hsl(var(--muted-foreground)); font-family: var(--font-serif); font-size: var(--text-lead); text-align: center; opacity: 0.55; user-select: none; animation: hint-breathe 2.4s ease-in-out infinite; }
@keyframes hint-breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.72; } }

@keyframes msg-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes msg-enter-guest { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }

/* ═══ Right Panel: Envelope ═══ */
.envelope-card {
  display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center;
  width: 100%; min-height: 92px; padding: 12px 4px; gap: 14px;
  color: hsl(var(--sidebar-foreground)); background: transparent; text-align: left;
  transition: transform var(--motion-fast) var(--ease-out);
}
.envelope-card:hover { transform: translateX(2px); }
.envelope-illustration {
  position: relative; display: grid; place-items: center;
  width: 58px; height: 44px; perspective: 180px;
  border: 1px solid hsl(var(--sidebar-foreground) / 0.24); border-radius: 3px;
  color: hsl(var(--accent-foreground)); background: hsl(var(--card) / 0.7);
}
.envelope-illustration svg { width: 34px; height: 34px; stroke-width: 1.2; }
.envelope-flap {
  position: absolute; top: -1px; right: -1px; left: -1px; height: 20px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: hsl(var(--accent) / 0.66); transform-origin: top;
  transition: transform var(--motion-slow) var(--ease-spring);
}
.envelope-card:hover .envelope-flap,
.envelope-card[aria-expanded="true"] .envelope-flap { transform: rotateX(155deg); }
.envelope-card small { font-family: var(--font-sans); font-size: var(--text-sm); color: hsl(var(--muted-foreground)); text-transform: uppercase; letter-spacing: var(--tracking-label); }
.envelope-card strong { font-family: var(--font-display); font-size: var(--text-sm); font-weight: 500; letter-spacing: var(--tracking-heading); }

.author-letter { margin: 14px 0 0; font-family: var(--font-serif); animation: letter-in var(--motion-slow) var(--ease-spring) both; }
.letter-paper {
  padding: 18px 16px 14px;
  border: 1px solid hsl(var(--border)); border-radius: 2px 2px var(--radius-md) var(--radius-md);
  color: hsl(var(--card-foreground));
  background: repeating-linear-gradient(180deg, transparent 0 25px, hsl(var(--border) / 0.28) 26px), hsl(var(--card));
  box-shadow: 0 12px 32px hsl(var(--foreground) / 0.08);
}
.letter-paper p { margin: 0; font-family: var(--font-display); font-size: var(--text-md); line-height: var(--leading-letter); }
.letter-paper button { margin-top: 12px; padding: 5px 0; color: hsl(var(--accent-foreground)); background: transparent; font-family: var(--font-sans); font-size: var(--text-sm); }

@keyframes letter-in { from { opacity: 0; transform: translateY(-8px) scaleY(0.94); } to { opacity: 1; transform: translateY(0) scaleY(1); } }

/* ═══ Right Panel: Game ═══ */
.game-card { margin-top: 24px; }
.game-card header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.game-card header svg { width: 24px; height: 24px; color: hsl(var(--accent-foreground)); }
.game-card h3 { margin: 0; font-family: var(--font-display); font-size: var(--text-md); font-weight: 500; }
.game-frame { width: 100%; height: 420px; border: 0; border-radius: var(--radius-sm); }

/* ═══ Cloud Menu ═══ */
.cloud-menu {
  position: fixed; z-index: 60; top: 66px; left: 50%; transform: translateX(-50%);
  width: min(340px, 92vw); max-height: calc(100dvh - 90px);
  padding: 22px 20px 18px; overflow-y: auto;
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  background: rgb(var(--glass-rgb) / 0.9); box-shadow: 0 24px 64px hsl(var(--foreground) / 0.18);
  backdrop-filter: blur(28px);
  animation: cloud-in var(--motion-base) var(--ease-spring) both;
}
@keyframes cloud-in { from { opacity: 0; transform: translateY(-8px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.cloud-menu__header { display: flex; justify-content: flex-end; align-items: start; margin-bottom: 8px; }
.cloud-kicker { margin: 0; font-family: var(--font-sans); font-size: var(--text-xs); color: hsl(var(--story-accent)); font-weight: 700; letter-spacing: var(--tracking-label); text-transform: uppercase; }
.cloud-menu h2 { margin: 4px 0 0; font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 500; letter-spacing: var(--tracking-heading); }
.cloud-section { margin-bottom: 20px; }
.cloud-section h3 { margin: 0 0 10px; font-size: var(--text-sm); font-weight: 600; color: hsl(var(--muted-foreground)); }
.cloud-section__heading { display: flex; justify-content: space-between; align-items: center; }
.segmented-control { display: flex; gap: 4px; padding: 3px; border-radius: var(--radius-md); background: hsl(var(--secondary)); }
.segmented-control button {
  display: flex; align-items: center; gap: 5px;
  min-height: 34px; padding: 5px 10px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); background: transparent;
}
.segmented-control button.is-selected { color: hsl(var(--accent-foreground)); background: hsl(var(--card)); box-shadow: 0 1px 4px hsl(var(--foreground) / 0.08); }

.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.theme-choice {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center;
  min-height: 42px; padding: 5px 7px; gap: 7px;
  border: 1px solid hsl(var(--border) / 0.6); border-radius: var(--radius-md);
  background: hsl(var(--card) / 0.4); font-size: var(--text-xs); text-align: left;
  transition: border-color var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}
.theme-choice:hover { border-color: hsl(var(--accent-foreground) / 0.4); transform: translateY(-1px); }
.theme-choice:active { transform: scale(0.97); }
.theme-choice.is-selected { border-color: hsl(var(--accent-foreground) / 0.5); box-shadow: inset 0 0 0 1px hsl(var(--accent-foreground) / 0.16); }
.theme-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  background: conic-gradient(var(--swatch-a, #888) 0deg 120deg, var(--swatch-b, #888) 120deg 240deg, var(--swatch-c, #888) 240deg 360deg);
  border: 1px solid hsl(var(--border) / 0.4);
  flex-shrink: 0;
}
/* 熊猫三色圆卡硬确保 */
.theme-swatch[data-theme-choice="panda"] {
  background: conic-gradient(#FF75B5 0deg 120deg, #19f9d8 120deg 240deg, #242526 240deg 360deg) !important;
}

.theme-swatch i { display: none; }

.language-row { display: flex; width: 100%; }
.language-row button {
  flex: 1; min-height: 38px; border: 1px solid hsl(var(--border) / 0.5); border-radius: var(--radius-sm);
  background: hsl(var(--card) / 0.5); font-size: var(--text-xs);
}
.language-row button.is-selected { color: hsl(var(--accent-foreground)); background: hsl(var(--card) / 0.85); box-shadow: 0 1px 4px hsl(var(--foreground) / 0.08); }

.cloud-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 14px; border-top: 1px solid hsl(var(--border) / 0.7); }
.cloud-links button, .cloud-link-button {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  min-height: 52px; padding: 9px 11px; border-radius: var(--radius-md);
  background: hsl(var(--secondary) / 0.68); text-align: left; text-decoration: none;
  color: hsl(var(--foreground)); font-size: inherit;
}
.cloud-links button:hover, .cloud-link-button:hover { background: hsl(var(--secondary) / 0.9); }
.cloud-links small, .cloud-link-button small { margin-top: 2px; color: hsl(var(--muted-foreground)); font-size: var(--text-xs); }

/* ═══ Journal: hide language switcher ═══ */
.language-switcher { display: none !important; }

/* ═══ Mobile Scrim ═══ */
.mobile-scrim { position: fixed; z-index: 45; inset: 0; background: rgb(0 0 0 / 0.26); backdrop-filter: blur(2px); }
.mobile-scrim[hidden] { display: none !important; }

/* ═══ Responsive ═══ */
@media (max-width: 840px) {
  .workspace { display: block; }
  .main-stage { width: 100%; height: 100%; padding-top: 60px; }
  .side-panel {
    position: fixed; z-index: 48; top: 0; bottom: 0;
    width: min(86vw, 320px);
    padding-top: 80px !important;
    transition: transform var(--motion-slow) var(--ease-spring), opacity var(--motion-base) var(--ease-out);
  }
  .side-panel--left { left: 0; transform: translateX(0); }
  .side-panel--right { right: 0; transform: translateX(0); }
  .app-shell[data-left-open="false"] .side-panel--left { transform: translateX(-105%); opacity: 0; }
  .app-shell[data-right-open="false"] .side-panel--right { transform: translateX(105%); opacity: 0; }
  .resize-handle { display: none; }
  .module-sheet { width: calc(100% - 28px); margin: 14px auto; padding: 24px 20px; }
  [data-theme="panda"] .primary-nav::before,
  [data-theme="panda"] .primary-nav::after { display: none; }
  [data-theme="panda"] .primary-nav { padding: 4px 6px; gap: 0; }
}

@media (max-width: 520px) {
  .module-sheet { width: calc(100% - 16px); margin: 8px auto; padding: 18px 10px 22px; border-radius: var(--radius-md); }
  .home-chat { width: calc(100% - 28px); }
}

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

/* ═══ Panda Special Theme ═══ */
.panda-emoji { display: none; }
/* ── Navigation ── */
[data-theme="panda"] .panda-emoji { display: inline; }
[data-theme="panda"] .nav-icon-svg { display: none; }
[data-theme="panda"] .icon-button > svg { display: none; }
[data-theme="panda"] .app-shell {
  background: 
    none;
}
[data-theme="panda"][data-mode="dark"] .app-shell {
  background: 
    none;
}
/* ── Navigation ── */
[data-theme="panda"] .primary-nav {
  box-shadow: 0 2px 20px hsl(340 72% 68% / 0.12), 0 0 0 0.5px hsl(170 87% 54% / 0.25);
  border-radius: 28px;
  padding: 6px 10px;
  gap: 4px;
}
[data-theme="panda"] .primary-nav::before {
  content: "🎋";
  position: absolute;
  left: -18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
  pointer-events: none;
}
[data-theme="panda"] .primary-nav::after {
  content: "🎋";
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%) scaleX(-1);
  font-size: 16px;
  opacity: 0.5;
  pointer-events: none;
}
[data-theme="panda"] .nav-item {
  width: 40px; height: 40px;
  border-radius: 50%;
}
[data-theme="panda"] .nav-item.is-active {
  color: hsl(var(--accent-foreground));
  background: hsl(340 72% 68% / 0.15);
}
[data-theme="panda"] .nav-item.is-active::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px; height: 5px;
  border-radius: 50%;
  background: hsl(170 87% 54%);
}
[data-theme="panda"] .nav-item:hover {
  background: hsl(340 72% 68% / 0.1);
  transform: scale(1.12);
}
/* ── Icon buttons ── */
[data-theme="panda"] .icon-button {
  border-radius: 14px;
  box-shadow: 0 2px 10px hsl(0 0% 0% / 0.08), 0 0 0 0.5px hsl(170 87% 54% / 0.15);
}
[data-theme="panda"] .icon-button:hover {
  background: hsl(340 72% 68% / 0.12);
}
/* panda ear decorations on toggle buttons */
[data-theme="panda"] .topbar-edge--left::before,
[data-theme="panda"] .topbar-edge--right::before {
  content: "🐾";
  position: absolute;
  font-size: 22px;
  opacity: 0.85;
  pointer-events: none;
  top: 50%;
  transform: translateY(-50%);
}
[data-theme="panda"] .topbar-edge--left::before { left: 7px; }
[data-theme="panda"] .topbar-edge--right::before { right: 7px; }
[data-theme="panda"] .topbar-edge--left .icon-button svg,
[data-theme="panda"] .topbar-edge--right .icon-button svg { display: none; }
/* ── Module sheets ── */
[data-theme="panda"] .module-sheet {
  border-color: hsl(170 87% 54% / 0.16);
  border-radius: 22px;
  box-shadow: 0 18px 60px hsl(0 0% 0% / 0.06);
}
/* ── Chat ── */
[data-theme="panda"] .chat-bubble {
  border-color: hsl(340 72% 68% / 0.18);
  border-radius: 6px 22px 22px 22px;
}
[data-theme="panda"] .chat-message--guest .chat-bubble {
  border-radius: 22px 6px 22px 22px;
}
[data-theme="panda"] .chat-choice {
  border-color: hsl(170 87% 54% / 0.25);
  border-radius: 24px;
}
[data-theme="panda"] .chat-choice:hover {
  border-color: hsl(340 72% 68% / 0.5);
  background: hsl(340 72% 68% / 0.08);
}
[data-theme="panda"] .chat-continue .chat-choice {
  background: linear-gradient(135deg, hsl(340 72% 68% / 0.15), hsl(170 87% 54% / 0.1));
  border-color: hsl(340 72% 68% / 0.35);
  color: hsl(var(--accent-foreground));
}
/* ── Side panels ── */
[data-theme="panda"] .side-panel {
  border-radius: 0 18px 18px 0;
  position: relative;
}
[data-theme="panda"] .side-panel--right {
  border-radius: 18px 0 0 18px;
}
[data-theme="panda"] .side-panel--left::after {
  content: "";
  position: absolute;
  bottom: 16px;
  right: 12px;
  width: 48px;
  height: 48px;
  background: none;
  opacity: 0.18;
  pointer-events: none;
}
[data-theme="panda"] .side-panel--right::after {
  content: "";
  position: absolute;
  bottom: 60px;
  left: 10px;
  width: 40px;
  height: 100px;
  background: none;
  opacity: 0.16;
  pointer-events: none;
}
[data-theme="panda"] .panel-heading h2 {
  position: relative;
  padding-left: 26px;
}
[data-theme="panda"] .panel-heading h2::before {
  content: "";
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px;
  background: none;
}
/* ── Music Box ── */
[data-theme="panda"] .music-box__play {
  background: linear-gradient(135deg, hsl(340 72% 68%), hsl(170 87% 54%));
  box-shadow: 0 3px 14px hsl(340 72% 68% / 0.35);
}
[data-theme="panda"] .music-box__disc {
  background: conic-gradient(hsl(0 0% 30%) 0deg, hsl(340 72% 68% / 0.4) 90deg, hsl(0 0% 30%) 180deg, hsl(170 87% 54% / 0.4) 270deg, hsl(0 0% 30%) 360deg);
}
/* ── Cloud menu ── */
[data-theme="panda"] .cloud-menu {
  border-color: hsl(170 87% 54% / 0.2);
  box-shadow: 0 24px 64px hsl(0 0% 0% / 0.25), 0 0 0 1px hsl(340 72% 68% / 0.15);
}
[data-theme="panda"] .cloud-menu__header::after {
  content: "";
  position: absolute;
  top: -16px;
  right: 20px;
  width: 36px;
  height: 36px;
  background: none;
  opacity: 0.55;
  pointer-events: none;
}
[data-theme="panda"] .theme-choice:hover {
  border-color: hsl(340 72% 68% / 0.5);
}
/* ── Calendar ── */
[data-theme="panda"] .calendar-frame {
  border-color: hsl(170 87% 54% / 0.2);
  border-radius: 20px;
}
[data-theme="panda"] .calendar-toolbar input[type="date"] {
  border-color: hsl(170 87% 54% / 0.3);
}
[data-theme="panda"] .view-switch {
  background: hsl(170 87% 54% / 0.08);
}
[data-theme="panda"] .year-cell {
  border-color: hsl(170 87% 54% / 0.2);
}
[data-theme="panda"] .year-cell:hover {
  border-color: hsl(340 72% 68%);
  box-shadow: 0 4px 18px hsl(340 72% 68% / 0.18);
}
/* ── Journal ── */
[data-theme="panda"] .journal-entry:hover {
  background: hsl(340 72% 68% / 0.08);
}
[data-theme="panda"] .journal-year__heading {
  color: hsl(var(--accent-foreground));
}
/* ── Album ── */
[data-theme="panda"] .album-tab[aria-selected="true"] {
  background: linear-gradient(180deg, hsl(340 72% 68% / 0.15), hsl(170 87% 54% / 0.15));
}
[data-theme="panda"] .main-stage::after {
  content: "";
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  background: none;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}
[data-theme="panda"] .main-stage::after {
  content: "";
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  background: none;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}

