:root {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #222c29;
  background: #edece6;
  --accent: #235f53;
  --edge: #bec7bc;
}
* { box-sizing: border-box }
body { margin: 0; min-height: 100dvh; display: grid; align-items: center; padding: clamp(8px, 2vw, 22px) }
main { width: min(100%, 580px); margin: auto; display: grid; gap: clamp(6px, 1.4vh, 14px) }
header, nav, footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap }
h1 { font: 600 clamp(24px,5vw,40px)/1 Georgia, serif; margin: 0; letter-spacing: -.045em }
p { margin: 0; font-size: .86rem; line-height: 1.3 }
#status { color: var(--accent); font-weight: 700; min-height: 1.25em }
button, select { font: inherit; color: inherit }
button, select { cursor: pointer; touch-action: manipulation; border: 1px solid var(--edge); border-radius: 9px; background: #fafaf4; min-height: 36px; padding: 5px 12px }
button:focus-visible, select:focus-visible { outline: 3px solid #b5481d; outline-offset: -3px }
button[aria-pressed=true] { background: var(--accent); color: white }
#board { display: grid; width: min(100%, 440px, max(196px, calc(100dvh - 178px))); margin: auto; border-radius: 14px; background: #22443d; gap: 3px; padding: 7px; box-shadow: 0 4px 0 #142e28 }
#board > * { display: grid; place-items: center; min-width: 0; min-height: 0; padding: 0; aspect-ratio: 1; border: 0; border-radius: 4px; background: #f7f1dc; font-weight: 800 }
#board .x { color: #ae462d } #board .o { color: #215e50 }
#board .line { background: #d1eea6 }
body[data-game=tic-tac-toe] #board { grid-template-columns: repeat(3,1fr) }
body[data-game=tic-tac-toe] #board button { font: bold clamp(30px, min(12vw,12vh), 86px)/1 Georgia,serif }
body[data-game=minesweeper] #board { width: min(100%, 480px, max(216px, calc((100dvh - 185px)*var(--ratio,1)))); gap: 2px }
#board .covered { background: #a5c7b7; box-shadow: inset 0 -2px #80a893 }
#board .flag { background: #ebc56e; color: #5c350e }
#board .mine { color: #fff; background: #ad412c }
#board .number { color: #155a71 }
#board .wall { background: repeating-linear-gradient(135deg,#37594c 0 6px,#315045 6px 8px) }
#board .floor { background: #e6ddc4; font-size: clamp(14px,4vw,27px) }
#board .goal { background: #e7bb74 }
#board .crate::after { content:"×"; width:65%; height:65%; display:grid; place-items:center; border:2px solid #98582e; color:#804424; background:#d59859; border-radius:4px }
#board .goal.crate::after { background:#7cad86; border-color:#42705a }
#board .worker::after { content:""; width:58%; aspect-ratio:1; border:4px solid #eaffdf; border-radius:50%; background:#25705b; box-shadow:0 2px 0 #305846 }
nav[aria-label=Movement] { justify-content:center }
footer { border-top:1px solid var(--edge); padding-top:6px }
@media(max-height:450px) and (min-width:540px){
 main{grid-template-columns:minmax(155px,1fr) 1.35fr;max-width:740px}
 #board{grid-column:2;grid-row:1/span 6} footer{align-self:start}
}
