* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #171914; color: #f4efe1; font-family: system-ui, sans-serif; }
#game { position: relative; width: 100%; height: 100%; overflow: hidden; }
.webgl { position: absolute; inset: 0; display: block; }
:focus-visible { outline: 2px solid #f3dfa8; outline-offset: 4px; }

#hud { position: absolute; z-index: 5; top: 15px; left: 15px; display: flex; flex-direction: column; gap: 8px; font-size: 17px; font-weight: 700; text-shadow: 2px 2px 3px black; pointer-events: none; }
#crosshair { position: absolute; z-index: 5; top: 50%; left: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%); pointer-events: none; }
.dot, .centre { position: absolute; width: 4px; height: 4px; background: white; border-radius: 50%; }
.dot.top { left: 15px; top: 2px; }
.dot.bottom { left: 15px; bottom: 2px; }
.dot.left { left: 2px; top: 15px; }
.dot.right { right: 2px; top: 15px; }
.centre { display: none; left: 15px; top: 15px; }
#crosshair.aiming .dot, #crosshair.aiming .centre { background: #f55; }
#crosshair.aiming .centre { display: block; }
#message { position: absolute; z-index: 5; top: 70px; left: 50%; transform: translateX(-50%); text-align: center; font-weight: 700; text-shadow: 2px 2px 3px black; pointer-events: none; }
#minimap { position: absolute; z-index: 5; width: clamp(144px, 24vw, 208px); right: 15px; top: 15px; overflow: hidden; border: 1px solid #939781; border-radius: 8px; background: #171c18; pointer-events: none; }
#map { display: block; width: 100%; height: auto; }
.map-north { position: absolute; left: 8px; top: 8px; padding: 1px 5px; border-radius: 3px; color: #f4efe1; background: #171c18; font-size: .72rem; font-weight: 700; }
.map-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; padding: 6px 8px; border-top: 1px solid #4e5747; color: #f0ece0; font-size: .66rem; }
.map-legend span { display: flex; align-items: center; gap: 5px; }
.map-legend span::before { content: ''; width: 8px; height: 8px; flex: none; background: var(--marker); }
.legend-building { --marker: #afb5aa; }
.legend-roof { --marker: #dcc28b; }
.legend-player { --marker: #c3f7ff; }
.legend-player::before { clip-path: polygon(50% 0, 100% 100%, 50% 72%, 0 100%); }
.legend-enemy { --marker: #ff827d; }
.legend-enemy::before { border-radius: 50%; }

#screen { position: absolute; z-index: 10; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 12, 9, .78); }
#menu { width: min(100%, 580px); max-height: 100%; overflow: auto; padding: clamp(20px, 5vw, 35px); text-align: center; background: #21251c; border: 1px solid #8d805d; border-radius: 12px; box-shadow: 0 10px 60px #0008; }
.back-link { display: inline-block; margin-bottom: 20px; color: #e9d3a4; text-underline-offset: 4px; }
#screenTitle { font: 400 clamp(2.35rem, 8vw, 4.1rem)/1 Georgia, serif; margin: 0 0 15px; }
#screenText { color: #e8e0cd; }
#difficultyField { display: grid; gap: 5px; width: min(100%, 270px); margin: 18px auto 6px; text-align: left; color: #e8e0cd; font-size: .84rem; font-weight: 650; }
#difficulty { width: 100%; min-height: 44px; padding: 6px 10px; border: 1px solid #8d805d; border-radius: 7px; color: #f4efe1; background: #313727; font: inherit; }
#startButton { min-height: 44px; margin: 8px 0; padding: 10px 24px; border: 1px solid #a9b182; border-radius: 7px; background: #c5ce9b; color: #1b2113; font: inherit; font-weight: 700; cursor: pointer; }
#startButton:hover:enabled { background: #d7dfb6; }
#startButton:disabled { opacity: .6; cursor: default; }
.controls { color: #c9c4b2; line-height: 1.65; font-size: .82rem; }

#scope { display: none; position: absolute; z-index: 6; inset: 0; border: 35px solid black; border-radius: 50%; pointer-events: none; box-shadow: inset 0 0 30px black; }
.scope-line { position: absolute; background: rgba(0, 0, 0, .85); }
.scope-line.horizontal { height: 2px; width: 100%; top: 50%; }
.scope-line.vertical { width: 2px; height: 100%; left: 50%; }
