:root {
  color-scheme: light;
  --pine: #173b25;
  --dark: #112c22;
  --green: #207044;
  --cream: #f6f4e8;
  --panel: #fffdfa;
  --line: #dce3d2;
  --yellow: #f8cb61;
  --muted: #4d6557;
  font-family: "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--cream); color: var(--dark); }
button, a { -webkit-tap-highlight-color: transparent; }
button { min-height: 42px; border: 1px solid transparent; padding: .45rem .7rem; border-radius: .7rem; cursor: pointer; font: 750 .88rem/1.1 system-ui,sans-serif; color: var(--dark); }
button:disabled { opacity: .62; cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid #87521e; outline-offset: 3px; }
.primary { background: #246540; color: #fff; border-color: #1b5533; box-shadow: inset 0 1px #ffffff38; }
.subtle { background: #edf2e5; border-color: #dce6d6; }
.primary:hover:not(:disabled), .primary:focus-visible { background: #174d31; }
.subtle:hover:not(:disabled) { background: #e1ebd8; }
.site-bar { background: #163d2a; color: #fff; border-bottom: 1px solid #ffffff20; }
.site-bar-inner { width: min(70rem, 100%); margin: auto; padding: .6rem clamp(.75rem, 3vw, 1.5rem); display: flex; align-items: center; justify-content: space-between; gap: .3rem 1.15rem; flex-wrap: wrap; }
.site-logo { font-size: 1rem; font-weight: 850; text-decoration: none; white-space: nowrap; color: #fff; }
.site-logo strong { color: #aee276; }
.site-bar nav { display: flex; gap: .35rem .85rem; flex-wrap: wrap; }
.site-bar nav a { color: #f9fbf2; font-size: .79rem; text-decoration: none; font-weight: 700; padding-block: .35rem; }
.site-bar nav a[aria-current] { color: #d1f195; text-decoration: underline; text-underline-offset: .35em; }
.site-bar a:focus-visible { outline-color: #fff; }
main { width: min(66rem, 100%); margin: auto; padding: clamp(.65rem, 2.4vw, 1.5rem); }
.game-hero { min-height: 158px; position: relative; isolation: isolate; display: flex; align-items: center; overflow: hidden; border-radius: 1.35rem; background: radial-gradient(ellipse at 78% 55%, #417342, transparent 47%), linear-gradient(105deg, #163e2c 10%, #275639); color: #f5f5dd; box-shadow: 0 6px 16px #163d2a22; }
.hero-copy { position: relative; z-index: 2; padding: clamp(.85rem, 3vw, 1.85rem); }
.hero-copy h1 { margin: 0; font: 900 clamp(2.65rem, 8vw, 5.55rem)/.93 Georgia,serif; letter-spacing: -.07em; color: #f6d77d; text-shadow: 0 4px #102e23; }
.hero-copy h1 span { color: #e8f4d0; }
.hero-copy p { margin: .5rem 0 0; font-weight: 750; font-size: clamp(.83rem, 2.8vw, 1.05rem); }
.hero-produce { position: absolute; inset: 0 0 0 49%; pointer-events: none; }
.hero-produce img { width: clamp(76px, 22vw, 208px); height: auto; position: absolute; filter: drop-shadow(0 13px 15px #06181080); }
.hero-blueberry { left: 1%; top: 20%; transform: rotate(-16deg) scale(.68); }
.hero-carrot { left: 21%; top: -18%; transform: rotate(-30deg) scale(1.1); }
.hero-apple { left: 45%; top: 2%; transform: rotate(13deg) scale(1.05); }
.hero-lemon { left: 70%; top: 27%; transform: rotate(17deg) scale(.72); }
.game-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.6fr) minmax(0, .9fr); margin-top: .95rem; align-items: start; }
.play-panel, .side-panel { padding: clamp(.68rem, 2vw, 1.12rem); border: 1px solid var(--line); border-radius: 1.1rem; background: var(--panel); box-shadow: 0 4px 12px #28462c10; }
.game-sidebar { display: grid; gap: 1rem; min-width: 0; }
.round-header, .side-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
h2 { margin: 0; color: var(--dark); font: bold clamp(1.2rem, 4vw, 1.85rem)/1.1 Georgia,serif; }
.level-number { font-size: .76rem; font-weight: 800; color: var(--muted); margin: 0 0 .15rem; }
.toolbar, .round-controls, .rank-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.scoreboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: .38rem; margin: .65rem 0; }
.scoreboard div { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .17rem .55rem; padding: .28rem .2rem; border: 1px solid var(--line); border-radius: .58rem; font-variant-numeric: tabular-nums; background: #f0f4e9; }
.scoreboard dt { color: var(--muted); font-size: .74rem; font-weight: 750; }
.scoreboard dd { margin: 0; font-family: system-ui,sans-serif; font-size: clamp(1rem, 3.8vw, 1.32rem); font-weight: 850; line-height: 1.35; }
.objectives { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.objectives:not(:empty) { margin-bottom: .55rem; }
.objective { display: inline-flex; gap: .28rem; align-items: center; font-size: .78rem; font-weight: 750; min-height: 26px; border-radius: .4rem; background: #f0ead7; padding: .1rem .4rem; }
.objective img { width: 22px; height: 22px; object-fit: contain; }
.objective .soil-icon { width: 14px; height: 14px; background: #a16d41; border: 2px dashed #74472c; border-radius: 3px; }
.board-shell { position: relative; max-width: 500px; margin: auto; }
.board { --gap: clamp(2px, .65vw, 5px); display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(7, minmax(0, 1fr)); gap: var(--gap); aspect-ratio: 1; background: #16362b; padding: var(--gap); border: 2px solid #224d37; border-radius: .95rem; box-shadow: inset 0 2px 8px #061e16bf, 0 4px 0 #d5e0cb; overflow: hidden; touch-action: none; user-select: none; }
.tile { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; aspect-ratio: 1; padding: 0; border: 0; border-radius: 18%; background: linear-gradient(150deg,#34614c,#294c3d); box-shadow: inset 0 1px #ffffff19; overflow: visible; }
.tile:nth-child(even) { background: linear-gradient(150deg,#405e4b,#2b503d); }
.tile.soil { background: repeating-linear-gradient(133deg,#513728 0 3px,#76533b 3px 12px); box-shadow: inset 0 0 0 2px #aa835c; }
.tile:focus-visible { outline: 2px solid #fff; outline-offset: -2px; z-index: 2; }
.tile.selected { background: #608050; box-shadow: inset 0 0 0 3px #ffda67; z-index: 1; }
.tile.suggested { box-shadow: inset 0 0 0 3px #ffda67; animation: hint 800ms ease-in-out infinite alternate; }
@keyframes hint { to { box-shadow: inset 0 0 0 3px #fff7bb, inset 0 0 12px #fbd775; } }
.tile img { width: 96%; height: 96%; object-fit: contain; filter: drop-shadow(0 2px 2px #071b17a8); pointer-events: none; }
.tile img[hidden] { display: none; }
.tile[data-power]::after { content: attr(data-power); display: grid; place-items: center; position: absolute; inset: auto 1px 1px auto; width: 40%; aspect-ratio: 1; color: #142722; border-radius: 50%; background: #fdde83; font-size: clamp(.54rem, 2.5vw, .85rem); font-weight: 900; box-shadow: 0 0 5px #f9dc6b9c; pointer-events: none; }
.tile[data-power="✦"]::after { background: linear-gradient(140deg,#fbd27d,#fddbea,#a5efd5); }
#board-feedback { position: absolute; inset: 35% 0 auto; color: #ffeb9c; text-shadow: 0 2px 2px #061a13, 0 0 8px #163627; text-align: center; font: 900 clamp(1rem, 5vw, 1.7rem)/1 system-ui,sans-serif; pointer-events: none; }
#game-status { min-height: 1.25rem; margin: .7rem 0 .4rem; color: var(--muted); font: 700 .82rem/1.4 system-ui,sans-serif; }
.round-controls #next { margin-left: auto; }
.side-heading span { color: var(--muted); font: 700 .78rem/1.2 system-ui,sans-serif; }
.level-picker { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: .3rem; margin-top: .7rem; }
.level-picker button { padding: .23rem .1rem; min-height: 43px; display: grid; place-items: center; gap: .08rem; background: #eff4e9; border-color: var(--line); font-variant-numeric: tabular-nums; }
.level-picker button[aria-current] { background: #226440; color: #fff; border-color: #226440; }
.level-picker button:disabled { color: #495850; background: #f2f2ee; }
.level-picker .stars { display: block; color: #8b4f05; font-size: .66rem; white-space: nowrap; line-height: 1; }
.level-picker button[aria-current] .stars { color: #ffdc78; }
#rank-message { margin: .65rem 0; color: var(--muted); font-size: .89rem; line-height: 1.38; overflow-wrap: anywhere; }
#rank-signin { display: inline-block; color: #145236; margin-bottom: .5rem; }
#ranking { padding: 0; margin: .65rem 0 0; list-style: none; font: 650 .85rem/1.3 system-ui,sans-serif; }
#ranking:empty { display: none; }
#ranking li { display: grid; grid-template-columns: 1.6rem minmax(0,1fr) auto; gap: .25rem; padding: .45rem .2rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
#ranking li.yours { background: #eff6e8; }
#rank-submit { margin-top: .5rem; }
dialog { width: min(35rem, calc(100% - 1.5rem)); max-height: 86dvh; padding: 1.25rem; border: 1px solid var(--line); border-radius: 1.25rem; background: var(--panel); color: var(--dark); line-height: 1.5; }
dialog::backdrop { background: #071e16b5; }
@media (max-width: 720px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .game-hero { min-height: 106px; }
  .hero-produce { left: 55%; }
  .hero-blueberry { display: none; }
  .hero-carrot { left: 5%; top: -4%; }
  .hero-apple { left: 44%; top: 3%; }
  .hero-lemon { left: 77%; top: 35%; }
}
@media (max-width: 390px) {
  .round-header { align-items: flex-start; }
  .toolbar { justify-content: flex-end; }
  .toolbar button { font-size: .72rem; padding: .35rem .4rem; min-height: 40px; }
  .site-bar nav { gap: .2rem .65rem; }
}
@media (prefers-reduced-motion: reduce) { .tile.suggested { animation: none; } }
