* { box-sizing: border-box; }
:root { color-scheme: light; --ink: #30454e; --muted: #738087; --line: #d6dcd7; --navy: #233e4d; --gold: #e6bf69; }
body { margin: 0; color: var(--ink); background: radial-gradient(ellipse at 18% 0, #2a4654 0, transparent 50%), #182b3a; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.65; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; border: 1px solid #bccac9; border-radius: 11px; padding: 9px 12px; background: #fffdf3; color: var(--ink); font-weight: 650; cursor: pointer; touch-action: manipulation; }
button:hover:not(:disabled) { border-color: #7d989b; background: #edf2ed; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .48; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #d2a84b; outline-offset: 3px; }
[hidden] { display: none !important; }
.page { max-width: 1120px; margin: auto; padding: 22px 30px 0; }
.site-header { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.back-home { display: inline-flex; align-items: center; min-height: 44px; color: #d5dfd8; font-size: 13px; text-underline-offset: 4px; }
.night-mark { color: #afc2c4; font-size: 11px; letter-spacing: 1px; white-space: nowrap; }
.night-mark span { color: #e2c884; font-size: 22px; vertical-align: middle; }
.hero { padding: 34px 0 25px; color: #f5f0db; }
.eyebrow { margin: 0 0 7px; font-size: 10px; letter-spacing: 2px; font-weight: 750; color: #7c9396; }
.hero .eyebrow { color: #adc5c5; }
h1 { margin: 0 0 12px; font-size: clamp(34px, 5vw, 50px); letter-spacing: 1px; line-height: 1.25; }
h1 span { color: #dfbf70; }
.lead { font-size: 15px; color: #c4d1cf; margin: 0; line-height: 1.9; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 17px; }
.hero-tags span { font-size: 11px; border: 1px solid #526b70; border-radius: 6px; background: #34505a66; color: #d1dfd6; padding: 3px 9px; }
.puzzle-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.puzzle-actions button { font-size: 12px; min-height: 46px; border-color: #607b7e; background: #304b58; color: #ebead7; }
.puzzle-actions button:hover { background: #3b5b65; border-color: #9db3aa; }
.notice { margin: 0 0 12px; border: 1px solid #d9bb7b; border-radius: 11px; background: #fff4d6; color: #735e34; padding: 12px 15px; font-size: 12px; }
.notice p { margin: 3px 0; }
.night-layout { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(0, .9fr); gap: 22px; align-items: start; }
.panel { min-width: 0; padding: 23px; border: 1px solid #d6ddd4; border-radius: 20px; background: #f7f5e9; box-shadow: 0 5px 0 #0d22338c; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
h2 { margin: 0; font-size: 20px; line-height: 1.4; letter-spacing: .3px; }
.moon-mark { font-size: 37px; color: #b5b89b; line-height: 1; }
.puzzle-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; color: #7a8a85; border-bottom: 1px dashed #cdd6ca; padding-bottom: 12px; }
.puzzle-meta code { color: #54716e; letter-spacing: 1.4px; font-family: ui-monospace, monospace; }
.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 15px 0; }
.scoreboard > div { border: 1px solid #d2dccd; border-radius: 12px; background: #edf0e2; display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; gap: 8px; }
.scoreboard span { font-size: 11px; color: #70817a; }
.scoreboard strong { font-size: 24px; color: #3f6264; line-height: 1.3; }
.scoreboard b { font-weight: 750; }
.scoreboard small { font-size: 11px; font-weight: 500; color: #899789; }
.board { display: grid; grid-template-columns: repeat(4, minmax(44px, 1fr)); gap: 9px; padding: 10px; width: 100%; border: 1px solid #617c80; border-radius: 16px; background: #263f4c; }
.cell { position: relative; min-width: 44px; min-height: 44px; width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 4px; border: 1px solid #567179; border-radius: 11px; background: #324e59; color: #afc3be; overflow: hidden; }
.cell:hover:not(:disabled) { background: #3d5d67; border-color: #b5c5b1; }
.cell[aria-disabled="true"] { cursor: default; }
.cell[data-last="true"] { box-shadow: inset 0 0 0 2px #f8e4a6, inset 0 0 0 4px #5d7771; }
.cell[data-affected="true"] { border: 2px dashed #b9c6aa; }
.cell:focus-visible { z-index: 1; outline-offset: -4px; }
.cell-number { position: absolute; left: 6px; top: 3px; font-family: ui-monospace, monospace; font-size: 9px; font-weight: 500; color: #92aaa9; }
.lamp { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 3px; width: 76%; height: 76%; border-radius: 50%; border: 1px solid #607a7a; background: #273f49; }
.lamp-symbol { font-size: clamp(24px, 4vw, 40px); line-height: 1; color: #91aaa7; }
.lamp-label { font-size: 10px; line-height: 1.4; color: #a1b8af; }
.cell[data-lit="1"] { background: #526264; border-color: #d5c383; }
.cell[data-lit="1"]:hover { background: #65716b; }
.cell[data-lit="1"] .lamp { border-color: #efd89b; background: #edce7f; box-shadow: 0 0 16px #f2d58838, inset 0 0 0 5px #f8e7b14d; }
.cell[data-lit="1"] .lamp-symbol { color: #674d22; }
.cell[data-lit="1"] .lamp-label { color: #674d22; }
.cell[data-lit="1"] .cell-number { color: #e3dbb5; }
.board-legend { display: flex; flex-wrap: wrap; gap: 6px 13px; margin-top: 10px; font-size: 9px; color: #809187; }
.board-legend span { display: inline-flex; align-items: center; gap: 5px; }
.board-legend i { display: inline-block; width: 10px; height: 10px; border: 1px solid #7f9791; border-radius: 2px; }
.last-example { box-shadow: inset 0 0 0 2px #e1cca0; }
.board-legend .affected-example { border-style: dashed; }
.play-actions { display: flex; align-items: center; gap: 12px; margin-top: 17px; }
#undo { flex: 0 0 145px; border-color: #c8d4c5; background: #fbfbf0; font-size: 12px; }
.play-actions > span { font-size: 10px; color: #899588; }
.live-status { margin: 13px 0 0; min-height: 48px; color: #58736b; font-size: 12px; }
.result { margin-top: 12px; border: 1px solid #d1ddc7; border-radius: 12px; background: #edf1e1; padding: 14px; }
.result h3 { margin: 0 0 5px; font-size: 14px; color: #466760; }
.result p { margin: 0; font-size: 11px; color: #71836c; }
.result[data-phase="won"] { border-color: #b4c6a0; background: #e8efd9; }
.save-note { margin: 12px 1px 0; color: #939e8d; font-size: 10px; }
.side-stack { min-width: 0; display: grid; gap: 22px; }
.cross-example { max-width: 220px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 19px auto; padding: 13px; border: 1px dashed #c5d2c2; border-radius: 13px; background: #eef1e3; }
.cross-example > span { min-height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: #e3e9db; color: #90a198; font-size: 22px; }
.cross-example .neighbor { color: #9d8045; background: #f0dfac; border: 1px solid #ddc78e; }
.cross-example .center { color: #f5efdb; background: #4d6b6b; border: 1px solid #39575c; font-size: 10px; }
.rules { padding-left: 20px; margin: 15px 0; color: #72856f; font-size: 12px; }
.rules li { margin-bottom: 10px; padding-left: 2px; }
.rules strong { color: #577164; font-weight: 700; }
.strategy-note { color: #677c64; background: #ebefdd; border-left: 3px solid #bccda8; margin: 16px 0 12px; padding: 11px 12px; font-size: 12px; }
.small-note { font-size: 10px; color: #8a9982; line-height: 1.85; }
.count { font-size: 11px; white-space: nowrap; color: #7c9276; }
.records { max-height: 320px; overflow-y: auto; padding: 2px 3px 2px 0; }
.empty-record { color: #a0ae8e; text-align: center; padding: 25px 5px 29px; font-size: 12px; }
.record-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed #d8e0cc; }
.record-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.record-seed { color: #647e65; font-family: ui-monospace, monospace; font-size: 12px; }
.record-score, .record-date { font-size: 10px; color: #8a9b7e; }
.record-item button { min-width: 72px; font-size: 11px; padding: 8px; border-color: #d2dfc3; }
.share-panel { margin-top: 25px; border: 1px solid #4a6269; padding: 15px 18px; background: #2b4654; color: #c1d2c8; font-size: 11px; border-radius: 12px; }
.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 #9db3a3; border-radius: 8px; color: #46615e; background: #f8faee; font-size: 12px; }
footer { padding: 28px 0; text-align: center; color: #91aaab; font-size: 10px; letter-spacing: 1px; }
footer span { padding-inline: 4px; }
dialog { width: min(440px, calc(100% - 32px)); padding: 26px; border: 1px solid #bfcdbd; border-radius: 19px; color: var(--ink); background: #f7f5e9; box-shadow: 0 20px 70px #0b1b2f66; }
dialog::backdrop { background: #101f32aa; backdrop-filter: blur(3px); }
dialog h2 { font-size: 23px; }
dialog > p:not(.eyebrow) { font-size: 13px; color: #778674; margin: 14px 0 22px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.dialog-actions button { min-width: 0; padding: 10px 5px; font-size: 12px; }
.primary { background: #416568; border-color: #416568; color: #f8f3df; }
.primary:hover:not(:disabled) { background: #36565c; border-color: #36565c; }
@media (max-width: 900px) {
  .page { padding-inline: 22px; }
  .night-layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 16px; }
  .panel { padding: 17px; }
  .game { padding: 13px; }
  .side-stack { gap: 16px; }
  h2 { font-size: 18px; }
  .cell { border-radius: 8px; }
  .board { gap: 6px; padding: 7px; }
  .play-actions { gap: 8px; }
  #undo { flex-basis: 116px; }
}
@media (max-width: 700px) {
  .page { padding: 14px 16px 0; }
  .site-header { gap: 8px; }
  .back-home { font-size: 12px; }
  .night-mark { font-size: 10px; letter-spacing: 0; }
  .hero { padding: 27px 0 23px; }
  .lead { font-size: 14px; }
  .puzzle-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
  .night-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .panel { padding: 20px 18px; }
  .game { padding: 12px; }
  .game .section-heading { padding: 4px 2px 0; }
  .scoreboard { gap: 8px; margin: 13px 0; }
  .scoreboard > div { padding: 9px 10px; }
  .scoreboard strong { font-size: 23px; }
  .board { gap: 6px; padding: 7px; border-radius: 12px; }
  .cell { border-radius: 7px; }
  .cell-number { left: 4px; top: 2px; font-size: 8px; }
  .lamp { width: 80%; height: 80%; gap: 1px; }
  .lamp-symbol { font-size: 28px; }
  .lamp-label { font-size: 9px; }
  .play-actions > span { font-size: 9px; }
  .live-status { min-height: 43px; }
  .cross-example { max-width: 215px; }
  .share-panel { margin-top: 23px; }
  dialog { padding: 22px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  button:active:not(:disabled) { transform: none; }
}
