:root {
  --night-1: #0b0b2a;
  --night-2: #1a1040;
  --night-3: #3a1f5c;
  --gold: #c8a45c;
  --paper: #f7ecd7;
  --ink: #4a3420;
  --soil: #6b4f2a;
  --soil-dark: #553d1e;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; width: 100%; overflow: hidden; position: fixed; background: var(--night-1); font-family: "Courier New", "PingFang SC", "Microsoft YaHei", monospace; color: #f6e3b4; }
button { font-family: inherit; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; display: none; overflow: hidden; }
.screen.active { display: flex; }
#titleScreen { flex-direction: column; align-items: center; justify-content: center; }
#starfield, #sky { position: absolute; inset: 0; width: 100%; height: 100%; }
#fireCanvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.title-banner { position: absolute; bottom: 0; z-index: 1; width: clamp(150px, 32vw, 280px); aspect-ratio: 434 / 390; background-size: contain; background-repeat: no-repeat; background-position: bottom; opacity: .88; pointer-events: none; }
.title-banner.left { left: 0; }
.title-banner.right { right: 0; }
.title-logo { width: min(520px, 84vw); height: auto; display: block; margin: 0 auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,.65)); cursor: pointer; }
.title-wrap { position: relative; z-index: 2; text-align: center; padding: 24px; }
.logo { font-size: clamp(34px, 9vw, 72px); letter-spacing: 6px; color: var(--gold); text-shadow: 0 0 10px rgba(200,164,92,.7), 3px 3px 0 #3a2a4a; cursor: default; user-select: none; }
.subtitle { margin-top: 12px; font-size: clamp(14px, 4vw, 20px); color: #cbb7e8; letter-spacing: 2px; }
.meta-line { margin-top: 18px; font-size: clamp(12px, 3.4vw, 15px); color: #ff9ec7; }
.meta-line .dot { margin: 0 8px; color: var(--gold); }
.pixel-btn { display: inline-block; margin-top: 28px; padding: 13px 34px; background: #3a2a4a; color: #f6e3b4; border: 3px solid var(--gold); font-size: 16px; letter-spacing: 4px; cursor: pointer; box-shadow: 0 4px 0 #241a30, 0 0 0 3px #241a30 inset; }
.pixel-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #241a30, 0 0 0 3px #241a30 inset; }
.pixel-btn.small { padding: 9px 18px; font-size: 13px; margin-top: 14px; letter-spacing: 2px; }
#farmScreen { flex-direction: column; }
.hud { position: absolute; top: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.bag { background: rgba(20,12,40,.72); border: 2px solid var(--gold); padding: 6px 12px; font-size: 13px; letter-spacing: 1px; }
.icon-btn { background: rgba(20,12,40,.72); border: 2px solid var(--gold); color: #f6e3b4; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }
.icon-btn.off { color: #8a7a9a; border-color: #6a5a7a; }
.scene { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 70px 16px 40px; }
.house { text-align: center; margin-bottom: 10px; cursor: pointer; }
.house-img { width: clamp(120px, 34vw, 200px); height: auto; image-rendering: pixelated; filter: drop-shadow(0 8px 0 rgba(0,0,0,.25)); transition: transform .15s; }
.house:hover .house-img { transform: scale(1.04); }
.house-emoji { font-size: clamp(44px, 12vw, 64px); filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); }
.house-sign { display: block; margin-top: 2px; font-size: 11px; letter-spacing: 2px; color: #cbb7e8; }
.mailbox { position: absolute; top: 12%; right: 12%; z-index: 6; background: none; border: none; cursor: pointer; font-size: 34px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.mailbox.shake { animation: shake .4s; }
.dot-badge { position: absolute; top: -4px; right: -6px; width: 12px; height: 12px; background: #ff5d7a; border-radius: 50%; box-shadow: 0 0 8px #ff5d7a; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.farm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(420px, 86vw); }
.plot { position: relative; aspect-ratio: 1; background: linear-gradient(160deg, var(--soil), var(--soil-dark)); background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.12) 0 2px, rgba(255,255,255,.05) 2px 4px); border: 3px solid #3d2b14; display: flex; align-items: center; justify-content: center; font-size: clamp(26px, 9vw, 40px); cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.35), inset 0 0 0 2px rgba(255,255,255,.06); }
.plot::before { content: ""; position: absolute; inset: 4px; border: 1px dashed rgba(0,0,0,.25); }
.plot.mature:hover { transform: scale(1.04); }
.plot.shake { animation: shake .45s; }
.plot.harvested { cursor: default; opacity: .92; }
.plot.harvested::after { content: "🌱"; font-size: clamp(18px, 6vw, 26px); position: absolute; bottom: 4px; right: 6px; }
.plot .crop { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.crop-img { width: 78%; height: auto; image-rendering: pixelated; filter: drop-shadow(0 3px 0 rgba(0,0,0,.3)); }
.npc { position: absolute; bottom: 8%; left: 8%; z-index: 6; text-align: center; cursor: pointer; font-size: 34px; }
.hearts { display: block; font-size: 12px; color: #ff5d7a; letter-spacing: 2px; margin-top: 2px; text-shadow: 0 0 6px rgba(255,93,122,.8); }
.night-controls { position: absolute; bottom: 64px; left: 0; right: 0; z-index: 8; text-align: center; pointer-events: none; }
.night-hint { display: block; font-size: 12px; color: #cbb7e8; margin-bottom: 4px; text-shadow: 0 1px 2px #000; }
.night-controls .pixel-btn { margin-top: 6px; pointer-events: auto; }
.foot { position: absolute; bottom: 0; left: 0; right: 0; z-index: 6; text-align: center; padding: 10px; font-size: 11px; color: #8a7a9a; letter-spacing: 2px; }
#farmScreen.night::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,12,50,.2), rgba(15,8,35,.55)); pointer-events: none; z-index: 1; }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(10,6,25,.78); display: flex; align-items: center; justify-content: center; padding: 20px; }
#cardModal, #letterModal { z-index: 45; }
.card, .letter { background: var(--paper); color: var(--ink); border: 3px solid #8a6a3a; box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px #8a6a3a, 0 14px 40px rgba(0,0,0,.5); padding: 26px 22px; max-width: 440px; width: 100%; text-align: center; }
.card-icon { font-size: 52px; margin-bottom: 8px; }
.card-meta { font-size: 14px; color: #8a6a3a; letter-spacing: 3px; }
.card-date { margin-top: 4px; font-size: 12px; color: #a0846a; }
.card-text { margin: 14px 0 6px; font-size: 15px; line-height: 1.9; text-align: left; padding: 0 6px; }
.card .pixel-btn, .letter .pixel-btn { margin-top: 16px; }
.letter { position: relative; text-align: left; }
.seal { position: absolute; top: -18px; right: 22px; width: 44px; height: 44px; background: #c34043; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 0 0 3px rgba(255,255,255,.35), 0 4px 8px rgba(0,0,0,.35); transform: rotate(8deg); }
.letter-title { font-size: 18px; letter-spacing: 2px; margin-bottom: 12px; color: #5a4020; text-align: center; }
.letter-body-wrap { max-height: 46vh; overflow-y: auto; }
.letter-body { font-size: 14px; line-height: 2; white-space: pre-wrap; }
.letter-sign { margin-top: 14px; text-align: right; font-size: 13px; color: #8a6a3a; }
.letter .pixel-btn { display: block; margin-left: auto; margin-right: auto; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 50; background: rgba(20,12,40,.92); border: 2px solid var(--gold); color: #f6e3b4; padding: 10px 18px; font-size: 13px; letter-spacing: 1px; max-width: 82vw; text-align: center; box-shadow: 0 0 0 3px rgba(20,12,40,.5); }
.lantern { position: fixed; bottom: 12%; left: 50%; z-index: 20; width: 46px; height: 58px; background: radial-gradient(circle at 50% 60%, #ffd9a0, #ff7d6b 70%, #c34043); border-radius: 46% 46% 42% 42% / 55% 55% 40% 40%; box-shadow: 0 0 18px rgba(255,150,120,.8), inset 0 -8px 12px rgba(180,40,40,.5); pointer-events: none; animation: rise 12s ease-in forwards; }
.lantern::before { content: ""; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 2px; height: 14px; background: rgba(255,220,180,.6); }
.lantern span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); width: 160px; font-size: 11px; color: #ffd9a0; text-shadow: 0 0 6px #000; white-space: nowrap; }
@keyframes rise { 0% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(calc(-50% + 40px), -115vh); opacity: .15; } }
@media (max-width: 480px) {
  .mailbox { top: 10%; right: 8%; font-size: 28px; }
  .npc { bottom: 6%; left: 5%; font-size: 28px; }
  .mine { left: 5%; bottom: 22%; }
  .foot { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .plot.mature:hover { transform: none; }
  .lantern { animation-duration: 24s; }
}

.hud-right { display: flex; gap: 8px; }
.pond { position: absolute; right: 10%; bottom: 10%; z-index: 6; text-align: center; cursor: pointer; }
.pond-emoji { font-size: 30px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.pond-label { display: block; font-size: 10px; color: #cbb7e8; letter-spacing: 2px; margin-top: 2px; }
.calendar-box { background: var(--paper); color: var(--ink); border: 3px solid #8a6a3a; box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px #8a6a3a, 0 14px 40px rgba(0,0,0,.5); padding: 20px 16px; max-width: 380px; width: 100%; }
.calendar-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.calendar-title { font-size: 16px; letter-spacing: 2px; color: #5a4020; }
.calendar-head .pixel-btn { margin-top: 0; padding: 6px 12px; font-size: 12px; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; color: #a0846a; margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 13px; background: #fdf6e8; border: 1px solid #d9c6a8; color: var(--ink); }
.cal-day.empty { background: transparent; border-color: transparent; }
.cal-day.today { outline: 2px solid #c8a45c; }
.cal-day.has-event { cursor: pointer; background: #f7e3d0; }
.cal-day .evt-flag { position: absolute; bottom: 1px; font-size: 10px; }
.cal-detail { min-height: 44px; margin-top: 12px; padding: 10px 12px; background: #fdf6e8; border: 2px dashed #d9c6a8; font-size: 13px; line-height: 1.8; color: #5a4020; white-space: pre-line; }
.fish-box { background: linear-gradient(180deg, #1d3f66, #12324f); color: #dff0ff; border: 3px solid #4a90c8; box-shadow: 0 0 0 4px #12324f, 0 0 0 7px #4a90c8, 0 14px 40px rgba(0,0,0,.5); padding: 18px 16px; max-width: 340px; width: 100%; text-align: center; }
.fish-title { font-size: 16px; letter-spacing: 3px; margin-bottom: 12px; }
.fish-pond { position: relative; height: 220px; background: linear-gradient(180deg, #1d5f8a, #0e2a45); border: 2px solid #4a90c8; overflow: hidden; cursor: pointer; }
.fish-zone { position: absolute; left: 0; right: 0; top: 35%; height: 30%; background: rgba(120,220,255,.18); border-top: 2px dashed rgba(160,230,255,.6); border-bottom: 2px dashed rgba(160,230,255,.6); }
.fish-icon { position: absolute; left: 50%; transform: translateX(-50%); font-size: 34px; transition: top .04s linear; will-change: top; }
.fish-hint { margin-top: 10px; font-size: 12px; color: #a9cff0; }
.fish-count { margin-top: 6px; font-size: 12px; color: #7fb4dd; }
.fish-box .pixel-btn { margin-top: 12px; }
.pw-box { background: var(--paper); color: var(--ink); border: 3px solid #8a6a3a; box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px #8a6a3a, 0 14px 40px rgba(0,0,0,.5); padding: 24px 20px; max-width: 320px; width: 100%; text-align: center; }
.pw-title { font-size: 17px; letter-spacing: 3px; color: #5a4020; margin-bottom: 8px; }
.pw-hint { font-size: 12px; color: #a0846a; margin-bottom: 14px; }
.pw-input { width: 100%; padding: 10px; border: 2px solid #8a6a3a; background: #fdf6e8; font-size: 16px; text-align: center; letter-spacing: 6px; color: var(--ink); outline: none; font-family: inherit; }
.pw-input:focus { border-color: #c8a45c; }
.pw-box .pixel-btn { margin-top: 14px; width: 100%; }
.pw-box .pixel-btn.plain { background: transparent; color: #8a6a3a; border-color: #a0846a; }
.pw-shake { animation: shake .4s; }
.gallery-box { background: var(--night-2); border: 3px solid var(--gold); box-shadow: 0 0 0 4px #1a1040, 0 0 0 7px var(--gold), 0 14px 40px rgba(0,0,0,.5); padding: 16px; max-width: 560px; width: 100%; max-height: 84vh; display: flex; flex-direction: column; }
.gallery-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: #f6e3b4; }
.gallery-head h3 { font-size: 16px; letter-spacing: 3px; }
.gallery-head .pixel-btn { margin-top: 0; padding: 6px 12px; font-size: 12px; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; overflow-y: auto; padding-right: 2px; }
.photo-card { background: rgba(0,0,0,.35); border: 2px solid #4a3a6a; padding: 6px; display: flex; flex-direction: column; }
.photo-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: center; display: block; flex: none; }
.photo-cap { margin-top: 4px; font-size: 11px; color: #cbb7e8; text-align: center; }
.photo-date { font-size: 10px; color: #8a7a9a; text-align: center; }
.mine { position: absolute; left: 8%; bottom: 24%; z-index: 6; text-align: center; cursor: pointer; }
.mine-emoji { font-size: 30px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.mine-label { display: block; font-size: 10px; color: #cbb7e8; letter-spacing: 2px; margin-top: 2px; }
.bag { cursor: pointer; }
.mine-box { background: linear-gradient(180deg, #3a2f45, #241a30); color: #e8d9c0; border: 3px solid #8a6a3a; box-shadow: 0 0 0 4px #241a30, 0 0 0 7px #8a6a3a, 0 14px 40px rgba(0,0,0,.5); padding: 16px; max-width: 340px; width: 100%; text-align: center; }
.mine-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mine-head h3 { font-size: 16px; letter-spacing: 3px; }
.mine-head .pixel-btn { margin-top: 0; padding: 6px 12px; font-size: 12px; }
.mine-gems { display: flex; justify-content: center; gap: 8px; margin: 8px 0 12px; }
.gem-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); display: inline-block; }
.mine-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px; background-color: #2e2436; background-image: url("assets/tex_stone.png"); background-size: 48px 48px; image-rendering: pixelated; }
.rock { aspect-ratio: 1; background: linear-gradient(160deg, #6a5a6a, #4a3a4a); border: 3px solid #2a1e2a; display: flex; align-items: center; justify-content: center; font-size: 28px; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.4); }
.rock.broken { cursor: default; opacity: .3; }
.rock.shake { animation: shake .35s; }
.rock.gem-got { opacity: 1 !important; animation: gemPulse 1.6s ease-in-out infinite; }
@keyframes gemPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); } }
.mine-hint { margin-top: 10px; font-size: 12px; color: #a99a80; }
.bag-box { background: var(--paper); color: var(--ink); border: 3px solid #8a6a3a; box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px #8a6a3a, 0 14px 40px rgba(0,0,0,.5); padding: 16px; max-width: 420px; width: 100%; }
.bag-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.bag-head h3 { font-size: 16px; letter-spacing: 2px; color: #5a4020; }
.bag-head .pixel-btn { margin-top: 0; padding: 6px 12px; font-size: 12px; }
.bag-list { max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.bag-item { display: flex; align-items: center; gap: 10px; background: #fdf6e8; border: 2px solid #d9c6a8; padding: 10px 12px; cursor: pointer; }
.bag-item:active { background: #f0e2c8; }
.bag-item-icon { font-size: 24px; }
.bag-item-text { font-size: 13px; line-height: 1.6; }
.bag-empty { text-align: center; color: #a0846a; padding: 20px 0; }
/* ===== V1.2：天数计数 + 心愿清单 ===== */
.days-count { margin-top: 12px; color: var(--gold); font-size: 13px; letter-spacing: 3px; opacity: .9; text-shadow: 0 0 10px rgba(200,164,92,.35); }
.wish-box { background: var(--night-2); border: 3px solid var(--gold); box-shadow: 0 0 0 4px #1a1040, 0 0 0 7px var(--gold), 0 14px 40px rgba(0,0,0,.5); padding: 16px; max-width: 420px; width: 100%; max-height: 84vh; display: flex; flex-direction: column; }
.wish-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.wish-head h3 { margin: 0; color: var(--gold); letter-spacing: 2px; font-size: 17px; }
.wish-head .pixel-btn { margin-top: 0; padding: 8px 14px; font-size: 12px; letter-spacing: 2px; }
.wish-sub { color: #f6e3b4; opacity: .7; font-size: 12px; letter-spacing: 1px; margin: 4px 0 10px; }
.wish-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; }
.wish-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: rgba(255,255,255,.04); border: 2px solid rgba(246,227,180,.18); margin-bottom: 8px; color: #f6e3b4; font-size: 14px; line-height: 1.6; cursor: pointer; }
.wish-item input { margin-top: 3px; accent-color: var(--gold); cursor: pointer; flex: none; }
.wish-item.done { opacity: .5; }
.wish-item.done span { text-decoration: line-through; }