/* Title screen: existing controls retain their game event handlers. */
#menu .adventure-choice #openMinigames { background:#675024; border-color:#e5c777; box-shadow:0 4px 0 #332512; }
#menu .adventure-choice #openMinigames:hover { background:#876932; }
.minigames-dialog { width:min(720px,calc(100% - 24px)); max-height:90vh; overflow:auto; padding:24px; border:3px solid #a1ac68; border-radius:18px; background:#f7f4e8; color:#183b2c; }
.minigames-dialog::backdrop { background:#0b211ce8; }
.mini-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.mini-header h2 { margin:0; font-size:28px; }
.mini-gallery { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:20px; }
.mini-gallery button { border:2px solid #82985c; border-radius:12px; padding:20px; background:#e6ebcf; color:#183b2c; }
.mini-gallery img { width:80px; height:90px; object-fit:contain; }
.mini-gallery b,.mini-gallery span { display:block; margin-top:10px; }
.mini-gallery span { font-size:13px; line-height:1.6; }
.memory-board { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin:18px 0; }
.memory-card,.reflex-cell { min-width:0; min-height:85px; border:2px solid #809858; border-radius:10px; background:#304c33; color:#fff0b4; font-size:32px; }
.memory-card img,.reflex-cell img { width:60px; height:65px; object-fit:contain; }
.memory-card.matched { background:#d5e6a7; opacity:1; cursor:default; }
.reflex-board { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:18px 0; }
.reflex-cell:disabled { cursor:default; }
#menu #openZombies:disabled { opacity:.65; cursor:not-allowed; }
#miniBack,#miniReplay { margin:12px 12px 0 0; }
@media(max-width:480px){.mini-gallery{grid-template-columns:1fr}.minigames-dialog{padding:16px}.mini-header h2{font-size:22px}.memory-board{gap:6px}.memory-card img{width:45px;height:55px}}
#menu .map-choice label:has(input[value="2"]) { flex-basis:100%; }
#difficultyControl { margin-top:24px; }
.adventure-choice { display:grid; gap:16px; }
#menu .adventure-choice button { display:flex; align-items:center; gap:16px; width:100%; margin:0; padding:18px; text-align:left; border:2px solid #bf9ac9; border-radius:12px; background:#634070; color:#fff0cf; box-shadow:0 4px 0 #302038; }
#menu .adventure-choice button:hover { background:#80518c; transform:translateY(-2px); }
#menu .adventure-choice #choosePlants { background:#3c5930; border-color:#a7c574; box-shadow:0 4px 0 #172a1d; }
#menu .adventure-choice #choosePlants:hover { background:#52783d; }
.adventure-choice img { width:64px; height:76px; object-fit:contain; flex-shrink:0; }
.adventure-choice b { display:block; font-size:clamp(17px,3vw,23px); }
.adventure-choice small { display:block; margin-top:7px; font-size:12px; font-weight:500; }
#defenseOptions { margin-top:26px; border-top:1px solid #77935b; padding-top:22px; }
#defenseOptions[hidden] { display:none; }
.adventure-parts { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:20px; }
#menu .adventure-parts button { flex:1; padding:12px 8px; font-size:13px; }
#menu .adventure-parts button[aria-pressed="true"] { background:#d8ed8b; color:#183b2c; border-color:#efffc4; }
#adventurePartTitle { color:#f0f4ce; margin:0 0 18px; font-size:28px; }
#menu .map-choice label[hidden],#start[hidden] { display:none; }
#menu #mapUnlockHint { margin:0 0 18px; color:#f5dfa0; }
body:has(#zombieHost:not(.hidden)) > .shell { display:none; }
#openZombies { width:100%; font:inherit; font-weight:850; }
#menu .map-choice label:has(input:disabled) { opacity:.55; cursor:not-allowed; }
.zombie-adventure-link { display:block; margin-top:20px; padding:15px; background:#634070; color:#fff0cf; border:2px solid #bf9ac9; border-radius:10px; font-weight:850; text-decoration:none; box-shadow:0 4px 0 #302038; }
.zombie-adventure-link:hover { background:#80518c; }
.zombie-adventure-link:focus-visible { outline:3px solid #ffcf62; outline-offset:4px; }
.almanac-dialog { width:min(940px,calc(100% - 24px)); max-height:90vh; padding:24px; border:3px solid #a1ac68; border-radius:18px; background:#f7f4e8; color:#183b2c; box-shadow:0 15px 70px #0008; }
.almanac-dialog::backdrop { background:#0b211cdd; }
.almanac-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.almanac-heading p { margin:0 0 4px; font-size:12px; text-transform:uppercase; letter-spacing:2px; }
.almanac-heading h2 { margin:0; font:700 38px Georgia,serif; }
.almanac-tabs { display:flex; gap:10px; margin:24px 0 18px; }
.almanac-tabs button { flex:1; padding:14px; border:2px solid #77935b; border-radius:10px; background:#e6eacf; color:#294535; font-weight:800; }
.almanac-tabs button[aria-selected="true"] { color:#f5e9b1; background:#294535; box-shadow:0 3px 0 #10271e; }
.almanac-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr)); gap:16px; }
.almanac-card { padding:16px; border:1px solid #c5cda8; border-radius:12px; background:#fffdf4; }
.almanac-portrait { height:130px; display:grid; place-items:center; background:radial-gradient(ellipse,#dbe6a8,#edf0de); border-radius:8px; }
.almanac-portrait img { width:110px; height:110px; object-fit:contain; }
.almanac-card h3 { font-size:18px; margin:16px 0 10px; }
.almanac-stats { display:flex; flex-wrap:wrap; gap:6px; }
.almanac-stats span { padding:5px 8px; border-radius:6px; background:#e9edcf; font-size:12px; font-weight:750; }
.almanac-card p { font-size:13px; line-height:1.65; margin:12px 0 0; }
.almanac-location { border-top:1px solid #dcdcca; padding-top:10px; color:#50633f; }
.level-picker { border:0; padding:0; margin:22px 0; min-width:0; }
.level-picker legend { font-weight:750; margin-bottom:12px; }
#levelButtons { display:flex; flex-wrap:wrap; gap:10px; }
#levelButtons button { min-width:48px; min-height:48px; }
#levelButtons button[aria-pressed="true"] { background:#294535; color:#f5e9b1; border-color:#77935b; box-shadow:0 3px 0 #091b15; }
#levelButtons button:disabled { opacity:.45; cursor:not-allowed; }
body:has(#menu:not(.hidden)) {
 background:#122b25;
}
body:has(#menu:not(.hidden)) .shell { max-width:none; padding:0; }
body:has(#menu:not(.hidden)) .masthead {
 position:relative; z-index:2; justify-content:center; gap:10px;
 margin:0; padding:16px; border:0; background:#10271ee6;
}
body:has(#menu:not(.hidden)) .masthead .brand,
body:has(#menu:not(.hidden)) .masthead .tag,
body:has(#menu:not(.hidden)) .footer { display:none; }
body:has(#menu:not(.hidden)) .masthead button {
 color:#f5e9b1; background:#294535; border:2px solid #77935b;
 border-radius:8px; box-shadow:0 3px 0 #091b15; font-weight:800;
}
body:has(#menu:not(.hidden)) .masthead button:hover { background:#3b5c3d; }
#menu {
 position:relative; isolation:isolate; overflow:hidden;
 min-height:calc(100svh - 80px); display:grid; place-items:center;
 padding:36px 20px 60px;
 background:radial-gradient(ellipse at 50% 25%,#799e66 0%,#345d46 48%,#122e2a 85%);
}
.title-scenery { position:absolute; inset:0; z-index:-1; pointer-events:none; }
.title-scenery::before {
 content:''; position:absolute; inset:55% -15% -35%; border-radius:50% 50% 0 0;
 background:repeating-linear-gradient(100deg,#263b22 0 65px,#344b2b 68px 120px);
 transform:rotate(-5deg); border-top:12px solid #6b8340;
 box-shadow:0 -20px 70px #c4d97520;
}
.title-scenery::after {
 content:''; position:absolute; inset:0;
 background:radial-gradient(ellipse at center,transparent 35%,#061b2370 100%);
}
.menu-moon {
 position:absolute; width:160px; aspect-ratio:1; top:8%; right:12%;
 border-radius:50%; background:#f5e8ab; box-shadow:0 0 85px #f5e8ab55;
}
.title-scenery img {
 position:absolute; bottom:8%; width:clamp(150px,25vw,370px); height:48%;
 object-fit:contain; filter:drop-shadow(0 18px 8px #07180b80);
 animation:menu-idle 5s ease-in-out infinite;
}
.menu-plant { left:1%; transform:rotate(-8deg); }
.menu-zombie { right:1%; transform:rotate(8deg); animation-delay:-2s!important; }
.title-menu { width:min(510px,100%); text-align:center; }
.menu-kicker {
 color:#f2df95; text-transform:uppercase; font-size:12px;
 font-weight:900; letter-spacing:3px; margin:0 0 16px;
 text-shadow:0 2px 3px #142a1e;
}
#menu h1 {
 margin:0 0 30px; font-family:Georgia,serif; font-weight:900;
 font-size:clamp(48px,6.5vw,82px); line-height:.98; letter-spacing:-3px;
 color:#fff0be; text-shadow:0 4px 0 #533e22,0 7px 0 #142d21,0 12px 22px #10291e;
 transform:rotate(-3deg);
}
#menu h1 span { display:block; color:#c3e774; font-size:1.15em; }
.menu-panel {
 padding:24px; background:linear-gradient(160deg,#304a30f5,#172f24fa);
 border:3px solid #a1ac68; border-radius:18px;
 box-shadow:0 7px 0 #0e2119, inset 0 0 0 4px #172c21,0 22px 50px #06180a70;
}
#menu .map-choice { min-width:0; margin:0 0 20px; gap:16px; display:flex; flex-direction:column; }
#menu .map-choice legend {
 color:#e5e8bf; width:100%; text-transform:uppercase; letter-spacing:2px;
 font-size:12px; margin-bottom:16px;
}
#menu .map-choice label { flex:none; width:100%; min-width:0; padding:0; background:none; position:relative; }
#menu .map-choice input { position:absolute; left:14px; top:50%; transform:translateY(-50%); margin:0; accent-color:#c8e675; width:18px; height:18px; }
.map-option {
 display:flex; align-items:center; justify-content:flex-start; gap:16px; min-height:110px;
 padding:16px 16px 16px 46px; border:2px solid #68805c; border-radius:14px;
 background:#142b23; color:#d8dfc0; transition:background .15s,border-color .15s;
}
.map-option img { width:64px; height:72px; object-fit:contain; flex-shrink:0; }
.map-option b { display:block; font-size:17px; }
.map-option small { display:block; font-size:13px; margin-top:7px; line-height:1.4; }
#menu input:checked + .map-option { background:#4b6233; border-color:#e4ed99; color:#fff8cc; box-shadow:inset 0 0 12px #a5cc3520; }
#menu input:focus-visible + .map-option { outline:3px solid #ffcf62; outline-offset:4px; }
#menu label:hover .map-option { border-color:#e4ed99; }
#menu #start {
 width:100%; min-height:68px; padding:15px 10px; border:3px solid #edf5a4;
 border-radius:10px; background:linear-gradient(#b3d764,#759b37); color:#21331b;
 font-size:clamp(18px,3vw,24px); font-weight:900;
 text-shadow:0 1px #d4ec9e; box-shadow:0 6px 0 #3d5827,0 9px 0 #10241b;
}
#menu #start:disabled { filter:grayscale(.65); opacity:.75; }
#menu #start:not(:disabled):hover { background:linear-gradient(#cfeb85,#92b947); }
#menu #start:not(:disabled):active { transform:translateY(4px); box-shadow:0 2px 0 #3d5827; }
#menu .small { color:#c1ceb0; font-size:11px; margin:16px 0 0; line-height:1.5; }
#menu .load-error { color:#ffceae; overflow-wrap:anywhere; }
@keyframes menu-idle { 50% { translate:0 -10px; } }
@media(max-width:760px) {
 #menu { padding:30px 16px 45px; }
 .title-scenery img { opacity:.3; width:45%; bottom:1%; height:40%; }
 .menu-moon { width:110px; top:3%; right:-25px; }
 .title-menu { width:min(460px,100%); }
 .menu-panel { padding:20px 16px; }
 body:has(#menu:not(.hidden)) .masthead { gap:8px; padding:12px 8px; }
 body:has(#menu:not(.hidden)) .masthead button { padding:9px; font-size:11px; }
}
@media(max-width:360px) {
 .map-option { gap:10px; padding-right:10px; }
 .map-option img { width:48px; height:58px; }
 #menu h1 { font-size:44px; }
}
@media(prefers-reduced-motion:reduce) {
 .title-scenery img { animation:none; }
 #menu button,.map-option { transition:none; }
}
.sequence-board,.puzzle-board { display:grid; gap:10px; width:min(100%,390px); margin:18px auto; }
.sequence-board { grid-template-columns:repeat(2,minmax(0,1fr)); }
.puzzle-board { grid-template-columns:repeat(3,minmax(0,1fr)); }
.sequence-pad,.puzzle-tile { position:relative; min-width:0; aspect-ratio:1; padding:8px; border:3px solid #789a62; border-radius:12px; background:#203c2c; color:#fff5cc; }
.sequence-pad img,.puzzle-tile img { width:75%; height:75%; object-fit:contain; }
.sequence-pad b,.puzzle-tile b { position:absolute; bottom:5px; right:10px; font-size:24px; }
.sequence-pad:disabled,.puzzle-tile:disabled { opacity:1; }
.sequence-pad.lit,.spot-board .lit { background:#c4e575; border-color:#fff3a1; box-shadow:0 0 0 4px #eac75f; }
.puzzle-tile:disabled { cursor:default; border-color:#465c3b; }
.puzzle-tile.empty { background:#13271d; border:2px dashed #789a62; }
.sequence-pad:focus-visible,.puzzle-tile:focus-visible { outline:3px solid #ffcf62; outline-offset:3px; }
