:root {
  --cream: #f6ecd8;
  --ink: #2d2a22;
  --brown: #6b4a2f;
  --green: #6f9b4a;
  --green-deep: #3f6430;
  --gold: #e7b44b;
  --panel: rgba(28, 34, 24, 0.55);
  --panel-line: rgba(246, 236, 216, 0.16);
  --shadow: 0 18px 50px rgba(10, 18, 8, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0e1610;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: var(--cream);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

canvas#app { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

.vignette {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  background:
    radial-gradient(ellipse 78% 68% at 50% 46%, transparent 52%, rgba(10, 18, 9, .32) 100%),
    linear-gradient(180deg, rgba(14, 24, 16, .10), transparent 22%, transparent 82%, rgba(10, 16, 9, .18));
}

.hidden { display: none !important; }

/* ================= HUD ================= */
#hud {
  position: fixed; inset: 0; pointer-events: none;
  padding: 26px 30px 26px;
  display: flex; flex-direction: column; justify-content: space-between;
  z-index: 5;
}

.hud-top-left { display: flex; flex-direction: column; gap: 14px; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-leaf { width: 30px; height: 30px; fill: #bfe3a0; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.brand h1 {
  margin: 0; font-size: 21px; letter-spacing: .18em; font-weight: 600;
  text-shadow: 0 2px 18px rgba(0,0,0,.45);
}
.brand p { margin: 2px 0 0; font-size: 8px; letter-spacing: .34em; opacity: .6; }

.status-row { display: flex; gap: 9px; flex-wrap: wrap; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px 8px 11px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  backdrop-filter: blur(14px) saturate(1.1);
  font-size: 13px; font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 24px rgba(8,14,6,.18);
}
.pill .ico { font-size: 13px; opacity: .95; }
.pill .sep { opacity: .35; }
.pill small { font-size: 9px; opacity: .55; letter-spacing: .08em; margin-left: -1px; }
.pill.coins .ico { color: var(--gold); }

.hud-top-right { pointer-events: auto; align-self: flex-end; margin-top: -58px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--panel-line); background: var(--panel); color: var(--cream);
  font-size: 15px; backdrop-filter: blur(14px);
  transition: .2s;
}
.icon-btn:hover { background: rgba(70,86,52,.7); transform: translateY(-1px); }

/* prompt */
.prompt {
  position: fixed; left: 50%; top: 62%; transform: translate(-50%, 0);
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px 10px 10px;
  background: rgba(24, 30, 20, .72);
  border: 1px solid rgba(246,236,216,.22);
  border-radius: 999px;
  backdrop-filter: blur(16px);
  font-size: 14px; letter-spacing: .06em;
  box-shadow: var(--shadow);
  animation: pop .22s ease;
}
.prompt-key {
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; background: var(--cream); color: var(--ink);
  font-weight: 700; font-size: 13px;
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* bottom toolbar */
.hud-bottom { display: flex; justify-content: center; }

.seed-icon { width: 30px; height: 30px; position: relative; }
.seed-icon::before, .seed-icon::after { content: ""; position: absolute; }
.seed-icon.carrot::before {
  left: 9px; top: 11px; width: 13px; height: 17px; border-radius: 50% 50% 55% 55% / 30% 30% 70% 70%;
  background: linear-gradient(160deg, #ff9a4d, #d95d18); transform: rotate(8deg);
}
.seed-icon.carrot::after {
  left: 10px; top: 1px; width: 12px; height: 14px; border-radius: 50% 50% 30% 30%;
  background: repeating-linear-gradient(90deg, #6ea044 0 4px, #4d7d31 4px 7px);
  transform: rotate(-6deg);
}
.seed-icon.tomato::before {
  left: 5px; top: 8px; width: 21px; height: 21px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ff8a70, #cf3d26 65%, #9e2a18);
  box-shadow: inset -3px -4px 6px rgba(0,0,0,.25);
}
.seed-icon.tomato::after {
  left: 10px; top: 4px; width: 11px; height: 9px;
  background: #5f913c; border-radius: 60% 10% 60% 10%;
  transform: rotate(20deg);
}
.seed-icon.pumpkin::before {
  left: 3px; top: 9px; width: 24px; height: 19px; border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ffb35c, #e07a1f 60%, #a94f10);
  box-shadow: inset -4px -3px 7px rgba(90,40,0,.3), inset 4px 0 5px rgba(255,200,120,.18);
}
.seed-icon.pumpkin::after {
  left: 13px; top: 3px; width: 5px; height: 8px; border-radius: 3px;
  background: #6a7d38; transform: rotate(12deg);
}

/* toast */
#toastWrap {
  position: fixed; left: 50%; top: 22%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.toast {
  padding: 8px 16px; border-radius: 999px; font-size: 12.5px; letter-spacing: .05em;
  background: rgba(28,36,22,.78); border: 1px solid rgba(206,232,170,.22);
  backdrop-filter: blur(12px);
  animation: toastIn .25s ease, toastOut .4s ease 1.7s forwards;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* quest */
.quest {
  position: fixed; right: 30px; bottom: 30px; width: 216px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel); border: 1px solid var(--panel-line);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.quest-title { font-size: 10px; letter-spacing: .26em; opacity: .55; margin-bottom: 6px; }
.quest-body { font-size: 12.5px; opacity: .95; }
.quest-body b { color: #d6eab1; font-weight: 600; }
.quest-bar { margin-top: 9px; height: 3px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.quest-bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #9cc76b, #e7d07a); border-radius: 3px; transition: width .5s ease; }

/* help */
.help {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 360px; padding: 26px 28px;
  border-radius: 20px;
  background: rgba(24, 30, 20, .82);
  border: 1px solid rgba(246,236,216,.16);
  backdrop-filter: blur(22px);
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  pointer-events: auto;
  z-index: 20;
}
.help h2 { margin: 0 0 18px; font-size: 15px; letter-spacing: .2em; font-weight: 500; }
.help-grid { display: grid; grid-template-columns: 150px 1fr; gap: 11px 12px; font-size: 12px; align-items: center; }
.help-grid span:nth-child(even) { opacity: .7; font-size: 11.5px; }
kbd {
  display: inline-block; min-width: 22px; text-align: center;
  padding: 3px 6px; margin-right: 4px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  border-radius: 5px; font-size: 10px; font-family: inherit; color: #e9e0cd;
}
.help-note { margin: 18px 0 16px; font-size: 11px; line-height: 1.8; opacity: .55; }
.ghost-btn {
  width: 100%; padding: 10px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.06); color: var(--cream);
  border: 1px solid rgba(255,255,255,.12); font-family: inherit; font-size: 12px; letter-spacing: .1em;
  transition: .2s;
}
.ghost-btn:hover { background: rgba(255,255,255,.12); }

/* ================= START ================= */
.start {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 120%, rgba(30,46,26,.12), rgba(8,14,10,.52) 70%);
  transition: opacity .9s ease, visibility .9s;
}
.start.gone { opacity: 0; visibility: hidden; }
.start-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 42%, transparent 34%, rgba(6,10,7,.42) 100%); }

.start-panel {
  position: relative; text-align: center; padding: 44px 58px 40px;
  max-width: 560px;
  animation: rise 1s cubic-bezier(.16,1,.3,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }

.start-kicker { font-size: 9px; letter-spacing: .5em; color: #cfe5ae; opacity: .6; margin-bottom: 18px; }
.start-panel h1 {
  margin: 0; font-size: clamp(44px, 7vw, 72px); font-weight: 600; letter-spacing: .16em;
  color: #f8f1df;
  text-shadow: 0 12px 50px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.1);
}
.start-sub {
  margin-top: 8px; font-size: 10px; letter-spacing: .58em; color: #d7e8bb; opacity: .55;
  font-family: Georgia, serif;
}
.start-desc {
  margin: 30px auto 26px; font-size: 12.5px; line-height: 2.05; letter-spacing: .08em;
  color: #e6e0cf; opacity: .72; font-weight: 300;
}
.start-controls {
  display: flex; justify-content: center; gap: 26px;
  font-size: 10.5px; opacity: .6; letter-spacing: .06em;
  margin-bottom: 30px;
}
.start-controls kbd { margin-right: 6px; }

.start-btn {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 15px 34px; border-radius: 999px; cursor: pointer;
  background: linear-gradient(160deg, #f2e7cd, #e2d2b0);
  color: #2e3524; border: none;
  font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: .2em;
  box-shadow: 0 10px 34px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.7);
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s;
}
.start-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
.start-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 42px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.7); }
.start-btn:hover svg { transform: translateX(3px); }
.start-btn:active { transform: translateY(0); }

.start-hint { margin-top: 22px; font-size: 9px; letter-spacing: .22em; opacity: .3; }

/* loading */
.loading {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; gap: 18px;
  align-items: center; justify-content: center;
  background: #0b120d; color: #cfe0b8; font-size: 11px; letter-spacing: .28em;
  transition: opacity .7s ease, visibility .7s;
}
.loading.done { opacity: 0; visibility: hidden; }
.loading-ring {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(207,224,184,.15); border-top-color: #cfe0b8;
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  #hud { padding: 16px; }
  .quest { display: none; }
  .brand h1 { font-size: 17px; }
  .start-panel { padding: 30px 24px; }
}

/* ================= EXTENDED CROPS ================= */
.seed-icon.corn::before {
  left: 11px; top: 5px; width: 9px; height: 21px;
  border-radius: 50% 50% 45% 45% / 18% 18% 82% 82%;
  background:
    repeating-linear-gradient(0deg, #f5d35c 0 3px, #d9a92f 3px 4.5px),
    linear-gradient(90deg, #e8bd3f, #f7dc7c);
  transform: rotate(6deg);
  box-shadow: inset -2px 0 3px rgba(120, 80, 0, .25);
}
.seed-icon.corn::after {
  left: 4px; top: 12px; width: 23px; height: 16px;
  border-radius: 50% 50% 60% 60%;
  background:
    linear-gradient(100deg, #3f6a2b 0 40%, transparent 41%),
    linear-gradient(260deg, #4f7d33 0 40%, transparent 41%);
  transform: rotate(4deg);
}
.seed-icon.strawberry::before {
  left: 5px; top: 9px; width: 21px; height: 19px;
  border-radius: 50% 50% 48% 48% / 42% 42% 72% 72%;
  background:
    radial-gradient(circle at 36% 28%, rgba(255,255,255,.34), transparent 42%),
    radial-gradient(#ffe6a0 1px, transparent 1.4px) 0 0 / 6px 5px,
    radial-gradient(circle at 40% 35%, #e0455a, #b32240 72%);
  box-shadow: inset -3px -3px 6px rgba(90, 0, 20, .3);
}
.seed-icon.strawberry::after {
  left: 9px; top: 3px; width: 13px; height: 8px;
  background: #4f7d33; border-radius: 60% 10% 60% 10%;
  box-shadow: 9px 2px 0 -1px #5f913c;
  transform: rotate(-16deg);
}
.seed-icon.sunflower::before {
  left: 5px; top: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: repeating-conic-gradient(#f7c948 0 14deg, #e2a72a 14deg 28deg);
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.seed-icon.sunflower::after {
  left: 12px; top: 10px; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7a5426, #432b12);
  box-shadow: 0 16px 0 -3px #4f7d33;
}

/* ================= ENERGY ================= */
.pill.energy { gap: 8px; }
.pill.energy .ico { color: #ffd66b; }
.ebar {
  display: inline-block; width: 64px; height: 6px; border-radius: 4px;
  background: rgba(255,255,255,.13); overflow: hidden;
}
.ebar i {
  display: block; height: 100%; width: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #9ed36a, #f6d46a);
  transition: width .28s ease, background .28s ease;
}
.ebar i.low { background: linear-gradient(90deg, #e07070, #e7a05a); }

.prompt-cost {
  font-size: 11px; color: #f0d98a; letter-spacing: .02em;
  padding-left: 2px; opacity: .9;
}

/* ================= SHOP ================= */
.shop {
  position: fixed; inset: 0; z-index: 26; pointer-events: auto;
  display: grid; place-items: center;
  background: rgba(7, 11, 8, .58);
  backdrop-filter: blur(7px);
}
.shop-panel {
  width: min(560px, 92vw); max-height: 84vh;
  display: flex; flex-direction: column;
  border-radius: 22px; overflow: hidden;
  background: linear-gradient(180deg, rgba(31, 39, 27, .97), rgba(21, 27, 19, .98));
  border: 1px solid rgba(246, 236, 216, .16);
  box-shadow: 0 40px 110px rgba(0, 0, 0, .6);
  animation: shopIn .28s cubic-bezier(.16,1,.3,1);
}
@keyframes shopIn { from { opacity: 0; transform: translateY(14px) scale(.985); } }

.shop-head { display: flex; align-items: center; gap: 18px; padding: 22px 22px 14px; }
.shop-kicker { font-size: 8px; letter-spacing: .42em; opacity: .45; margin-bottom: 5px; }
.shop-head h2 { margin: 0; font-size: 19px; letter-spacing: .16em; font-weight: 600; color: #f6ecd8; }
.shop-coins {
  margin-left: auto; font-size: 14px; color: var(--gold);
  font-variant-numeric: tabular-nums; letter-spacing: .05em;
}
.shop-close {
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer;
  background: rgba(255,255,255,.06); color: var(--cream);
  border: 1px solid rgba(255,255,255,.1); font-size: 12px;
  transition: .18s;
}
.shop-close:hover { background: rgba(255,255,255,.14); }

.shop-tabs { display: flex; gap: 6px; padding: 0 22px 12px; border-bottom: 1px solid rgba(246,236,216,.08); }
.shop-tab {
  padding: 8px 16px; border-radius: 10px; cursor: pointer;
  font-family: inherit; font-size: 11.5px; letter-spacing: .12em;
  color: #d9d2bf; background: transparent; border: 1px solid transparent;
  transition: .18s;
}
.shop-tab:hover { background: rgba(255,255,255,.05); }
.shop-tab.active {
  background: rgba(180, 216, 140, .14);
  border-color: rgba(180, 216, 140, .34);
  color: #e6f2d2;
}

.shop-body { padding: 14px 18px 6px; overflow-y: auto; }
.shop-grid { display: flex; flex-direction: column; gap: 7px; }
.shop-item {
  display: grid; grid-template-columns: 46px 1fr auto auto;
  align-items: center; gap: 13px;
  padding: 9px 12px; border-radius: 12px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.05);
}
.shop-ico {
  width: 46px; height: 44px; display: grid; place-items: center;
  border-radius: 10px; background: rgba(255,255,255,.045);
}
.shop-emoji { font-size: 22px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.shop-name { display: flex; flex-direction: column; gap: 2px; font-size: 13px; letter-spacing: .04em; }
.shop-name small { font-size: 10px; opacity: .48; letter-spacing: .02em; }
.shop-price { font-size: 12.5px; color: var(--gold); font-variant-numeric: tabular-nums; }
.shop-buy {
  min-width: 58px; padding: 7px 12px; border-radius: 9px; cursor: pointer;
  font-family: inherit; font-size: 11.5px; letter-spacing: .1em;
  color: #1f2a18; border: none;
  background: linear-gradient(160deg, #dcecbc, #b8d693);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
  transition: .18s;
}
.shop-buy:hover { filter: brightness(1.05); transform: translateY(-1px); }
.shop-buy:disabled { opacity: .3; cursor: not-allowed; transform: none; filter: none; }
.shop-empty { font-size: 11.5px; opacity: .45; text-align: center; padding: 26px 0; line-height: 1.9; }
.shop-sellall {
  margin: 14px 0 10px; width: 100%; padding: 12px;
  border-radius: 12px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; letter-spacing: .14em;
  color: #1f2a18; border: none;
  background: linear-gradient(160deg, #f0d98a, #dcb45e);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
  transition: .18s;
}
.shop-sellall:hover { filter: brightness(1.06); }
.shop-tip { padding: 10px 18px 15px; font-size: 10px; opacity: .38; letter-spacing: .08em; text-align: center; }
.shop-tip kbd { margin: 0 2px; }

/* ================= FISHING ================= */
.fishing {
  position: fixed; inset: 0; z-index: 25; pointer-events: none;
  display: grid; place-items: center;
  background: rgba(6, 12, 10, .34);
  backdrop-filter: blur(3px);
}
.fishing-card {
  pointer-events: auto;
  width: min(350px, 88vw); padding: 24px 26px 18px;
  border-radius: 20px; text-align: center;
  background: rgba(18, 27, 24, .92);
  border: 1px solid rgba(170, 214, 200, .2);
  box-shadow: 0 34px 90px rgba(0, 0, 0, .55);
  animation: shopIn .28s cubic-bezier(.16,1,.3,1);
}
.fishing-title { font-size: 15px; letter-spacing: .12em; margin-bottom: 18px; color: #e9f2e4; }
.fishing-track {
  position: relative; height: 190px; width: 84px; margin: 0 auto;
  border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, #2b4f5d, #0f1e25);
  border: 1px solid rgba(160, 205, 215, .22);
  box-shadow: inset 0 12px 30px rgba(0, 0, 0, .35);
}
.fish-zone {
  position: absolute; left: 0; right: 0; height: 0;
  background: linear-gradient(180deg, rgba(140,210,255,.04), rgba(110,190,240,.3), rgba(140,210,255,.04));
  border-top: 1px dashed rgba(170, 225, 255, .5);
  border-bottom: 1px dashed rgba(170, 225, 255, .5);
}
.reel-bar {
  position: absolute; left: 8px; right: 8px; height: 4px; border-radius: 2px;
  background: #f4e7c6;
  box-shadow: 0 0 10px rgba(255, 240, 200, .65);
}
.fish-mark {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 18px; filter: drop-shadow(0 2px 5px rgba(0,0,0,.4));
}
.fishing-progress {
  margin: 17px auto 9px; height: 6px; width: 100%;
  border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden;
}
.fishing-progress i { display: block; height: 100%; width: 50%; background: #e7c86a; border-radius: 4px; }
.fishing-hint { font-size: 10.5px; opacity: .55; letter-spacing: .06em; }
.fishing-hint kbd { margin: 0 2px; }

/* ================= SLEEP / DAY CARD ================= */
.sleep-fade {
  position: fixed; inset: 0; z-index: 34; pointer-events: none;
  background: #04070a; opacity: 0;
  transition: opacity 1.1s ease;
}
.sleep-fade.on { opacity: 1; }

.day-card {
  position: fixed; left: 50%; top: 50%; z-index: 36;
  transform: translate(-50%, -46%) scale(.98);
  padding: 34px 58px 30px;
  border-radius: 24px; text-align: center;
  background: rgba(17, 23, 16, .93);
  border: 1px solid rgba(206, 232, 170, .18);
  box-shadow: 0 44px 110px rgba(0, 0, 0, .6);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .7s ease, transform .7s cubic-bezier(.16,1,.3,1), visibility .7s;
}
.day-card.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.day-card-kicker { font-size: 9px; letter-spacing: .5em; color: #cfe5ae; opacity: .6; margin-bottom: 12px; }
.day-card h2 { margin: 0; font-size: 34px; font-weight: 600; letter-spacing: .14em; color: #f8f1df; }
.day-card-sub { margin-top: 11px; font-size: 13px; letter-spacing: .1em; color: #d7e8bb; opacity: .82; }
.day-card-line { margin-top: 16px; font-size: 11px; opacity: .48; letter-spacing: .06em; }

/* ================= INVENTORY / PAUSE / SCENE FADE ================= */
.hud-top-right { display: flex; gap: 8px; }

.inv-panel {
  position: fixed; right: 30px; top: 116px; width: 280px;
  padding: 20px 20px 16px;
  border-radius: 18px;
  background: rgba(24, 30, 20, .88);
  border: 1px solid rgba(246,236,216,.16);
  backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  pointer-events: auto;
  z-index: 21;
  animation: shopIn .22s cubic-bezier(.16,1,.3,1);
}
.inv-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.inv-head h2 { margin: 0; font-size: 14px; letter-spacing: .22em; font-weight: 500; }
.inv-sub { font-size: 9.5px; letter-spacing: .26em; opacity: .45; margin: 14px 0 8px; }
.inv-grid { display: flex; flex-direction: column; gap: 5px; max-height: 240px; overflow: auto; }
.inv-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 10px; border-radius: 9px;
  background: rgba(255,255,255,.04);
  font-size: 12px;
}
.inv-name { flex: 1; opacity: .92; }
.inv-count { color: #cbe6a4; font-variant-numeric: tabular-nums; }
.inv-price { font-size: 10px; opacity: .45; }
.inv-empty { font-size: 11.5px; line-height: 1.8; opacity: .45; padding: 8px 2px; }
.inv-seeds { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.inv-seed {
  display: flex; justify-content: space-between; gap: 6px;
  padding: 6px 9px; border-radius: 8px;
  background: rgba(255,255,255,.04);
  font-size: 11px; opacity: .85;
}
.inv-seed b { font-weight: 500; color: #cbe6a4; }
.inv-seed.active { background: rgba(174,220,128,.16); border: 1px solid rgba(194,229,160,.35); }
.inv-seed.empty { opacity: .38; }
.inv-foot { margin-top: 15px; font-size: 10.5px; opacity: .5; letter-spacing: .06em; }
.inv-foot b { color: var(--gold); font-weight: 600; }

.pause-panel {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 300px; padding: 26px 26px 20px;
  border-radius: 20px;
  background: rgba(20, 26, 18, .93);
  border: 1px solid rgba(246,236,216,.16);
  backdrop-filter: blur(22px);
  box-shadow: 0 40px 100px rgba(0,0,0,.55);
  pointer-events: auto; z-index: 24;
  display: flex; flex-direction: column; gap: 9px;
  animation: shopIn .22s cubic-bezier(.16,1,.3,1);
}
.pause-panel h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: .3em; font-weight: 500; }
.pause-panel .ghost-btn { text-align: left; padding: 11px 14px; }
.pause-panel .ghost-btn.subtle { opacity: .55; margin-top: 4px; }
.pause-note { margin: 10px 0 0; font-size: 9.5px; line-height: 1.7; opacity: .4; letter-spacing: .05em; }

.start-new {
  display: block; margin: 14px auto 0;
  background: none; border: none; cursor: pointer;
  color: #d7e8bb; opacity: .45; font-family: inherit;
  font-size: 11px; letter-spacing: .12em;
  text-decoration: underline; text-underline-offset: 4px;
  transition: .2s;
}
.start-new:hover { opacity: .8; }

.scene-fade {
  position: fixed; inset: 0; z-index: 33; pointer-events: none;
  background: #070b08; opacity: 0;
  transition: opacity .3s ease;
}
.scene-fade.on { opacity: 1; }

/* ================= 蓝莓图标 ================= */
.seed-icon.blueberry::before {
  left: 5px; top: 7px; width: 20px; height: 20px; border-radius: 50%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255,255,255,.4), transparent 34%),
    radial-gradient(circle at 45% 42%, #6d86d6, #3d51a6 68%, #26336e);
  box-shadow: inset -3px -4px 6px rgba(10,18,60,.35);
}
.seed-icon.blueberry::after {
  left: 11px; top: 3px; width: 9px; height: 8px;
  background: #5f913c; border-radius: 60% 10% 60% 10%;
  box-shadow: -7px 4px 0 -1px #4d7d31;
  transform: rotate(-18deg);
}

/* 场景名牌 */
.pill.scene-pill { background: rgba(255,255,255,.06); }
.pill.scene-pill #sceneName { font-size: 12px; letter-spacing: .08em; }

/* ================= 通用弹窗（任务板 / 矿车 / 观景） ================= */
.popup {
  position: fixed; inset: 0; z-index: 35;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 10, 7, .55);
  backdrop-filter: blur(4px);
  transition: opacity .2s ease, visibility .2s;
}
.popup.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.popup-card {
  width: min(440px, 88vw);
  padding: 26px 30px 22px;
  border-radius: 22px;
  background: rgba(22, 29, 20, .97);
  border: 1px solid rgba(246, 236, 216, .2);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6);
  animation: shopIn .24s cubic-bezier(.16,1,.3,1);
}
.popup-kicker { font-size: 9px; letter-spacing: .42em; color: #cfe5ae; opacity: .55; margin-bottom: 8px; }
.popup-card h2 { margin: 0 0 14px; font-size: 20px; letter-spacing: .08em; font-weight: 500; color: #f3ecda; }
.popup-body { font-size: 12.5px; line-height: 1.95; color: #dcd5c3; opacity: .9; }
.popup-body b { color: #e7d9a8; font-weight: 600; }
.popup-body small { opacity: .55; font-size: 11px; }
.popup-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.popup-btn {
  width: 100%; padding: 11px 14px; border-radius: 11px; cursor: pointer;
  background: rgba(255, 255, 255, .06); color: var(--cream);
  border: 1px solid rgba(255, 255, 255, .12);
  font-family: inherit; font-size: 12px; letter-spacing: .08em;
  text-align: left; transition: .18s;
}
.popup-btn:hover { background: rgba(255, 255, 255, .12); }
.popup-btn.primary {
  background: linear-gradient(160deg, #f2e7cd, #e2d2b0);
  color: #2e3524; border-color: transparent; font-weight: 600;
}
.popup-btn.primary:hover { filter: brightness(1.04); }

/* ================= 8 格快捷栏 ================= */
.hud-bottom {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.hotbar {
  pointer-events: auto;
  display: flex; gap: 5px;
  padding: 6px;
  border-radius: 15px;
  background: rgba(18, 24, 16, .62);
  border: 1px solid var(--panel-line);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: var(--shadow);
}
.hb-slot {
  position: relative;
  width: 58px; height: 66px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 2px; padding: 4px 3px 5px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .035);
  cursor: pointer;
  transition: .16s ease;
}
.hb-slot:hover { background: rgba(255, 255, 255, .09); }
.hb-slot.active {
  border-color: rgba(194, 229, 160, .6);
  background: linear-gradient(180deg, rgba(214, 235, 177, .22), rgba(214, 235, 177, .05));
  box-shadow: inset 0 0 18px rgba(174, 220, 128, .15);
}
.hb-slot.empty { opacity: .38; }
.hb-key {
  position: absolute; top: 3px; left: 6px;
  font-size: 8px; opacity: .5; letter-spacing: .05em;
}
.hb-ico { height: 25px; display: grid; place-items: center; }
.hb-ico .seed-icon { transform: scale(.72); transform-origin: center; }
.hb-emoji { font-size: 19px; line-height: 1; }
.hb-name {
  font-size: 9px; letter-spacing: .04em; opacity: .88;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hb-count { font-size: 9px; color: #cbe6a4; font-variant-numeric: tabular-nums; }

/* ================= NPC 对话 ================= */
.dialogue {
  position: fixed; inset: 0; z-index: 36;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 10, 7, .52);
  backdrop-filter: blur(5px);
  transition: opacity .2s ease, visibility .2s;
}
.dialogue.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.dlg-card {
  width: min(520px, 90vw);
  max-height: 86vh; overflow: auto;
  padding: 22px 26px 18px;
  border-radius: 22px;
  background: rgba(24, 31, 21, .97);
  border: 1px solid rgba(246, 236, 216, .2);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .62);
  animation: shopIn .24s cubic-bezier(.16,1,.3,1);
}
.dlg-head { display: flex; align-items: center; gap: 13px; }
.dlg-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 600;
  color: #2e3524;
  background: linear-gradient(160deg, #e9d9b4, #c9b483);
  border: 2px solid rgba(246, 236, 216, .35);
  flex: none;
}
.dlg-who { flex: 1; min-width: 0; }
.dlg-kicker { font-size: 8px; letter-spacing: .32em; color: #cfe5ae; opacity: .55; }
.dlg-who h2 { margin: 2px 0 4px; font-size: 17px; letter-spacing: .1em; font-weight: 500; color: #f3ecda; }
.dlg-friend { display: flex; align-items: center; gap: 7px; font-size: 9px; opacity: .85; }
.dlg-fbar { width: 96px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.dlg-fbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #d98a8a, #e7c86a, #8fd66b); transition: width .3s; }
.dlg-friend b { font-weight: 500; color: #cbe6a4; }
.dlg-close { align-self: flex-start; background: none; border: none; color: var(--cream); opacity: .5; font-size: 16px; cursor: pointer; }
.dlg-close:hover { opacity: 1; }
.dlg-body {
  margin-top: 14px; padding: 14px 15px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
  font-size: 12.5px; line-height: 1.95; color: #ded7c5;
}
.dlg-body b { color: #e7d9a8; }
.dlg-memory { display: inline-block; margin-bottom: 4px; color: #d9b978; font-size: 10px; letter-spacing: .18em; }
.dlg-page { margin-top: 6px; font-size: 9px; opacity: .4; text-align: right; letter-spacing: .12em; }
.dlg-actions { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.dlg-tip { margin-top: 10px; font-size: 9px; opacity: .35; letter-spacing: .06em; }
.dlg-tip kbd { font-family: inherit; }

/* ================= 背包技能 / 图鉴 ================= */
.inv-skills { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.inv-skill {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 2px; border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  font-size: 9.5px;
}
.inv-skill b { color: #cbe6a4; font-weight: 500; font-size: 10px; }
.inv-skill small { font-size: 7.5px; opacity: .38; }
.inv-codex {
  margin-top: 8px; display: flex; flex-direction: column; gap: 8px;
  font-size: 9.5px; letter-spacing: .05em;
}
.inv-codex b { color: #cbe6a4; font-weight: 500; }
.inv-story {
  padding: 8px 10px; border-radius: 8px;
  background: rgba(216, 185, 120, .07);
  border: 1px solid rgba(216, 185, 120, .14);
}
.inv-story span { display: block; font-size: 8.5px; letter-spacing: .2em; opacity: .5; }
.inv-story b { display: block; margin: 2px 0 4px; color: #e7d9a8; font-size: 12px; font-weight: 500; }
.inv-story p { margin: 0; font-size: 9.5px; line-height: 1.6; opacity: .62; }
.inv-codex-row { display: flex; justify-content: space-between; gap: 8px; opacity: .55; }
.inv-ach { display: flex; flex-wrap: wrap; gap: 4px; }
.inv-ach-item {
  padding: 2px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .035);
  color: rgba(255, 255, 255, .28); font-size: 8.5px;
}
.inv-ach-item.got { color: #d8c58a; background: rgba(216, 197, 138, .1); }
.codex-cats { display: flex; flex-direction: column; gap: 7px; }
.codex-cat {
  padding: 7px 9px; border-radius: 8px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .05);
}
.codex-cat > b {
  display: block; margin-bottom: 4px;
  font-size: 8.5px; letter-spacing: .18em; opacity: .55; font-weight: 500;
}
.codex-list { display: flex; flex-wrap: wrap; gap: 4px; }
.codex-item {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 3px 7px; border-radius: 6px;
  background: rgba(203, 230, 164, .06);
  color: rgba(240, 235, 215, .85); font-size: 9px;
}
.codex-item small { font-size: 7.5px; opacity: .4; }
.festival-pill { background: rgba(216, 160, 90, .16); border-color: rgba(232, 186, 120, .25); }

/* ================= MAP ================= */
.map-panel {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(660px, 92vw); max-height: 94vh; overflow: auto;
  padding: 22px 24px 16px;
  border-radius: 22px;
  background: rgba(23, 29, 20, .94);
  border: 1px solid rgba(246,236,216,.18);
  backdrop-filter: blur(22px);
  box-shadow: 0 34px 90px rgba(0,0,0,.55);
  pointer-events: auto;
  z-index: 24;
  animation: shopIn .22s cubic-bezier(.16,1,.3,1);
}
.map-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.map-head h2 { margin: 0; font-size: 16px; letter-spacing: .22em; font-weight: 500; }
.map-kicker { margin: 4px 0 0; font-size: 8px; letter-spacing: .42em; opacity: .4; }
.map-here { margin: 10px 0 12px; font-size: 11.5px; opacity: .62; }
.map-here b { color: #e7d9a8; font-weight: 600; }
.map-board {
  position: relative; width: 100%; aspect-ratio: 1.62 / 1;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 28% 22%, rgba(120, 156, 96, .16), transparent 58%),
    radial-gradient(ellipse at 74% 68%, rgba(178, 150, 90, .10), transparent 55%),
    linear-gradient(160deg, rgba(52, 66, 42, .62), rgba(30, 38, 27, .72));
  border: 1px solid rgba(246,236,216,.12);
  overflow: hidden;
}
.map-board::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(246,236,216,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246,236,216,.035) 1px, transparent 1px);
  background-size: 25% 25%;
}
.map-lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.map-edge { stroke: rgba(246,236,216,.3); stroke-width: 1.7; vector-effect: non-scaling-stroke; }
.map-edge.indoor { stroke-dasharray: 4 3; stroke: rgba(214, 186, 132, .42); }
.map-edge.boat { stroke: rgba(126, 188, 214, .60); stroke-width: 2; stroke-dasharray: 6 3; }
.map-edge.cart { stroke: rgba(224, 176, 96, .55); stroke-dasharray: 2 3; }
.map-nodes { position: absolute; inset: 0; z-index: 2; }
.map-node {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap; font-size: 9.5px; letter-spacing: .04em;
  color: rgba(240, 235, 215, .9); pointer-events: none;
}
.map-node b { font-weight: 500; }
.map-node::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: rgba(240, 235, 215, .55);
  border: 1px solid rgba(20, 26, 18, .9);
  box-shadow: 0 0 0 2px rgba(240, 235, 215, .10);
  flex: none;
}
.map-node.visited { color: rgba(240, 235, 215, .96); }
.map-node.visited::before { background: #cbe6a4; }
.map-node.unvisited { color: rgba(240, 235, 215, .45); }
.map-node.unvisited::before { background: rgba(240, 235, 215, .18); box-shadow: none; }
.map-node.current { color: #f6e6b4; font-size: 10.5px; }
.map-node.current::before {
  width: 10px; height: 10px; background: var(--gold);
  box-shadow: 0 0 0 4px rgba(231, 180, 75, .18), 0 0 14px rgba(231, 180, 75, .5);
  animation: mapPulse 1.8s ease-in-out infinite;
}
.map-node.home b::after { content: " ·家"; font-size: 8px; opacity: .55; }
@keyframes mapPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(231, 180, 75, .16), 0 0 10px rgba(231, 180, 75, .35); }
  50% { box-shadow: 0 0 0 6px rgba(231, 180, 75, .06), 0 0 18px rgba(231, 180, 75, .6); }
}
.map-edge-label {
  position: absolute; transform: translate(-50%, -50%); z-index: 3;
  padding: 1px 5px; border-radius: 5px;
  background: rgba(20, 26, 18, .86);
  border: 1px solid rgba(246,236,216,.12);
  font-size: 8px; letter-spacing: .04em; color: rgba(246, 240, 220, .78);
  white-space: nowrap; pointer-events: none;
}
.map-routes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px;
  margin-top: 12px;
}
.map-route {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 10.5px; color: rgba(246, 240, 220, .72);
  padding: 4px 8px; border-radius: 7px;
  background: rgba(255,255,255,.035);
}
.map-route span { opacity: .85; }
.map-route i { font-style: normal; font-size: 9px; opacity: .45; }
.map-route b { color: #d9eab9; font-weight: 500; }
.map-legend {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 12px; font-size: 9.5px; opacity: .55;
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend .lg { width: 16px; height: 0; border-top: 2px solid rgba(246,236,216,.45); }
.map-legend .lg-indoor { border-top-style: dashed; border-color: rgba(214,186,132,.6); }
.map-legend .lg-boat { border-color: rgba(126,188,214,.7); }
.map-legend .lg-cart { border-top-style: dotted; border-color: rgba(224,176,96,.7); }
.map-foot { margin-top: 8px; font-size: 8.5px; letter-spacing: .16em; opacity: .3; text-align: right; }

@media (max-width: 760px) {
  .hb-slot { width: 44px; height: 56px; }
  .hb-name { font-size: 8px; }
  .hb-emoji { font-size: 15px; }
  .hb-ico { height: 19px; }
}

@media (max-width: 620px) {
  .map-panel { padding: 16px 14px 12px; }
  .map-routes { grid-template-columns: 1fr; }
  .map-node { font-size: 8.5px; }
  .map-node.current { font-size: 9.5px; }
}
@media (max-height: 700px) {
  .map-panel { padding: 14px 16px 10px; }
  .map-here { margin: 6px 0 8px; }
  .map-board { aspect-ratio: auto; height: min(44vh, 330px); }
  .map-routes { margin-top: 8px; gap: 3px 12px; }
  .map-legend { margin-top: 8px; }
}
