/* Cliff Jump — Big Air, Small Splash */

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: #072530;
    border: 1px solid #14485c;
    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: #0d3342;
    color: #fff;
    border: 1px solid #1d5a72;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.mute-btn:hover {
    background: #1d5a72;
}

/* 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: #061826;
    border: 1px solid #14485c;
    border-top: none;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    --chrome-accent: #35d0ba;
}

.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(5, 16, 26, 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: #cde9f2;
}

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

.diff-btn {
    background: #0d3342;
    color: #cde9f2;
    border: 1px solid #1d5a72;
    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: #2f83a3;
}

.diff-btn.sel {
    background: #35d0ba;
    border-color: #35d0ba;
    color: #05302a;
}

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

.mode-button {
    background: #0d3342;
    color: #cde9f2;
    border: 1px solid #1d5a72;
    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: #2f83a3;
    background: #114253;
}

.crash-note {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 80;
    background: rgba(5, 14, 22, 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: 12%;
    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, cliff 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(8, 22, 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(30, 62, 80, 0.8);
}

.play-button {
    margin-top: 0.9rem;
    background: #35d0ba;
    color: #05302a;
    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: #5fe0cd;
    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; }
}

/* ---------- Dive 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(4, 14, 24, 0.72);
}

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

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

.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: #8fb8c8;
}

.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: #7fdfff;
    cursor: help;
}

/* Editable readout: type a value beyond the slider range and it stretches. */
.tune-val {
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 700;
    color: #ffd166;
    text-align: right;
    width: 5.2em;
    background: rgba(255, 209, 102, 0.08);
    border: 1px solid rgba(255, 209, 102, 0.25);
    border-radius: 4px;
    padding: 1px 4px;
}

.tune-val:focus {
    outline: none;
    border-color: #ffd166;
}

/* Hide number-input spinners; the slider is the coarse control. */
.tune-val::-webkit-outer-spin-button,
.tune-val::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tune-val[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

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

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