/* ==========================================================
   予川的小世界 — 主样式
   ========================================================== */

:root {
  --bg: #04050c;
  --bg-2: #0a0d1f;
  --panel: rgba(14, 18, 38, 0.82);
  --line: rgba(139, 123, 255, 0.22);
  --text: #e6e8f5;
  --text-dim: #9aa0bf;
  --text-faint: #6b7190;
  --neon: #8b7bff;
  --neon-2: #5ef1ff;
  --warm: #ffb46b;
  --pink: #ff9ecb;
  --danger: #ff6b81;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.5;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--neon); }
img { max-width: 100%; }

/* ==========================================================
   房间
   ========================================================== */

.room {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
}

.room__wall {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 70% 10%, rgba(50, 40, 100, 0.55), transparent 60%),
    radial-gradient(100% 70% at 20% 0%, rgba(20, 30, 70, 0.6), transparent 55%),
    linear-gradient(180deg, #0a0e24 0%, #0a0a1a 55%, #06060f 100%);
}

.room__floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background:
    linear-gradient(180deg, transparent, rgba(7, 7, 15, 0.92) 45%),
    linear-gradient(180deg, #0b0a18, #050510);
  pointer-events: none;
}

.room__lampglow {
  position: absolute;
  left: 10%;
  top: 22%;
  width: 52vw;
  height: 52vw;
  max-width: 720px;
  max-height: 720px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 180, 107, 0.2), rgba(255, 180, 107, 0) 65%);
  pointer-events: none;
  transition: opacity 0.8s ease, background 0.8s ease;
  z-index: 2;
}

.room[data-lamp="cool"] .room__lampglow {
  background: radial-gradient(circle, rgba(94, 241, 255, 0.15), rgba(94, 241, 255, 0) 65%);
}

.room[data-lamp="off"] .room__lampglow {
  opacity: 0;
}

.room__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 38%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
  z-index: 5;
}

.room__dust {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: hidden;
}

.room__dust span {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  opacity: 0;
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 0.55; }
  90%  { opacity: 0.55; }
  100% { transform: translateY(-100vh) translateX(20px); opacity: 0; }
}

/* ==========================================================
   顶栏
   ========================================================== */

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 24px clamp(20px, 4vw, 48px);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 20;
  pointer-events: none;
}

.hud > * { pointer-events: auto; }

.hud__title {
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 600;
  letter-spacing: 2px;
  margin: 0;
  background: linear-gradient(90deg, #e6e8f5, #8b7bff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hud__sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  max-width: 60vw;
}

.hud__right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hud__clock {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.iconbtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  font-size: 16px;
  transition: background 0.2s;
}

.iconbtn:hover { background: rgba(139, 123, 255, 0.2); }

/* ==========================================================
   房间物品通用
   ========================================================== */

.obj {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.3s ease;
}

.obj:hover { transform: translateY(-2px); }
.obj:focus-visible { outline: 2px solid var(--neon); outline-offset: 6px; }

.obj__tag {
  position: absolute;
  left: 50%;
  bottom: -28px;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

.obj:hover .obj__tag,
.obj:focus-visible .obj__tag { opacity: 1; }

/* ---------- 窗户 ---------- */

.obj--window {
  top: 9%;
  right: 7%;
  width: clamp(220px, 26vw, 380px);
  aspect-ratio: 4 / 3;
  z-index: 6;
}

.window {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    inset 0 0 30px rgba(94, 241, 255, 0.1),
    0 10px 40px rgba(0, 0, 0, 0.55);
  border: 6px solid rgba(20, 22, 40, 0.9);
  background: #05060f;
}

.window__sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 75% 25%, rgba(139, 123, 255, 0.35), transparent 70%),
    linear-gradient(180deg, #0a0f28 0%, #0e1436 50%, #151735 100%);
  overflow: hidden;
}

.window__stars { position: absolute; inset: 0; }

.window__stars i {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 1; }
}

.window__moon {
  position: absolute;
  top: 13%;
  left: 16%;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8e0, #d6c9ff 60%, #8b7bff);
  box-shadow:
    0 0 30px rgba(214, 201, 255, 0.7),
    0 0 80px rgba(139, 123, 255, 0.4);
  opacity: 0.9;
}

