/* ═══════════════ 真实菜园 · 园圃志 ═══════════════
   一页活的节气笺：纸 · 墨 · 朱砂。
   白昼是宣纸墨字，入夜整页翻成藏青银字。 */

:root, #main {
  --paper: #f2ecdd;          /* 宣纸 */
  --paper-deep: #e9e1cc;
  --ink: #2c2a26;            /* 焦墨 */
  --ink-soft: #6b665a;       /* 淡墨 */
  --hair: #c9c2ae;           /* 发丝线 */
  --seal: #b23a2a;           /* 朱砂 */
  --wash-green: rgba(122, 142, 101, 0.32);
  --water-ink: #3d5a80;      /* 黛青 */
  --gold: rgba(214, 178, 92, 0.4);
  --serif: "Songti SC", "Noto Serif SC", "STSong", serif;
  --sans: -apple-system, "PingFang SC", sans-serif;
}
#main[data-phase="night"] {
  --paper: #262b38; --paper-deep: #1f2430;
  --ink: #d9d4c2; --ink-soft: #8f8c7d; --hair: #4a4f5c;
  --wash-green: rgba(140, 158, 122, 0.22);
  --gold: rgba(214, 190, 120, 0.18);
}
#main[data-phase="dawn"], #main[data-phase="dusk"] {
  --paper: #ece0c8; --paper-deep: #e2d4b8; --hair: #c4b898;
}
#main[data-season="winter"] { --paper: #eeece4; --paper-deep: #e4e2d8; --wash-green: rgba(130, 138, 122, 0.22); }
#main[data-season="autumn"] { --paper: #f0e7d0; --wash-green: rgba(150, 138, 90, 0.3); }

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body { font-family: var(--serif); background: #f2ecdd; color: #2c2a26; overflow: hidden; }
.hidden { display: none !important; }
button { font-family: var(--serif); }

/* ═══ 纸面 ═══ */
.main { position: fixed; inset: 0; background: var(--paper); color: var(--ink);
  transition: background 1s, color 1s; overflow: hidden; }
#paper-grain { position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: radial-gradient(rgba(120, 105, 75, 0.05) 1px, transparent 1.2px),
    radial-gradient(rgba(120, 105, 75, 0.04) 1px, transparent 1.4px);
  background-size: 240px 240px, 170px 170px;
  background-position: 0 0, 60px 90px; }
#vignette { position: absolute; inset: 0; pointer-events: none; z-index: 6;
  box-shadow: inset 0 0 140px rgba(70, 58, 36, 0.16); }
#main[data-phase="night"] #vignette { box-shadow: inset 0 0 160px rgba(0, 0, 0, 0.45); }
#alm-foot { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center;
  font-size: 0.72rem; letter-spacing: 0.35em; color: var(--ink-soft); opacity: 0.75; z-index: 3; }

/* ═══ 天光 ═══ */
#celestial { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.sun-wash { position: absolute; top: 7%; right: 12%; width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle, var(--gold) 0%, transparent 68%);
  animation: breathe 8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.08); opacity: 0.85; } }
.moon-ink { position: absolute; top: 8%; right: 13%; width: 64px; height: 64px; border-radius: 50%;
  background: #e8e2ce; opacity: 0.9;
  box-shadow: inset -10px -7px 0 rgba(150, 145, 125, 0.4), 0 0 40px 8px rgba(232, 226, 206, 0.15); }
.star-s { position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: #cfc9b4; animation: twinkle 3.2s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: 0.15; } }

/* ═══ 墨雨 · 雪 · 雾 ═══ */
#precip { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.drop { position: absolute; top: -26px; width: 1.5px; height: 16px;
  background: linear-gradient(rgba(61, 90, 128, 0), rgba(61, 90, 128, 0.5));
  transform: rotate(9deg); animation: fall linear infinite; }
#main[data-phase="night"] .drop {
  background: linear-gradient(rgba(160, 175, 200, 0), rgba(160, 175, 200, 0.4)); }
@keyframes fall { to { transform: translateY(110vh) rotate(9deg); } }
.splash { position: absolute; width: 14px; height: 5px; border: 1px solid rgba(61, 90, 128, 0.4);
  border-radius: 50%; opacity: 0; animation: splashring 1.2s ease-out infinite; }
