* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #f1eee5; color: #171717; font-family: 'Courier New', Courier, monospace; overflow: hidden; }
body { display: flex; align-items: center; justify-content: center; }
#ui { position: relative; width: 100%; max-width: 100%; height: 100vh; height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14px; overflow-x: hidden; background-image: radial-gradient(#b8b2a7 0.6px, transparent 0.6px); background-size: 15px 15px; }
.hidden { display: none !important; }

/* Menu */
.menu-shell { width: min(940px, 100%); max-height: calc(100vh - 28px); overflow-y: auto; padding: clamp(1.2rem, 4vw, 2.8rem); border: 2px solid #171717; background: #fbfaf6; box-shadow: 9px 9px 0 #171717; text-align: left; }
.menu-brand { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1.3rem; border-bottom: 2px solid #171717; }
.brand-kicker, .card-kicker { font-size: 0.68rem; font-weight: bold; letter-spacing: 2px; text-transform: uppercase; }
.menu-brand h1 { margin: 0.15rem 0 0.1rem; font-size: clamp(2.4rem, 7vw, 4rem); line-height: 1; letter-spacing: 0.16em; text-transform: uppercase; }
.subtitle { font-size: 0.78rem; opacity: 0.7; }
.brand-stamp { display: grid; width: 72px; height: 72px; flex: 0 0 auto; place-items: center; border: 3px double #c81e1e; border-radius: 50%; color: #c81e1e; font-weight: bold; font-size: 1.1rem; transform: rotate(-12deg); }
.profile-strip { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: end; gap: 1rem; margin-top: 1rem; padding: 0.9rem 1rem; border: 1px solid #c9c3b7; background: #f6f2e9; }
.profile-name { min-width: 0; }
.profile-name .field-label { margin-top: 0; }
.profile-summary { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.profile-detail { display: flex; flex: 1 1 auto; min-width: 0; flex-direction: column; gap: 0.15rem; font-size: 0.8rem; }
.profile-detail strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-caption { color: #8e201e; font-size: 0.6rem; font-weight: bold; letter-spacing: 0.12em; white-space: nowrap; }
.account-panel { margin-top: 0.65rem; border: 1px dashed #aaa397; background: #fff; }
.account-panel summary { padding: 0.55rem 0.7rem; color: #8e201e; cursor: pointer; font-size: 0.65rem; font-weight: bold; letter-spacing: 0.05em; }
.account-controls { display: grid; grid-template-columns: minmax(110px, 0.35fr) minmax(0, 1fr); align-items: center; gap: 0.4rem 0.65rem; padding: 0 0.7rem 0.7rem; }
.account-controls label { font-size: 0.67rem; font-weight: bold; }
.account-controls input { padding: 0.45rem 0.55rem; font-size: 0.75rem; }
.account-buttons, .account-status { grid-column: 1 / -1; }
.account-buttons { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.account-status { min-height: 1rem; font-size: 0.67rem; line-height: 1.4; opacity: 0.78; }
.menu-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1rem; margin-top: 1.3rem; }
.menu-card { display: flex; flex-direction: column; align-items: flex-start; padding: 1.25rem; border: 2px solid #171717; background: #fff; box-shadow: 4px 4px 0 #d9d4c8; }
.menu-card h2 { margin: 0.45rem 0; font-size: 1.35rem; letter-spacing: 0.02em; }
.card-kicker { color: #8e201e; }
.card-copy { min-height: 2.6rem; margin-bottom: 1rem; font-size: 0.78rem; line-height: 1.5; opacity: 0.72; }
.field-label { display: block; margin: 0.25rem 0 0.4rem; font-size: 0.72rem; font-weight: bold; letter-spacing: 0.04em; }
.row { margin: 0.55rem 0; display: flex; gap: 0.6rem; justify-content: center; align-items: center; flex-wrap: wrap; }
label { font-size: 0.85rem; }
input, select { width: 100%; max-width: 100%; padding: 0.65rem 0.7rem; border: 2px solid #171717; background: #fff; color: #171717; font-family: inherit; font-size: 0.85rem; outline: none; }
input:focus, select:focus { box-shadow: 3px 3px 0 #171717; }
.online-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; width: 100%; margin: 0.8rem 0 1rem; }
.join-room { width: 100%; padding-top: 0.7rem; border-top: 1px dashed #aaa397; }
.join-actions { display: flex; gap: 0.5rem; }
.join-actions input { min-width: 0; text-transform: uppercase; }
.join-actions .btn { flex: 0 0 auto; }
.bot-card { background: #f6f2e9; }
.bot-start { width: 100%; margin-top: 0.9rem; }
.bot-note { margin-top: 0.7rem; font-size: 0.68rem; opacity: 0.65; }
.menu-footer { display: flex; align-items: center; justify-content: flex-end; gap: 0.8rem; margin-top: 1.1rem; }
.profile-mark { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border: 1px solid #c81e1e; color: #c81e1e; }
.profile-mark canvas { display: block; width: 28px; height: 28px; }
.btn { padding: 0.62rem 0.85rem; font-family: inherit; font-size: 0.8rem; border: 2px solid #171717; background: #fff; color: #171717; cursor: pointer; text-transform: uppercase; letter-spacing: 0.07em; transition: background 0.12s, color 0.12s, transform 0.08s; }
.with-icon { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; }
.btn-icon { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { background: #171717; color: #fff; }
.btn.primary { background: #171717; color: #fff; }
.btn.primary:hover { background: #8e201e; border-color: #8e201e; }
.btn:active { transform: translate(1px, 1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, .sym-btn:focus-visible, .color-btn:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 3px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { background: #fff; color: #000; }
.btn.ghost { border-style: dashed; }
.btn.small { padding: 0.35rem 0.6rem; font-size: 0.72rem; letter-spacing: 0.5px; }
.btn.danger { border-color: #c81e1e; color: #c81e1e; }
.btn.danger:hover { background: #c81e1e; color: #fff; }
.status { margin-top: 0.9rem; min-height: 1.2rem; font-size: 0.74rem; opacity: 0.78; }

/* Game Layout */
#game { width: 100%; min-width: 0; max-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; overflow-x: hidden; }
#hud { width: 100%; max-width: 1180px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.hud-info { display: flex; align-items: center; gap: 1.2rem; font-size: 0.82rem; }
.hud-info strong { text-transform: uppercase; letter-spacing: 1px; }
.hud-weather { position: relative; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.28rem 0.5rem; border: 1px solid #c9c3b7; background: #fbfaf6; cursor: help; }
.hud-weather-label { color: #8e201e; font-size: 0.64rem; font-weight: bold; letter-spacing: 0.08em; text-transform: uppercase; }
.wind-info-icon { display: inline-block; width: 18px; height: 18px; vertical-align: -4px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wind-tooltip { position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; width: min(290px, calc(100vw - 28px)); padding: 0.65rem 0.75rem; border: 1px solid #8e201e; background: #171717; color: #fff; font-size: 0.68rem; line-height: 1.45; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity 0.12s, transform 0.12s, visibility 0.12s; }
.hud-weather:hover .wind-tooltip, .hud-weather:focus .wind-tooltip, .hud-weather:focus-within .wind-tooltip { opacity: 1; visibility: visible; transform: translateY(0); }
.hud-weather small { min-height: 0.8rem; color: #8e201e; font-size: 0.62rem; }
.hud-actions { display: flex; min-width: 0; max-width: 100%; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.turn-clock { display: flex; align-items: center; gap: 0.4rem; padding: 0.28rem 0.48rem; border: 2px solid #171717; background: #fff; }
.turn-clock span { font-size: 0.58rem; font-weight: bold; letter-spacing: 0.08em; }
.turn-clock strong { min-width: 1.45rem; color: #8e201e; font-size: 0.9rem; text-align: center; font-variant-numeric: tabular-nums; }
.turn-clock.urgent { border-color: #c81e1e; background: #fff1ef; animation: timerPulse 0.9s ease-in-out infinite; }
.base-placement-panel { position: fixed; top: clamp(74px, 11vh, 112px); left: 50%; z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: min(800px, calc(100vw - 32px)); padding: 0.65rem 0.8rem; border: 2px solid #8e201e; background: #fff4ed; box-shadow: 4px 4px 0 rgba(142,32,30,0.2); transform: translateX(-50%); }
.base-placement-panel strong, .checkpoint-mode-label { color: #8e201e; font-size: 0.65rem; font-weight: bold; letter-spacing: 0.1em; }
.base-placement-panel p { margin: 0.2rem 0 0; font-size: 0.75rem; line-height: 1.35; }
.base-placement-countdown { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.arena { display: flex; min-width: 0; max-width: 100%; align-items: center; justify-content: center; gap: 16px; width: 100%; overflow-x: hidden; }
.player-column { position: relative; z-index: 1; display: grid; min-width: 0; flex: 0 0 198px; grid-template-columns: minmax(0, 1fr) 40px; grid-template-areas: "panel modes" "skills skills"; align-items: start; gap: 0.5rem; }
.player-column:hover, .player-column:focus-within { z-index: 8; }
.player-panel { grid-area: panel; position: relative; width: 100%; border: 2px solid #000; padding: 0.7rem 0.6rem; display: flex; flex-direction: column; gap: 0.55rem; align-items: center; background: #fff; transition: box-shadow 0.15s, transform 0.15s; }
.player-panel.active { box-shadow: 5px 5px 0 #000; transform: translate(-2px, -2px); }
.player-panel.dead { opacity: 0.4; filter: grayscale(1); }
.pp-head { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 0.4rem; }
.pp-name { font-size: 0.85rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 95px; }
.pp-badge { font-size: 0.6rem; border: 1px solid #000; padding: 0.1rem 0.3rem; opacity: 0; text-transform: uppercase; }
.player-panel.active .pp-badge { opacity: 1; background: #000; color: #fff; }
.player-skills { width: 100%; padding: 0.4rem; border: 1.5px solid #171717; background: rgba(255,255,255,0.94); }
.checkpoint-mode-control { grid-area: modes; display: flex; flex-direction: column; gap: 0.3rem; width: 40px; }
.checkpoint-mode-button { position: relative; display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; padding: 3px; border: 1.5px solid #171717; border-radius: 7px; background: linear-gradient(145deg, #fff 0%, #f4f0e7 100%); color: #171717; cursor: pointer; font: inherit; transition: background 0.12s, color 0.12s, box-shadow 0.12s, transform 0.12s; }
.checkpoint-mode-button:hover:not(:disabled), .checkpoint-mode-button:focus-visible { outline: 2px solid #8e201e; outline-offset: 2px; }
.checkpoint-mode-button.selected { background: linear-gradient(145deg, #333 0%, #171717 100%); color: #fff; box-shadow: 2px 2px 0 #8e201e, inset 0 0 0 1px rgba(255,255,255,0.16); transform: translateY(-1px); }
.checkpoint-mode-button:disabled { opacity: 0.48; cursor: not-allowed; }
.checkpoint-mode-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.checkpoint-mode-icon--permanent { color: #8e201e; }
.checkpoint-mode-icon--linked { color: #315e7a; }
.checkpoint-mode-button.selected .checkpoint-mode-icon { color: #fff; }
.checkpoint-mode-count { position: absolute; right: 1px; bottom: 1px; min-width: 13px; padding: 0 2px; border: 1px solid #171717; background: #fff; color: #171717; font-size: 0.52rem; font-weight: bold; line-height: 1.1; text-align: center; font-variant-numeric: tabular-nums; }
.checkpoint-mode-tooltip { position: absolute; top: 50%; left: calc(100% + 0.45rem); z-index: 20; width: 220px; padding: 0.55rem 0.65rem; border: 1px solid #8e201e; background: #171717; color: #fff; font-size: 0.67rem; font-weight: normal; line-height: 1.4; text-align: left; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-50%) translateX(-4px); transition: opacity 0.12s, transform 0.12s, visibility 0.12s; }
.checkpoint-mode-control--p2 .checkpoint-mode-tooltip { right: calc(100% + 0.45rem); left: auto; transform: translateY(-50%) translateX(4px); }
.checkpoint-mode-button:hover .checkpoint-mode-tooltip, .checkpoint-mode-button:focus-visible .checkpoint-mode-tooltip { opacity: 1; visibility: visible; transform: translateY(-50%); }
.player-skills { grid-area: skills; }
.player-skills-title { margin: 0 0 0.35rem; color: #8e201e; font-size: 0.53rem; font-weight: bold; letter-spacing: 0.14em; }
.player-skill-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.35rem; }
.focus-skill-slot { position: relative; z-index: 4; display: flex; justify-content: center; width: 100%; }
.focus-skill-slot--compact { display: none; width: auto; }
.focus-skill-button { display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 0.35rem; width: 100%; min-height: 46px; padding: 0.35rem 0.4rem; border: 1.5px solid #8e201e; background: #fffaf7; color: #171717; cursor: pointer; font-family: inherit; text-align: left; transition: background 0.12s, color 0.12s, box-shadow 0.12s; }
.focus-skill-button:hover:not(:disabled), .focus-skill-button:focus-visible { background: #f7e8e4; outline: 2px solid #8e201e; outline-offset: 2px; }
.focus-skill-button:disabled { opacity: 0.6; cursor: not-allowed; }
.focus-skill-button.armed { background: #8e201e; color: #fff; box-shadow: 3px 3px 0 #171717; }
.focus-skill-icon { width: 23px; height: 23px; fill: none; stroke: #8e201e; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.focus-skill-button.armed .focus-skill-icon { stroke: #fff; }
.focus-skill-copy { display: flex; min-width: 0; flex-direction: column; gap: 0.08rem; line-height: 1.1; }
.focus-skill-copy strong { font-size: 0.64rem; letter-spacing: 0.12em; }
.focus-skill-copy small { font-size: 0.58rem; opacity: 0.76; white-space: nowrap; }
.focus-skill-count { font-weight: bold; font-variant-numeric: tabular-nums; }
.focus-skill-status { max-width: 48px; color: #8e201e; font-size: 0.48rem; font-weight: bold; line-height: 1.15; text-align: right; }
.focus-skill-button.armed .focus-skill-status { color: #fff; }
.match-skill-symbol { display: grid; width: 23px; height: 23px; place-items: center; border: 1px solid #8e201e; border-radius: 50%; color: #8e201e; font-size: 0.8rem; font-weight: bold; }
.focus-skill-button.armed .match-skill-symbol { border-color: #fff; color: #fff; }
.focus-tooltip { position: absolute; top: 50%; z-index: 20; width: 220px; padding: 0.55rem 0.65rem; border: 1px solid #8e201e; background: #171717; color: #fff; font-size: 0.67rem; line-height: 1.4; text-align: left; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.12s, transform 0.12s, visibility 0.12s; }
#playerSkillsP1 .focus-tooltip { top: auto; bottom: calc(100% + 0.45rem); left: calc(100% + 0.55rem); transform: translateX(-4px); }
#playerSkillsP2 .focus-tooltip { top: auto; right: calc(100% + 0.55rem); bottom: calc(100% + 0.45rem); transform: translateX(4px); }
.focus-skill-slot:hover .focus-tooltip, .focus-skill-button:focus-visible + .focus-tooltip { opacity: 1; visibility: visible; }
#playerSkillsP1 .focus-skill-slot:hover .focus-tooltip, #playerSkillsP1 .focus-skill-button:focus-visible + .focus-tooltip { transform: translateX(0); }
#playerSkillsP2 .focus-skill-slot:hover .focus-tooltip, #playerSkillsP2 .focus-skill-button:focus-visible + .focus-tooltip { transform: translateX(0); }
.focus-skill-slot--compact .focus-skill-button { width: auto; min-width: 132px; }
.focus-skill-slot--compact .focus-tooltip { top: auto; right: auto; bottom: calc(100% + 0.45rem); left: 50%; width: min(240px, 75vw); transform: translate(-50%, 4px); }
.focus-skill-slot--compact:hover .focus-tooltip, .focus-skill-button:focus-visible + .focus-tooltip { transform: translate(-50%, 0); }
.skill-draft-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.45rem; margin: 0.65rem 0; }
.skill-draft-option { display: grid; grid-template-columns: 25px minmax(0, 1fr); align-items: start; gap: 0.35rem; min-height: 70px; padding: 0.45rem; border: 1.5px solid #171717; background: #fff; color: #171717; cursor: pointer; font-family: inherit; text-align: left; transition: background 0.12s, transform 0.12s; }
.skill-draft-option:hover:not(:disabled), .skill-draft-option:focus-visible { background: #f7e8e4; outline: 2px solid #8e201e; outline-offset: 2px; transform: translateY(-2px); }
.skill-draft-option:disabled { opacity: 0.55; cursor: not-allowed; }
.skill-draft-icon { display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid #8e201e; border-radius: 50%; color: #8e201e; font-weight: bold; }
.skill-draft-copy { display: flex; flex-direction: column; gap: 0.2rem; }
.skill-draft-copy strong { font-size: 0.68rem; }
.skill-draft-copy small { font-size: 0.57rem; line-height: 1.3; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.pp-symbol canvas { display: block; }
.pp-stats { width: 100%; display: flex; justify-content: space-between; font-size: 0.75rem; border-top: 1px dashed #000; padding-top: 0.4rem; }
.pp-stats strong { font-variant-numeric: tabular-nums; }
.pp-capacity-meter { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; width: 100%; height: 7px; }
.pp-capacity-segment { border: 1px solid var(--player-color, #171717); background: transparent; }
.pp-capacity-segment.is-filled { background: var(--player-color, #171717); }

.board-frame { position: relative; min-width: 0; border: 3px solid #000; background: #fff; box-shadow: 10px 10px 0 rgba(0,0,0,0.12); line-height: 0; flex: 0 1 auto; max-width: calc(100vw - 24px); }
#gameCanvas { display: block; width: min(800px, calc(100vw - 440px), calc(133.333vh - 240px)); height: auto; cursor: crosshair; touch-action: none; }
.hud-status { width: 100%; min-height: 1rem; text-align: right; font-size: 0.75rem; opacity: 0.8; }
.game-instruction { display: flex; align-items: flex-start; gap: 0.6rem; width: min(800px, calc(100vw - 32px)); padding: 0.6rem 0.8rem; border: 1px dashed #aaa397; background: rgba(251,250,246,0.9); font-size: 0.74rem; line-height: 1.4; }
.instruction-icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: #8e201e; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.board-notice { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: clamp(0.7rem, 3vw, 1.4rem); background: rgba(23,23,23,0.46); line-height: 1.35; overflow-y: auto; }
.board-notice:not(.hidden) { animation: noticeVeil 0.22s ease-out both; }
.board-notice.is-draft #boardNoticeMessage { white-space: pre-line; }
.notice-card { width: min(680px, 100%); max-height: calc(100dvh - 2rem); overflow-y: auto; padding: clamp(0.8rem, 2vw, 1.25rem); border: 2px solid #171717; background: rgba(251,250,246,0.99); box-shadow: 7px 7px 0 rgba(23,23,23,0.8); text-align: center; pointer-events: auto; animation: noticeEnter 0.3s ease-out both; }
.notice-kicker { margin-bottom: 0.45rem; color: #8e201e; font-size: 0.68rem; font-weight: bold; letter-spacing: 0.18em; }
.notice-card h2 { margin: 0 0 0.6rem; font-size: clamp(1.15rem, 3vw, 1.7rem); letter-spacing: 0.08em; line-height: 1.2; }
.notice-card p:not(.notice-kicker) { margin: 0 auto 1rem; max-width: 34rem; font-size: clamp(0.76rem, 1.8vw, 0.9rem); }
.ready-cta { width: min(330px, 100%); min-height: 58px; border-width: 3px; font-size: clamp(0.9rem, 2.4vw, 1.1rem); letter-spacing: 0.14em; animation: readyPulse 1.8s ease-in-out infinite; }

@keyframes noticeVeil { from { opacity: 0; } to { opacity: 1; } }
@keyframes noticeEnter { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes readyPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(200,30,30,0.2); } 50% { box-shadow: 0 0 0 7px rgba(200,30,30,0.18); } }
@keyframes timerPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(200,30,30,0.12); } 50% { box-shadow: 0 0 0 4px rgba(200,30,30,0.18); } }
@keyframes placementPulse { 0%, 100% { box-shadow: 4px 4px 0 rgba(142,32,30,0.16); } 50% { box-shadow: 4px 4px 0 rgba(142,32,30,0.16), 0 0 0 4px rgba(200,30,30,0.12); } }
.base-placement-action { position: absolute; z-index: 9; max-width: calc(100% - 8px); line-height: normal; }
.base-placement-action .btn { max-width: calc(100vw - 24px); white-space: normal; box-shadow: 3px 3px 0 rgba(23,23,23,0.7); }
.measurement-tool-wrap { position: relative; }
.measurement-panel { position: fixed; top: clamp(72px, 12vh, 108px); right: 12px; z-index: 30; width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 92px); overflow-y: auto; padding: 0.8rem; border: 2px solid #171717; background: rgba(251,250,246,0.98); box-shadow: 5px 5px 0 rgba(23,23,23,0.75); line-height: 1.35; pointer-events: none; }
.measurement-panel button, .measurement-panel input { pointer-events: auto; }
.measurement-panel details { pointer-events: auto; }
.measurement-readout div:first-child { border: 2px solid #8e201e; background: #fff4ed; }
.measurement-readout div:first-child dd { color: #8e201e; font-size: 0.95rem; }
.measurement-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; color: #8e201e; font-size: 0.68rem; letter-spacing: 0.08em; }
.measurement-close { width: 28px; height: 28px; border: 1px solid #171717; background: #fff; color: #171717; cursor: pointer; font-family: inherit; font-size: 1.1rem; font-weight: bold; }
.measurement-power { display: flex; flex-direction: column; gap: 0.25rem; margin: 0.55rem 0; font-size: 0.68rem; font-weight: bold; }
.measurement-power span { display: flex; justify-content: space-between; }
.measurement-power input { width: 100%; padding: 0; accent-color: #8e201e; }
.measurement-prompt { min-height: 1.2rem; margin: 0.45rem 0; font-size: 0.68rem; }
.measurement-readout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem; }
.measurement-readout div { min-width: 0; padding: 0.35rem 0.45rem; border: 1px dashed #aaa397; background: #fff; }
.measurement-readout dt { color: #666; font-size: 0.58rem; font-weight: bold; text-transform: uppercase; }
.measurement-readout dd { overflow-wrap: anywhere; font-size: 0.7rem; font-weight: bold; font-variant-numeric: tabular-nums; }
.measurement-notes, .measurement-terrain { margin-top: 0.5rem; font-size: 0.6rem; }
.measurement-formula { margin-top: 0.55rem; padding: 0.45rem 0.55rem; border: 1px solid #c9c3b7; background: #f6f2e9; font-size: 0.63rem; line-height: 1.45; }
.measurement-formula summary { color: #8e201e; cursor: pointer; font-weight: bold; }
.measurement-formula p { margin-top: 0.4rem; }
.measurement-terrain { padding-top: 0.4rem; border-top: 1px dashed #aaa397; }

/* Overlays */
.overlay { position: absolute; inset: 0; background: rgba(251,250,246,0.97); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 20; padding: 1.5rem; overflow: auto; text-align: center; }
.overlay h2 { font-size: 1.8rem; letter-spacing: 3px; margin-bottom: 0.6rem; text-transform: uppercase; }
.overlay p { margin-bottom: 1rem; font-size: 0.95rem; max-width: 560px; line-height: 1.4; }
.overlay-sub { opacity: 0.7; font-size: 0.8rem; margin-bottom: 0.5rem; }

/* Customize */
.customize-grid { display: flex; gap: 1.4rem; margin: 1rem 0 1.4rem; flex-wrap: wrap; justify-content: center; }
.custom-card { border: 2px solid #000; padding: 1rem; width: min(370px, 100%); display: flex; flex-direction: column; align-items: center; gap: 0.6rem; background: #fff; }
.custom-card h3 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 1px; }
.c-name { width: 100%; text-align: center; }
.c-symbols { display: flex; gap: 0.45rem; justify-content: center; flex-wrap: wrap; }
.sym-btn { width: 38px; height: 38px; border: 2px solid #000; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.sym-btn.selected { background: #000; }
.sym-btn.selected canvas { filter: invert(1); }
.c-colors { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.color-btn { width: 28px; height: 28px; border: 2px solid #000; cursor: pointer; padding: 0; }
.color-btn.selected { outline: 2px solid #000; outline-offset: 2px; }
.c-preview { border: 2px solid #000; background: #fff; }

/* Rules */
.rules { text-align: left; max-width: 620px; margin: 0 0 1.2rem; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.85rem; line-height: 1.4; }

@media (max-width: 980px) {
  #ui { justify-content: flex-start; overflow-y: auto; }
  #game { height: auto; min-height: calc(100dvh - 28px); flex: 0 0 auto; justify-content: flex-start; }
  .board-notice { align-items: center; overflow-y: auto; }
  .arena { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "board board" "player-one player-two"; align-items: start; gap: 8px; }
  .player-column { display: grid; flex: initial; width: 100%; grid-template-columns: minmax(0, 1fr); grid-template-areas: "modes" "skills"; }
  .player-column:first-child { grid-area: player-one; }
  .player-column:last-child { grid-area: player-two; }
  .player-panel { display: none; }
  .board-frame { grid-area: board; justify-self: center; width: auto; }
  .player-skills .focus-skill-slot:not(.match-skill-slot) { display: none; }
  .focus-skill-slot--compact { display: flex; }
  .checkpoint-mode-control { flex-direction: row; justify-content: center; gap: 0.35rem; width: 100%; }
  .checkpoint-mode-button { width: 38px; height: 38px; flex-basis: 38px; }
  .checkpoint-mode-tooltip, .checkpoint-mode-control--p2 .checkpoint-mode-tooltip { position: fixed; top: 50%; right: 12px; bottom: auto; left: 12px; width: auto; max-width: 360px; transform: translateY(calc(-50% + 4px)); }
  .checkpoint-mode-button:hover .checkpoint-mode-tooltip, .checkpoint-mode-button:focus-visible .checkpoint-mode-tooltip { transform: translateY(-50%); }
  #gameCanvas { width: min(800px, calc(100vw - 40px), max(260px, calc(133.333dvh - 480px))); max-width: 100%; }
  #hud { align-items: flex-start; }
  .hud-info, .hud-actions { width: 100%; justify-content: center; }
  .hud-status { text-align: center; }
}

@media (max-width: 700px) {
  .menu-grid { grid-template-columns: 1fr; }
  .profile-strip { grid-template-columns: 1fr; align-items: stretch; }
  .card-copy { min-height: auto; }
}

@media (max-width: 480px) {
  #ui { padding: 8px; }
  .menu-shell { max-height: calc(100vh - 16px); padding: 1rem; box-shadow: 5px 5px 0 #171717; }
  .menu-brand { padding-bottom: 1rem; }
  .brand-stamp { width: 52px; height: 52px; border-width: 2px; font-size: 0.85rem; }
  .menu-card { padding: 0.9rem; }
  .menu-card h2 { font-size: 1.15rem; }
  .online-actions { grid-template-columns: 1fr; }
  .join-actions { flex-direction: column; }
  .join-actions .btn { width: 100%; }
  .menu-footer { align-items: flex-start; flex-direction: column; }
  .profile-summary { display: grid; grid-template-columns: 34px minmax(0, 1fr); width: 100%; }
  .profile-summary .btn { grid-column: 1 / -1; width: 100%; }
  .base-placement-panel { align-items: stretch; flex-direction: column; }
  .base-placement-countdown { align-self: flex-start; }
  .checkpoint-mode-button { width: 36px; height: 36px; flex-basis: 36px; }
  #game { gap: 6px; }
  #hud { gap: 0.4rem; }
  .hud-info { gap: 0.7rem; font-size: 0.72rem; }
  .hud-actions { gap: 0.25rem; }
  .turn-clock { gap: 0.25rem; padding: 0.25rem 0.35rem; }
  .turn-clock span { font-size: 0.5rem; }
  .hud-weather small { font-size: 0.55rem; }
  .btn.small { padding: 0.3rem 0.42rem; font-size: 0.65rem; }
  .focus-skill-button { min-height: 40px; }
  .focus-skill-icon { width: 20px; height: 20px; }
  .skill-draft-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill-draft-option { grid-template-columns: 22px minmax(0, 1fr); gap: 0.3rem; min-height: 86px; padding: 0.35rem; }
  .skill-draft-icon { width: 21px; height: 21px; }
  #gameCanvas { width: min(800px, calc(100vw - 40px), max(250px, calc(133.333dvh - 480px))); }
  .notice-card { box-shadow: 4px 4px 0 rgba(23,23,23,0.8); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .board-notice:not(.hidden), .notice-card, .ready-cta, .turn-clock.urgent, .base-placement-panel { animation: none !important; }
}