.window__city {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  background: linear-gradient(180deg, transparent, #05060f 60%);
  overflow: hidden;
}

.window__city i {
  position: absolute;
  bottom: var(--b, 0);
  left: var(--l, 0);
  width: var(--w, 3px);
  height: var(--h, 4px);
  background: var(--c, #ffd28a);
  box-shadow: 0 0 6px var(--c, #ffd28a);
  opacity: var(--o, 0.8);
  border-radius: 1px;
}

.window__bar {
  position: absolute;
  background: rgba(14, 16, 32, 0.95);
  box-shadow: 0 0 0 1px rgba(94, 241, 255, 0.08);
}

.window__bar--v { left: 50%; top: 0; bottom: 0; width: 6px; transform: translateX(-50%); }
.window__bar--h { top: 50%; left: 0; right: 0; height: 6px; transform: translateY(-50%); }

.window__sill {
  position: absolute;
  left: -10px;
  right: -10px;
  bottom: -14px;
  height: 14px;
  background: linear-gradient(180deg, #1a1c30, #0c0d18);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

/* ---------- 相框 ---------- */

.obj--frame {
  top: 14%;
  left: 8%;
  width: clamp(100px, 13vw, 170px);
  aspect-ratio: 4 / 5;
  z-index: 7;
}

.frame {
  display: block;
  width: 100%;
  height: 100%;
  padding: 8px;
  background: linear-gradient(145deg, #2a2540, #14121f);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(139, 123, 255, 0.2),
    0 12px 30px rgba(0, 0, 0, 0.6);
  transform: rotate(-2deg);
  transition: transform 0.3s;
}

.obj--frame:hover .frame { transform: rotate(0); }

.frame__inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(135deg, #1a2246, #0a0d1f);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.frame__inner img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- 日历 ---------- */

.obj--calendar {
  top: 38%;
  left: 6%;
  width: clamp(70px, 9vw, 110px);
  z-index: 7;
}

.cal {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(180deg, #f4f1ea, #ddd7cc);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.3);
  color: #2a2438;
  position: relative;
  transform: rotate(2deg);
  transition: transform 0.3s;
}

.obj--calendar:hover .cal { transform: rotate(0); }

.cal__top {
  display: block;
  height: 28%;
  background: linear-gradient(180deg, #8b7bff, #5a4dbb);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.cal__num {
  position: absolute;
  inset: 28% 0 0 0;
  display: grid;
  place-items: center;
  font-size: clamp(24px, 3.4vw, 40px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- 书桌 ---------- */

.desk {
  position: absolute;
  left: 14%;
  bottom: 0;
  width: 34%;
  height: 30%;
  z-index: 6;
  pointer-events: none;
}

.desk__top {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 38%;
  height: 10%;
  background: linear-gradient(180deg, #3a2a1c, #241810);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.desk__leg {
  position: absolute;
  bottom: 0;
  width: 4%;
  height: 40%;
  background: linear-gradient(180deg, #2a1e14, #160e08);
}

.desk__leg--l { left: 6%; }
.desk__leg--r { right: 6%; }

/* ---------- 台灯 ---------- */

.obj--lamp {
  left: 18%;
  bottom: 26%;
  width: clamp(50px, 6vw, 80px);
  z-index: 9;
}

.lamp { display: block; position: relative; width: 100%; aspect-ratio: 3 / 5; }

.lamp__shade {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 40%;
  background: linear-gradient(180deg, #2a2840, #15131f);
  border-radius: 50% 50% 8px 8px / 30% 30% 8px 8px;
  box-shadow: inset 0 -6px 10px rgba(255, 180, 107, 0.3);
  z-index: 2;
}

.lamp__stand {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translateX(-50%);
  width: 6%;
  height: 45%;
  background: linear-gradient(180deg, #2a2840, #0e0d16);
}

.lamp__base {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 8%;
  background: linear-gradient(180deg, #2a2840, #0e0d16);
  border-radius: 50%;
}

.lamp__cone {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  width: 240%;
  height: 220%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 180, 107, 0.4), transparent 65%);
  filter: blur(6px);
  pointer-events: none;
  transition: opacity 0.5s, background 0.5s;
  z-index: 1;
}

.room[data-lamp="cool"] .lamp__cone {
  background: radial-gradient(ellipse at 50% 30%, rgba(94, 241, 255, 0.32), transparent 65%);
}

.room[data-lamp="off"] .lamp__cone { opacity: 0; }

/* ---------- 便签 ---------- */

.obj--note {
  top: 25%;
  right: 27%;
  width: clamp(60px, 7vw, 90px);
  aspect-ratio: 1;
  z-index: 9;
}

.note-card {
  display: flex;
  flex-direction: column;
  gap: 8%;
  width: 100%;
  height: 100%;
  padding: 18% 12%;
  background: linear-gradient(135deg, #f5e6a8, #e7c874);
  border-radius: 3px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.08);
  transform: rotate(4deg);
  transition: transform 0.3s;
}

.obj--note:hover .note-card { transform: rotate(0) scale(1.04); }

.note-card__line {
  display: block;
  height: 8%;
  background: rgba(120, 90, 40, 0.4);
  border-radius: 2px;
}

.note-card__line--short { width: 60%; }

/* ---------- 手记（书桌上的本子） ---------- */

.obj--book {
  left: 32%;
  bottom: 30%;
  width: clamp(64px, 8vw, 100px);
  z-index: 9;
}

.book {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  position: relative;
  transform: rotate(-6deg);
  transition: transform 0.3s;
}

.obj--book:hover .book { transform: rotate(0) translateY(-2px); }

.book__cover {
  position: absolute;
  left: 0;
  top: 8%;
  width: 92%;
  height: 90%;
  background: linear-gradient(135deg, #3a2a5a, #1c1230);
  border-radius: 3px 8px 8px 3px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(139, 123, 255, 0.2);
}

.book__pages {
  position: absolute;
  right: 0;
  top: 12%;
  width: 16%;
  height: 82%;
  background: linear-gradient(90deg, #ddd6c8, #f4efe4);
  border-radius: 0 3px 3px 0;
  box-shadow: inset -2px 0 0 rgba(0, 0, 0, 0.1);
}

/* ---------- 礼物盒 ---------- */

.obj--gift {
  right: 23%;
  bottom: 11%;
  width: clamp(70px, 9vw, 110px);
  z-index: 9;
}

.giftbox {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  transition: transform 0.3s;
}

.obj--gift:hover .giftbox { transform: translateY(-3px) rotate(-2deg); }

.giftbox__body {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  height: 62%;
  background: linear-gradient(180deg, #4a3a7a, #2a1f4a);
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55), inset 0 -4px 8px rgba(0, 0, 0, 0.3);
}

.giftbox__lid {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 20%;
  height: 22%;
  background: linear-gradient(180deg, #5a4a8a, #3a2a6a);
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.giftbox__ribbon {
  position: absolute;
  background: linear-gradient(180deg, #ff9ecb, #c96f9a);
}

.giftbox__ribbon--v { left: 46%; right: 46%; top: 20%; bottom: 0; }
.giftbox__ribbon--h { left: 8%; right: 8%; top: 45%; height: 8%; }

.giftbox__bow {
  position: absolute;
  left: 50%;
  top: 10%;
  transform: translateX(-50%);
  width: 30%;
  height: 16%;
  background:
    radial-gradient(circle at 20% 50%, #ff9ecb 0 40%, transparent 41%),
    radial-gradient(circle at 80% 50%, #ff9ecb 0 40%, transparent 41%);
}

/* ==========================================================
   角色
   ========================================================== */

.character {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
}

.character__halo {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(139, 123, 255, 0.18), transparent 60%);
  pointer-events: none;
}

.character__svgwrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  animation: none;
}

.character__portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 38%;
  border-radius: 0;
  -webkit-mask-image: none;
  mask-image: none;
  filter: brightness(0.88) saturate(0.92);
}

.character__svgwrap svg {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: block;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
}

@keyframes charFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}

.character__info {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  top: max(76px, 10%);
  max-width: 240px;
  pointer-events: none;
  z-index: 9;
}

.pill {
  display: inline-block;
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(139, 123, 255, 0.15);
  border: 1px solid rgba(139, 123, 255, 0.35);
  color: #c9c2ff;
  letter-spacing: 1px;
  backdrop-filter: blur(8px);
}

.character__line {
  margin: 10px 0 0;
  font-size: 13px;
  color: #b9bed9;
  line-height: 1.6;
  background: rgba(6, 8, 20, 0.55);
  border-left: 2px solid rgba(139, 123, 255, 0.5);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  backdrop-filter: blur(8px);
  max-width: 220px;
}

.character__hit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 40% 40% 20% 20%;
  pointer-events: auto;
  cursor: pointer;
  background: transparent;
  z-index: 5;
  transition: background 0.3s;
}

.character__hit:hover {
  background: radial-gradient(ellipse, rgba(139, 123, 255, 0.08), transparent 70%);
}

.character__hit:focus-visible { outline: 2px solid var(--neon); outline-offset: 6px; }

.character[data-state="night"] .character__svgwrap { filter: brightness(0.72) saturate(0.85); }
.character[data-state="shy"] .character__svgwrap  { filter: drop-shadow(0 0 30px rgba(255, 158, 203, 0.25)); }
.character[data-state="happy"] .character__svgwrap { filter: drop-shadow(0 0 30px rgba(255, 206, 106, 0.25)); }

/* ==========================================================
   底部提示 / 移动端快捷坞
   ========================================================== */

.room__hint {
  position: absolute;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-faint);
  margin: 0;
  z-index: 15;
  text-align: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(6, 8, 20, 0.4);
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: opacity 0.6s;
}

.room__hint.is-faded { opacity: 0; }

.dock {
  display: none;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 30;
  padding: 8px;
  gap: 4px;
  border-radius: 18px;
  background: rgba(10, 12, 26, 0.7);
  border: 1px solid rgba(139, 123, 255, 0.2);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow-x: auto;
  scrollbar-width: none;
}

.dock::-webkit-scrollbar { display: none; }

.dock button {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 10px;
  color: var(--text-dim);
  min-width: 52px;
  transition: background 0.2s, color 0.2s;
}

.dock button:hover { background: rgba(139, 123, 255, 0.15); color: var(--text); }
.dock__ico { font-size: 18px; line-height: 1; }

/* ==========================================================
   弹层 / 面板
   ========================================================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 5, 12, 0.7);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.overlay.is-open { opacity: 1; }
.overlay[hidden] { display: none; }

.panel {
  width: min(920px, 100%);
  max-height: min(86vh, 900px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(16, 20, 42, 0.96), rgba(10, 12, 26, 0.98));
  border: 1px solid rgba(139, 123, 255, 0.22);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.overlay.is-open .panel { transform: translateY(0) scale(1); }

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(139, 123, 255, 0.14);
  flex-shrink: 0;
}

.panel__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
}

.panel__close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  font-size: 14px;
  transition: background 0.2s;
}

.panel__close:hover { background: rgba(255, 107, 129, 0.25); }

.panel__body {
  padding: 20px 22px 26px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
}

.panel__body::-webkit-scrollbar { width: 8px; }
.panel__body::-webkit-scrollbar-thumb {
  background: rgba(139, 123, 255, 0.3);
  border-radius: 4px;
}

/* ==========================================================
   通用组件
   ========================================================== */

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar .input { flex: 1; min-width: 160px; }

.input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(139, 123, 255, 0.2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  resize: vertical;
}

.input:focus { border-color: rgba(139, 123, 255, 0.6); background: rgba(255, 255, 255, 0.06); }

.btn {
  padding: 9px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  color: var(--text);
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  white-space: nowrap;
}

.btn:hover { background: rgba(139, 123, 255, 0.2); border-color: rgba(139, 123, 255, 0.4); }
.btn:active { transform: scale(0.97); }
.btn--primary {
  background: linear-gradient(135deg, #6a5aff, #8b7bff);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 20px rgba(139, 123, 255, 0.35);
}
.btn--primary:hover { background: linear-gradient(135deg, #7a6aff, #9b8bff); }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--danger { color: #ff8ba0; border-color: rgba(255, 107, 129, 0.3); }
.btn--danger:hover { background: rgba(255, 107, 129, 0.2); border-color: rgba(255, 107, 129, 0.5); }
.btn--ghost { background: transparent; }

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.chip {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: #b9bed9;
  transition: all 0.2s;
}

.chip:hover { border-color: rgba(139, 123, 255, 0.4); }
.chip.is-on {
  background: rgba(139, 123, 255, 0.22);
  border-color: rgba(139, 123, 255, 0.6);
  color: #fff;
}

.hint {
  font-size: 12px;
  color: var(--text-faint);
  margin: 0 0 14px;
  line-height: 1.6;
}

.empty {
  text-align: center;
  color: var(--text-faint);
  padding: 40px 20px;
  font-size: 13px;
}

.cards { display: grid; gap: 14px; }

.card {
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(139, 123, 255, 0.15);
  transition: border-color 0.2s, background 0.2s;
}

.card:hover { border-color: rgba(139, 123, 255, 0.35); background: rgba(255, 255, 255, 0.045); }

.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(139, 123, 255, 0.15);
  border: 1px solid rgba(139, 123, 255, 0.3);
  color: #c9c2ff;
}

.card__date { font-size: 12px; color: var(--text-faint); margin-left: auto; }

.card__title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.card__intro,
.card__note {
  margin: 0 0 8px;
  font-size: 13px;
  color: #b9bed9;
  line-height: 1.7;
  white-space: pre-wrap;
}

.card__note { color: var(--text-dim); font-size: 12px; }

.card__foot {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.link { color: var(--neon); text-decoration: none; }
.link:hover { text-decoration: underline; }

.card__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.star {
  font-size: 16px;
  color: #4a4e68;
  transition: color 0.2s, transform 0.15s;
  padding: 0 4px;
}

.star:hover { transform: scale(1.15); }
.star.is-on { color: #ffce6a; text-shadow: 0 0 12px rgba(255, 206, 106, 0.5); }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 12px; color: var(--text-dim); }
.form__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }

.checkboxes {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(139, 123, 255, 0.15);
}

.checkboxes label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #b9bed9;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.checkboxes label:hover { background: rgba(139, 123, 255, 0.1); }

.timeline {
  position: relative;
  padding-left: 22px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, rgba(139, 123, 255, 0.5), rgba(139, 123, 255, 0.05));
}

.timeline .card { position: relative; margin-bottom: 14px; }
.timeline .card::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 22px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 12px rgba(139, 123, 255, 0.8);
}

/* 照片网格 */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(139, 123, 255, 0.2);
  cursor: pointer;
  background: #0a0d1f;
}

.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s; }
.photo-item:hover img { transform: scale(1.06); }

.photo-item__cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 10px 8px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.8));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-item__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(139, 123, 255, 0.8);
  color: #fff;
}

/* 大图查看 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 3, 8, 0.94);
  backdrop-filter: blur(12px);
}

.lightbox[hidden] { display: none; }

.lightbox__close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 16px;
  z-index: 2;
}

.lightbox__fig {
  margin: 0;
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.lightbox__img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
}

.lightbox__img img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
}

.lightbox__cap {
  font-size: 13px;
  color: #b9bed9;
  text-align: center;
  max-width: 600px;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* 主菜单 */
.menu {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 5, 12, 0.75);
  backdrop-filter: blur(10px);
}

.menu[hidden] { display: none; }

.menu__inner {
  width: min(380px, 100%);
  padding: 22px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(16, 20, 42, 0.98), rgba(10, 12, 26, 0.99));
  border: 1px solid rgba(139, 123, 255, 0.22);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  display: grid;
  gap: 6px;
  max-height: 90vh;
  overflow-y: auto;
}

.menu__title { margin: 0 0 8px; font-size: 15px; font-weight: 600; letter-spacing: 1px; }

.menu__inner button {
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  transition: background 0.2s;
}

.menu__inner button:hover { background: rgba(139, 123, 255, 0.18); }

.menu__hr { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.08); margin: 8px 0; width: 100%; }

.menu__note { font-size: 11px; color: var(--text-faint); line-height: 1.7; margin: 4px 0; }

.menu__close { margin-top: 6px; }

/* 拆礼物动画 */
.gift-open-anim {
  display: grid;
  place-items: center;
  padding: 40px 0;
  font-size: 64px;
  animation: giftPop 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

@keyframes giftPop {
  0%   { transform: scale(0.6) rotate(-8deg); opacity: 0; }
  50%  { transform: scale(1.15) rotate(6deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* 谜题 */
.puzzle-card.is-locked .puzzle-reward { display: none; }
.puzzle-card.is-unlocked .puzzle-input-row { display: none; }

/* 统计 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(139, 123, 255, 0.12), rgba(139, 123, 255, 0.03));
  border: 1px solid rgba(139, 123, 255, 0.2);
  text-align: center;
}

.stat__num {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(180deg, #fff, #8b7bff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}

.stat__label { font-size: 11px; color: var(--text-dim); margin-top: 4px; letter-spacing: 1px; }

/* ==========================================================
   响应式
   ========================================================== */

@media (max-width: 900px) {
  .desk,
  .obj--lamp,
  .obj--book,
  .obj--gift,
  .obj--note,
  .obj--calendar,
  .obj--frame {
    display: none;
  }

  .obj--window {
    top: 8%;
    right: 4%;
    width: 46vw;
    max-width: 240px;
    opacity: 0.75;
  }

  .character {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    transform: none;
  }

  .character__info {
    left: 16px;
    top: max(76px, 9%);
    transform: none;
    text-align: left;
  }

  .character__line { display: none; }
  .character__portrait { object-position: center 35%; }

  .dock { display: flex; }
  .room__hint { display: none; }
  .hud { padding: 16px; }
  .panel { max-height: 92vh; border-radius: 16px; }
  .panel__body { padding: 16px 16px 22px; }
}

@media (max-width: 520px) {
  .hud__sub { max-width: 46vw; font-size: 11px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

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