@keyframes splashring { 0% { transform: scale(0.2); opacity: 0.6; } 100% { transform: scale(1.5); opacity: 0; } }
.flake { position: absolute; top: -20px; width: 5px; height: 5px; border-radius: 50%;
  border: 1px solid var(--ink-soft); background: rgba(255, 255, 255, 0.5); opacity: 0.7;
  animation: snowfall linear infinite; }
@keyframes snowfall { to { transform: translateY(110vh) translateX(5vw); } }
#fog { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.fog-band { position: absolute; left: -8%; width: 116%; height: 16vh; border-radius: 50%;
  background: rgba(150, 140, 115, 0.14); filter: blur(26px);
  animation: fogdrift 30s ease-in-out infinite alternate; }
@keyframes fogdrift { to { transform: translateX(5vw); } }

/* ═══ 历首 ═══ */
#almanac { position: absolute; top: 0; left: 0; right: 0; z-index: 8;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 22px 26px 0; }
.alm-side { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.alm-side.right { flex-direction: row; align-items: center; gap: 10px; }
.brand-v { writing-mode: vertical-rl; letter-spacing: 0.5em; font-size: 0.95rem;
  color: var(--ink); border-right: 1px solid var(--hair); padding-right: 8px; }
.seal-sq { width: 30px; height: 30px; background: var(--seal); color: #f4efe2;
  display: grid; place-items: center; font-size: 17px; border-radius: 4px;
  box-shadow: 0 1px 0 rgba(90, 30, 20, 0.4); }
.alm-center { text-align: center; flex: 1; padding-top: 2px; }
#term-big { font-size: clamp(2rem, 4.6vw, 3.2rem); letter-spacing: 0.55em; margin-left: 0.55em;
  font-weight: 700; color: var(--ink); }
.alm-line { display: inline-block; margin-top: 6px; border: none; background: none; cursor: pointer;
  font-size: 0.92rem; letter-spacing: 0.14em; color: var(--ink-soft);
  border-bottom: 1px solid transparent; }
.alm-line:hover { border-bottom-color: var(--seal); color: var(--ink); }
.seal-btn { width: 38px; height: 38px; border: 1.5px solid var(--seal); color: var(--seal);
  background: transparent; border-radius: 5px; font-size: 18px; cursor: pointer;
  line-height: 1; position: relative; transition: all 0.15s; }
.seal-btn:hover { background: var(--seal); color: var(--paper); }
.seal-btn .mini { position: absolute; top: -7px; right: -7px; min-width: 16px; height: 16px;
  background: var(--seal); color: #f4efe2; border-radius: 8px; font-size: 10px;
  display: grid; place-items: center; padding: 0 3px; font-family: var(--sans); }
.coin-line { font-size: 0.95rem; letter-spacing: 0.1em; color: var(--ink);
  border-bottom: 1px solid var(--hair); padding: 2px 4px; white-space: nowrap; }

/* 七日历 */
.forecast-strip { position: absolute; top: 118px; left: 50%; transform: translateX(-50%);
  z-index: 8; display: flex; overflow-x: auto; max-width: 92vw;
  border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(2px); }
.fc-day { flex: 0 0 76px; text-align: center; padding: 10px 6px;
  border-right: 1px solid var(--hair); font-size: 0.72rem; color: var(--ink-soft); }
.fc-day:last-child { border-right: none; }
.fc-day .d { font-size: 0.8rem; color: var(--ink); letter-spacing: 0.1em; }
.fc-day .i { font-size: 1.15rem; color: var(--ink); margin: 3px 0; letter-spacing: 0.2em; }
.fc-day .rain { color: var(--water-ink); font-family: var(--sans); }
#main[data-phase="night"] .fc-day .rain { color: #9db4d0; }

/* ═══ 园圃 ═══ */
#scene { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -44%);
  z-index: 4; display: flex; flex-direction: column; gap: 26px; align-items: center; }
.beds-row { display: flex; gap: 26px; justify-content: center; }
.plot-tile { position: relative; width: min(196px, 21vw); cursor: pointer;
  border: 1.5px solid var(--ink); border-radius: 3px;
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px var(--hair);
  background: color-mix(in srgb, var(--paper-deep) 60%, var(--paper));
  padding: 12px 8px 6px; transition: transform 0.2s, box-shadow 0.2s, background 1s, border-color 1s; }
.plot-tile:hover { transform: translateY(-4px);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px var(--hair), 0 8px 18px rgba(60, 48, 26, 0.18); }
.plot-tile.locked { border-style: dashed; border-color: var(--ink-soft); opacity: 0.7; }
.plot-tile.locked:hover { opacity: 0.95; }
.plot-tile svg { display: block; width: 100%; height: auto; }
.tile-No { position: absolute; top: 6px; left: 8px; font-size: 0.7rem; color: var(--ink-soft);
  writing-mode: vertical-rl; letter-spacing: 0.2em; }
