/* ============ 阳光农场 样式 ============ */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
:root{
  --cream:#fff8e7; --paper:#fffdf4; --brown:#7a5230; --brown-d:#5d3d22;
  --green:#69a83b; --green-d:#4c8427; --gold:#f6c945; --red:#e05a4e;
  --shadow:0 2px 8px rgba(60,40,10,.18);
}
html,body{ height:100%; overflow:hidden; }
body{
  font-family:"PingFang SC","Hiragino Sans GB","Microsoft YaHei",-apple-system,"Segoe UI",sans-serif;
  background:#a5d678; color:#4a3c20;
  touch-action:manipulation; user-select:none; -webkit-user-select:none;
}
button{ font-family:inherit; cursor:pointer; border:none; background:none; color:inherit; }
.hidden{ display:none !important; }

#app{ display:flex; flex-direction:column; height:100%; height:100dvh; }

/* ---------- HUD ---------- */
#hud{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:6px 10px; background:linear-gradient(#fff3d0,#ffe9b3);
  border-bottom:2px solid #e0c48a; z-index:20; min-height:50px;
}
.hud-item{ display:flex; align-items:center; gap:6px; background:rgba(255,255,255,.55);
  border:1px solid #e3cd97; border-radius:20px; padding:3px 12px; font-weight:700; font-size:14px; }
.hud-item .ic{ width:16px; height:16px; }
#moneyVal{ min-width:34px; color:#8a5a12; }
#hudMoney.pulse{ animation:pulse .5s; }
@keyframes pulse{ 40%{ transform:scale(1.15); background:#ffe58a; } }
.lv-badge{ color:#3f7a1f; }
.xp-bar{ width:74px; height:8px; background:#e6d9b8; border-radius:4px; overflow:hidden; }
#xpFill{ height:100%; width:0%; background:linear-gradient(90deg,#8bd450,#5aa72e); border-radius:4px; transition:width .3s; }
#hudDate{ gap:8px; font-size:13px; }
#timeVal{ font-variant-numeric:tabular-nums; color:#7a5a20; }
#weatherIcon{ display:inline-flex; }
#weatherIcon svg{ width:20px; height:20px; }
.hud-btns{ margin-left:auto; padding:3px 6px; gap:2px; background:rgba(255,255,255,.55); }
.hbtn{ width:32px; height:30px; border-radius:8px; display:inline-flex; align-items:center; justify-content:center; color:#7a5a20; }
.hbtn:hover{ background:#ffe9b3; }
.hbtn.active{ background:#f6c945; color:#5d3d22; box-shadow:inset 0 -2px 0 rgba(0,0,0,.12); }
.hbtn .ic{ width:17px; height:17px; }
.ico-pause{ width:10px; height:12px; border-left:3.5px solid currentColor; border-right:3.5px solid currentColor; }
.ico-play{ width:0; height:0; border-left:10px solid currentColor; border-top:6.5px solid transparent; border-bottom:6.5px solid transparent; }
.ico-ff{ position:relative; width:16px; height:12px; }
.ico-ff::before,.ico-ff::after{ content:""; position:absolute; top:0; width:0; height:0;
  border-left:8px solid currentColor; border-top:6px solid transparent; border-bottom:6px solid transparent; }
.ico-ff::after{ left:8px; }

/* ---------- 主区域 ---------- */
#main{ flex:1; display:flex; min-height:0; position:relative; }
#canvasWrap{ flex:1; position:relative; min-width:0; overflow:hidden; }
#gameCanvas{ position:absolute; inset:0; display:block; touch-action:none; }
#fxLayer{ position:absolute; inset:0; pointer-events:none; overflow:hidden; z-index:5; }

/* 金币飞行动画 */
.fly-coin{
  position:absolute; width:18px; height:18px; margin:-9px 0 0 -9px; border-radius:50%;
  background:radial-gradient(circle at 35% 35%, #ffe98a, #f6c945 60%, #d9a52e);
  border:2px solid #c8922a; z-index:9; pointer-events:none;
  transition:transform .8s cubic-bezier(.3,.6,.4,1), opacity .8s;
}
.fly-text{
  position:absolute; transform:translate(-50%,-50%); font-weight:800; font-size:14px;
  color:#fff; text-shadow:0 1px 3px rgba(0,0,0,.45); pointer-events:none; z-index:9;
  animation:floatUp 1.2s ease-out forwards; white-space:nowrap;
}
@keyframes floatUp{ to{ transform:translate(-50%,-240%); opacity:0; } }

/* toast */
#toastBox{ position:absolute; top:8px; left:50%; transform:translateX(-50%); z-index:30;
  display:flex; flex-direction:column; gap:6px; align-items:center; pointer-events:none; width:max-content; max-width:92%; }
.toast{
  background:rgba(50,36,14,.88); color:#ffeec2; padding:7px 16px; border-radius:18px;
  font-size:13.5px; font-weight:600; box-shadow:var(--shadow); animation:toastIn .25s ease-out;
  max-width:100%; text-align:center;
}
.toast.good{ background:rgba(63,122,31,.92); }
.toast.bad{ background:rgba(190,60,48,.92); }
.toast.fade{ opacity:0; transition:opacity .4s; }
@keyframes toastIn{ from{ transform:translateY(-10px); opacity:0; } }

/* 教程气泡 */
#tutorialBubble{
  position:absolute; bottom:12px; left:50%; transform:translateX(-50%); z-index:25;
  background:#fffdf4; border:2px solid #f6c945; border-radius:14px; padding:10px 14px;
  box-shadow:var(--shadow); max-width:min(480px,92%); font-size:13.5px; line-height:1.5;
}
#tutorialBubble::before{ content:"📢"; margin-right:6px; }
#tutSkip{ display:block; margin:6px 0 0 auto; color:#a8874a; font-size:12px; text-decoration:underline; }
.tut-flash{ animation:tutFlash 1s infinite; }
@keyframes tutFlash{ 50%{ box-shadow:0 0 0 5px rgba(246,201,69,.55); } }

/* ---------- 侧面板 ---------- */
#panel{
  width:340px; background:var(--cream); border-left:2px solid #e0c48a;
  display:flex; flex-direction:column; z-index:15;
}
#panelHead{ display:flex; align-items:center; border-bottom:2px solid #eadcae; background:#fdf3d8; }
#panelTabs{ display:flex; flex:1; }
#panelTabs button{
  flex:1; padding:10px 0; font-size:13.5px; font-weight:700; color:#9a7b45;
  border-bottom:3px solid transparent;
}
#panelTabs button.active{ color:#5d3d22; border-bottom-color:var(--gold); background:var(--cream); }
#panelClose{ display:none; font-size:22px; padding:0 12px; color:#9a7b45; }
#panelBody{ flex:1; overflow-y:auto; padding:10px; -webkit-overflow-scrolling:touch; }

.sec-title{ font-size:13px; font-weight:800; color:#9a7b45; margin:10px 2px 6px; }
.sec-title:first-child{ margin-top:0; }
.shop-item{
  display:flex; align-items:center; gap:8px; background:var(--paper); border:1.5px solid #eadcae;
  border-radius:12px; padding:8px 10px; margin-bottom:8px;
}
.shop-item.locked{ opacity:.55; }
.item-ico{ width:38px; height:38px; border-radius:10px; flex:none; display:flex; align-items:center; justify-content:center; }
.item-ico canvas, .item-ico svg{ width:32px; height:32px; }
.item-info{ flex:1; min-width:0; }
.item-name{ font-weight:800; font-size:14px; }
.item-name .rare-tag{ font-size:10px; background:#e7c9ff; color:#7b3fd4; border-radius:6px; padding:1px 5px; margin-left:4px; vertical-align:1px; }
.item-desc{ font-size:11.5px; color:#9a7b45; line-height:1.35; }
.item-own{ font-size:11px; color:#5c8a36; font-weight:700; }
.buy-btns{ display:flex; flex-direction:column; gap:4px; align-items:stretch; }
.btn{
  background:linear-gradient(#ffdf7e,#f6c945); border:1.5px solid #d9a52e; color:#5d3d22;
  font-weight:800; font-size:12.5px; border-radius:9px; padding:5px 10px; box-shadow:0 2px 0 #d9a52e;
  white-space:nowrap;
}
.btn:active{ transform:translateY(2px); box-shadow:none; }
.btn:disabled{ background:#e6ddc8; color:#a99e83; border-color:#cfc4a8; box-shadow:none; cursor:not-allowed; }
.btn.green{ background:linear-gradient(#9fdd6e,#69a83b); border-color:#4c8427; color:#fff; box-shadow:0 2px 0 #4c8427; }
.btn.red{ background:linear-gradient(#f2a297,#e05a4e); border-color:#b73a30; color:#fff; box-shadow:0 2px 0 #b73a30; }
.btn.ghost{ background:transparent; border-color:#cbb98c; color:#8a6c35; box-shadow:none; }
.btn.small{ font-size:11.5px; padding:3px 8px; }

/* 仓库 */
.cap-bar{ height:10px; background:#e6d9b8; border-radius:5px; overflow:hidden; margin:4px 0 10px; }
.cap-bar>div{ height:100%; background:linear-gradient(90deg,#8bd450,#5aa72e); }
.cap-txt{ font-size:12px; color:#9a7b45; font-weight:700; }
.inv-row{
  display:flex; align-items:center; gap:8px; background:var(--paper); border:1.5px solid #eadcae;
  border-radius:12px; padding:7px 10px; margin-bottom:7px;
}
.inv-row .cnt{ font-weight:800; min-width:30px; text-align:center; background:#f3ead0; border-radius:8px; padding:3px 6px; font-size:13px; }
.empty-tip{ text-align:center; color:#b3a171; font-size:13px; padding:26px 0; }

/* 订单 */
.order-card{
  background:var(--paper); border:1.5px solid #eadcae; border-radius:12px; padding:10px; margin-bottom:10px;
}
.order-head{ display:flex; justify-content:space-between; font-size:12px; color:#9a7b45; font-weight:700; margin-bottom:6px; }
.order-items{ display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
.order-need{ font-size:12.5px; font-weight:800; background:#f3ead0; border-radius:8px; padding:3px 8px; }
.order-need.ok{ background:#dff0c8; color:#3f7a1f; }
.order-need.lack{ color:#b73a30; }
.order-reward{ color:#8a5a12; font-weight:800; font-size:13px; }
.order-btns{ display:flex; gap:8px; margin-top:8px; }

/* 委托 */
.npc-block{ margin-bottom:12px; }
.npc-name{ font-weight:800; font-size:14px; color:#5d3d22; margin-bottom:4px; display:flex; align-items:center; gap:6px; }
.npc-name .npc-face{ width:26px; height:26px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:13px; }
.quest-card{ background:var(--paper); border:1.5px solid #eadcae; border-radius:12px; padding:9px 10px; }
.quest-text{ font-size:13px; font-weight:700; line-height:1.4; }
.quest-prog{ font-size:12px; color:#7a5a20; margin:5px 0; font-weight:700; }
.prog-bar{ height:7px; background:#e6d9b8; border-radius:4px; overflow:hidden; margin-bottom:7px; }
.prog-bar>div{ height:100%; background:linear-gradient(90deg,#8bd450,#5aa72e); }
.quest-reward{ font-size:12px; color:#8a5a12; font-weight:700; }
.quest-done-tip{ font-size:12px; color:#3f7a1f; font-weight:700; }

/* 帮助 */
.help-body{ font-size:13px; line-height:1.7; }
.help-body h3{ font-size:14px; color:#5d3d22; margin:10px 0 4px; }
.help-body ul{ padding-left:18px; }
.help-body b{ color:#8a5a12; }

/* ---------- 工具栏 ---------- */
#toolbar{
  background:linear-gradient(#fff3d0,#ffe9b3); border-top:2px solid #e0c48a; z-index:20;
  padding:6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tools{ display:flex; justify-content:center; gap:10px; }
.tool{
  display:flex; flex-direction:column; align-items:center; gap:2px; width:66px; padding:6px 0 4px;
  border-radius:14px; color:#7a5a20; font-size:12px; font-weight:800;
  border:2px solid transparent;
}
.tool svg{ width:26px; height:26px; }
.tool.active{ background:#fffdf4; border-color:var(--gold); box-shadow:var(--shadow); color:#5d3d22; }
#seedPicker{
  display:flex; gap:6px; overflow-x:auto; padding:2px 2px 8px; margin-bottom:2px;
  -webkit-overflow-scrolling:touch;
}
.seed-chip{
  flex:none; display:flex; align-items:center; gap:5px; background:#fffdf4; border:2px solid #eadcae;
  border-radius:16px; padding:3px 10px 3px 4px; font-size:12.5px; font-weight:800; color:#5d3d22;
}
.seed-chip.active{ border-color:var(--gold); background:#fff3c4; }
.seed-chip .cnt{ background:#f3ead0; border-radius:8px; padding:1px 6px; font-size:11.5px; }
.seed-chip.buy{ color:#3f7a1f; border-style:dashed; padding-left:10px; }

/* ---------- 手机端 FAB ---------- */
#fabRow{ display:none; }

/* ---------- 开始界面 ---------- */
#startScreen{
  position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(#8ecff0 0%, #bfe6f7 45%, #a5d678 45.5%, #7cb342 100%);
}
.start-card{ text-align:center; width:min(400px,90%); }
.start-art{ position:relative; height:150px; margin-bottom:6px; }
.s-sun{ position:absolute; top:4px; right:26px; width:52px; height:52px; border-radius:50%;
  background:radial-gradient(circle at 35% 35%, #fff3a8, #ffd94d 65%, #f2b53a);
  box-shadow:0 0 26px 8px rgba(255,220,90,.75); animation:sunBob 3.5s ease-in-out infinite; }
@keyframes sunBob{ 50%{ transform:translateY(-7px); } }
.s-cloud{ position:absolute; background:#fff; border-radius:20px; opacity:.95; animation:cloudDrift 7s ease-in-out infinite; }
.s-cloud::before,.s-cloud::after{ content:""; position:absolute; background:#fff; border-radius:50%; }
.s-cloud.c1{ top:16px; left:30px; width:56px; height:18px; }
.s-cloud.c1::before{ width:22px; height:22px; top:-11px; left:9px; }
.s-cloud.c1::after{ width:16px; height:16px; top:-8px; left:28px; }
.s-cloud.c2{ top:42px; left:110px; width:44px; height:14px; animation-delay:-3s; }
.s-cloud.c2::before{ width:17px; height:17px; top:-8px; left:8px; }
@keyframes cloudDrift{ 50%{ transform:translateX(14px); } }
.s-hill{ position:absolute; bottom:0; border-radius:50% 50% 0 0; }
.s-hill.h1{ left:0; width:62%; height:64px; background:#8fbf4f; }
.s-hill.h2{ right:0; width:58%; height:48px; background:#7cb342; }
.s-house{ position:absolute; bottom:26px; left:44px; width:44px; height:32px; background:#e07a4e; border-radius:3px; }
.s-house::before{ content:""; position:absolute; top:-16px; left:-5px; width:54px; height:20px;
  background:#a8502e; clip-path:polygon(50% 0,100% 100%,0 100%); }
.s-house::after{ content:""; position:absolute; bottom:0; left:16px; width:12px; height:16px; background:#7a4a26; border-radius:3px 3px 0 0; }
.s-field{ position:absolute; bottom:4px; right:40px; width:92px; height:30px; border-radius:6px;
  background:repeating-linear-gradient(90deg,#8a5a34 0 10px,#9c6a3e 10px 20px); border:2px solid #6e4526; }
#startScreen h1{ font-size:44px; color:#4c8427; text-shadow:0 2px 0 #fff, 0 4px 10px rgba(60,90,20,.3); letter-spacing:6px; }
#startScreen .tag{ color:#5d7a35; font-weight:700; margin:8px 0 22px; font-size:14px; }
button.big{
  display:block; width:240px; margin:10px auto; padding:12px 0; font-size:17px; font-weight:800;
  color:#5d3d22; background:linear-gradient(#ffdf7e,#f6c945); border:2px solid #d9a52e;
  border-radius:16px; box-shadow:0 3px 0 #d9a52e;
}
button.big:active{ transform:translateY(2px); box-shadow:none; }
button.big.ghost{ background:rgba(255,255,255,.7); border-color:#cbb98c; color:#7a5a20; box-shadow:0 3px 0 #cbb98c; }

/* ---------- 弹窗 ---------- */
#modalLayer{
  position:fixed; inset:0; z-index:90; background:rgba(40,28,8,.45);
  display:flex; align-items:center; justify-content:center; padding:16px;
}
#modalCard{
  background:var(--cream); border-radius:18px; border:2px solid #e0c48a; box-shadow:0 10px 40px rgba(40,28,8,.4);
  width:min(430px,100%); max-height:86vh; overflow-y:auto; padding:20px;
  animation:modalIn .22s ease-out;
}
@keyframes modalIn{ from{ transform:scale(.9); opacity:0; } }
#modalCard h2{ font-size:20px; color:#5d3d22; text-align:center; margin-bottom:10px; }
#modalCard p{ font-size:13.5px; line-height:1.65; margin-bottom:8px; }
#modalCard .modal-btns{ display:flex; gap:10px; justify-content:center; margin-top:14px; flex-wrap:wrap; }
#modalCard .center{ text-align:center; }
#modalCard textarea{
  width:100%; height:90px; border:1.5px solid #d9c691; border-radius:10px; padding:8px;
  font-size:11px; font-family:monospace; background:#fffdf4; color:#5d3d22; resize:none;
}
.stat-grid{ display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:10px 0; }
.stat-grid .sg{ background:var(--paper); border:1px solid #eadcae; border-radius:10px; padding:7px 10px; font-size:12.5px; font-weight:700; }
.stat-grid .sg b{ display:block; font-size:16px; color:#8a5a12; }
.unlock-list{ background:#eef7dd; border:1px solid #c4dd9a; border-radius:10px; padding:8px 12px; font-size:13px; margin:8px 0; }

/* ---------- 响应式：手机 ---------- */
@media (max-width:900px){
  #panel{
    position:fixed; top:0; right:0; bottom:0; width:min(340px,88vw); z-index:60;
    transform:translateX(105%); transition:transform .25s ease-out; box-shadow:-6px 0 24px rgba(40,28,8,.3);
  }
  #panel.open{ transform:translateX(0); }
  #panelClose{ display:block; }
  #fabRow{
    display:flex; position:fixed; right:8px; bottom:calc(84px + env(safe-area-inset-bottom)); z-index:40;
    flex-direction:column; gap:8px;
  }
  #fabRow button{
    width:52px; height:40px; border-radius:12px; font-size:12px; font-weight:800; color:#5d3d22;
    background:linear-gradient(#ffdf7e,#f6c945); border:1.5px solid #d9a52e; box-shadow:var(--shadow);
  }
  #hudDate{ order:5; width:100%; justify-content:center; }
  .tool{ width:60px; }
  #startScreen h1{ font-size:36px; }
}
