/* GameJoyDen · Joy Den pixel theme */
:root {
  color-scheme: dark;
  --k: #2b1d2a;
  --night: #3d2c4a;
  --night-2: #4a3758;
  --wood: #7a4a2c;
  --wood-dark: #5e3820;
  --acorn: #c8823c;
  --wheat: #f4c45a;
  --cream: #fdf0d5;
  --moss: #5a9a4a;
  --leaf: #9bd16a;
  --lake: #4aa3c8;
  --sky: #a8dcf0;
  --lantern: #ff9a3c;
  --rose: #e8506a;
  --gloom: #6b4a8c;
  --stone: #8a8a9a;
  --text: var(--cream);
  --subtle: #d9c9b8;
  font: 100% / 1.5 "Trebuchet MS", "Avenir Next", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--k); color: var(--text); }
[hidden] { display: none !important; }
a { color: var(--wheat); text-underline-offset: .22em; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--wheat); outline-offset: 3px; }
h1, h2, p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
canvas[data-sprite], .field { image-rendering: pixelated; image-rendering: crisp-edges; }

.topbar, main, footer { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.topbar, footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.topbar { min-height: 64px; border-bottom: 3px solid var(--night); }
.topbar a, footer a { text-decoration: none; font-weight: 700; }
.topbar a:hover, footer a:hover { text-decoration: underline; }
.wordmark { display: inline-flex; align-items: center; gap: .5rem; color: var(--cream); font-weight: 800; letter-spacing: .02em; }
.mark { color: var(--wheat); }
footer { padding-block: 1.1rem; border-top: 3px solid var(--night); color: var(--subtle); }

/* Pixel buttons: hard edges, stepped shadow. */
.px-btn, .primary {
  display: inline-block;
  padding: .6rem 1rem;
  color: var(--cream);
  background: var(--night-2);
  border: 3px solid var(--k);
  border-radius: 0;
  box-shadow: inset -3px -3px 0 #0005, inset 3px 3px 0 #fff2, 0 3px 0 var(--k);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: .02em;
}
.px-btn:hover:not(:disabled), .primary:hover:not(:disabled) { filter: brightness(1.12); }
.px-btn:active:not(:disabled), .primary:active:not(:disabled) { transform: translateY(2px); box-shadow: inset -3px -3px 0 #0005, inset 3px 3px 0 #fff2; }
.px-btn:disabled { opacity: .45; }
.primary { background: var(--lantern); color: var(--k); }
.big { font-size: 1.2rem; padding: .85rem 1.4rem; }
.small { padding: .35rem .7rem; font-size: .85rem; }

/* Landing hero */
.hero { display: grid; grid-template-columns: 1fr 1.2fr; align-items: center; gap: clamp(1.5rem, 5vw, 4rem); padding: clamp(2.5rem, 7vw, 5.5rem) 0; }
h1 { font: 900 clamp(4rem, 11vw, 8.5rem)/.85 Impact, "Arial Narrow", sans-serif; text-transform: uppercase; letter-spacing: .01em; color: var(--cream); text-shadow: 5px 5px 0 var(--night); }
h1 em { color: var(--wheat); font-style: normal; }
.intro p { max-width: 30rem; margin-block: 1.4rem; color: var(--subtle); font-size: 1.1rem; }
.field { display: block; width: 100%; aspect-ratio: 16 / 9; border: 4px solid var(--k); box-shadow: 0 0 0 3px var(--wood), 0 0 0 6px var(--k); background: #6aaa52; }
.field-preview { box-shadow: 0 0 0 3px var(--wood), 0 0 0 6px var(--k), 0 1.4rem 3rem #000a; }
body.playing .hero { display: none; }

/* Game cabinet */
.cabinet { margin-top: 1rem; padding: .8rem; background: var(--night); border: 4px solid var(--k); box-shadow: inset 0 0 0 3px var(--night-2); }
.title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .3rem 1rem; margin-bottom: .6rem; }
.title-row h2 { font-size: clamp(1.3rem, 3.5vw, 1.8rem); color: var(--wheat); text-shadow: 3px 3px 0 var(--k); }
.announcement { color: var(--subtle); font-size: .95rem; }

.resbar { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; padding: .45rem .8rem; margin-bottom: .7rem; background: var(--k); border: 3px solid var(--wood-dark); font: 800 1rem/1.2 "Courier New", ui-monospace, monospace; }
.res { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.res .ico, .ico-lantern { width: 24px; height: 24px; }
.ico-lantern { display: inline-block; background: var(--lantern); border: 3px solid var(--k); box-shadow: inset 0 0 0 3px var(--wheat); }
.res-wave { margin-left: auto; color: var(--wheat); }
.res-boss { color: #ffb3c0; }
#base-meter { -webkit-appearance: none; appearance: none; width: 4rem; height: .7rem; background: var(--night); border: 2px solid var(--k); }
#base-meter::-webkit-meter-bar { background: var(--night); border: 0; border-radius: 0; height: 100%; }
#base-meter::-webkit-meter-optimum-value { background: var(--wheat); }
#base-meter::-moz-meter-bar { background: var(--wheat); }
#base-meter::-webkit-meter-suboptimum-value, #base-meter::-webkit-meter-even-less-good-value { background: var(--rose); }

.screen { display: grid; grid-template-columns: minmax(230px, 27%) minmax(0, 1fr) auto; gap: .8rem; align-items: start; }

/* The Acorn Machine (left column, like the benchmark's slot cabinet) */
.machine { display: grid; gap: .55rem; padding: .6rem; background: var(--wood); border: 4px solid var(--k); box-shadow: inset -4px -4px 0 var(--wood-dark), inset 4px 4px 0 #9a6238; }
.machine-top { display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .3rem; background: var(--k); color: var(--wheat); font: 800 .95rem/1 "Courier New", ui-monospace, monospace; border: 3px solid var(--wood-dark); }
.machine-top .ico { width: 20px; height: 20px; }
.machine-body { display: grid; grid-template-columns: minmax(0, 1fr) 30px; gap: .4rem; align-items: stretch; }
.slot { position: relative; padding: .4rem; background: var(--k); border: 3px solid var(--wood-dark); }
.reels { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.cell { aspect-ratio: 1; display: grid; place-items: center; background: var(--cream); border: 3px solid var(--k); box-shadow: inset -3px -3px 0 #d8c8a8; }
.cell-ico { width: 78%; height: 78%; }
.cell[data-symbol="star"] { background: #fff4c2; }
.reels.spinning .cell:not(.landed) .cell-ico { transform: translateY(8%); opacity: .75; }
.cell.landed { animation: land .16s steps(2); }
.cell.hit { background: #fff8e0; box-shadow: inset 0 0 0 3px var(--wheat), inset -3px -3px 0 #d8c8a8; }
@keyframes land { 0% { transform: translateY(-8%); } 100% { transform: none; } }
.paylines { position: absolute; inset: .4rem; width: calc(100% - .8rem); height: calc(100% - .8rem); pointer-events: none; }
.paylines line { stroke-width: 9; stroke-linecap: square; opacity: .85; }

.lever { position: relative; display: grid; justify-items: center; align-content: start; padding: 0; background: none; border: 0; color: var(--cream); }
.lever-knob { width: 26px; height: 26px; background: var(--rose); border: 3px solid var(--k); box-shadow: inset -4px -4px 0 #b83a52, inset 3px 3px 0 #ff8ea2; transition: transform .12s steps(2); }
.lever-arm { width: 8px; height: 120px; background: var(--stone); border: 3px solid var(--k); border-top: 0; box-shadow: inset -2px 0 0 #6a6a7a; transition: height .12s steps(2); }
.lever.pulled .lever-knob { transform: translateY(70px); }
.lever.pulled .lever-arm { height: 50px; }
.lever-label { position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); font-size: 0; }
.lever:disabled .lever-knob { background: #9a7a82; box-shadow: none; }
.lever:not(:disabled):hover .lever-knob { filter: brightness(1.15); }
#spin { min-height: 160px; }
.machine > #buy { width: 100%; font-size: .9rem; }
.spin-result { min-height: 2.6rem; padding: .35rem .45rem; background: var(--k); border: 3px solid var(--wood-dark); color: var(--cream); font: 700 .82rem/1.35 "Courier New", ui-monospace, monospace; }
.inventory { padding: .4rem .45rem; background: var(--wood-dark); border: 3px solid var(--k); }
.label { color: var(--wheat); font: 800 .75rem/1 "Courier New", ui-monospace, monospace; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .35rem; }
.charm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.charm-list li { padding: .15rem .45rem; background: var(--gloom); border: 2px solid var(--k); font-size: .8rem; }
.charm-list li.empty { background: none; border-color: transparent; color: var(--subtle); padding-left: 0; }

/* Stage (center): wave track, field, roster row */
.stage { display: grid; gap: .55rem; min-width: 0; }
.wave-track { display: flex; justify-content: center; gap: .3rem; margin: 0; padding: .3rem; list-style: none; background: var(--k); border: 3px solid var(--wood-dark); }
.wave { display: grid; place-items: center; width: 32px; height: 32px; background: var(--night); border: 3px solid var(--k); color: var(--subtle); font: 800 .9rem/1 "Courier New", ui-monospace, monospace; }
.wave.done { background: var(--moss); color: var(--k); }
.wave.now { background: var(--wheat); color: var(--k); transform: scale(1.18); }
.wave.boss { background: #5a2a3a; }
.wave.boss.now { background: var(--rose); }
.wave-ico { width: 22px; height: 22px; }
.roster { list-style: none; margin: 0; padding: .4rem; min-height: 64px; display: flex; flex-wrap: wrap; gap: .35rem; background: var(--k); border: 3px solid var(--wood-dark); }
.unit { position: relative; display: grid; justify-items: center; width: 58px; padding: .15rem .1rem .1rem; background: var(--night-2); border: 3px solid var(--k); box-shadow: inset -3px -3px 0 #0004; font: 800 .75rem/1.1 "Courier New", ui-monospace, monospace; }
.unit-badger { background: #6a3a3a; }
.unit-owl { background: #3a4a6a; }
.unit-tortoise { background: #3a5a3a; }
.unit-ico { width: 32px; height: 32px; }
.unit-stars { color: var(--wheat); font-size: .65rem; letter-spacing: -.05em; }

/* Tools (right column) */
.tools { display: grid; gap: .5rem; align-content: start; }
.tools > * { display: grid; place-items: center; text-align: center; }
.fight { min-width: 92px; min-height: 92px; font-size: 1.1rem; background: var(--rose); color: var(--cream); }
.fight.ready { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { background: #ff7088; } }

.chips { margin-top: .8rem; padding: .7rem; background: #2a1d3a; border: 4px solid var(--k); box-shadow: inset 0 0 0 3px var(--gloom); }
.chips-title { font-weight: 800; color: var(--wheat); margin-bottom: .55rem; }
.chip-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.chip { display: grid; gap: .25rem; text-align: left; background: var(--gloom); }
.chip span { color: #eadcf5; font-weight: 600; font-size: .86rem; }
.ending { display: grid; gap: .8rem; justify-items: start; margin-top: .8rem; }
.feedback p { margin-bottom: .4rem; }
.rating { display: flex; flex-wrap: wrap; gap: .45rem; }
.rating button[aria-pressed="true"] { background: var(--moss); }

.instructions { padding-block: 2.2rem; max-width: 52rem; }
.instructions h1, .instructions h2 { font-size: clamp(1.4rem, 4vw, 2rem); color: var(--wheat); margin: .3rem 0 .8rem; text-shadow: none; }
.instructions h1 { font-family: inherit; text-transform: none; }
.instructions ol { padding-left: 1.4rem; color: var(--subtle); }
.instructions li { margin-bottom: .6rem; }
.instructions strong { color: var(--cream); }
.instructions p { color: var(--subtle); margin-bottom: .8rem; }

/* Portal */
.portal-intro { padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(1.5rem, 4vw, 3rem); }
.portal-intro h1 { font-size: clamp(2.6rem, 10vw, 6.5rem); }
.portal-intro p, .portal-game p { margin-top: 1rem; color: var(--subtle); font-size: 1.08rem; }
.portal-game { display: grid; grid-template-columns: minmax(0, 1fr) 1.4fr; gap: clamp(1.2rem, 5vw, 3.5rem); align-items: center; padding: clamp(1rem, 4vw, 2rem); margin-bottom: 3rem; background: var(--night); border: 4px solid var(--k); box-shadow: inset 0 0 0 3px var(--night-2); }
.portal-game h2 { font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1; color: var(--wheat); }
.portal-game a { margin-top: 1.1rem; }
.portal-signal { display: grid; min-height: 10rem; place-items: center; background: #6aaa52; border: 4px solid var(--k); box-shadow: 0 0 0 3px var(--wood), 0 0 0 6px var(--k); }
.portal-signal canvas { width: 128px; height: 128px; }
.portal-signal span { font-size: 5rem; line-height: 1; color: var(--wheat); }
.portal-game .portal-shot { display: block; margin: 0; border: 4px solid var(--k); box-shadow: 0 0 0 3px var(--wood), 0 0 0 6px var(--k); }
.portal-shot img { display: block; width: 100%; height: auto; }


/* Guide (SEO landing) pages */
.topnav { display: flex; gap: 1.1rem; flex-wrap: wrap; justify-content: flex-end; }
.guide-title { font-size: clamp(2.4rem, 6.5vw, 4.6rem); line-height: .95; }
.guide-title em { display: block; margin-top: .35rem; }
.guide { max-width: 52rem; padding-block: 1rem 2rem; }
.guide section { margin-top: 2.6rem; }
.guide h2 { font-size: clamp(1.4rem, 4vw, 2rem); color: var(--wheat); margin-bottom: .8rem; }
.guide p, .guide li { color: var(--subtle); }
.guide p { margin-bottom: .9rem; }
.guide ul { padding-left: 1.3rem; }
.guide li { margin-bottom: .5rem; }
.guide strong { color: var(--cream); }
.note { font-size: .9rem; }
.game-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.game-card { padding: .9rem 1rem; background: var(--night); border: 4px solid var(--k); box-shadow: inset 0 0 0 3px var(--night-2); }
.game-card.featured { box-shadow: inset 0 0 0 3px var(--lantern); }
.game-card h3 { margin: 0 0 .4rem; color: var(--cream); font-size: 1.2rem; }
.game-card p { margin-bottom: .6rem; }
.facts { display: flex; flex-wrap: wrap; gap: .35rem; }
.facts span { padding: .1rem .5rem; background: var(--k); border: 2px solid var(--wood-dark); color: var(--wheat); font: 700 .78rem/1.4 "Courier New", ui-monospace, monospace; }
.faq details { margin-bottom: .55rem; background: var(--night); border: 3px solid var(--k); }
.faq summary { padding: .7rem .9rem; color: var(--cream); font-weight: 800; cursor: pointer; }
.faq details[open] summary { color: var(--wheat); }
.faq details p { padding: 0 .9rem .3rem; }
.more-link { margin-top: .9rem; }
footer span a { color: var(--wheat); }
footer { flex-wrap: wrap; }
.footnav { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.stat-table { width: 100%; border-collapse: collapse; margin: .4rem 0 1.1rem; font-size: .95rem; }
.stat-table th, .stat-table td { padding: .45rem .6rem; border: 2px solid var(--night); text-align: left; color: var(--subtle); }
.stat-table th { background: var(--night); color: var(--wheat); }
.stat-table td:first-child { color: var(--cream); font-weight: 700; }
.table-wrap { overflow-x: auto; }
.page-text { max-width: 52rem; padding-block: 2.2rem; }
.page-text h1 { font-size: clamp(2rem, 5vw, 3rem); color: var(--wheat); margin: .3rem 0 1rem; }
.page-text h2 { font-size: clamp(1.3rem, 3.5vw, 1.7rem); color: var(--wheat); margin: 1.8rem 0 .7rem; }
.page-text p, .page-text li { color: var(--subtle); }
.page-text p { margin-bottom: .9rem; }
.page-text ul, .page-text ol { padding-left: 1.3rem; }
.page-text li { margin-bottom: .5rem; }
.page-text strong { color: var(--cream); }
.page-text a:not(.px-btn), .guide a:not(.px-btn) { color: var(--wheat); }

@media (max-width: 900px) {
  .screen { grid-template-columns: 1fr; }
  .stage { order: -1; }
  .machine { max-width: 460px; width: 100%; justify-self: center; }
  .tools { grid-auto-flow: column; justify-content: center; }
  .fight { min-height: 56px; }
}
@media (max-width: 670px) {
  .stat-table { font-size: .85rem; }
  .stat-table th, .stat-table td { padding: .35rem .4rem; }
  .topnav { gap: .7rem; font-size: .9rem; }
  .hero, .portal-game { grid-template-columns: 1fr; }
  .chip-options { grid-template-columns: 1fr; }
  .res-wave { margin-left: 0; }
  .resbar { font-size: .9rem; }
  .wave { width: 28px; height: 28px; }
  .unit { width: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .cell.landed, .fight.ready { animation: none; }
  .lever-knob, .lever-arm { transition: none; }
}