.bed-cap { text-align: center; font-size: 0.82rem; letter-spacing: 0.12em;
  color: var(--ink); margin-top: 4px; min-height: 1.3em; }
.bed-cap .pct { font-family: var(--sans); font-size: 0.72rem; color: var(--ink-soft); }
.tile-progress { height: 2px; background: var(--hair); margin: 5px 10px 2px; }
.tile-progress i { display: block; height: 100%; background: var(--ink); transition: width 0.5s; }
.plot-tile.mature-tile .tile-progress i { background: var(--seal); }

/* 状态印 */
.seal-mark { position: absolute; top: -11px; right: -11px; width: 26px; height: 26px;
  border: 1.5px solid var(--seal); color: var(--seal); background: var(--paper);
  border-radius: 5px; display: grid; place-items: center; font-size: 14px;
  animation: floaty 2.4s ease-in-out infinite; z-index: 2; }
.seal-mark.solid { background: var(--seal); color: #f4efe2; }
.seal-mark.gray { border-color: var(--ink-soft); color: var(--ink-soft); background: var(--paper); animation: none; }
.seal-mark.water { border-color: var(--water-ink); color: var(--water-ink); }
@keyframes floaty { 50% { transform: translateY(-4px); } }

/* 植物摇曳 · 更替动效 */
.plant-sway { transform-origin: 50% 100%; transform-box: fill-box;
  animation: sway 5.5s ease-in-out infinite; }
@keyframes sway { 25% { transform: rotate(1.2deg); } 75% { transform: rotate(-1.2deg); } }
.plant-sway.windy { animation-duration: 2.6s; }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.plot-tile.just-changed svg { animation: pop 0.45s ease-out; }

/* 墨晕涟漪（浇水） */
.ink-ripple { position: absolute; border: 1.5px solid var(--water-ink); border-radius: 50%;
  pointer-events: none; animation: ringout 0.9s ease-out forwards; z-index: 30; }
@keyframes ringout { 0% { transform: scale(0.15); opacity: 0.8; } 100% { transform: scale(1.6); opacity: 0; } }

/* ═══ 册页（底部面板） ═══ */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; pointer-events: none; }
.sheet-inner { pointer-events: auto; width: min(560px, 96vw); max-height: 66vh; overflow-y: auto;
  background: var(--paper, #f2ecdd); color: var(--ink, #2c2a26);
  border: 1.5px solid var(--ink, #2c2a26); border-bottom: none; border-radius: 6px 6px 0 0;
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px var(--hair), 0 -10px 34px rgba(40, 32, 16, 0.3);
  padding: 20px 24px 24px; animation: slideup 0.28s ease-out; }
@keyframes slideup { from { transform: translateY(38%); opacity: 0.3; } }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--hair); padding-bottom: 8px; margin-bottom: 12px; }
.sheet-head h3 { font-size: 1.2rem; letter-spacing: 0.18em; font-weight: 700; }
.sheet-close { border: none; background: none; font-size: 1.5rem; color: var(--ink-soft);
  cursor: pointer; line-height: 1; }
.stage-tag { display: inline-block; border: 1px solid var(--seal); color: var(--seal);
  border-radius: 4px; padding: 1px 10px; font-size: 0.78rem; letter-spacing: 0.15em; }
