:root {
  color-scheme: dark;
  --ink: #f7f1e5;
  --muted: #9aaec1;
  --page: #101d32;
  --panel: #162740;
  --line: #2a4059;
  --gold: #ffd77b;
  --mint: #81dbcb;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid #a5f6e2; outline-offset: 4px; }
[hidden] { display: none !important; }
.player {
  min-height: 100vh;
  background: radial-gradient(ellipse at 27% 54%, #203f58 0, transparent 45%), radial-gradient(ellipse at 87% 0, #2d2a49 0, transparent 45%), #101d32;
}
.masthead {
  min-height: 74px; max-width: 1260px; margin: auto; padding: 0 35px;
  display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #ffffff14;
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 850; font-size: 21px; line-height: 1.08; }
.brand small { display: block; color: var(--muted); font-size: 9px; margin-top: 6px; font-weight: 650; }
.brand-mark {
  width: 42px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 14px;
  color: var(--gold); font-size: 26px; border: 1px solid #ffca7360;
  background: linear-gradient(145deg, #634b58, #353c56 52%, #243e56);
}
.mast-actions { display: flex; gap: 12px; align-items: center; }
.quiet { border: 0; background: none; color: var(--muted); padding: 8px 10px; font-size: .87rem; }
.quiet:is(:hover, :focus-visible) { color: var(--ink); }
.sound-toggle { display: inline-grid; place-items: center; min-width: 36px; min-height: 34px; }
.sound-toggle[aria-pressed=true] { color: #dcebe8; background: #345069; }
.sound-toggle[aria-pressed=false] .sound-slash,
.sound-toggle[aria-pressed=true] .sound-waves { display: none; }
.mast-actions .quiet { border: 1px solid #ffffff23; border-radius: 9px; padding: 9px 13px; }
.mast-actions #open-progress { color: #dcebe8; }
.player-layout {
  max-width: 1030px; padding: 26px 34px 24px; margin: auto;
  display: grid; grid-template-columns: minmax(0, 410px) minmax(0, 1fr); gap: clamp(40px, 7vw, 112px); align-items: center;
}
.game-column { min-width: 0; }
.pond {
  border-radius: 27px; background: linear-gradient(#f5a092 23.6%, #3cadcf 23.6%, #263670);
  position: relative; overflow: hidden; isolation: isolate; aspect-ratio: 420 / 686;
  box-shadow: 0 0 0 1px #e5e4ff3c, 0 20px 90px #080d1e8a; touch-action: manipulation;
}
.pond canvas { display: block; width: 100%; height: 100%; }
.hud { height: 49px; position: absolute; inset: 14px 15px auto; display: grid; grid-template-columns: 118px minmax(0, 1fr) 64px; align-items: stretch; column-gap: 5px; pointer-events: none; }
.hud-item, .hud-required-fish {
  height: 100%; background: #233e50ef; border: 1px solid #91bebc70;
  border-radius: 12px; box-shadow: 0 2px 6px #101b2f80; font-variant-numeric: tabular-nums;
}
.hud-item { display: flex; gap: 5px; align-items: center; padding: 7px; min-width: 0; }
.hud-item > span:last-child { flex: 1; min-width: 0; }
.hud-item small { display: block; font-size: 10px; line-height: 12px; white-space: nowrap; color: #ffe7df; }
.hud-value { container-type: inline-size; display: block; height: 20px; line-height: 20px; white-space: nowrap; }
.hud-value strong { display: inline-block; height: 1em; font-size: 19px; line-height: 1; }
#score { font-size: min(19px, calc((100cqw - 8px - var(--goal-digits, 3) * 6.5px) / var(--digits, 1) / .65)); }
#casts { font-size: min(19px, calc(100cqw / var(--digits, 1) / .65)); }
#goal { font-size: 11px; color: #ffe7df; }
.hud-right { grid-column: 3; text-align: right; }
.hud.required-mode { grid-template-columns: 1fr; }
.hud.required-mode .hud-item { display: none; }
.hud.required-mode .hud-required { grid-column: 1; }
.gold-coin { width: 24px; flex: none; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; }
.gold-coin { background: #ffda73; color: #a65b36; border: 2px solid #fca855; box-shadow: inset 0 0 0 1px #fff1b6; }
.pond-controls { padding: 8px 12px 0; text-align: center; }
.pond-controls p { color: #e1ebf9; font-size: 12px; margin: 0; min-height: 17px; }
.primary {
  border: 1px solid #ffe7ae; background: linear-gradient(#ffe193, #ffc765); color: #43304b;
  border-radius: 10px; padding: 10px 18px; font-weight: 850; box-shadow: inset 0 1px #fff4cb;
}
.primary:not(:disabled):hover { filter: brightness(1.08); }
.primary:not(:disabled):active { transform: translateY(2px); }
.primary:disabled { opacity: .62; }
.game-under { display: flex; justify-content: space-between; align-items: center; color: #bccddd; font-size: .8rem; margin: 10px 3px 0; }
.game-under i { display: inline-block; width: 7px; height: 7px; background: #83dfca; border-radius: 50%; margin-right: 8px; }
.game-under .quiet { padding-right: 0; }
.expedition { padding-bottom: 26px; min-width: 0; }
.intro h1 {
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  font-size: clamp(34px, 4.3vw, 63px); letter-spacing: -.065em; line-height: 1.19; margin: 14px 0 14px; font-weight: 900;
}
.intro h1 em { color: #ffd592; font-style: normal; }
.intro p { color: #aebfd0; line-height: 1.8; margin-block: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.section-heading h2 { margin: 0; font-size: 1.06rem; }
.section-heading > span { font-variant-numeric: tabular-nums; font-size: 11px; color: var(--muted); }
.hint { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin-top: 14px; }
.hint b { color: #e0e7eb; }
.keycap { background: #23364f; border: 1px solid #3c536e; border-bottom-width: 3px; border-radius: 6px; padding: 1px 8px; color: #d5dfeb; font-size: 1rem; }
.result {
  position: absolute; inset: 0; padding: 20px; display: grid; place-items: center;
  background: #12182c9c; backdrop-filter: blur(4px);
}
.result-card { background: #182a46; border: 1px solid #ffd78670; border-radius: 20px; width: min(100%, 288px); padding: 22px; display: grid; text-align: center; gap: 9px; }
.result-card :is(h2,p) { margin: 0; }
.result-card p { color: #afc1d9; }
.result-card .result-icon { font-size: 36px; color: var(--gold); }
.result-card .primary { margin-top: 6px; }
dialog { width: min(500px, calc(100% - 30px)); background: #182a42; border: 1px solid #38516c; border-radius: 17px; color: var(--ink); padding: 23px; }
dialog::backdrop { background: #080f20b6; backdrop-filter: blur(3px); }
dialog h2 { margin: 2px 32px 10px 0; font-size: 1.3rem; }
dialog p { color: var(--muted); line-height: 1.6; font-size: .88rem; }
.dialog-close { position: absolute; top: 13px; right: 13px; font-size: 21px; }
label { display: grid; gap: 5px; font-size: .85rem; color: #c5d4df; }
input, select { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid #385469; border-radius: 7px; background: #122238; color: var(--ink); }
dialog form > .primary { margin-top: 12px; width: 100%; }
dialog form > :last-child { margin-bottom: 0; }
@media (min-width: 701px) and (max-height: 850px) {
  .player-layout { grid-template-columns: minmax(0, min(410px, calc((100svh - 155px) * .612))) minmax(0, 1fr); justify-content: center; max-width: 970px; }
}
@media (max-width: 700px) {
  .masthead { padding: 0 14px; min-height: 59px; }
  .brand { font-size: 17px; gap: 7px; }
  .brand-mark { width: 34px; border-radius: 10px; font-size: 21px; }
  .brand small { font-size: 7px; margin-top: 4px; }
  .mast-actions { gap: 5px; }
  .mast-actions .quiet { padding: 7px 8px; font-size: .7rem; }
  .player-layout { display: block; max-width: 465px; padding: 11px 12px 22px; }
  .pond { border-radius: 19px; }
  .hud { inset: 11px 10px auto; }
  .game-under { margin-top: 5px; }
  .intro, .hint, .desktop-only { display: none; }
  .expedition { padding: 0; }
}
.fish-progress { color: #fff0c5; font-size: .8rem; overflow-wrap: anywhere; }
.pond-controls .fish-progress { color: #fff0c5; margin-bottom: 4px; }
.game-cover { width:min(1100px, calc(100% - 32px)); margin:clamp(24px,6vh,70px) auto; min-height:475px; padding:clamp(24px,5vw,70px); display:grid; grid-template-columns:1fr 1fr; align-items:center; position:relative; isolation:isolate; overflow:hidden; border:1px solid #6ac8c45e; border-radius:28px; background:#172c42; }
.cover-sky { position:absolute; inset:0; z-index:-1; background:repeating-linear-gradient(90deg, transparent 0 31px,#8cb9d01c 31px 32px),radial-gradient(ellipse at 73% 55%,#31545c,#172940 45%,#111d31 76%); }
.cover-copy { position:relative; z-index:1; }
.cover-copy h1 { font-size:clamp(2.8rem,7vw,5.6rem); line-height:1; letter-spacing:-.09em; margin:12px 0 20px; }
.cover-copy h1 em { color:#ffd592; font-style:normal; }
#player-growth { color:#ffe29f; font-weight:700; font-variant-numeric:tabular-nums; }
.cover-actions { display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.cover-actions .quiet { border:1px solid #e6edff5c; border-radius:10px; background:#17223882; }
#cover-character { color:#e8eefc; }
.cover-art { position:relative; min-height:260px; margin-top:15px; }
.cover-art img,.character-art img { position:absolute; image-rendering:pixelated; object-fit:contain; }
#cover-fisher { width:38%; height:63%; bottom:25%; left:23%; z-index:1; object-position:bottom; }
#character-dialog { width:min(790px,calc(100% - 24px)); max-height:90dvh; overflow:auto; }
#character-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,120px),1fr)); gap:8px; }
.character-card { min-width:0; display:grid; grid-template-rows:75px auto 1fr auto; gap:5px; justify-items:center; padding:9px 6px; white-space:normal; overflow-wrap:anywhere; }
.character-card[aria-pressed=true] { outline:2px solid var(--mint); outline-offset:-2px; }
.character-card:disabled { opacity:.78; }
.character-card small { color:#d2e1ec; text-align:center; font-size:.75rem; }
.character-art { width:100%; height:75px; position:relative; }
.character-art img:first-child { width:45%; height:55px; bottom:13px; left:23%; object-position:bottom; z-index:1; }
.character-art img:last-child { width:100%; height:30px; bottom:0; left:0; }
@media(max-width:700px) {
  .game-cover { grid-template-columns:1fr; margin-top:14px; gap:4px; }
  .cover-art { min-height:160px; order:-1; }
  .cover-sky { background:repeating-linear-gradient(90deg, transparent 0 23px,#8cb9d01a 23px 24px),radial-gradient(ellipse at 45% 24%,#31545c,#172940 44%,#111d31 82%); }
  .cover-copy h1 { margin-top:8px; }
}
.level-intro {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center;
  background: #111f386b; pointer-events: none;
  animation: level-intro-overlay var(--level-intro-duration) ease both;
}
.level-intro strong {
  padding: 16px 34px; max-width: 88%; color: #ffe5a5; background: #182a46;
  border: 1px solid #ffd889b3; border-radius: 18px; box-shadow: 0 12px 36px #07152199;
  font-size: clamp(1.6rem, 6vw, 2.4rem); letter-spacing: .08em; overflow-wrap: anywhere;
  animation: level-intro-title var(--level-intro-duration) ease both;
}
@keyframes level-intro-overlay { 0%, 100% { opacity: 0; } 18%, 75% { opacity: 1; } }
@keyframes level-intro-title {
  0% { transform: translateY(9px) scale(.95); }
  22%, 76% { transform: none; }
  100% { transform: translateY(-5px); }
}
@media (prefers-reduced-motion: reduce) {
  .level-intro strong { animation: none; }
}
.hud-number-roll { display: inline-flex; vertical-align: top; }
.hud-number-digit { display: inline-block; width: 1ch; height: 1em; line-height: 1; overflow: hidden; text-align: center; }
.hud-number-digit > span, .hud-number-digit > span > span { display: block; }
.hud-number-digit > span > span { height: 1em; }
.hud-number-accessible { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.hud-roll-up { animation: hud-roll-up 250ms cubic-bezier(.2,.7,.28,1) both; }
.hud-roll-down { animation: hud-roll-down 250ms cubic-bezier(.2,.7,.28,1) both; }
@keyframes hud-roll-up { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@keyframes hud-roll-down { from { transform: translateY(-50%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .hud-roll-up, .hud-roll-down { animation-duration: 1ms; }
}
.chest-choice {
  position:absolute; z-index:3; left:8px; right:8px; bottom:42px; padding:9px;
  background:#17263feb; border:1px solid #eac989a8; border-radius:12px;
  color:#ffe6ad; text-align:center; font-variant-numeric:tabular-nums; box-shadow:0 5px 16px #0815278c;
}
.chest-choice-header { display:flex; justify-content:space-between; gap:6px; margin-bottom:6px; }
.chest-choice-header span { font-size:.78rem; }
.chest-choice-options { display:flex; justify-content:center; flex-wrap:wrap; gap:4px; }
.chest-choice-options button { padding:4px 6px; font-size:.76rem; }
.chest-choice > .quiet { padding:4px 6px 0; font-size:.73rem; }
#preview-chest { bottom:58px; }
.chest-choice-options button.secondary { border:1px solid #927b568c; border-radius:7px; background:#29415a; color:#f8edcb; }
.chest-choice-options button.secondary:hover:not(:disabled) { background:#36536b; }
.chest-choice-options button:disabled { opacity:.48; }
.hud-required { display:flex; justify-content:center; gap:5px; min-width:0; }
.hud-required-fish {
  display:grid; place-content:center; justify-items:center; gap:2px; flex:0 1 38px; min-width:0; padding:3px 2px;
  color:#fff1cc; font-size:clamp(8px, 2.8vw, 10px); line-height:1.1;
  font-weight:700;
}
.hud-required-fish img { display:block; width:26px; max-width:100%; height:20px; object-fit:contain; image-rendering:pixelated; }
.hud-required-fish.fulfilled { border-color:#8bf0c7; color:#a8ffda; }

body.player {
  color-scheme: light;
  --ink: #522e3c;
  --muted: #775462;
  --gold: #a4492f;
  --mint: #53794e;
  min-height: 100vh;
  color: var(--ink);
  background: #fff5e9;
}
.player :focus-visible { outline-color: #8c4965; }
.player .masthead { background: #fff9ee; border-color: #ecd5cd; }
.player .brand-mark { background: #f7d2cc; border-color: #e6afae; color: #923e58; }
.player .mast-actions .quiet, .player .mast-actions #open-progress, .player .cover-actions .quiet, .player .sound-toggle[aria-pressed=true] {
  color: #63394a; background: #f8e4dd; border-color: #dfb8b7;
}
.player .game-cover { background: #fff0df; border-color: #ead1c1; }
.player .cover-sky {
  background: linear-gradient(90deg, #fff2df 8%, #fff2dff0 32%, #fff2df14 68%),
    url('/assets/dessert/shop.png') center / cover;
}
.player .cover-copy h1, .player .intro h1 { letter-spacing: normal; color: #552f40; }
.player .cover-copy h1 em, .player .intro h1 em { color: #953d59; }
.player #player-growth, .player #cover-character, .player .intro p,
.player .hint, .player .hint b, .player .game-under, .player .pond-controls p { color: var(--muted); }
.player .keycap { color: var(--ink); border-color: #e4bbba; background: #f8e2d9; }
.player #cover-fisher { inset: 4% 0 0 25%; width: 58%; height: 92%; }
.player .cover-art img, .player .character-art img { image-rendering: auto; }
.player .character-art img:first-child { width: 70%; left: 15%; height: 68px; bottom: 0; }
.player .pond { background: #fff1dc; box-shadow: 0 0 0 1px #e8cabc, 0 14px 45px #91566525; }
.player .hud-item { background: #fff8ecf5; border-color: #dcaaa9; box-shadow: 0 2px 6px #87546330; }
.player .hud-item small, .player #goal { color: #764856; }
.player .hud-required-fish { color: #63394a; background: #fff7e9f5; border-color: #d8ada8; }
.player .hud-required-fish.fulfilled { color: #42613e; border-color: #83a575; background: #eaf3de; }
.player .primary { background: #923e58; border-color: #923e58; color: #fff8ed; box-shadow: none; }
.player dialog, .player .result-card, .player .chest-choice, .player .level-intro strong {
  color: var(--ink); background: #fff5e7; border-color: #e2b5ab;
}
.player dialog input, .player .character-card, .player .chest-choice-options button.secondary {
  color: var(--ink); background: #fae2db; border: 1px solid #deb5b4;
}
.player .character-card small, .player .result-card p, .player dialog label { color: var(--muted); }
.player .result, .player .level-intro { background: #6d3f4f60; }
@media(max-width:700px) {
  .player .cover-sky { background: linear-gradient(0deg, #fff2df 42%, transparent 80%),
    url('/assets/dessert/shop.png') top center / auto 60% no-repeat; }
  .player #cover-fisher { left: 21%; height: 100%; }
}
