* {
box-sizing: border-box;
margin: 0;
padding: 0;
}

html,
body {
width: 100%;
height: 100%;
background-color: #0b0f17;
color: #f8fafc;
font-family:
"Trebuchet MS",
"Segoe UI",
system-ui,
-apple-system,
sans-serif;
-webkit-font-smoothing: antialiased;
overflow: hidden;
}

.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}

.hidden {
display: none !important;
}

.game-shell {
position: relative;
display: flex;
flex-direction: column;
width: 100%;
height: 100vh;
height: 100dvh;
background-color: #0b0f17;
overflow: hidden;
}

.hud-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 7px 14px;
background-color: #131c2b;
border-bottom: 1px solid #263348;
z-index: 10;
min-height: 52px;
}

body[data-state="title"] .hud-bar {
display: none;
}

.hud-left,
.hud-center,
.hud-actions {
display: flex;
align-items: center;
gap: 12px;
}

.hud-stat {
display: flex;
flex-direction: column;
gap: 1px;
}

.hud-kicker {
font-size: 10px;
font-weight: 700;
letter-spacing: 0.06em;
color: #94a3b8;
white-space: nowrap;
}

.hud-val {
font-size: 15px;
font-weight: 800;
color: #f8fafc;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}

.hud-gold {
color: #fbbf24;
}

.hud-loot {
display: inline-flex;
align-items: center;
gap: 5px;
white-space: nowrap;
}

.hud-icon {
width: 20px;
height: 20px;
flex-shrink: 0;
}

.hud-loot-val {
font-size: 14px;
font-weight: 700;
color: #f8fafc;
font-variant-numeric: tabular-nums;
}

.hud-muted {
color: #94a3b8;
}

.hud-carrot-found {
color: #fb923c;
}

.hud-turn {
font-size: 13px;
font-weight: 700;
color: #cbd5e1;
font-variant-numeric: tabular-nums;
white-space: nowrap;
min-width: 76px;
}

.hud-actions {
gap: 6px;
}

.icon-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 5px;
background-color: #1e293b;
color: #f8fafc;
border: 1px solid #334155;
border-radius: 8px;
padding: 0 10px;
height: 36px;
min-width: 36px;
font-size: 12px;
font-weight: 700;
cursor: pointer;
white-space: nowrap;
transition:
background-color 140ms ease,
transform 120ms ease;
}

.icon-btn:hover {
background-color: #334155;
border-color: #475569;
}

.icon-btn:active {
transform: scale(0.96);
}

.icon-btn-lbl {
font-size: 12px;
font-weight: 700;
}

.icon-btn:focus-visible,
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.challenge-card-btn:focus-visible,
.tab-btn:focus-visible,
.name-input:focus-visible {
outline: 2px solid #f59e0b;
outline-offset: 2px;
}

.stage-wrap {
position: relative;
flex: 1 1 auto;
width: 100%;
min-height: 240px;
display: flex;
align-items: center;
justify-content: center;
background-color: #0b0f17;
overflow: hidden;
}

#game-canvas {
display: block;
width: 100%;
height: 100%;
touch-action: none;
user-select: none;
-webkit-user-select: none;
cursor: grab;
}

#game-canvas:active {
cursor: grabbing;
}

.overlay-modal {
position: fixed;
inset: 0;
background-color: rgba(8, 12, 20, 0.84);
display: flex;
align-items: center;
justify-content: center;
padding: 14px;
z-index: 30;
overflow-y: auto;
}

.modal-card {
width: 100%;
max-width: 440px;
max-height: 94dvh;
overflow-y: auto;
background-color: #151e2e;
border: 1px solid #2d3b52;
border-radius: 14px;
padding: 22px;
box-shadow:
0 20px 44px rgba(0, 0, 0, 0.65);
display: flex;
flex-direction: column;
gap: 14px;
}

.modal-card-wide {
max-width: 520px;
}

.casual-home {
text-align: center;
}

.emblem-wrap {
display: flex;
justify-content: center;
}

.title-svg {
width: 148px;
height: 82px;
}

