:root {
  color-scheme: light;
  --paper: #f5f3e9;
  --surface: #fffcf3;
  --ink: #263f37;
  --muted: #5d7166;
  --line: #d8ddcc;
  --accent: #9b4b32;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); line-height: 1.6; }
button, input { font: inherit; }
button { min-height: 44px; padding: 10px 14px; border: 1px solid #c4cebb; border-radius: 11px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 650; line-height: 1.4; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
button:hover { border-color: #728976; background: #eef3e6; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button:disabled:active { transform: none; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #a5452b; outline-offset: 4px; }
a { color: inherit; text-underline-offset: 5px; }
.page-shell { max-width: 1230px; padding: 0 36px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 82px; border-bottom: 1px solid var(--line); }
.home-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; font-size: 15px; text-decoration: none; }
.home-link:hover { text-decoration: underline; }
.topbar > span { color: var(--muted); font-size: 12px; letter-spacing: .05em; text-align: right; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; padding: 46px 0 35px; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .14em; margin: 0 0 10px; }
h1 { margin: 0 0 15px; font-family: Georgia, "Songti SC", "STSong", serif; font-size: clamp(38px, 4.5vw, 60px); font-weight: 700; line-height: 1.15; letter-spacing: -.035em; }
h1 span { color: var(--accent); }
.intro { margin: 0; font-size: 16px; line-height: 1.8; color: #4c6555; }
.hero-note { border-left: 2px solid #c1cdb4; padding-left: 16px; margin: 0 0 4px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 314px; gap: 24px; align-items: start; }
.garden-panel { border: 1px solid #d0d8c4; border-radius: 24px; padding: 26px; background: var(--surface); box-shadow: 0 14px 34px rgb(39 64 45 / 5%); min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 20px; }
.panel-heading .eyebrow { margin-bottom: 7px; }
h2 { font-size: 18px; margin: 0; line-height: 1.5; }
.grid-tag { flex: 0 0 auto; color: #61775c; padding: 7px 12px; font-size: 12px; font-weight: 700; border: 1px solid #d6dfc9; border-radius: 9px; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.history-tools, .light-tools { display: flex; gap: 6px; }
.light-tools { border: 1px solid #d1dac7; border-radius: 12px; padding: 3px; gap: 2px; background: #edf0e3; }
.light-tools button { border-color: transparent; background: transparent; min-height: 44px; padding: 7px 15px; border-radius: 9px; }
.light-tools button[aria-pressed="true"] { background: var(--ink); color: #fffcf1; }
.brush-status { font-size: 12px; color: #5d735b; margin: 0 0 10px; }
.scene { --grass: #dfe8ca; --tree: #c5ddba; --flower: #efddcc; --pond: #c5dfe2; --path: #dedecf; --sand: #eee2bd; --rock: #d3dcd4; --bench: #e7d7bd; --scene-ink: #315441; --scene-paper: #e9eeda; padding: 15px; background: var(--scene-paper); color: var(--scene-ink); border: 1px solid #d0d9bc; border-radius: 18px; }
.scene[data-light="dusk"] { --grass: #3e5954; --tree: #315650; --flower: #65565e; --pond: #3b5c72; --path: #63676a; --sand: #6b6655; --rock: #52616b; --bench: #716353; --scene-ink: #edf0dc; --scene-paper: #243e46; border-color: #3e5b61; }
.scene-topline { display: flex; justify-content: space-between; align-items: center; font-size: 11px; letter-spacing: .12em; opacity: .9; padding: 0 3px 10px; }
.garden { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.garden-cell { padding: 4px; min-width: 0; min-height: 44px; width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; color: var(--scene-ink); background: var(--grass); border: 1px solid rgb(72 103 65 / 12%); border-radius: 8px; box-shadow: inset 0 -3px 0 rgb(43 72 41 / 5%); }
.garden-cell:hover { border-color: currentColor; background: var(--grass); }
.garden-cell[data-material="1"] { background: var(--tree); }
.garden-cell[data-material="2"] { background: var(--flower); }
.garden-cell[data-material="3"] { background: var(--pond); }
.garden-cell[data-material="4"] { background: var(--path); }
.garden-cell[data-material="5"] { background: var(--sand); }
.garden-cell[data-material="6"] { background: var(--rock); }
.garden-cell[data-material="7"] { background: var(--bench); }
.garden-cell:focus-visible { outline-color: #ad472c; outline-offset: 1px; z-index: 1; }
.scene[data-light="dusk"] .garden-cell:focus-visible { outline-color: #fff1ad; }
.material-icon { display: block; width: 76%; max-width: 66px; aspect-ratio: 1; flex: 0 0 auto; }
.material-icon svg { width: 100%; height: 100%; display: block; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.garden-summary { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; font-size: 11px; color: var(--muted); margin-top: 12px; font-variant-numeric: tabular-nums; }
.garden-summary strong { font-size: 16px; color: var(--ink); }
.game-status { font-size: 13px; color: #4e6854; line-height: 1.7; margin: 13px 0; min-height: 23px; }
.replace-tools { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid #e3e6d7; padding-top: 17px; margin-top: 15px; }
.small-note { color: var(--muted); font-size: 11px; line-height: 1.8; margin: 12px 0 0; }
.notice, .storage-status { color: #7a4a2f; background: #fbf0dd; border-left: 3px solid #c99862; border-radius: 5px; padding: 10px 12px; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.side-panel { display: grid; gap: 18px; min-width: 0; }
.side-panel > section { padding: 23px; border: 1px solid var(--line); border-radius: 20px; background: rgb(255 252 243 / 73%); }
.side-panel h2 { font-size: 17px; margin-bottom: 16px; }
.palette { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.palette-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 77px; padding: 7px 2px; border-radius: 10px; font-size: 11px; white-space: nowrap; }
.palette-button .material-icon { width: 35px; max-width: 100%; }
.palette-button[aria-pressed="true"] { background: #e4ecd6; border: 2px solid #3b6045; padding: 6px 1px; color: #224a31; box-shadow: 0 0 0 1px #3b6045; }
.share-panel > p:not(.eyebrow):not(.small-note):not(.storage-status) { color: var(--muted); font-size: 13px; line-height: 1.8; margin: 0 0 15px; }
.primary { background: #3d6148; color: #fffdf1; border-color: #3d6148; }
.primary:hover { background: #2d5039; color: #fffdf1; border-color: #2d5039; }
#shareButton { width: 100%; }
.storage-status { margin: 14px 0 0; font-size: 11px; }
.share-fallback { margin-top: 12px; }
.share-fallback label { display: block; font-size: 11px; margin-bottom: 6px; color: var(--muted); }
.share-fallback input { display: block; width: 100%; min-width: 0; min-height: 44px; border: 1px solid #b9c7af; border-radius: 8px; padding: 8px; font-size: 11px; background: #fffef8; color: var(--ink); }
.material-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; list-style: none; padding: 0; margin: 0; }
.material-counts li { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 5px; border-bottom: 1px solid #e2e7d8; color: var(--muted); font-size: 12px; }
.material-counts strong { color: var(--ink); font-variant-numeric: tabular-nums; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; padding: 27px 0; color: var(--muted); font-size: 11px; }
footer a { display: inline-flex; align-items: center; min-height: 44px; }
dialog { width: min(450px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 40px); overflow: auto; margin: auto; padding: 27px; border: 1px solid #cbd4bc; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 25px 80px rgb(29 55 36 / 24%); }
dialog::backdrop { background: rgb(30 49 38 / 48%); backdrop-filter: blur(3px); }
dialog h2 { font-size: 22px; margin: 0 0 12px; }
dialog > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.9; margin-bottom: 22px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
@media (max-width: 1000px) {
  .page-shell { padding: 0 24px; }
  .layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; }
  .garden-panel { padding: 20px; }
  .side-panel > section { padding: 18px; }
  .scene { padding: 11px; }
  .garden { gap: 4px; }
  .palette { gap: 5px; }
  .palette-button { font-size: 10px; }
  .palette-button .material-icon { width: 30px; }
}
@media (max-width: 850px) {
  .page-shell { max-width: 740px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .hero { align-items: start; }
  .hero-note { max-width: 190px; }
  .side-panel { grid-template-columns: 1fr 1fr; }
  .counts-panel { grid-column: 1 / -1; }
  .material-counts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .palette-button { font-size: 11px; }
  .palette-button .material-icon { width: 35px; }
}
@media (max-width: 540px) {
  .page-shell { padding: 0 10px; }
  .topbar { min-height: 68px; gap: 10px; padding: 0 3px; }
  .home-link { font-size: 13px; }
  .topbar > span { max-width: 48%; font-size: 10px; }
  .hero { padding: 30px 5px 25px; display: block; }
  h1 { font-size: 42px; }
  .intro { font-size: 14px; }
  .hero-note { margin-top: 16px; font-size: 11px; max-width: none; }
  .hero-note br { display: none; }
  .garden-panel { padding: 12px 10px; border-radius: 17px; }
  .panel-heading { margin: 4px 2px 17px; }
  .panel-heading h2 { font-size: 16px; }
  .panel-heading .eyebrow { font-size: 9px; }
  .grid-tag { padding: 5px 9px; font-size: 11px; }
  .toolbar { gap: 8px; }
  .history-tools { gap: 5px; }
  .history-tools button { padding: 8px 10px; font-size: 12px; }
  .light-tools button { padding: 7px 12px; font-size: 12px; }
  .scene { padding: 6px; border-radius: 11px; }
  .scene-topline { padding: 3px 4px 8px; font-size: 10px; }
  .garden { gap: 3px; }
  .garden-cell { padding: 2px; border-radius: 6px; }
  .material-icon { width: 88%; }
  .garden-summary { font-size: 10px; gap: 5px; }
  .garden-summary strong { font-size: 14px; }
  .game-status { font-size: 12px; }
  .replace-tools button { font-size: 12px; }
  .side-panel { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .side-panel > section { padding: 20px; border-radius: 17px; }
  .counts-panel { grid-column: auto; }
  .material-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .palette { gap: 8px; }
  .palette-button { font-size: 12px; min-height: 83px; }
  .palette-button .material-icon { width: 38px; }
  dialog { padding: 22px; }
  .dialog-actions { flex-direction: column; }
  .dialog-actions button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  button:active { transform: none; }
}
