html, body {
    margin: 0;
    height: 100%;
    background: #000;
    color: #9ec1c9;
    font-family: "VT323", "Consolas", ui-monospace, monospace;
    overflow: hidden;
}

/* .app (the play area) is defined in ../../arcade/arcade-shell.css. */

#stage {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
    cursor: crosshair;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.hud__item span {
    margin-left: 0.5rem;
    color: #d0e6ec;
}

.whisper {
    position: absolute;
    left: 50%;
    top: 22%;
    transform: translateX(-50%);
    color: #b7d0d6;
    font-size: 1.4rem;
    letter-spacing: 0.25em;
    text-shadow: 0 0 12px rgba(0, 0, 0, 0.9);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
    text-align: center;
    max-width: 80%;
    font-style: italic;
}

.whisper.visible {
    opacity: 0.85;
}

.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    background: rgba(0, 0, 0, 0.82);
    text-align: center;
    padding: 1rem;
    box-sizing: border-box;
    overflow-y: auto;
}

.overlay.is-game-over {
    gap: 1rem;
}

.overlay.is-game-over .mode-select {
    display: none;
}

.overlay.hidden {
    display: none;
}

.overlay__title {
    font-size: clamp(2rem, 8vw, 4.5rem);
    letter-spacing: 0.4em;
    text-indent: 0.4em; /* balances the trailing letter-space so it centres */
    color: #d0e6ec;
    text-shadow: 0 0 18px rgba(158, 193, 201, 0.55);
}

.overlay__hint {
    max-width: 34rem;
    font-size: 1.15rem;
    line-height: 1.7;
    color: #9ec1c9;
}

.btn {
    background: transparent;
    color: #d0e6ec;
    border: 2px solid #9ec1c9;
    border-radius: 0;
    padding: 0.5rem 1.75rem;
    font-family: inherit;
    font-size: 1.3rem;
    letter-spacing: 0.25em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn:hover {
    background: rgba(158, 193, 201, 0.15);
}

#btn-start {
    min-width: 12rem;
    box-sizing: border-box;
    padding: 0.6rem 1.5rem;
    font-size: 1.3rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-align: center;
}

.highscore-panel {
    width: min(92vw, 46rem);
    max-height: min(54vh, 30rem);
    border: 2px solid rgba(158, 193, 201, 0.72);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 18px rgba(158, 193, 201, 0.22), inset 0 0 0 1px rgba(158, 193, 201, 0.12);
    padding: 0.9rem;
    box-sizing: border-box;
}

.highscore-panel.hidden,
.highscore-panel[hidden] {
    display: none;
}

.highscore-status {
    color: #fff;
    font-size: 1.1rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    text-shadow: 0 0 6px rgba(158, 193, 201, 0.55);
}

.highscore-table-wrap {
    max-height: min(42vh, 23rem);
    overflow: auto;
}

.highscore-table {
    width: 100%;
    border-collapse: collapse;
    color: #d0e6ec;
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.highscore-table th,
.highscore-table td {
    border-bottom: 1px solid rgba(158, 193, 201, 0.24);
    padding: 0.35rem 0.45rem;
    text-align: left;
}

.highscore-table th:first-child,
.highscore-table td:first-child {
    width: 3.5rem;
    text-align: right;
}

.highscore-table th:last-child,
.highscore-table td:last-child {
    text-align: right;
}

.highscore-table tr.achieved {
    color: #fff;
    text-shadow: 0 0 8px rgba(158, 193, 201, 0.85);
    background: rgba(158, 193, 201, 0.12);
}

/* Base .touch-controls / .touch-btn layout lives in
   ../../arcade/arcade-shell.css - only the theme colour is overridden here. */
.touch-btn {
    background: rgba(0, 0, 0, 0.4);
    color: #9ec1c9;
    border-color: rgba(158, 193, 201, 0.55);
}

.touch-btn.pressed {
    background: rgba(158, 193, 201, 0.25);
    color: #ffffff;
}

.touch-btn--action {
    border-color: rgba(210, 180, 100, 0.7);
    color: #e6cc80;
}

.inventory {
    position: absolute;
    top: 3rem;
    right: max(0.75rem, env(safe-area-inset-right));
    display: flex;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(158, 193, 201, 0.35);
    border-radius: 6px;
    pointer-events: none;
    z-index: 4;
}
.inv-key {
    width: 1.8rem;
    height: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.inv-key svg {
    width: 100%;
    height: 100%;
}
.inv-key--master {
    filter: drop-shadow(0 0 4px currentColor);
}
.mode-select {
    display: grid;
    grid-template-columns: repeat(4, 4.6rem);
    gap: 0.35rem;
    justify-content: center;
    margin: 0.5rem 0;
    max-width: 100%;
    overflow-x: auto;
}
.mode-btn {
    box-sizing: border-box;
    width: 100%;
    background: transparent;
    color: #9ec1c9;
    border: 2px solid rgba(158, 193, 201, 0.5);
    padding: 0.3rem 0.3rem;
    font-family: inherit;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.mode-btn.selected {
    color: #d0e6ec;
    border-color: #d0e6ec;
    background: rgba(158, 193, 201, 0.18);
}

.arcade-btn {
    color: #9ec1c9;
    border-color: rgba(158, 193, 201, 0.55);
}

.arcade-btn:hover:not(:disabled) {
    background: rgba(158, 193, 201, 0.15);
}
