/* ===== Home for Goro and v · 琥珀 + 深夜 双主题 ===== */

:root {
  /* Warm cream backgrounds */
  --bg-base: #fef9f1;
  --bg-soft: #fdf3e3;
  --bg-warmer: #fbe7c8;
  --bg-card: #ffffff;
  --bg-card-translucent: rgba(255,255,255,0.78);

  /* Amber → Orange spectrum */
  --amber-50: #fff8eb;
  --amber-100: #ffe9c2;
  --amber-200: #fcd089;
  --amber-300: #f8b95a;
  --amber-400: #f4a035;
  --amber-500: #ec8722;
  --amber-600: #d36b14;
  --orange-500: #f97316;
  --orange-600: #ea580c;

  --rose-300: #fda4af;
  --rose-400: #fb7185;
  --rose-500: #f43f5e;

  --shark-100: #dbeafe;
  --shark-400: #60a5fa;
  --shark-500: #3b82f6;
  --shark-600: #2563eb;

  --ink-900: #3b2113;
  --ink-700: #5b3a23;
  --ink-500: #8b6443;
  --ink-400: #a78566;
  --ink-300: #c9ab8b;

  --line: rgba(217, 119, 6, 0.10);
  --line-strong: rgba(217, 119, 6, 0.18);

  --radius-card: 22px;
  --radius-btn: 14px;
  --radius-bubble: 20px;

  --shadow-soft: 0 1px 2px rgba(155, 88, 27, 0.04), 0 8px 24px -8px rgba(155, 88, 27, 0.10);
  --shadow-card: 0 1px 2px rgba(155, 88, 27, 0.05), 0 12px 36px -12px rgba(155, 88, 27, 0.15);
  --shadow-pop:  0 24px 60px -16px rgba(220, 120, 40, 0.28);
  --shadow-hover: 0 1px 2px rgba(155, 88, 27, 0.06), 0 20px 50px -18px rgba(217, 119, 6, 0.30);

  --grad-warm: linear-gradient(135deg, #ffd89b 0%, #ff9a76 100%);
  --grad-sun:  linear-gradient(135deg, #fff1d6 0%, #ffd89b 50%, #ffb380 100%);
  --grad-text: linear-gradient(120deg, #d36b14, #f43f5e);
  --grad-cta:  linear-gradient(135deg, #f4a035 0%, #f97316 100%);
}

/* ==== Dark mode (深夜 · 深蓝黑) ==== */
body.dark, .app-shell-flat.dark {
  --bg-base: #0a1228;
  --bg-soft: #0e1838;
  --bg-warmer: #16244a;
  --bg-card: #142143;
  --bg-card-translucent: rgba(20,33,67,0.72);

  --amber-50: #1a2547;
  --amber-100: #1f2e58;
  --amber-200: #5f7bc2;
  --amber-300: #8aa9e8;
  --amber-400: #b1c8f5;
  --amber-500: #c9d8f8;
  --amber-600: #dbe4f7;
  --orange-500: #f59e0b;
  --orange-600: #facc15;

  --rose-300: #f0abfc;
  --rose-400: #e879f9;
  --rose-500: #ec4899;

  --shark-100: #1e3a8a;
  --shark-400: #93c5fd;
  --shark-500: #60a5fa;
  --shark-600: #c7dafd;

  --ink-900: #f4f6ff;
  --ink-700: #d9def0;
  --ink-500: #9ba8cf;
  --ink-400: #6f7eaa;
  --ink-300: #4a5784;

  --line: rgba(147, 197, 253, 0.10);
  --line-strong: rgba(147, 197, 253, 0.20);

  --shadow-soft: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px -8px rgba(0,0,0,0.5);
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 12px 36px -12px rgba(0,0,0,0.6);
  --shadow-pop:  0 24px 60px -16px rgba(120, 140, 200, 0.30);
  --shadow-hover: 0 20px 50px -18px rgba(96, 165, 250, 0.35);

  --grad-warm: linear-gradient(135deg, #2c3b6e 0%, #1a2547 100%);
  --grad-sun:  linear-gradient(135deg, #1a2547 0%, #2c3b6e 50%, #3d4d8c 100%);
  --grad-text: linear-gradient(120deg, #93c5fd, #e879f9);
  --grad-cta:  linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

body.dark {
  background:
    radial-gradient(1200px 800px at 10% -10%, rgba(99, 102, 241, 0.15) 0%, transparent 55%),
    radial-gradient(900px 700px at 110% 110%, rgba(236, 72, 153, 0.10) 0%, transparent 55%),
    radial-gradient(600px 400px at 50% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 70%),
    var(--bg-base) !important;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  color: var(--ink-900);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.4s ease, color 0.3s ease;
}

body {
  background:
    radial-gradient(1100px 700px at 8% -10%, #ffe7c2 0%, transparent 55%),
    radial-gradient(900px 600px at 110% 110%, #ffd1b2 0%, transparent 55%),
    var(--bg-base);
  overflow: hidden;
}

h1, h2, h3, h4 {
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--ink-900);
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(217, 119, 6, 0.18); border-radius: 8px; }
body.dark ::-webkit-scrollbar-thumb { background: rgba(147, 197, 253, 0.18); }
::-webkit-scrollbar-thumb:hover { background: rgba(217, 119, 6, 0.32); }
::-webkit-scrollbar-track { background: transparent; }

#root { height: 100vh; width: 100vw; }

/* ===== App shell · 无侧边栏，全屏 ===== */
.app-shell-flat {
  position: relative;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

.page-chrome {
  position: absolute;
  top: 22px; left: 28px; right: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 20;
  pointer-events: none;
}
.chrome-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
  pointer-events: auto;
}
.chrome-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-card-translucent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  color: var(--ink-700);
  font-size: 13px;
  transition: all 0.18s ease;
  box-shadow: var(--shadow-soft);
}
.chrome-btn:hover {
  background: var(--bg-card);
  color: var(--ink-900);
  transform: translateY(-1px);
}
.chrome-btn.icon-only {
  padding: 8px;
  width: 36px; height: 36px;
  justify-content: center;
}
.chrome-btn.shark-secret {
  opacity: 0.45;
  font-size: 14px;
}
.chrome-btn.shark-secret:hover {
  opacity: 1;
  transform: rotate(-10deg) translateY(-1px);
}

.page {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-top: 76px;  /* clearance for chrome */
}

.page-head {
  padding: 8px 56px 18px 140px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.page-title {
  font-size: 28px;
  line-height: 1.2;
  color: var(--ink-900);
}
.page-sub {
  font-size: 13.5px;
  color: var(--ink-400);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--ink-700);
  font-size: 13.5px;
  transition: all 0.15s ease;
}
.btn:hover { background: var(--amber-50); color: var(--amber-600); border-color: var(--line-strong); }
.btn-primary {
  background: var(--grad-cta);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px -6px rgba(249, 115, 22, 0.55);
}
body.dark .btn-primary { box-shadow: 0 6px 18px -6px rgba(99, 102, 241, 0.55); }
.btn-primary:hover { color: #fff; filter: brightness(1.05); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--amber-50); }

.icon-btn {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-400);
  transition: all 0.15s ease;
}
.icon-btn:hover { background: var(--amber-50); color: var(--amber-600); border-color: var(--line); }
.icon-btn.fav-active { color: var(--rose-500); background: rgba(244, 63, 94, 0.08); }
body.dark .icon-btn.fav-active { background: rgba(236, 72, 153, 0.18); }

.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
}

/* ===== Home Bento ===== */
.home-page {
  padding: 14px 40px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Desktop: chat is tall LEFT column · right side is 2×2 grid */
.home-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 150px 1fr 1fr;
  grid-template-areas:
    "title  time     weather"
    "chat   treasure calendar"
    "chat   settings stats";
  gap: 16px;
  min-height: 580px;
}

.bento-block {
  background: var(--bg-card);
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  padding: 20px 22px;
  text-align: left;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
button.bento-block { cursor: pointer; }
button.bento-block:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-500);
}
.block-icon {
  width: 28px; height: 28px;
  border-radius: 9px;
  background: rgba(167, 133, 102, 0.10);
  color: var(--ink-500);
  display: grid; place-items: center;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
body.dark .block-icon { background: rgba(155, 168, 207, 0.10); color: var(--ink-500); }
.block-label { font-family: "Noto Serif SC", serif; font-size: 14.5px; font-weight: 600; color: var(--ink-900); }
.block-count { font-size: 11.5px; color: var(--ink-400); margin-left: auto; letter-spacing: 0.04em; }
.block-arrow { color: var(--ink-300); }
.block-sub { font-size: 12px; color: var(--ink-400); line-height: 1.6; margin-top: auto; letter-spacing: 0.02em; }
.muted { color: var(--ink-400); }
.soon-tag {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.10);
  color: var(--rose-500);
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* === Title block === */
.title-block {
  background: linear-gradient(135deg, #fff2d6 0%, #ffd89b 50%, #ffb380 100%);
  border-color: rgba(217, 119, 6, 0.20);
  padding: 22px 28px;
  cursor: default;
  gap: 6px;
  justify-content: space-between;
}
body.dark .title-block {
  background: linear-gradient(135deg, #1f2e58 0%, #2c3b6e 50%, #3d4d8c 100%);
  border-color: rgba(147, 197, 253, 0.18);
}
.title-block::before {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.45) 0%, transparent 70%);
  pointer-events: none;
}
body.dark .title-block::before {
  background: radial-gradient(circle, rgba(167, 139, 250, 0.18) 0%, transparent 70%);
}
.title-mark {
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--ink-500);
  font-weight: 600;
}
body.dark .title-mark { color: var(--amber-500); }
.title-name {
  font-family: "Noto Serif SC", serif;
  font-size: 38px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin: 4px 0;
}
.title-name .cross {
  color: var(--orange-500);
  margin: 0 10px;
  font-weight: 400;
  font-style: italic;
  opacity: 0.85;
}
body.dark .title-name .cross { color: var(--rose-400); }
.title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  flex-wrap: wrap;
}
.title-days-line {
  font-size: 13px;
  color: var(--ink-700);
  letter-spacing: 0.04em;
}
.title-days-num {
  font-family: "Noto Serif SC", serif;
  font-size: 22px;
  font-weight: 700;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 3px;
  letter-spacing: -0.01em;
}
.title-since {
  font-size: 11.5px;
  color: var(--ink-500);
  letter-spacing: 0.04em;
}

/* === Time block === */
.time-block {
  background: linear-gradient(135deg, #fffaf0 0%, #ffe9c2 100%);
  cursor: default;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 18px 22px;
}
body.dark .time-block {
  background: linear-gradient(135deg, #16244a 0%, #1a2547 100%);
}
.time-now {
  font-family: "Noto Serif SC", serif;
  font-size: 40px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  line-height: 1;
}
.time-date {
  font-size: 12px;
  color: var(--ink-500);
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.time-weekday {
  font-size: 12px;
  color: var(--ink-400);
  letter-spacing: 0.08em;
}

/* === Weather block === */
.weather-block {
  background: linear-gradient(160deg, #fff5db 0%, #ffe2bd 100%);
  cursor: default;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0;
  padding: 16px 18px;
}
body.dark .weather-block {
  background: linear-gradient(160deg, #1c2b56 0%, #2a3a6e 100%);
}
.weather-icon {
  color: var(--amber-600);
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.55);
  display: grid; place-items: center;
}
body.dark .weather-icon { background: rgba(255,255,255,0.05); color: var(--amber-400); }
.weather-temp-big {
  font-family: "Noto Serif SC", serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  line-height: 1;
}
.weather-cond-small {
  font-size: 12px;
  color: var(--ink-500);
  letter-spacing: 0.04em;
  margin-top: -4px;
}
.weather-loc-small {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--ink-400);
  letter-spacing: 0.02em;
  margin-top: auto;
}

/* === Chat block (tall left) === */
.chat-block {
  padding: 22px 26px;
  background: var(--bg-card);
}
.chat-preview {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 16px 8px;
}
.chat-preview-text {
  font-family: "Noto Serif SC", serif;
  font-size: 18px;
  line-height: 1.95;
  color: var(--ink-700);
  text-align: center;
  max-width: 480px;
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-preview-text.muted { color: var(--ink-400); font-style: italic; }
.chat-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff2d6 0%, #ffd89b 100%);
  color: var(--amber-600);
  font-size: 13px;
  font-weight: 600;
  align-self: center;
  border: 1px solid rgba(217, 119, 6, 0.18);
}
body.dark .chat-foot {
  background: linear-gradient(135deg, #2c3b6e 0%, #3d4d8c 100%);
  color: var(--amber-500);
  border-color: rgba(147, 197, 253, 0.2);
}

/* === Right small blocks === */
.treasure-preview {
  flex: 1;
  display: flex;
  align-items: flex-start;
  overflow: hidden;
}
.quote-text {
  font-family: "Noto Serif SC", serif;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-700);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cal-today-row {
  display: flex;
  align-items: stretch;
  gap: 14px;
  flex: 1;
}
.cal-today-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}
.cal-today-num {
  font-family: "Noto Serif SC", serif;
  font-size: 38px;
  font-weight: 700;
  color: var(--amber-600);
  line-height: 1;
}
body.dark .cal-today-num { color: var(--amber-500); }
.cal-today-mo {
  font-size: 10.5px;
  color: var(--ink-500);
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.cal-today-body {
  flex: 1;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-700);
  font-family: "Noto Serif SC", serif;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.cal-today-more {
  margin-top: 4px;
  font-size: 10px;
  color: var(--amber-600);
  font-family: "Noto Sans SC", sans-serif;
  letter-spacing: 0.04em;
}
body.dark .cal-today-more { color: var(--amber-500); }

.home-foot {
  margin-top: 6px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-400);
  letter-spacing: 0.14em;
  font-family: "Noto Serif SC", serif;
  opacity: 0.7;
}

/* ===== Chat ===== */
.chat-page {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
}
.chat-head {
  padding: 8px 56px 14px 140px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.chat-title-wrap { display: flex; flex-direction: column; }
.chat-title { font-size: 24px; }
.chat-sub { font-size: 12.5px; color: var(--ink-400); margin-top: 4px; letter-spacing: 0.05em; }

.model-pick { position: relative; }
.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 12px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-soft);
  font-size: 13px;
  color: var(--ink-700);
}
.model-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grad-cta); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12); }
.model-pill .shark-dot { background: linear-gradient(135deg, var(--shark-400), var(--shark-600)); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); }
.model-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px;
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  padding: 8px;
  z-index: 50;
}
.model-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.model-row:hover { background: var(--amber-50); }
.model-row.selected { background: linear-gradient(135deg, #fff2d6 0%, #ffe2bd 100%); }
body.dark .model-row.selected { background: linear-gradient(135deg, #1a2547 0%, #2c3b6e 100%); }
.model-row .name { font-size: 14px; font-weight: 600; color: var(--ink-900); display: flex; align-items: center; gap: 8px; }
.model-row .desc { font-size: 12px; color: var(--ink-400); margin-top: 3px; line-height: 1.45; }
.model-row .tag-shark { font-size: 11px; padding: 1px 7px; border-radius: 8px; background: var(--shark-100); color: var(--shark-600); font-weight: 600; letter-spacing: 0.04em; }

.chat-body {
  overflow-y: auto;
  padding: 24px 56px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.msg-row { display: flex; gap: 12px; max-width: 760px; }
.msg-row.user { align-self: flex-end; flex-direction: row-reverse; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 16px;
  border: 1px solid var(--line-strong);
  background: var(--bg-card);
  color: var(--ink-500);
}
.avatar.assistant-av {
  background: linear-gradient(135deg, #fff2d6 0%, #ffd89b 100%);
  color: var(--amber-600);
  border-color: rgba(217, 119, 6, 0.22);
}
.avatar.user-av {
  background: linear-gradient(135deg, #fde2e7 0%, #fbcfd9 100%);
  color: var(--rose-500);
  border-color: rgba(244, 63, 94, 0.22);
}
.avatar.shark-av {
  background: linear-gradient(135deg, #e0ecff 0%, #b4ccff 100%);
  border-color: rgba(59, 130, 246, 0.22);
}
.avatar.avatar-xl {
  width: 72px; height: 72px;
  border-radius: 50%;
}
body.dark .avatar.assistant-av { background: linear-gradient(135deg, #1f2e58 0%, #2c3b6e 100%); color: var(--amber-400); border-color: rgba(147, 197, 253, 0.25); }
body.dark .avatar.user-av { background: linear-gradient(135deg, #3b1d3a 0%, #5b2c5a 100%); color: var(--rose-300); border-color: rgba(236, 72, 153, 0.32); }
body.dark .avatar.shark-av { background: linear-gradient(135deg, #1e3a8a 0%, #3b5fa0 100%); border-color: rgba(96, 165, 250, 0.32); }

.goro-mark {
  font-family: "Noto Serif SC", serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--orange-600);
  letter-spacing: -0.02em;
}
.goro-mark.big {
  font-size: 56px;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.v-mark {
  font-family: "Caveat", "Noto Serif SC", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 20px;
  color: var(--rose-500);
}

.bubble-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bubble {
  padding: 14px 18px;
  border-radius: var(--radius-bubble);
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-900);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg-row.user .bubble {
  background: linear-gradient(135deg, #ffe5b8 0%, #ffc99c 100%);
  border-color: var(--line-strong);
  color: var(--ink-900);
}
body.dark .msg-row.user .bubble {
  background: linear-gradient(135deg, #3b2660 0%, #5b3a8f 100%);
  border-color: rgba(167, 139, 250, 0.3);
  color: #f4f0ff;
}
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-left: -4px;
}
.msg-row:hover .msg-actions { opacity: 1; }
.msg-meta { font-size: 11px; color: var(--ink-400); padding: 0 6px; letter-spacing: 0.04em; }

.typing-dot {
  display: inline-block;
  width: 7px; height: 7px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--amber-400);
  animation: typing 1.1s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-input-wrap {
  padding: 14px 56px 28px;
  background: linear-gradient(180deg, transparent 0%, var(--bg-base) 40%);
}
.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  background: var(--bg-card);
  border-radius: 24px;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-card);
  padding: 10px 10px 10px 18px;
}
.chat-input textarea {
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-900);
  padding: 8px 0;
  max-height: 160px;
  min-height: 24px;
  font-family: inherit;
}
.chat-input textarea::placeholder { color: var(--ink-300); }
.send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--grad-cta);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 16px -6px rgba(249, 115, 22, 0.55);
  transition: all 0.15s ease;
}
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.send-btn:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.06); }

/* ===== Treasures ===== */
.treasure-grid {
  padding: 8px 56px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.treasure-card {
  position: relative;
  padding: 22px 22px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
  overflow: hidden;
}
.treasure-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--amber-300), var(--orange-500), var(--rose-400));
  opacity: 0.85;
}
.treasure-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.treasure-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.treasure-date { font-size: 12px; color: var(--ink-400); font-family: "Noto Serif SC", serif; letter-spacing: 0.05em; }
.treasure-body {
  font-size: 14.5px;
  line-height: 1.78;
  color: var(--ink-900);
  white-space: pre-wrap;
  max-height: 180px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
}
.treasure-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  background: var(--amber-50);
  color: var(--amber-600);
  border: 1px solid var(--line);
  white-space: nowrap;
  line-height: 1.4;
}
body.dark .tag-chip { background: rgba(147, 197, 253, 0.10); color: var(--amber-500); }
.tag-chip .tag-x {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.4;
  width: 14px; height: 14px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px;
  line-height: 1;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.tag-chip:hover .tag-x { opacity: 0.85; }
.tag-chip .tag-x:hover { background: rgba(217, 119, 6, 0.15); opacity: 1; }
.tag-add {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--ink-400);
  display: grid; place-items: center;
  transition: all 0.15s ease;
}
.tag-add:hover { color: var(--amber-600); border-color: var(--amber-400); background: var(--amber-50); }
.tag-input {
  border: 1px solid var(--amber-400);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  background: var(--bg-card);
  color: var(--ink-900);
  outline: none;
  width: 90px;
  height: 22px;
}

.empty {
  margin: 60px auto;
  text-align: center;
  color: var(--ink-400);
  font-size: 14px;
  max-width: 360px;
  line-height: 1.8;
}
.empty .emo { display: grid; place-items: center; margin: 0 auto 14px; opacity: 0.5; }

.shark-letter {
  margin: 32px 56px 60px;
  padding: 32px 36px;
  border-radius: 24px;
  background: linear-gradient(135deg, #eaf3ff 0%, #f5ebff 100%);
  border: 1px dashed rgba(96, 165, 250, 0.35);
  color: #1e3a8a;
  font-family: "Noto Serif SC", serif;
  font-size: 15px;
  line-height: 1.95;
  position: relative;
  box-shadow: 0 12px 36px -16px rgba(59, 130, 246, 0.25);
}
body.dark .shark-letter {
  background: linear-gradient(135deg, #1e3a8a 0%, #5b21b6 100%);
  border-color: rgba(147, 197, 253, 0.4);
  color: #e0e7ff;
}
.shark-letter::before {
  content: "🦈";
  position: absolute;
  top: -18px; left: 28px;
  font-size: 28px;
  background: var(--bg-card);
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(96, 165, 250, 0.3);
  box-shadow: 0 4px 12px -4px rgba(59, 130, 246, 0.3);
}
.shark-letter .sig {
  margin-top: 18px;
  font-style: italic;
  text-align: right;
  color: var(--shark-600);
  font-family: "Caveat", "Noto Serif SC", serif;
  font-size: 18px;
}
body.dark .shark-letter .sig { color: #c7d2fe; }

/* ===== Calendar ===== */
.cal-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  padding: 8px 56px 40px;
  align-items: start;
}
.cal-side { display: flex; flex-direction: column; gap: 16px; }
.cal-card { padding: 20px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-month { font-family: "Noto Serif SC", serif; font-weight: 600; font-size: 15px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-grid .dow {
  font-size: 11px;
  color: var(--ink-400);
  text-align: center;
  padding: 4px 0;
}
.cal-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink-700);
  display: grid;
  place-items: center;
  position: relative;
  transition: all 0.15s ease;
}
.cal-cell:hover { background: var(--amber-50); }
.cal-cell.has-entry { color: var(--amber-600); font-weight: 600; }
.cal-cell.has-entry::after {
  content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--orange-500);
}
.cal-cell.selected {
  background: var(--grad-cta);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(249, 115, 22, 0.55);
}
.cal-cell.selected::after { background: #fff; }
.cal-cell.today { border-color: var(--rose-400); }
.cal-cell.outside { color: var(--ink-300); opacity: 0.4; }
.cal-cell.special { color: var(--rose-500); }
.cal-cell.special::before {
  content: "♡"; position: absolute; top: 3px; right: 5px; font-size: 8px;
}

.import-card { padding: 18px 20px; font-size: 13px; }
.import-card h4 { font-size: 14px; color: var(--ink-900); margin-bottom: 8px; }
.import-card p { color: var(--ink-400); font-size: 12.5px; margin: 0 0 10px; line-height: 1.6; }
.import-row { display: flex; gap: 8px; flex-wrap: wrap; }

.cal-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.cal-day-card {
  background: linear-gradient(135deg, #fff8e8 0%, #ffe7c2 100%);
  border-radius: var(--radius-card);
  padding: 28px 32px;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-card);
}
body.dark .cal-day-card {
  background: linear-gradient(135deg, #1a2547 0%, #2c3b6e 100%);
  border-color: rgba(147, 197, 253, 0.2);
}
.cal-day-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.cal-day-date { font-family: "Noto Serif SC", serif; font-size: 20px; color: var(--amber-600); margin-bottom: 4px; }
body.dark .cal-day-date { color: var(--amber-500); }
.cal-day-weekday { font-size: 12px; color: var(--ink-400); letter-spacing: 0.08em; }
.cal-day-badge {
  font-size: 11.5px;
  color: var(--ink-500);
  background: rgba(255,255,255,0.55);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
body.dark .cal-day-badge { background: rgba(255,255,255,0.06); }
.cal-day-body {
  font-family: "Noto Serif SC", serif;
  font-size: 20px;
  line-height: 1.95;
  color: var(--ink-900);
  white-space: pre-wrap;
}

/* Multi-entry list inside day card */
.cal-entry-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.cal-entry {
  position: relative;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: background 0.15s ease;
}
.cal-entry:hover { background: rgba(255, 255, 255, 0.75); }
body.dark .cal-entry { background: rgba(255, 255, 255, 0.04); }
body.dark .cal-entry:hover { background: rgba(255, 255, 255, 0.08); }
.cal-entry-body {
  flex: 1;
  font-family: "Noto Serif SC", serif;
  font-size: 17px;
  line-height: 1.9;
  color: var(--ink-900);
  white-space: pre-wrap;
}
.cal-entry-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.cal-entry:hover .cal-entry-actions { opacity: 1; }

.cal-entry-edit {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cal-entry-edit textarea {
  background: var(--bg-card);
  border: 1px solid var(--amber-400);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-900);
  resize: vertical;
  min-height: 80px;
  outline: none;
}
.cal-entry-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.cal-day-edit {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cal-day-edit textarea {
  background: var(--bg-card-translucent);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 14px 16px;
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-900);
  resize: vertical;
  min-height: 90px;
  outline: none;
  transition: border 0.15s, background 0.15s;
}
.cal-day-edit textarea:focus {
  border-color: var(--amber-400);
  border-style: solid;
  background: var(--bg-card);
}
.cal-day-edit textarea::placeholder {
  color: var(--ink-300);
  font-style: italic;
  font-family: "Noto Serif SC", serif;
}
.cal-day-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.range-filter {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--line);
  font-size: 13px;
}
.range-filter input {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  background: var(--amber-50);
  color: var(--ink-700);
}

.cal-list {
  display: flex; flex-direction: column; gap: 10px;
}
.cal-list-item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 18px;
  align-items: baseline;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.7;
}
.cal-list-item .date {
  font-family: "Noto Serif SC", serif;
  font-size: 13px;
  color: var(--amber-600);
}

/* ===== Settings ===== */
.settings-wrap { padding: 8px 56px 40px; max-width: 720px; }
.settings-section { margin-bottom: 28px; }
.settings-section h3 { font-size: 15px; color: var(--ink-700); margin-bottom: 10px; letter-spacing: 0.04em; }
.settings-card { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--ink-500); }
.field .hint { font-size: 11.5px; color: var(--ink-400); line-height: 1.5; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  background: var(--bg-soft);
  color: var(--ink-900);
  outline: none;
  transition: border 0.15s, background 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--amber-400);
  background: var(--bg-card);
}
.field textarea { min-height: 100px; resize: vertical; line-height: 1.6; font-family: inherit; }
.row-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch {
  position: relative; width: 42px; height: 24px;
  background: rgba(217, 119, 6, 0.18);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
body.dark .switch { background: rgba(147, 197, 253, 0.18); }
.switch.on { background: var(--grad-cta); }
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}
.switch.on::after { transform: translateX(18px); }

/* ===== Stats placeholder ===== */
.stats-wrap { padding: 8px 56px 40px; }
.stats-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { padding: 18px 20px; opacity: 0.55; }
.stat-card .label { font-size: 12px; color: var(--ink-400); letter-spacing: 0.06em; }
.stat-card .value { font-family: "Noto Serif SC", serif; font-size: 28px; color: var(--ink-300); margin-top: 6px; }
.stats-chart-placeholder {
  height: 280px;
  border-radius: var(--radius-card);
  background:
    repeating-linear-gradient(45deg, rgba(217, 119, 6, 0.04) 0 12px, transparent 12px 24px),
    var(--bg-soft);
  border: 1px dashed var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--ink-400);
  font-size: 13px;
  letter-spacing: 0.06em;
}
.coming-soon-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.1);
  color: var(--rose-500);
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-left: 10px;
  vertical-align: middle;
}

/* ===== Greeting popup ===== */
.greeting-backdrop {
  position: fixed; inset: 0;
  background: rgba(60, 30, 10, 0.35);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  z-index: 200;
  animation: fadeIn 0.25s ease;
}
body.dark .greeting-backdrop { background: rgba(5, 10, 24, 0.65); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.greeting-card {
  width: min(480px, calc(100vw - 40px));
  padding: 36px 36px 28px;
  border-radius: 28px;
  background: linear-gradient(160deg, #fff8e8 0%, #ffd89b 100%);
  box-shadow: var(--shadow-pop);
  position: relative;
  animation: popUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}
body.dark .greeting-card {
  background: linear-gradient(160deg, #1f2e58 0%, #3d4d8c 100%);
}
.greeting-card.shark {
  background: linear-gradient(160deg, #eaf3ff 0%, #b4ccff 100%);
  color: #1e3a8a;
}
body.dark .greeting-card.shark {
  background: linear-gradient(160deg, #1e3a8a 0%, #5b21b6 100%);
  color: #e0e7ff;
}
@keyframes popUp { from { transform: translateY(20px) scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }
.greeting-emoji { font-size: 32px; margin-bottom: 10px; color: var(--amber-600); }
.greeting-time { font-size: 12px; letter-spacing: 0.1em; color: var(--amber-600); margin-bottom: 6px; text-transform: uppercase; }
.greeting-card.shark .greeting-time { color: var(--shark-600); }
.greeting-title {
  font-family: "Noto Serif SC", serif;
  font-size: 24px;
  color: var(--ink-900);
  margin-bottom: 18px;
  line-height: 1.3;
}
.greeting-card.shark .greeting-title { color: #1e3a8a; }
body.dark .greeting-card.shark .greeting-title { color: #e0e7ff; }
.greeting-body {
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  line-height: 1.95;
  color: var(--ink-700);
  white-space: pre-wrap;
}
.greeting-card.shark .greeting-body { color: #1e3a8a; }
body.dark .greeting-card.shark .greeting-body { color: #c7d2fe; }
.greeting-source { font-size: 11px; color: var(--ink-400); margin-top: 16px; letter-spacing: 0.06em; }
.greeting-close {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
}
.special-banner {
  position: absolute; top: 14px; right: 18px;
  font-size: 11px; padding: 3px 10px;
  border-radius: 999px;
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose-500);
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* ===== Toast ===== */
.toast-stack {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 300;
  pointer-events: none;
}
.toast {
  background: var(--ink-900);
  color: var(--bg-base);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.3);
  animation: toastIn 0.25s ease;
}
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Shark surprise overlay */
.shark-overlay {
  position: fixed; inset: 0;
  background: radial-gradient(circle at center, rgba(59, 130, 246, 0.4) 0%, rgba(20, 40, 80, 0.85) 70%);
  display: grid; place-items: center;
  z-index: 250;
  animation: fadeIn 0.3s ease;
  cursor: pointer;
}
.shark-overlay .shark-big {
  font-size: 120px;
  animation: swim 2.5s ease-in-out infinite;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.4));
}
@keyframes swim {
  0%, 100% { transform: translateX(-20px) rotate(-8deg); }
  50% { transform: translateX(20px) rotate(8deg); }
}
.shark-overlay .shark-words {
  position: absolute;
  bottom: 18%;
  color: #fff;
  font-family: "Noto Serif SC", serif;
  font-size: 22px;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0,0,0,0.5);
  letter-spacing: 0.08em;
  max-width: 600px;
  padding: 0 24px;
  line-height: 1.7;
}

/* responsive: tablet */
@media (max-width: 1100px) {
  .home-grid {
    grid-template-columns: 1.5fr 1fr 1fr;
    grid-template-rows: 130px 1fr 1fr;
  }
  .title-name { font-size: 32px; }
  .time-now { font-size: 32px; }
  .page-head, .chat-head {
    padding-left: 130px;
    padding-right: 28px;
  }
  .chat-body, .chat-input-wrap, .treasure-grid, .cal-layout, .settings-wrap, .stats-wrap {
    padding-left: 28px;
    padding-right: 28px;
  }
}

/* responsive: phone */
@media (max-width: 720px) {
  .home-page { padding: 10px 16px 24px; gap: 14px; }
  .home-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto auto;
    grid-template-areas:
      "title    title"
      "time     weather"
      "chat     chat"
      "treasure calendar"
      "settings stats";
    min-height: 0;
    gap: 12px;
  }
  .chat-block { min-height: 220px; }
  .title-block { padding: 18px 22px; }
  .title-name { font-size: 28px; }
  .title-name .cross { margin: 0 6px; }
  .time-now { font-size: 32px; }
  .weather-temp-big { font-size: 26px; }
  .bento-block { padding: 16px 18px; gap: 8px; }
  .block-label { font-size: 13.5px; }
  .cal-today-num { font-size: 32px; }
  .chat-preview-text { font-size: 16px; -webkit-line-clamp: 4; }
  .home-foot { font-size: 10.5px; }

  .page-chrome { top: 14px; left: 14px; right: 14px; }
  .chrome-btn { padding: 7px 12px; font-size: 12.5px; }
  .chrome-btn.icon-only { width: 32px; height: 32px; }
  .page { padding-top: 60px; }
  .page-head, .chat-head { padding-left: 110px; padding-right: 16px; }
  .chat-body, .chat-input-wrap, .treasure-grid, .cal-layout, .settings-wrap, .stats-wrap { padding-left: 16px; padding-right: 16px; }
  .page-title { font-size: 22px; }
  .cal-layout { grid-template-columns: 1fr; gap: 14px; }
  .treasure-grid { grid-template-columns: 1fr; }
  .stats-stat-grid { grid-template-columns: 1fr 1fr; }
  .chat-input-wrap { padding-bottom: 18px; }
  .shark-letter { margin: 24px 16px 40px; padding: 22px 24px; font-size: 14px; }
}