.modal-title {
font-size: 26px;
font-weight: 800;
color: #f8fafc;
text-align: center;
letter-spacing: -0.02em;
text-wrap: balance;
}

.modal-desc {
font-size: 14px;
line-height: 1.45;
color: #cbd5e1;
text-align: center;
}

.play-hero-btn {
font-size: 17px;
min-height: 48px;
letter-spacing: 0.02em;
}

.challenge-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}

.challenge-card-btn {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
padding: 12px 10px;
min-height: 62px;
background-color: #0f172a;
border: 1px solid #334155;
border-radius: 10px;
color: #f8fafc;
cursor: pointer;
transition:
border-color 140ms ease,
background-color 140ms ease,
transform 120ms ease;
}

.challenge-card-btn:hover {
border-color: #f59e0b;
background-color: #1a263b;
}

.challenge-card-btn:active {
transform: scale(0.98);
}

.challenge-name {
font-size: 14px;
font-weight: 800;
color: #f8fafc;
white-space: nowrap;
}

.challenge-meta {
font-size: 12px;
font-weight: 600;
color: #94a3b8;
font-variant-numeric: tabular-nums;
white-space: nowrap;
}

.trophy-wrap {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
background-color: #0f172a;
border: 1px solid #263348;
border-radius: 10px;
padding: 12px;
}

.trophy-canvas {
width: 240px;
height: 152px;
display: block;
}

.record-status {
font-size: 13px;
font-weight: 700;
color: #fbbf24;
text-align: center;
}

.record-status.qualified {
color: #34d399;
}

.record-status.missed {
color: #f87171;
}

.stats-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}

.stat-tile {
background-color: #0f172a;
border: 1px solid #263348;
border-radius: 8px;
padding: 9px 12px;
display: flex;
flex-direction: column;
gap: 2px;
}

.stat-kicker {
font-size: 10px;
font-weight: 700;
color: #94a3b8;
letter-spacing: 0.05em;
}

.stat-num {
font-size: 17px;
font-weight: 800;
color: #fbbf24;
font-variant-numeric: tabular-nums;
}

.breakdown-line {
font-size: 12px;
color: #94a3b8;
text-align: center;
font-variant-numeric: tabular-nums;
}

.hero-score-box {
background-color: #0f172a;
border: 1px solid #263348;
border-radius: 10px;
padding: 14px 12px;
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
}

.hero-score-num {
font-size: 34px;
font-weight: 800;
color: #fbbf24;
font-variant-numeric: tabular-nums;
line-height: 1.1;
}

.summary-meta-line {
font-size: 13px;
color: #cbd5e1;
font-variant-numeric: tabular-nums;
}

.summary-stages {
display: flex;
flex-direction: column;
gap: 5px;
}

.stage-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 6px 10px;
background-color: #0f172a;
border: 1px solid #263348;
border-radius: 8px;
font-size: 12px;
font-variant-numeric: tabular-nums;
}

.stage-row-name {
font-weight: 700;
color: #e2e8f0;
}

.stage-row-metrics {
font-weight: 700;
color: #fbbf24;
}

.submit-box {
background-color: rgba(52, 211, 153, 0.08);
border: 1px solid #34d399;
border-radius: 10px;
padding: 12px;
display: flex;
flex-direction: column;
gap: 8px;
}

.submit-title {
font-size: 14px;
font-weight: 800;
color: #34d399;
text-align: center;
}

.submit-form {
display: flex;
gap: 8px;
}

.name-input {
flex: 1 1 auto;
min-width: 0;
min-height: 44px;
background-color: #0b0f17;
color: #f8fafc;
border: 1px solid #475569;
border-radius: 8px;
padding: 0 12px;
font-size: 15px;
font-weight: 600;
}

.submit-feedback {
font-size: 12px;
font-weight: 600;
color: #cbd5e1;
text-align: center;
min-height: 16px;
}

.submit-feedback.err {
color: #f87171;
}

.submit-feedback.ok {
color: #34d399;
}

