/* Ski Jump — Alpine Air */

body {
    background-color: #f5f7fa;
}

.game-wrapper {
    position: relative;
    max-width: 1100px;
    margin: 1.25rem auto 2.5rem;
    padding: 0 12px;
}

.game-header-integrated {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #101b33;
    border: 1px solid #23345a;
    border-radius: 12px 12px 0 0;
    padding: 10px 14px;
}

.game-logo {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #fff;
    font-size: 1.25rem;
    margin: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.high-score-display {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: #7fdfff;
    background: rgba(127, 223, 255, 0.12);
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    white-space: nowrap;
}

.mute-btn {
    background: #16233f;
    color: #fff;
    border: 1px solid #2b3d64;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.mute-btn:hover {
    background: #2b3d64;
}

/* The playfield: fills the viewport height minus site nav + game header so it
   plays well in both portrait and landscape. Fullscreen takes the whole screen. */
.canvas-container {
    position: relative;
    width: 100%;
    height: 70vh; /* fallback for browsers without dvh */
    height: max(430px, min(calc(100dvh - 230px), 820px));
    background: #0b1020;
    border: 1px solid #23345a;
    border-top: none;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    --chrome-accent: #38b6ff;
}

.canvas-container canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

@supports (padding: max(0px)) {
    .game-wrapper {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
}

.canvas-container:fullscreen {
    height: 100%;
    border: none;
    border-radius: 0;
}

.canvas-container:-webkit-full-screen {
    height: 100%;
    border: none;
    border-radius: 0;
}

/* Start overlay */
.start-screen {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.4rem;
    padding: 20px;
    background: rgba(7, 11, 24, 0.85);
    color: #fff;
    font-family: 'Courier New', monospace;
}

.start-screen h2 {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 8px;
    margin: 0;
}

.start-screen .tagline {
    color: #7fdfff;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.8rem;
    margin: 0 0 0.8rem;
}

.start-screen .instructions p {
    margin: 0 0 0.7rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #cdd9f2;
}

/* Difficulty selector (start screen) */
.diff-row {
    display: flex;
    gap: 8px;
    margin-top: 0.4rem;
}

.diff-btn {
    background: #16233f;
    color: #cdd9f2;
    border: 1px solid #2b3d64;
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.diff-btn:hover {
    border-color: #3f5896;
}

.diff-btn.sel {
    background: #38b6ff;
    border-color: #38b6ff;
    color: #06263c;
}

/* Mode buttons (start screen) + end-of-round actions */
.mode-row {
    display: flex;
    gap: 10px;
    margin-top: 0.7rem;
}

.mode-button {
    background: #16233f;
    color: #cdd9f2;
    border: 1px solid #2b3d64;
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.mode-button:hover {
    border-color: #3f5896;
    background: #1d2c4c;
}

.crash-note {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 80;
    background: rgba(9, 13, 26, 0.95);
    border: 1px solid #ff6b6b;
    border-radius: 10px;
    padding: 14px 18px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-weight: 700;
}

.end-actions {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 16%;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 45;
}

.share-button {
    margin-top: 0;
    padding: 0.65rem 1.4rem;
    font-size: 0.9rem;
}

/* In-game corner buttons: exit at the bottom, hill selector above it.
   Safe-area insets keep them clear of notches and home indicators. */
#level-btn {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

.level-btn {
    position: absolute;
    left: calc(10px + env(safe-area-inset-left, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    background: rgba(16, 20, 32, 0.65);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
}

.level-btn:hover {
    background: rgba(56, 60, 74, 0.8);
}

.play-button {
    margin-top: 0.9rem;
    background: #38b6ff;
    color: #06263c;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 2.2rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.play-button:hover {
    background: #5ec6ff;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .game-wrapper { padding: 0 6px; margin-top: 0.75rem; }
    .game-logo { font-size: 1.05rem; letter-spacing: 2px; }
    .high-score-display { font-size: 0.72rem; padding: 0.3rem 0.55rem; }
    .start-screen h2 { font-size: 1.9rem; letter-spacing: 5px; }
}

/* ---------- Flight tuning modal ---------- */
.tune-modal {
    position: absolute;
    inset: 0;
    z-index: 90;   /* above the start screen (50) and crash note (80) */
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(6, 10, 22, 0.72);
}

.tune-modal.open {
    display: flex;
}

.tune-panel {
    width: min(94%, 430px);
    max-height: 88%;
    overflow-y: auto;
    background: #0d1526;
    border: 2px solid #7fdfff;
    border-radius: 10px;
    padding: 14px 16px 16px;
    font-family: 'Courier New', monospace;
    color: #eaf3ff;
}

.tune-panel h3 {
    margin: 0 0 2px;
    font-size: 1rem;
    letter-spacing: 2px;
    color: #fff;
}

.tune-note {
    margin: 0 0 12px;
    font-size: 0.7rem;
    color: #9fb0d8;
}

.tune-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 10px;
    align-items: center;
    margin-bottom: 10px;
}

.tune-row label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #8fd3ff;
    cursor: help;
}

.tune-val {
    font-size: 0.72rem;
    font-weight: 700;
    color: #ffd166;
    text-align: right;
}

.tune-row input[type="range"] {
    grid-column: 1 / -1;
    width: 100%;
    accent-color: #38b6ff;
    cursor: pointer;
}

.tune-btns {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}
