:root {
  color-scheme: dark;
  font-family: "Microsoft JhengHei", "PingFang TC", sans-serif;
  color: #f9edd1;
  background: #102422;
  font-synthesis: none;
  --line: #e5c99a38;
  --muted: #c0cabe;
  --gold: #f4cb83;
  --serif: "Noto Serif TC", "PMingLiU", "Songti TC", Georgia, serif;
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
button:disabled { cursor: default; opacity: .48; }
[hidden] { display: none !important; }
#game { height: 100dvh; min-height: 420px; display: grid; grid-template-rows: 72px minmax(0, 1fr) 64px; overflow: hidden; }
.masthead, .dock { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 0 26px; z-index: 1; background: #102522; }
.masthead { border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { font: 700 24px/1 var(--serif); letter-spacing: .12em; }
.brand div span { display: block; margin-top: 5px; font: 9px Georgia, serif; letter-spacing: .28em; color: var(--gold); }
.seal { display: grid; place-items: center; width: 38px; height: 38px; font: 31px Georgia, serif; color: var(--gold); border: 1px solid #f4cb836a; border-radius: 50%; }
.clock { width: clamp(170px, 21vw, 270px); }
.clock-label { display: flex; align-items: baseline; justify-content: space-between; font-size: 12px; color: var(--muted); }
.clock-label strong { color: var(--gold); font-size: 14px; letter-spacing: .12em; }
#time { font-variant-numeric: tabular-nums; }
.tide-track { background: #f9edd124; height: 2px; position: relative; margin-top: 10px; }
.tide-track::after { content: ""; position: absolute; left: 33.33%; right: 33.33%; height: 5px; top: -1px; border-inline: 1px solid #f4cb8370; }
.tide-track i { display: block; background: var(--gold); height: 100%; width: 0%; }
nav { display: flex; gap: 7px; justify-self: end; }
nav button { border: 1px solid var(--line); background: #fff8d607; padding: 8px 12px; border-radius: 5px; font-size: 12px; white-space: nowrap; }
nav button:hover { background: #fff8d61b; }
kbd { font: 11px/1.1 system-ui, sans-serif; color: var(--gold); border: 1px solid #f4cb8357; padding: 3px 5px; border-radius: 4px; white-space: nowrap; }
.stage { position: relative; min-height: 0; isolation: isolate; background: #234a43; overflow: hidden; }
#scene { display: block; width: 100%; height: 100%; touch-action: none; }
.stage::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; box-shadow: inset 0 0 110px #0c26287a; }
.location, .field-note, #toast, #prompt { position: absolute; z-index: 1; }
.location { left: 26px; top: 23px; color: #fff2d3; display: flex; align-items: center; gap: 10px; letter-spacing: .10em; font: 700 16px var(--serif); text-shadow: 0 1px 5px #102522; }
.location i { width: 22px; height: 1px; background: #f5d5a4; }
.location small { font: 12px system-ui, sans-serif; color: #fff3da; }
.field-note { right: 24px; top: 23px; width: min(235px, 30vw); border: 1px solid #f7daa550; background: #132e2aeb; border-radius: 6px; padding: 15px 17px; box-shadow: 0 7px 24px #14262132; }
.field-note span, .chapter { color: var(--gold); letter-spacing: .16em; font-size: 11px; }
.field-note p { margin: 8px 0 0; font-size: 13px; line-height: 1.7; color: #f6edda; }
#prompt, #toast { left: 50%; transform: translateX(-50%); background: #132923f2; box-shadow: 0 6px 22px #0d221e50; border: 1px solid var(--line); border-radius: 5px; white-space: nowrap; }
#prompt { bottom: 18px; padding: 10px 15px; font-size: 13px; }
#prompt kbd { margin-right: 7px; }
#toast { bottom: 64px; padding: 9px 13px; font-size: 13px; opacity: 0; transition: opacity .24s; pointer-events: none; color: var(--gold); }
#toast.visible { opacity: 1; }
.dock { border-top: 1px solid var(--line); }
.controls, .pack { display: flex; gap: 13px; align-items: center; }
.controls { color: var(--muted); font-size: 11px; flex-wrap: wrap; }
.pack { gap: 6px; }
.item { display: flex; align-items: center; justify-content: center; gap: 7px; background: #f9ead60a; border: 1px solid var(--line); border-radius: 5px; height: 37px; min-width: 81px; font-size: 11px; color: var(--muted); }
.item b { color: #fff1d5; font-size: 13px; font-variant-numeric: tabular-nums; }
.item svg { width: 18px; height: 18px; }
.save { justify-self: end; font-size: 11px; color: var(--muted); }
.save::before { content: "◈"; color: #a6ceb6; margin-right: 7px; }
dialog { width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 30px); padding: 0; border: 1px solid #e9cb8573; border-radius: 9px; background: #122c29; color: #f9edd1; box-shadow: 0 16px 90px #081a18a3; }
dialog::backdrop { background: #071a1869; backdrop-filter: blur(3px); }
.intro-inner { padding: clamp(28px, 6vw, 55px); text-align: center; background: radial-gradient(ellipse at 50% 20%, #30534a, transparent 70%); }
.intro-inner h1 { font: 700 clamp(52px, 9vw, 82px)/1.12 var(--serif); letter-spacing: .18em; margin: 30px 0 2px; padding-left: .18em; }
.subtitle { margin: 0 0 26px; color: var(--gold); font: 13px Georgia, serif; }
.intro-inner p:not(.subtitle) { font-size: 15px; line-height: 1.9; color: #e6e4cc; }
.primary { margin-top: 14px; background: #f4ce90; border: 1px solid #f4ce90; color: #172f2b; border-radius: 4px; padding: 12px 22px; font-weight: 700; }
.primary:hover { background: #ffe2ac; }
.primary span { padding-left: 15px; }
.panel-inner { padding: 26px; }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 8px 0 6px; font: 700 30px var(--serif); }
.close { background: none; border: 1px solid var(--line); border-radius: 5px; padding: 5px 10px; font-size: 19px; }
.panel-desc { color: var(--muted); margin: 5px 0 18px; line-height: 1.7; font-size: 14px; }
.choice { display: block; width: 100%; text-align: left; margin: 8px 0; background: #e9d7a90b; border: 1px solid var(--line); border-radius: 5px; padding: 12px 14px; }
.choice:not(:disabled):hover { background: #e9d7a923; border-color: #e9c7839c; }
.choice strong { color: var(--gold); display: block; font-size: 14px; }
.choice small { display: block; color: #d9ded0; margin-top: 5px; line-height: 1.55; }
.entry { border-top: 1px solid var(--line); padding: 12px 2px; }
.entry h3 { margin: 0; font-size: 14px; color: var(--gold); }
.entry p { margin: 5px 0 0; font-size: 13px; line-height: 1.65; color: var(--muted); }
.entry.empty { opacity: .72; }
@media (max-width: 820px) {
  .masthead, .dock { padding-inline: 12px; gap: 8px; }
  .controls span:first-child { display: none; }
  .location { left: 12px; }
  .field-note { right: 12px; }
}
@media (max-width: 560px) {
  #game { grid-template-rows: 64px minmax(0, 1fr) 56px; }
  .brand .seal, .controls, .save, nav kbd { display: none; }
  .dock { display: flex; justify-content: center; }
  .brand strong { font-size: 19px; }
  .brand div span { font-size: 7px; letter-spacing: .08em; }
  .clock { width: 116px; }
  .clock-label, nav button { font-size: 10px; }
  nav button { padding: 6px; }
  .field-note { width: 160px; padding: 8px 10px; }
  .field-note p { font-size: 11px; }
  .location { font-size: 13px; }
  .location small, .location i { display: none; }
}
.prompt-gap { display: inline-block; width: 16px; }
.stock { display:flex; gap:1px; background:var(--line); border:1px solid var(--line); border-radius:5px; overflow:hidden; margin:12px 0 16px; }
.stock div { flex:1; background:#1a3530; padding:9px 14px; display:flex; align-items:center; justify-content:space-between; }
.stock small { color:var(--muted); font-size:12px; }
.stock b { font:20px Georgia,serif; color:var(--gold); }
#angling { position:fixed; inset:0; width:100vw; height:100dvh; max-width:none; max-height:none; margin:0; border:0; border-radius:0; padding:0; overflow:hidden; background:#34585c; }
#angling::backdrop { background:#34585c; backdrop-filter:none; }
#angling[open] { animation:bay-reveal .27s ease-out both; }
@keyframes bay-reveal { from { opacity:0 } to { opacity:1 } }
#bay-surface,#fish-scene { position:absolute; inset:0; width:100%; height:100%; display:block; }
#fish-scene { outline:0; cursor:grab; touch-action:none; }
#fish-scene:active { cursor:grabbing; }
.fish-top { position:absolute; inset:0 0 auto; display:flex; justify-content:space-between; align-items:start; gap:12px; padding:clamp(12px,3vw,30px); background:linear-gradient(#122923c7,transparent); pointer-events:none; }
.fish-title { text-shadow:0 2px 10px #122d2bcc; }
.fish-top h2 { font:700 clamp(23px,3vw,37px) var(--serif); margin:4px 0; }
#fish-spot { color:#fff0d0;font-size:13px; }
#fish-exit { pointer-events:auto; background:#19362ee8; border:1px solid #e7cc9b69; padding:9px 12px; border-radius:6px; white-space:nowrap; }
.fish-controls { position:absolute; inset:auto auto 66px clamp(12px,3vw,32px); display:flex; justify-content:start; align-items:center; flex-wrap:wrap; gap:12px 16px; max-width:min(610px,calc(100vw - 24px)); padding:14px 16px; background:#102b26ef; box-shadow:0 8px 36px #0a222446; border-radius:8px; border:1px solid #e9c89257; }
.fish-message { flex:1 1 230px; }
.fish-controls strong { color:var(--gold); }
.fish-controls p { margin:5px 0 0; color:#d9e4d9; font-size:13px; }
.fish-meters { display:none; gap:7px; }
.working .fish-meters { display:grid; }
.fish-meters label { display:flex; justify-content:space-between; align-items:center; gap:8px; font-size:12px; color:#e3decf; }
.fish-meters meter { width:88px; }
#angling:not([data-stage="fight"]) .fish-reel { display:none; }
#fish-action { margin:0; min-width:104px; padding:8px 12px; touch-action:none; user-select:none; }
.fish-keys { position:absolute; bottom:0; inset-inline:0; padding:12px clamp(12px,3vw,32px) 18px; display:flex; flex-wrap:wrap; gap:6px 15px; align-items:center; color:#f1e5cf; font-size:12px; background:linear-gradient(transparent,#112923b0); pointer-events:none; }
.working .fish-walk-hint { opacity:.46; }
@media (prefers-reduced-motion:reduce) { #angling[open] { animation:none; } }
#panel:has(.garden){width:min(850px,94vw);background:linear-gradient(#183c32ed,#132b24fa),url('assets/coast.webp') center/cover}
.seed-select,.plots,.bed-art{display:flex;gap:10px}
.seed-select button{border:1px solid var(--line);padding:8px 18px;background:#253d30;border-radius:5px}
.seed-select [aria-pressed=true]{color:#24362d;background:#dfc08a}
.crop-tip,.farm-status{font-size:13px;line-height:1.6;color:var(--muted)}
.plots{flex-direction:column}
.plot{position:relative;border:7px ridge #a57f52;border-radius:7px;overflow:hidden;padding:0;background:repeating-linear-gradient(172deg,#604834 0 7px,#695039 9px,#584334 13px);touch-action:none;user-select:none}
.plot:disabled{opacity:.84}
.plot.wet{background:repeating-linear-gradient(172deg,#473a31 0 7px,#544638 9px,#42382e 13px)}
.bed-art{height:75px;align-items:center;justify-content:space-evenly}
.furrow{width:12px;height:6px;border-radius:50%;background:#31291e;box-shadow:0 2px #94714d}
.leaf{position:relative;width:10px;height:17px;background:#95b46b;border-radius:0 90%;transform:rotate(12deg);box-shadow:-5px 8px 4px #33281f70}
.leaf:after{content:'';position:absolute;left:7px;top:-2px;width:11px;height:18px;background:#688c51;border-radius:90% 0;transform:rotate(20deg)}
.purple .leaf{background:#ba7890}.purple .leaf:after{background:#985d77}.mature{transform:scale(1.65) rotate(12deg)}
.bed-label{display:block;background:#262c24db;color:#f3deba;padding:6px}
.plot:after{content:'';position:absolute;bottom:0;left:0;width:var(--stroke,0%);height:4px;background:#f0d69c}
.plot.working .leaf.mature{translate:0 var(--lift)}
.plot.working[data-tool="澆水"] .bed-art{background:linear-gradient(95deg,#598d893d var(--stroke),transparent var(--stroke))}
.plot.working[data-tool="播種"] .furrow.touched{background:radial-gradient(ellipse at center,#dbbd79 25%,#483523 42%)}

.plot.working[data-tool="澆水"] .touched:before{content:'';position:absolute;left:2px;top:-9px;width:4px;height:7px;border-radius:70% 30% 60% 40%;background:#b7e3d4}
.bed-art .leaf,.bed-art .leaf.mature{width:30px;height:27px;background:transparent;box-shadow:none;transform:rotate(-4deg);display:grid;place-items:center}
.bed-art .leaf.mature{width:55px;height:48px}.bed-art .leaf:after{display:none}.bed-art svg{width:100%;filter:drop-shadow(2px 3px 2px #29221c77)}
#panel:has(.counter){width:min(820px,94vw)}
.stove{height:clamp(100px,23vh,235px);position:relative;border-radius:5px;background:center 65% / cover url('assets/counter.webp'),#876747}
.chalk{position:absolute;bottom:12px;left:14px;padding:7px 14px;background:#263d34ee;color:#f7e4bb;font:600 16px var(--serif);border:2px solid #ae895c}
.service-note{color:var(--gold);margin:12px 0}.pantry,.station p,.diner{font-size:13px;color:var(--muted)}
.dish-row,.station,.diner{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:8px 0}
.counter button{padding:7px 10px;border-radius:4px;background:#27463b;border:1px solid var(--line)}
.counter button[aria-pressed=true],.station button:not(:disabled){color:#20392f;background:#e6c895}
.diner{justify-content:space-between;border-top:1px solid var(--line);padding-top:8px}
.heat{height:16px;flex:1;position:relative;border-radius:5px;background:linear-gradient(to right,#577f72 55%,#dfba74 55% 83%,#ad7059 83%)}
.heat i{position:absolute;top:-3px;height:22px;width:4px;background:#fff2d4}
.cook-pan{--turn:0deg;position:absolute;left:50%;top:52%;transform:translate(-50%,-50%);width:140px;height:80px;border-radius:50%;border:5px solid #595244;background:radial-gradient(ellipse,#584e3b,#322e25 70%);box-shadow:0 5px 0 #232923,0 8px 12px #34322277;touch-action:none;cursor:grab}
.cook-pan.soup{background:radial-gradient(ellipse,#d5b377,#b79252 65%,#5a5042)}
.food{position:absolute;inset:8px;display:flex;justify-content:center;align-items:center;gap:0;transform:rotate(var(--turn));transition:transform .24s}
.food i{width:20px;height:31px;background:linear-gradient(58deg,#51754a 46%,#d1cf87 50%,#90aa66 55%);border-radius:80% 5% 70% 18%;transform:rotate(-27deg)}
.food i:nth-child(2){transform:rotate(24deg)}.food b{width:57px;height:23px;border-radius:70% 30% 65% 35%;background:repeating-linear-gradient(110deg,#c99962 0 10px,#946a47 12px,#dfb983 14px);box-shadow:0 2px 1px #57422b}
.cook-pan:before{content:'∿　∿';position:absolute;left:32%;top:-18px;color:#fff5d9;animation:steam 1.5s infinite}
@keyframes steam{from{opacity:.8;translate:0 5px}to{opacity:0;translate:3px -12px}}
#panel:has(.garden-yard){position:fixed;inset:0;margin:0;width:100vw;height:100dvh;max-width:none;max-height:none;border:0;border-radius:0;padding:0;overflow:hidden;background:#997b59}
.garden-yard canvas{position:absolute;inset:0;width:100%;height:100%;touch-action:none;outline:0}
#panel:has(.garden-yard) .panel-head,#panel:has(.garden-yard) .panel-desc{position:relative;z-index:1;pointer-events:none;text-shadow:0 1px 6px #122d22,0 1px 12px #172f26}
#panel:has(.garden-yard) .close{pointer-events:auto;background:#21392e}
#panel:has(.garden-yard) .panel-desc{color:white}
.garden-kit{position:absolute;bottom:18px;left:clamp(12px,3vw,32px);max-width:calc(100vw - 30px);padding:13px 17px;background:#17362df2;border:1px solid #e2c28f77;border-radius:7px}
.garden-kit .seed-select{display:flex;gap:7px;flex-wrap:wrap}.garden-kit .expand{margin:0;width:auto}
.bed-call{display:block;margin-top:9px;color:var(--gold)}.farm-act{margin:0;padding:8px 14px;touch-action:none}
.world-start,.world-form select,.world-form input,.room-tools button,.catalog button,.room-port{color:#f8ebd3;border:1px solid #d7c89a68;background:#214235;border-radius:5px;padding:8px 12px;font:inherit}
.world-start{display:block;margin:14px auto 0}.world-form{display:flex;flex-wrap:wrap;gap:8px;padding-bottom:15px}.world-form input{min-width:100px;flex:1}.world-form .primary{margin:0}.world-error:empty{display:none}
#panel:has(.cottage){width:min(1120px,98vw);max-height:98dvh}
#panel:has(.cottage) .panel-inner{padding:14px}#panel:has(.cottage) .panel-desc:empty{display:none}
.cottage-stage{position:relative;width:min(100%,calc((100dvh - 205px)*1.5));margin:6px auto;aspect-ratio:3/2;background:#987551 url('assets/cottage.webp') center / 100% 100%;overflow:hidden;border-radius:6px;isolation:isolate;outline:0}
.cottage-light{pointer-events:none;position:absolute;inset:0;background:linear-gradient(115deg,transparent 34%,#ffe9a519 48%,transparent 59%);animation:cottage-light 8s ease-in-out infinite alternate}
@keyframes cottage-light{to{transform:translateX(8%);opacity:.4}}
.room-slot{position:absolute;width:14%;height:22%;transform:translate(-50%,-93%);background:transparent;border:0;padding:0;border-radius:14px;display:flex;justify-content:center;align-items:end;color:#fff2ca;font-size:24px}
.room-slot:disabled{opacity:1;pointer-events:none}.room-slot img{max-width:100%;max-height:100%;object-fit:contain;filter:drop-shadow(4px 5px 3px #372e254d)}
.editing .room-slot{border:1px dashed #fff2b6;background:#5e543244}.editing .room-port{visibility:hidden}
.room-port{position:absolute;transform:translate(-50%,-50%);font-size:12px;background:#163a2dee;z-index:96;padding:5px 11px}
.room-actor{width:7%;height:auto;position:absolute;transform:translate(-48%,-91%);pointer-events:none}
.room-tools,.catalog{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.room-tip{font-size:13px;color:var(--muted)}.catalog{margin-top:8px}.catalog button[aria-pressed=true]{background:#f1cd90;color:#24392c}
@media(prefers-reduced-motion:reduce){.cottage-light{animation:none}}
.room-guest{position:absolute;width:7%;height:auto;transform:translate(-50%,-92%);pointer-events:none}
.tea-stop{position:absolute;transform:translate(-50%,0);z-index:95;background:#724c30;color:#fff1d3;border:1px solid #d6b67c;border-radius:12px;padding:3px 10px;font:inherit;font-size:12px}
.editing .tea-stop,.editing .tea-card{visibility:hidden}
.tea-card{display:flex;gap:12px;align-items:center;color:#f4e6c9;background:#233b33;padding:8px 12px;border-left:3px solid #b69358;font-size:14px}
.tea-cup{position:relative;width:34px;height:33px;flex:none;overflow:hidden;border:2px solid #ddc898;border-top:0;border-radius:2px 2px 10px 10px;background:#504639}
.tea-cup i,.tea-cup b{position:absolute;bottom:0;left:0;width:100%;height:var(--fill);background:#c98b47}.tea-cup b{bottom:var(--mark);height:2px;background:#fff0ab}
.pour{touch-action:none;user-select:none;background:#f2d79e;color:#342b20;padding:7px 12px;border-radius:5px}.room-actor.carrying{filter:drop-shadow(0 1px 3px #ffdc93)}
#panel:has(.voyage){width:min(680px,95vw)}.chart-shelf{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.chart-shelf button,.voyage-actions button{background:#284743;color:#faeacb;border:1px solid #a8986e;border-radius:6px;padding:10px;text-align:left}.chart-shelf strong,.chart-shelf small{display:block}.chart-shelf small{margin-top:6px;line-height:1.5}.chart-shelf button:disabled{opacity:.58}.voyage-heading{color:#f7d290;font-weight:bold}.voyage-note{min-height:1.3em}.sea-chart{display:grid;grid-template-columns:repeat(7,1fr);background:radial-gradient(ellipse at 85% 20%,#80a59a,#416f71 55%,#284e5a);border:5px double #b29a6c;border-radius:8px;overflow:hidden;margin-bottom:8px}.sea-chart button{height:clamp(29px,5.5vh,55px);border:1px dashed #bed6be44;border-radius:0;background:transparent;color:#fff0ca;font:bold 19px serif}.sea-chart button:disabled{opacity:1}.sea-chart .reachable{background:#d8edc42b;box-shadow:inset 0 0 0 1px #e5dea674}.sea-chart .shoal{color:#ebdcaa;background:repeating-linear-gradient(-22deg,#d2c99b31 0 2px,transparent 2px 8px)}.sea-chart .boat{background:#f3da9d38}.voyage-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.harbor-work{display:block;width:100%;padding:9px 12px;background:#294641;border:1px solid #998665;border-radius:5px;text-align:left;color:#f0ddba;margin:6px 0}.harbor-work small{display:block;margin-top:3px}.harbor-work:disabled{opacity:.8}
.sea-chart button{position:relative}.sea-chart .stamped{font-size:0}.sea-chart svg{height:84%;width:80%;max-width:52px;filter:drop-shadow(1px 2px 1px #233e3e77)}.sea-chart button:focus-visible{outline:2px solid #fff3b5;outline-offset:-3px}.chart-shelf strong{color:#f5d595;font-size:1.08em}
.feast-book{padding:9px 12px;background:#32433a;border:1px solid #9c906955;border-radius:5px;color:#f2ddae;margin:5px 0}.feast-book summary{cursor:pointer}.feast-book button{margin:5px 4px 0 0}.feast-book p{font-size:.9em}
#account-login{width:min(410px,90vw);padding:26px;color:#f1ddbc;background:#16342e;border:1px solid #9c885f;border-radius:9px}
#account-login::backdrop{background:#0a241ec9}
#account-login h1{font-size:1.5rem;margin:0}
#account-login label{display:grid;gap:4px;margin:12px 0}
#account-login input{padding:9px;border:1px solid #a69671;border-radius:4px;background:#fbf1d9;color:#182e26;font:inherit}
#account-login [role=status]{min-height:1.3em}
#account-controls{position:fixed;z-index:4;bottom:10px;right:12px;padding:5px 8px;background:#16342e;color:#f1ddbc;border-radius:5px;font-size:.78rem}
#feedback-box{background:#193a31;color:#f8ecd6;border:1px solid #a19470;border-radius:10px;width:min(390px,84vw);padding:22px}#feedback-box textarea{display:block;width:100%;box-sizing:border-box;margin-top:8px;padding:10px;font:inherit;background:#fff6e2;color:#23332d;border-radius:5px}#feedback-box::backdrop{background:#0d2824ad}
