* { box-sizing: border-box; }
:root { color-scheme: light; --ink: #334f50; --muted: #617b79; --paper: #fffdf4; --line: #c9d7ce; --green: #47736a; }
body { margin: 0; background: linear-gradient(140deg, #dfeae4, #f6f2e4 52%, #e3eee6); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.75; }
button, input { font: inherit; }
button { min-width: 44px; min-height: 44px; padding: 9px 13px; border: 1px solid #a9c3b5; border-radius: 10px; background: #fffdf5; color: #41695f; font-size: 12px; font-weight: 650; cursor: pointer; touch-action: manipulation; }
button:hover:not(:disabled) { background: #e6eee1; border-color: #6d9b86; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid #a8672e; outline-offset: 4px; }
[hidden] { display: none !important; }
.page { max-width: 1110px; margin: auto; padding: 22px 30px 0; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #bfcec4; padding-bottom: 12px; }
.back-home { min-height: 44px; display: inline-flex; align-items: center; color: #476c61; font-size: 13px; text-underline-offset: 4px; }
.header-note { color: #6d8276; font-size: 11px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 30px 0; }
.eyebrow { margin: 0 0 8px; color: #748776; font-size: 10px; font-weight: 750; letter-spacing: 1.5px; }
h1 { margin: 0 0 12px; font-size: clamp(36px, 5vw, 51px); line-height: 1.25; letter-spacing: 1px; color: #3f695b; }
h1 > span { color: #bd874b; }
.lead { font-size: 15px; color: #668074; margin: 0; line-height: 1.9; }
.hero-dock { position: relative; width: 224px; height: 128px; flex: 0 0 224px; border-bottom: 12px solid #bdcbb4; transform: rotate(4deg); }
.hero-box { position: absolute; width: 76px; height: 74px; bottom: 0; left: 22px; border: 2px solid #bc8b49; border-radius: 8px; background: linear-gradient(90deg, #dbb479 0 41%, #edd2a1 41% 59%, #dbb479 59%); display: grid; place-items: center; color: #9b7137; box-shadow: 5px -5px 0 #e6c58d; font-size: 24px; }
.hero-ring { position: absolute; width: 76px; height: 36px; right: 15px; bottom: 9px; border: 3px dashed #7ca697; border-radius: 50%; }
.hero-label { position: absolute; bottom: -35px; width: 100%; text-align: center; font-size: 10px; color: #7d8c78; }
.puzzle-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.puzzle-actions button { background: #4d7769; border-color: #6b8e7c; color: #fff9e8; min-height: 46px; }
.puzzle-actions button:hover:not(:disabled) { background: #3b6658; }
.notice { margin: 0 0 12px; padding: 12px 15px; border: 1px solid #d5ad63; border-radius: 10px; background: #fff1cc; color: #785b26; font-size: 12px; }
.notice p { margin: 2px 0; }
.port-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .85fr); gap: 22px; align-items: start; }
.panel { min-width: 0; padding: 23px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 5px 0 #aac0b444; }
.puzzle-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px dashed #cbd8c8; font-size: 11px; color: #6f8676; }
.puzzle-meta code { font-family: ui-monospace, monospace; letter-spacing: 1.4px; color: #577c66; }
.game-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 15px; }
.game-heading .eyebrow { margin-bottom: 5px; }
h2 { color: #436a5b; font-size: 21px; line-height: 1.45; margin: 0; }
.small-stamp { border: 1px solid #c7b08a; border-radius: 6px; padding: 2px 7px; color: #9a7b45; font-size: 10px; white-space: nowrap; transform: rotate(4deg); }
.scoreboard { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; margin: 0 0 18px; }
.scoreboard > div { min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 8px 11px; border: 1px solid #cfdbc7; border-radius: 9px; background: #eef2e3; }
.scoreboard span { font-size: 11px; color: #6a836b; }
.scoreboard strong { font-size: 23px; line-height: 1.3; color: #4f7857; }
.scoreboard b { font-weight: 750; }
.scoreboard small { font-size: 11px; font-weight: 500; color: #718870; }
.board { width: 100%; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; padding: 6px; border: 2px solid #9ab8a6; border-radius: 13px; background: #cadbc9; box-shadow: 0 5px 0 #91aa9770; outline-offset: 5px; }
.cell { position: relative; min-width: 0; aspect-ratio: 1; border-radius: 4px; background: #edf0de; overflow: hidden; }
.cell[data-wall="true"] { background: repeating-linear-gradient(0deg, #93ad9c 0 32%, #a8beab 32% 37%, #93ad9c 37% 69%, #809c8b 69% 74%); border: 1px solid #7b9987; box-shadow: inset 0 -3px 0 #75948266; }
.cell[data-wall="true"]::after { content: ""; position: absolute; width: 2px; height: 100%; left: 47%; background: #76927b55; }
.goal-ring { position: absolute; inset: 16%; border: 2px dashed #78a38c; border-radius: 50%; background: #d9e8c780; }
.crate { position: absolute; inset: 9%; border: 2px solid #b98b4c; border-radius: 5px; background: linear-gradient(90deg, #dbb176 0 39%, #f0d4a2 39% 61%, #dbb176 61%); box-shadow: inset 0 -4px 0 #bb8d4c55, 1px 2px 0 #8b754155; }
.crate::before { content: ""; position: absolute; left: 5px; right: 5px; top: 28%; height: 1px; background: #b38a5277; }
.crate::after { content: "↑"; position: absolute; left: 11%; top: 14%; font-family: sans-serif; font-size: clamp(9px, 1.3vw, 15px); color: #92672e; font-weight: 700; }
.docked-tag { position: absolute; right: 1px; bottom: 1px; width: 39%; height: 39%; display: grid; place-items: center; border: 1px dashed #315f4b; border-radius: 50%; color: #315f4b; background: #e6efcb; font-size: clamp(8px, 1vw, 13px); line-height: 1; font-weight: 800; }
.worker { position: absolute; width: 59%; height: 67%; top: 17%; left: 21%; border: 1px solid #4f6f69; border-radius: 42% 42% 32% 32%; background: #6b968c; box-shadow: 0 2px 0 #405e5b44; }
.worker::before { content: ""; position: absolute; width: 110%; height: 27%; left: -5%; top: -11%; border: 1px solid #ae8047; border-radius: 55% 55% 15% 15%; background: #dfb673; }
.face { position: absolute; top: 22%; left: 16%; width: 68%; height: 43%; border-radius: 45%; background: #f2dec0; }
.face::before, .face::after { content: ""; position: absolute; top: 35%; width: 10%; height: 18%; border-radius: 50%; background: #465b4c; }
.face::before { left: 22%; }
.face::after { right: 22%; }
.legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 15px; margin: 16px 0 14px; color: #718570; font-size: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 13px; height: 13px; }
.legend-person { border-radius: 40%; background: #6b968c; border-top: 4px solid #dbb176; }
.legend-box { background: linear-gradient(90deg, #dbb176 0 38%, #f0d4a2 38% 62%, #dbb176 62%); border: 1px solid #b98b4c; border-radius: 2px; }
.legend-goal { border: 2px dashed #78a38c; border-radius: 50%; }
.legend-wall { border: 1px solid #7b9987; background: repeating-linear-gradient(0deg, #93ad9c 0 4px, #a8beab 4px 5px); }
.movement-area { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 15px 0 0; }
.control-note { font-size: 11px; color: #6f8272; line-height: 1.75; margin: 0 0 10px; }
.direction-controls { display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 46px); gap: 6px; }
.direction-controls button { padding: 5px; font-family: sans-serif; font-size: 24px; line-height: 1; color: #40695b; background: #e6eee0; border-color: #a7bfaa; }
.direction-controls button:hover:not(:disabled) { background: #d0e0c8; }
#move-U { grid-column: 2; grid-row: 1; }
#move-L { grid-column: 1; grid-row: 2; }
#move-D { grid-column: 2; grid-row: 2; }
#move-R { grid-column: 3; grid-row: 2; }
.live-status { font-size: 12px; color: #517564; min-height: 44px; margin: 18px 0 0; }
.result { border: 1px solid #ccdab8; border-radius: 10px; padding: 14px; margin-top: 9px; background: #eef2de; }
.result h3 { margin: 0 0 5px; color: #4d7356; font-size: 14px; }
.result p { margin: 0; font-size: 11px; color: #687f62; }
.result[data-phase="won"] { background: #e7efcf; border-color: #a7bf89; }
.save-note { color: #74856e; font-size: 10px; margin: 12px 0 0; }
.side-stack { min-width: 0; display: grid; gap: 22px; }
.rules { margin: 18px 0; padding-left: 20px; color: #677f70; font-size: 12px; }
.rules li { padding-left: 2px; margin-bottom: 12px; }
.rules b { color: #4a715e; }
.note-card { border-left: 3px solid #bdc994; padding: 11px 13px; background: #f0f0d9; color: #6e7b54; font-size: 12px; margin: 17px 0; }
.small-note { font-size: 10px; color: #6f836d; line-height: 1.9; margin: 13px 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.count { font-size: 11px; color: #648360; white-space: nowrap; }
.records { max-height: 320px; overflow-y: auto; padding: 2px 3px 2px 0; }
.empty-record { text-align: center; font-size: 12px; color: #7d8e70; padding: 25px 5px; }
.record-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #d1ddc5; padding: 10px 0; }
.record-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.record-seed { color: #577a55; font-size: 12px; font-family: ui-monospace, monospace; }
.record-score, .record-date { font-size: 10px; color: #71886a; }
.record-item button { min-width: 72px; padding: 8px; font-size: 11px; }
.share-panel { border: 1px solid #a7bc9c; border-radius: 11px; padding: 15px 18px; margin-top: 25px; background: #e6edda; color: #637f5f; font-size: 11px; }
.share-panel p { margin: 0; }
.share-panel label { display: block; margin: 10px 0 5px; }
#share-fallback { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #a9bf9a; border-radius: 7px; background: #fffdf2; color: #526f4f; font-size: 12px; }
footer { padding: 28px 0; text-align: center; font-size: 10px; letter-spacing: 1px; color: #758970; }
footer span { color: #ac8d53; padding-inline: 4px; }
dialog { width: min(450px, calc(100% - 32px)); padding: 25px; border: 1px solid #c4d0ae; border-radius: 17px; background: #fffdf4; color: var(--ink); box-shadow: 0 20px 70px #28473b44; }
dialog::backdrop { background: #354f4399; backdrop-filter: blur(3px); }
dialog > p:not(.eyebrow) { font-size: 13px; color: #687e68; margin: 15px 0 20px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.dialog-actions button { min-width: 0; padding: 10px 5px; }
.primary { background: #4d7761; border-color: #4d7761; color: #fff9e7; }
.primary:hover:not(:disabled) { background: #3a654d; border-color: #3a654d; }
@media (max-width: 900px) {
  .page { padding-inline: 22px; }
  .port-layout { gap: 16px; }
  .panel { padding: 17px; }
  .game { padding: 15px; }
  .side-stack { gap: 16px; }
  h2 { font-size: 19px; }
  .small-stamp { display: none; }
  .movement-area { gap: 8px; }
}
@media (max-width: 700px) {
  .page { padding: 14px 16px 0; }
  .site-header { gap: 8px; }
  .back-home { font-size: 12px; }
  .header-note { font-size: 10px; }
  .hero { padding: 25px 0; }
  .hero-dock { display: none; }
  .lead { font-size: 14px; }
  .puzzle-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
  .port-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .panel { padding: 22px 18px; }
  .game { padding: 16px 13px; }
  h2 { font-size: 20px; }
  .scoreboard { gap: 6px; }
  .scoreboard > div { padding: 8px; }
  .scoreboard span { font-size: 10px; }
  .scoreboard strong { font-size: 22px; }
  .board { gap: 3px; padding: 5px; }
  .movement-area { gap: 8px; }
  .direction-controls { grid-template-columns: repeat(3, 46px); }
  dialog { padding: 22px 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
