:root {
  color-scheme: dark;
  --bg: #101713;
  --surface: #19241d;
  --line: #394b3b;
  --ink: #f3f5e8;
  --muted: #bac8b8;
  --green: #b6e980;
  --heading: "Courier New", monospace;
  font-family: system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 50% 12%, #202b20, transparent 70%); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid #e6ec9e; outline-offset: 4px; }
button:disabled { cursor: default; }
canvas { image-rendering: pixelated; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.topbar { border-bottom: 1px solid #29372b; background: #101813; }
.top-inner { min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font: bold 1.15rem var(--heading); }
.brand canvas { width: 23px; height: 23px; }
.outline { min-height: 40px; padding: 8px 14px; border: 1px solid #516951; color: #d7e5d0; background: #17241b; font-size: .9rem; font-weight: 650; }
.outline:hover { border-color: var(--green); color: var(--green); }
.hero { position: relative; overflow: hidden; min-height: 346px; isolation: isolate; display: flex; align-items: center; margin-top: 24px; border: 1px solid #526a54; box-shadow: 0 6px 0 #080e0b; background: #183229; }
.hero > canvas, .hero-shade { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero > canvas { object-fit: cover; object-position: center; }
.hero-shade { background: linear-gradient(90deg, #0b1815 0%, #0b1815ef 19%, #0b18158a 38%, transparent 65%); }
.hero-content { padding: 34px clamp(24px, 5vw, 72px); }
.eyebrow { color: #ceeda1; font: bold .85rem var(--heading); letter-spacing: .14em; margin: 0 0 17px; }
.live-dot { display: inline-block; vertical-align: 2px; width: 7px; height: 7px; margin-right: 5px; background: #b9ec78; box-shadow: 0 0 12px #a5e469; }
h1, h2, .card-title { font-family: var(--heading); }
h1 { margin: 0; font-size: clamp(3.35rem, 7vw, 6.3rem); line-height: .80; letter-spacing: -.075em; text-shadow: 4px 5px #0a110c; }
h1 em { font-style: normal; color: var(--green); }
#today { margin: 21px 0 17px; color: #d9e7d4; }
.primary { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 9px 16px; border: 1px solid #d5f4ad; box-shadow: 0 4px 0 #4e6d34; background: var(--green); color: #162513; font-weight: 800; text-align: center; }
.primary:hover { background: #ccf59e; }
.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #4e6d34; }
.section-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
h2 { margin: 0; font-size: clamp(1.45rem, 3.2vw, 2rem); letter-spacing: -.055em; }
#next-day { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.progress-box { min-width: 103px; color: var(--muted); font: bold .85rem var(--heading); text-align: right; }
.progress { display: grid; grid-template-columns: repeat(6,1fr); gap: 4px; margin-top: 7px; }
.progress i { height: 7px; border: 1px solid #52694e; background: #202b22; }
.progress .filled { background: var(--green); border-color: #caefaa; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card { display: flex; align-items: center; gap: 13px; padding: 13px; min-height: 96px; text-align: left; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 3px #0a110c; }
.card[data-state="ready"] { background: #243624; border-color: #80ae6d; }
.card[data-state="won"] { border-color: #ad9355; }
.card:hover { border-color: var(--green); background: #30422d; }
.icon-frame { width: 50px; height: 50px; display: grid; place-items: center; flex: none; background: #101b14; border: 1px solid #425642; box-shadow: inset 0 0 0 3px #1c2b21; }
.icon-frame canvas { width: 36px; height: 36px; }
.card-copy { display: grid; gap: 4px; min-width: 0; }
.card-title { font-size: clamp(.98rem, 1.7vw, 1.22rem); line-height: 1.1; overflow-wrap: anywhere; }
.card-status { font-size: .875rem; color: var(--muted); }
.card[data-state="ready"] .card-status { color: var(--green); }
.card[data-state="won"] .card-status { color: #f0d384; }
footer { min-height: 55px; border-top: 1px solid #2b3a2d; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
footer canvas { width: 15px; height: 15px; }
dialog { width: min(650px, calc(100% - 24px)); max-width: none; max-height: min(90dvh, 810px); padding: 0; border: 1px solid #72916a; color: var(--ink); background: #162019; box-shadow: 0 12px 55px #000b; }
dialog::backdrop { background: #080d0aee; }
.modal-head { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; min-height: 57px; padding: 5px 13px 5px 20px; background: #17231b; border-bottom: 1px solid #40563e; }
.modal-label { color: var(--green); font: bold .85rem var(--heading); letter-spacing: .10em; }
.close { width: 44px; height: 44px; padding: 0; }
.game-panel { padding: clamp(14px, 4vw, 25px); }
.game-panel h2 { margin-bottom: 8px; }
.game-panel p { margin: 8px 0 14px; color: #dae9d7; }
.arena { position: relative; width: 100%; aspect-ratio: 2.12; display: grid; place-items: center; overflow: hidden; border: 1px solid #526a54; isolation: isolate; background: #243d35; }
.arena-art { position: absolute; z-index: -1; width: 100%; height: 100%; object-fit: cover; }
.play-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.game-status { min-height: 24px; font-size: 1rem; }
.sprite-button { min-width: 54px; min-height: 54px; display: grid; place-items: center; padding: 5px; border: 2px solid #a9c696; box-shadow: 0 4px #101f17; background: #243b2c; touch-action: manipulation; }
.sprite-button:hover { border-color: #f5e49e; }
.sprite-button canvas { display: block; width: 41px; height: 41px; pointer-events: none; }
.tiger-lane { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; width: 90%; }
.tiger-lane > span { display: grid; place-items: center; min-width: 0; aspect-ratio: 1.15; border: 1px solid #8da26d; background: #15231bbd; }
.tiger-lane canvas { width: min(85%, 64px); }
.swipe-arena { touch-action: pan-y; }
.reveal-track { min-height: calc(60dvh + 490px); padding: 15px 16px 0; }
.reveal-sticky { position: sticky; top: 69px; }
.photo { display: grid; place-items: center; height: clamp(155px, 44dvh, 420px); background: #0e1711; border: 1px solid #526a54; overflow: hidden; }
.photo canvas, .photo img { width: 100%; height: 100%; object-fit: contain; }
.photo > [hidden] { display: none; }
.reveal-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; min-height: 42px; margin: 7px 0; font-size: .875rem; color: var(--muted); }
.reveal-controls .outline { margin-left: auto; }
.reveal-bottom { padding: 0 16px 18px; }
.route { display: flex; align-items: center; gap: 8px; padding: 12px 0; color: #e8cb85; font-weight: 750; }
body:has(dialog[open]) { overflow: hidden; }
@media (max-width: 770px) {
  .shell { width: calc(100% - 34px); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero > canvas { object-position: 66% center; }
}
@media (max-width: 460px) {
  .shell { width: calc(100% - 24px); }
  .top-inner { min-height: 57px; }
  .brand { font-size: 1rem; }
  .hero { min-height: 300px; margin-top: 15px; }
  .hero-content { padding: 24px 18px; }
  .hero > canvas { object-position: 85% center; }
  .hero-shade { background: linear-gradient(90deg, #0b1815f5, #0b1815b0 38%, #0b18151a 90%); }
  .achievements { margin-top: 25px; }
  .section-top { gap: 9px; }
  .cards { gap: 8px; }
  .card { padding: 8px; gap: 7px; min-height: 91px; }
  .icon-frame { width: 34px; height: 34px; }
  .icon-frame canvas { width: 25px; height: 25px; }
  .progress-box { min-width: 86px; }
  dialog { width: calc(100% - 12px); max-height: 96dvh; }
  .sprite-button { min-width: 47px; min-height: 47px; }
  .sprite-button canvas { width: 33px; height: 33px; }
}

.sprite-button[aria-pressed="true"] { border-color: #ffe093; box-shadow: 0 0 0 3px #be9a56; }
.photo { position: relative; }
.photo canvas, .photo img { position: absolute; inset: 0; }

.game-board { position: relative; display: grid; width: min(94%, 490px); gap: 5px; }
.mine-arena, .water-arena, .recipe-arena, .note-arena { min-height: 196px; padding: 14px 0; aspect-ratio: auto; }
.mine-arena { background: #222725; }
.mine-arena .arena-art { filter: brightness(.42) saturate(.4); }
.mine-board { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 325px; }
.mine-tile { position: relative; width: 100%; min-width: 0; min-height: 0; aspect-ratio: 1.15; padding: 0; touch-action: none; user-select: none; }
.mine-tile:disabled:not(.harvested) { background: #222b28; border-color: #68786d; }
.mine-tile.harvested { background: #121b17; border-color: #425747; }
.block-progress { position: absolute; bottom: 0; left: 0; height: 5px; width: 0; background: #e8df8c; pointer-events: none; }
.inventory-label { display: inline-flex; gap: 4px; align-items: center; color: #d3e4cc; font-weight: 650; }
.inventory-label canvas { height: 18px; width: 18px; }
.inventory-label .empty { opacity: .28; }
.play-controls .primary:disabled { opacity: .55; box-shadow: none; }
.swim-board { grid-template-columns: repeat(6, minmax(0, 1fr)); max-width: 395px; }
.bridge-board { grid-template-columns: repeat(7, minmax(0, 1fr)); max-width: 435px; }
.board-cell { min-width: 0; padding: 1px; min-height: 41px; aspect-ratio: 1.15; border: 1px solid #6f9d99; display: grid; place-items: center; background: #183b43e8; touch-action: manipulation; }
.board-cell canvas { width: min(84%, 35px); height: auto; pointer-events: none; }
.board-cell[data-kind="stone"] { background: #303e41; }
.board-cell[data-kind="player"] { background: #994d59; border-color: #ffc0af; }
.board-cell[data-kind="bubble"] { background: #286383; }
.board-cell[data-kind="chest"] { background: #68432f; border-color: #e0b778; }
.board-cell[data-kind="grass"] { background: #33482d; }
.board-cell[data-kind="plank"] { background: #583d2b; border-color: #ba8c59; }
.board-cell.step { border-color: #a4eff0; box-shadow: inset 0 0 0 1px #89d3e3; }
.board-cell:not(:disabled):hover { border-color: #f0dda0; }
.note-board { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.note-pad { --tone: #f0c271; min-width: 0; min-height: 90px; gap: 2px; padding-inline: 2px; background: #262131; border-color: var(--tone); color: var(--tone); }
.note-pad span { font-size: clamp(.72rem, 2.3vw, .93rem); font-weight: 750; }
.note-pad.green { --tone: #c3ec87; }
.note-pad.violet { --tone: #d4a0f4; }
.note-pad.blue { --tone: #9ce0fa; }
.note-pad.lit { background: var(--tone); color: #191824; box-shadow: 0 0 16px var(--tone); }
.recipe-board { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 390px; gap: 12px; }
.recipe-section { display: grid; gap: 5px; color: #fff3d4; font-weight: 750; text-align: center; }
.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
.recipe-cell { background: #30261fef; border-color: #957755; min-height: 40px; }
.recipe-cell.wrong-cell { border-color: #ff9a94; box-shadow: inset 0 0 0 2px #c46b64; }
.ingredient-bar { display: flex; flex-wrap: wrap; gap: 5px; width: 100%; }
.ingredient { display: inline-flex; align-items: center; gap: 4px; min-height: 42px; padding: 4px 7px; background: #2e281f; border: 1px solid #977b57; font-size: .86rem; }
.ingredient[aria-pressed="true"] { border-color: #ffe6a3; color: #ffe6a3; box-shadow: inset 0 0 0 1px #ffe6a3; }
.ingredient canvas { width: 20px; height: 20px; }
.reveal-bottom .outline { margin-left: 8px; }
@media (max-width: 430px) {
  .game-board { gap: 4px; }
  .bridge-board { width: 98%; }
  .bridge-board .board-cell { min-height: 38px; }
  .recipe-board { gap: 8px; }
  .recipe-board .board-cell { min-height: 39px; }
}

.achievements {
  margin: 32px 0 20px;
  padding: clamp(12px, 2.5vw, 22px);
  border: 1px solid #576557;
  background: linear-gradient(160deg, #182520d4, #101917a3), var(--stone-texture, #25332c);
  background-size: auto, 240px 160px;
  image-rendering: pixelated;
  box-shadow: inset 0 0 0 3px #111914ab, 0 5px #0a110c;
}
.card {
  background: linear-gradient(#1b2a25ee, #15231ff9);
  border-color: #536758;
}
.card[data-state="ready"] {
  background: linear-gradient(#283c2bf0, #1d3125f4);
  border-color: #668b69;
}
.card[data-state="won"] {
  background: linear-gradient(#3e3625ef, #26281fef);
  border-color: #b89a5c;
}
.icon-frame {
  background: linear-gradient(#0e1716aa, #17241ee6), var(--stone-texture, #24342a);
  background-size: auto, 120px 80px;
  box-shadow: inset 0 0 0 2px #697c6a30, 2px 2px #0d1614;
}
[data-state="won"] .icon-frame { border-color: #a38a55; }

.photo-stage {
  position: relative;
  padding: 4px;
  border: 1px solid #657565;
  background: var(--stone-texture, #26342b);
  background-size: 240px 160px;
  image-rendering: pixelated;
}
.notice {
  position: absolute;
  z-index: 1;
  top: 11px;
  left: 11px;
  max-width: calc(100% - 22px);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 6px;
  border: 2px solid #a48b56;
  background: linear-gradient(110deg, #202822fa, #192824f3), var(--stone-texture, #23352c);
  box-shadow: inset 0 0 0 2px #64705e80, 3px 4px #0b130fbf;
  pointer-events: none;
  animation: notice-arrival .24s steps(6, end) both;
}
.notice-emblem {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid #708473;
  background: #0e1b17;
  box-shadow: inset 0 0 0 2px #283e2e;
}
.notice-emblem canvas { width: 32px; height: 32px; }
.notice-text {
  display: grid;
  gap: 2px;
  font: bold .96rem var(--heading);
  color: #fbf3dc;
  text-shadow: 1px 2px #101511;
}
.notice-text strong { color: #ffdb7d; font-size: .85rem; }
@keyframes notice-arrival {
  from { transform: translateX(-8px); opacity: 0; }
}
@media (max-width: 460px) {
  .achievements { margin-top: 25px; padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .notice { animation: none; }
}
.photo img { image-rendering: auto; }