.tab-bar {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 4px;
padding: 4px;
background-color: #0f172a;
border: 1px solid #263348;
border-radius: 10px;
}

.tab-btn {
min-height: 38px;
background-color: transparent;
color: #94a3b8;
border: none;
border-radius: 7px;
font-size: 13px;
font-weight: 700;
cursor: pointer;
white-space: nowrap;
transition:
background-color 140ms ease,
color 140ms ease;
}

.tab-btn:hover {
color: #f8fafc;
}

.tab-btn.active {
background-color: #f59e0b;
color: #0f172a;
}

.board-meta-line {
font-size: 12px;
color: #94a3b8;
text-align: center;
font-variant-numeric: tabular-nums;
}

.board-box {
background-color: #0f172a;
border: 1px solid #263348;
border-radius: 10px;
padding: 10px;
display: flex;
flex-direction: column;
gap: 8px;
}

.board-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}

.board-title {
font-size: 13px;
font-weight: 800;
color: #f8fafc;
}

.board-rule {
font-size: 11px;
font-weight: 600;
color: #94a3b8;
}

.board-list {
display: flex;
flex-direction: column;
gap: 5px;
max-height: 170px;
overflow-y: auto;
}

.board-list-tall {
max-height: 290px;
}

.board-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 7px 10px;
background-color: #151e2e;
border: 1px solid #263348;
border-radius: 8px;
font-size: 13px;
font-variant-numeric: tabular-nums;
}

.board-row.highlight {
border-color: #f59e0b;
background-color: rgba(245, 158, 11, 0.14);
}

.board-left {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}

.board-rank {
font-weight: 800;
color: #fbbf24;
min-width: 24px;
}

.board-player {
font-weight: 700;
color: #f8fafc;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.board-right {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}

.board-pts {
font-weight: 800;
color: #fbbf24;
}

.board-sub {
font-size: 12px;
color: #94a3b8;
}

.board-empty {
font-size: 13px;
color: #94a3b8;
text-align: center;
padding: 16px 8px;
}

.modal-actions {
display: flex;
flex-direction: column;
gap: 8px;
}

.modal-actions-row {
flex-direction: row;
flex-wrap: wrap;
}

.modal-actions-row > button {
flex: 1 1 130px;
}

.primary-btn {
background-color: #f59e0b;
color: #0f172a;
border: 1px solid #fbbf24;
border-radius: 9px;
padding: 10px 16px;
font-size: 15px;
font-weight: 800;
cursor: pointer;
text-align: center;
white-space: nowrap;
min-height: 44px;
transition:
background-color 140ms ease,
transform 120ms ease;
}

.primary-btn:hover {
background-color: #fbbf24;
}

.primary-btn:active {
transform: scale(0.98);
}

.primary-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}

.secondary-btn {
background-color: #1e293b;
color: #f8fafc;
border: 1px solid #3f4f66;
border-radius: 9px;
padding: 10px 14px;
font-size: 14px;
font-weight: 700;
cursor: pointer;
text-align: center;
white-space: nowrap;
min-height: 44px;
transition:
background-color 140ms ease,
transform 120ms ease;
}

.secondary-btn:hover {
background-color: #334155;
}

.secondary-btn:active {
transform: scale(0.98);
}

.control-hint {
font-size: 12px;
color: #94a3b8;
text-align: center;
padding-top: 2px;
text-wrap: balance;
}

@media (max-width: 680px) {
.hud-bar {
padding: 6px 10px;
gap: 6px;
min-height: 48px;
}

.hud-left,
.hud-center {
gap: 8px;
}

.hud-val {
font-size: 13px;
}

.hud-loot-val {
font-size: 13px;
}

.hud-turn {
display: none;
}

.icon-btn {
height: 36px;
min-width: 36px;
padding: 0 7px;
}

.icon-btn-lbl {
display: none;
}

.modal-card {
padding: 16px;
gap: 11px;
}

.modal-title {
font-size: 22px;
}

.challenge-row {
grid-template-columns: 1fr;
}

.submit-form {
flex-direction: column;
}

.board-sub {
display: none;
}
}