.stage-tag.warn { background: var(--seal); color: #f4efe2; }
.sheet-note { font-size: 0.84rem; color: var(--ink-soft); margin: 7px 0; line-height: 1.7; }
.sheet-note b { color: var(--ink); }

.meter { margin: 9px 0; }
.meter .m-label { display: flex; justify-content: space-between; font-size: 0.75rem;
  color: var(--ink-soft); margin-bottom: 3px; letter-spacing: 0.12em; }
.m-bar { height: 5px; background: var(--hair); }
.m-fill { height: 100%; transition: width 0.5s; }
.m-fill.growth { background: #5a7247; }
.m-fill.water { background: var(--water-ink); }
.m-fill.health { background: #a8742c; }

.action-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn { padding: 9px 18px; border: 1.5px solid var(--ink); background: transparent;
  color: var(--ink); font-size: 0.92rem; letter-spacing: 0.15em; cursor: pointer;
  border-radius: 4px; font-family: var(--serif); transition: all 0.15s; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:hover { background: transparent; color: var(--ink); }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-primary { background: var(--seal); border-color: var(--seal); color: #f4efe2; }
.btn-primary:hover { background: #963022; border-color: #963022; color: #f4efe2; }
.btn-water { background: var(--water-ink); border-color: var(--water-ink); color: #f0ede2; }
.btn-water:hover { background: #2e4664; border-color: #2e4664; color: #f0ede2; }
.btn-danger { border-color: var(--seal); color: var(--seal); background: transparent; }
.btn-danger:hover { background: var(--seal); color: #f4efe2; }

.event-log { margin-top: 14px; border-top: 1px dashed var(--hair); padding-top: 8px; }
.event-log h4 { font-size: 0.8rem; letter-spacing: 0.2em; color: var(--ink-soft); margin-bottom: 5px; }
.event-item { font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 4px; }

/* 选种册 */
.plant-list { display: flex; flex-direction: column; }
.plant-item { display: flex; align-items: center; gap: 14px; padding: 10px 4px;
  border-bottom: 1px solid var(--hair); cursor: pointer; }
.plant-item:hover { background: color-mix(in srgb, var(--seal) 6%, transparent); }
.plant-item .pi-art { flex: 0 0 52px; }
.plant-item .pi-name { font-weight: 700; letter-spacing: 0.15em; }
.plant-item .pi-meta { font-size: 0.74rem; color: var(--ink-soft); font-family: var(--sans); }
.plant-item .pi-score { margin-left: auto; font-size: 1.15rem; font-weight: 700; white-space: nowrap; }
.score-good { color: #5a7247; } .score-mid { color: #a8742c; } .score-bad { color: var(--seal); }

/* 事件卡 · 冷知识 · 丰收 */
.chore-card { border: 1px solid var(--seal); border-left: 4px solid var(--seal);
  padding: 9px 12px; margin: 10px 0; font-size: 0.85rem;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.fact-card { border: 1px solid var(--hair); border-left: 4px solid #5a7247;
  padding: 10px 14px; margin: 12px 0; font-size: 0.85rem; line-height: 1.7; color: var(--ink-soft); }
.fact-card b { color: var(--ink); letter-spacing: 0.15em; }
.harvest-hero { font-size: 1.45rem; text-align: center; margin: 12px 0 8px;
  letter-spacing: 0.2em; animation: pop 0.5s ease-out; }

/* 图鉴 */
.dex-item { display: flex; align-items: flex-start; gap: 12px;
  border-bottom: 1px solid var(--hair); padding: 10px 2px; }
.dex-item .dx-emoji { font-size: 26px; }
.dex-item .dx-name { font-weight: 700; letter-spacing: 0.15em; }
.dex-item .dx-meta { font-size: 0.76rem; color: var(--ink-soft); font-family: var(--sans); margin-top: 2px; }
.dex-item .dx-count { margin-left: auto; font-size: 1.05rem; font-weight: 700; color: var(--seal); white-space: nowrap; }

/* 园丁码 */
.code-box { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; word-break: break-all;
  border: 1px dashed var(--ink-soft); padding: 8px 12px; margin: 6px 0; user-select: all; }

/* ═══ 特效 ═══ */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
.fx-pop { position: absolute; font-size: 26px; color: var(--seal);
  animation: fxpop 1.1s ease-out forwards; animation-fill-mode: both; }
@keyframes fxpop { 0% { transform: translateY(0) scale(0.6); opacity: 1; }
  100% { transform: translateY(-90px) scale(1.25); opacity: 0; } }
.fx-fly { position: absolute; font-size: 24px; z-index: 31;
  transition: transform 0.9s cubic-bezier(0.35, -0.25, 0.6, 1), opacity 0.9s ease-in; }
.seal-btn.bump { animation: bump 0.4s ease-out; }
@keyframes bump { 40% { transform: scale(1.3) rotate(-5deg); } }

/* 氛围：夜萤 · 墨燕 */
#ambient { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.firefly { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #e3d9a8;
  box-shadow: 0 0 7px 2px rgba(227, 217, 168, 0.5);
  animation: ffdrift ease-in-out infinite alternate, ffblink 2.8s ease-in-out infinite; }
@keyframes ffdrift { to { transform: translate(7vw, -5vh); } }
@keyframes ffblink { 0%, 100% { opacity: 0.05; } 50% { opacity: 0.9; } }
.swallow { position: absolute; left: -5vw; animation: birdfly linear forwards; opacity: 0.75; }
.swallow svg { animation: birdbob 2.4s ease-in-out infinite; display: block; }
@keyframes birdfly { to { transform: translateX(115vw); } }
@keyframes birdbob { 50% { transform: translateY(-8px); } }

.toast { position: fixed; top: 22vh; left: 50%; transform: translateX(-50%); z-index: 40;
  background: var(--ink, #2c2a26); color: var(--paper, #f2ecdd);
  padding: 10px 24px; font-size: 0.9rem; letter-spacing: 0.1em; font-family: var(--serif);
  border-radius: 4px; box-shadow: 0 6px 22px rgba(30, 24, 10, 0.35);
  max-width: 90vw; animation: slideup 0.25s ease-out; }

/* 分享卡浮层 */
.share-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(28, 24, 16, 0.72);
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.share-box { max-width: 460px; width: 100%; }
.share-canvas-wrap { display: flex; justify-content: center; margin-bottom: 14px; }
.share-box .btn { background: var(--paper, #f2ecdd); color: #2c2a26; border-color: #2c2a26; }
.share-box .btn-primary { background: #b23a2a; color: #f4efe2; border-color: #b23a2a; }

/* ═══ 扉页 ═══ */
.setup { position: fixed; inset: 0; background: #f2ecdd; overflow-y: auto; }
.setup::after { content: ""; position: fixed; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 140px rgba(70, 58, 36, 0.18); }
.setup-page { max-width: 420px; margin: 0 auto; padding: 11vh 26px 60px; text-align: center; color: #2c2a26; }
.cover-brand { display: flex; justify-content: center; align-items: flex-start; gap: 18px; margin-bottom: 26px; }
.cover-title { writing-mode: vertical-rl; font-size: 2.5rem; font-weight: 700;
  letter-spacing: 0.45em; border-right: 1.5px solid #2c2a26; padding-right: 16px; height: 220px; }
.cover-seal { width: 42px; height: 42px; background: #b23a2a; color: #f4efe2; border-radius: 5px;
  display: grid; place-items: center; font-size: 24px; margin-top: 178px; }
.tagline { color: #6b665a; margin-bottom: 34px; line-height: 2; letter-spacing: 0.1em; }
.setup .btn { border-color: #2c2a26; color: #2c2a26; }
.setup .btn:hover { background: #2c2a26; color: #f2ecdd; }
.setup .btn-primary { width: 100%; padding: 13px; font-size: 1rem; letter-spacing: 0.3em;
  background: #b23a2a; border-color: #b23a2a; color: #f4efe2; }
.setup .btn-primary:hover { background: #963022; }
.divider { display: flex; align-items: center; gap: 12px; color: #a29a84; font-size: 0.82rem;
  letter-spacing: 0.2em; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid #c9c2ae; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; padding: 10px 14px; border: 1.5px solid #c9c2ae; background: #faf6ea;
  color: #2c2a26; font-size: 0.95rem; outline: none; border-radius: 4px; font-family: var(--serif); }
.search-row input:focus { border-color: #b23a2a; }
.city-results { margin-top: 12px; text-align: left; }
.city-results button { display: block; width: 100%; padding: 10px 14px; margin-bottom: 6px;
  border: 1px solid #c9c2ae; background: #faf6ea; color: #2c2a26; cursor: pointer;
  font-size: 0.92rem; text-align: left; border-radius: 4px; font-family: var(--serif); }
.city-results button:hover { border-color: #b23a2a; }
.link-btn { border: none; background: none; color: #6b665a; cursor: pointer;
  font-size: 0.85rem; margin-top: 18px; letter-spacing: 0.1em; font-family: var(--serif);
  border-bottom: 1px solid transparent; }
.link-btn:hover { color: #b23a2a; border-bottom-color: #b23a2a; }
.setup-msg { margin-top: 14px; color: #6b665a; font-size: 0.88rem; min-height: 1.4em; }

/* ═══ 响应式 ═══ */
@media (max-width: 760px) {
  .beds-row { gap: 12px; }
  .plot-tile { width: 23vw; padding: 8px 5px 4px; }
  #scene { gap: 14px; transform: translate(-50%, -40%); }
  #term-big { letter-spacing: 0.3em; }
  .brand-v { display: none; }
  .alm-side.right { flex-wrap: wrap; max-width: 110px; justify-content: flex-end; }
  .coin-line { font-size: 0.8rem; }
}
