.home { --purple: #7257dc; }
.home .page { width: min(1120px, calc(100% - 32px)); }
.home main { padding: 0; overflow: hidden; }
.home section { padding: clamp(22px, 4vw, 44px); }
.home .intro { padding-bottom: 14px; text-align: center; }
.eyebrow { color: #65509c; font-weight: 750; letter-spacing: .06em; font-size: .85rem; }
.intro p { margin: 14px auto; }
.home h1 { font-size: clamp(2rem, 5vw, 3.6rem); max-width: 20ch; margin: auto; }
.home h2 { margin: 0 0 12px; font-size: clamp(1.35rem, 3vw, 1.9rem); }
.game-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.game-heading h2 { margin: 0; }
.game-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; margin: 20px 0; }
.board { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); aspect-ratio: 1; border: 3px solid #b8a6ed; border-radius: 12px; overflow: hidden; isolation: isolate; background: #fff; }
/* One continuous image avoids independent tile rounding at fractional sizes.
   Unfilled cells fade it with a 80% white overlay; placed cells reveal it. */
.board::before { content: ''; position: absolute; inset: 0; background: url('../img/monkey.webp') center / 100% 100%; z-index: -1; }
.slot { min-width: 0; padding: 0; border: 0; border-radius: 0; box-shadow: inset 0 0 0 1px #ffffffa8; background: rgb(255 255 255 / 80%); cursor: pointer; }
.piece { background-image: url('../img/monkey.webp'); background-size: 400% 400%; background-origin: border-box; background-repeat: no-repeat; }
.slot.filled { background: transparent; box-shadow: none; opacity: 1; }
.tray { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 10px; border-radius: 14px; background: #f2ecff; min-height: 100%; align-content: start; }
.piece { aspect-ratio: 1; width: 100%; border: 2px solid white; border-radius: 7px; padding: 0; box-shadow: 0 3px 7px #44316b25; cursor: grab; touch-action: none; }
.piece[aria-pressed=true] { outline: 3px solid #5935c9; outline-offset: 2px; }
.piece.dragging { opacity: .3; }
.drag-ghost { position: fixed; pointer-events: none; z-index: 100; margin: 0; box-shadow: 0 8px 20px #332b4560; }
.home button, .button { font: inherit; }
.replay, .button { display: inline-block; padding: 11px 20px; border: 0; border-radius: 12px; background: var(--purple); color: white; font-weight: 700; text-decoration: none; cursor: pointer; }
.replay { background: #eee9ff; color: #503399; }
.home :focus-visible { outline: 3px solid #3c2488; outline-offset: 3px; }
.progress-row { display: flex; align-items: center; gap: 12px; }
progress { width: 140px; max-width: 40vw; accent-color: var(--purple); }
.game-status { min-height: 3.3em; color: #65557d; margin-bottom: 0; }
.completion { background: #eaf5df; border-radius: 14px; padding: 20px; margin-top: 15px; }
.complete { animation: celebrate .6s ease; }
@keyframes celebrate { 50% { box-shadow: 0 0 0 8px #d7c8ff; } }
.fallback img { display: block; width: min(100%, 440px); height: auto; border-radius: 18px; margin: 16px auto; }
.features { background: #f8f4ff; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature-grid h3 { margin: 0 0 8px; }
.feature-grid p { margin: 0; }
.downloads { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.home .faq details { border-bottom: 1px solid var(--border); padding: 16px 0; }
.home .faq summary { cursor: pointer; font-weight: 700; }
.home footer { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; text-align: start; font-size: .85rem; }
.home footer p { margin: 0; flex-shrink: 0; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 18px; margin: 0; }
.legal-links a { white-space: nowrap; }
@media (max-width: 900px) { .home footer { flex-direction: column; gap: 12px; } .legal-links { justify-content: flex-start; } }
[hidden] { display: none !important; }
@media(max-width: 700px) { .game-layout, .feature-grid { grid-template-columns: 1fr; } .home .page { width: min(100% - 20px, 1120px); } .game-layout { gap: 16px; } .tray { gap: 12px; } }
@media(prefers-reduced-motion: reduce) { .complete { animation: none; } }

/* Decorative borders must not shrink the image coordinate system. */
.downloads .button { display: inline-flex; align-items: center; gap: 10px; }
.downloads .button img { width: 24px; height: 24px; flex: 0 0 24px; }
