/* Rock Skip — Still Water
   Identity: dusk at a glassy lake. Burnt-orange sky sinking into deep teal
   water, black pine silhouettes, warm amber accents. Fraunces for the title
   voice, Inter for UI. Quiet, warm, nothing neon. */

body {
    background-color: #f5f4f0;
}

.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: #0c1418;
    border: 1px solid #23343a;
    border-radius: 12px 12px 0 0;
    padding: 10px 14px;
}

.game-logo {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 650;
    letter-spacing: 1px;
    color: #f2e9dc;
    font-size: 1.3rem;
    margin: 0;
}

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

.high-score-display {
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
    font-weight: 700;
    color: #ffb35c;
    background: rgba(255, 179, 92, 0.12);
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    white-space: nowrap;
}

.mute-btn {
    background: #14232a;
    color: #f2e9dc;
    border: 1px solid #2b4048;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

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

/* The playfield: viewport height minus site nav + game header, same recipe as
   the other games so portrait and landscape both work. */
.canvas-container {
    position: relative;
    width: 100%;
    height: 70vh; /* fallback for browsers without dvh */
    height: max(430px, min(calc(100dvh - 230px), 820px));
    background: #0a1216;
    border: 1px solid #23343a;
    border-top: none;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    --chrome-accent: #ffb35c;
    font-family: 'Inter', sans-serif;
}

.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;
    justify-content: safe center; /* don't clip the top when content overflows */
    text-align: center;
    gap: 0.4rem;
    padding: 20px;
    background:
        linear-gradient(180deg,
            rgba(20, 12, 34, 0.88) 0%,
            rgba(52, 24, 40, 0.86) 34%,
            rgba(122, 55, 28, 0.82) 52%,
            rgba(10, 30, 34, 0.9) 68%,
            rgba(6, 18, 21, 0.94) 100%);
    color: #f2e9dc;
    overflow-y: auto;
}

.start-screen h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 2.7rem;
    font-weight: 650;
    letter-spacing: 4px;
    margin: 0;
    text-shadow: 0 2px 24px rgba(255, 140, 60, 0.35);
}

.start-screen .tagline {
    color: #ffb35c;
    letter-spacing: 5px;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 0 0 0.8rem;
}

.start-screen .instructions p {
    margin: 0 0 0.6rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #e4d8c6;
    max-width: 460px;
}

/* Conditions selector */
.cond-row {
    display: flex;
    gap: 8px;
    margin-top: 0.4rem;
}

.cond-btn {
    background: rgba(12, 24, 28, 0.72);
    color: #d9cdb9;
    border: 1px solid #3a5058;
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.cond-btn:hover {
    border-color: #5a7680;
}

.cond-btn.sel {
    background: #ffb35c;
    border-color: #ffb35c;
    color: #24160a;
}

/* Mode buttons + end-of-round actions */
.mode-row {
    display: flex;
    gap: 10px;
    margin-top: 0.7rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-button {
    background: rgba(12, 24, 28, 0.72);
    color: #e4d8c6;
    border: 1px solid #3a5058;
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.mode-button:hover {
    border-color: #ffb35c;
    background: rgba(30, 40, 44, 0.85);
}

.mode-button-quiet {
    font-size: 0.76rem;
    padding: 0.45rem 0.9rem;
    opacity: 0.85;
}

/* Challenge invitation card on the start screen */
.rs-invite {
    background: rgba(8, 16, 18, 0.8);
    border: 1px solid #ffb35c;
    border-radius: 12px;
    padding: 12px 18px;
    margin: 0.4rem 0 0.2rem;
    max-width: 420px;
}

.rs-invite .rs-invite-name { color: #ffb35c; font-weight: 700; }

/* While an invite is pending, the challenge is the only warm thing on screen. */
.rs-has-invite #play-button {
    background: transparent;
    border: 1px solid #3a5058;
    color: #e4d8c6;
}
.rs-has-invite #play-button:hover { border-color: #ffb35c; transform: none; }
.rs-has-invite .mode-row { opacity: 0.65; }
.rs-invite p { margin: 0 0 6px; font-size: 0.9rem; }
.rs-invite .rs-invite-score {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rs-panel .rs-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: #b8ab95;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
}

.rs-panel .rs-close:hover { color: #f2e9dc; }

.rs-panel .rs-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.rs-panel .rs-btn {
    background: rgba(12, 24, 28, 0.9);
    color: #e4d8c6;
    border: 1px solid #3a5058;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
}

.rs-panel .rs-btn:hover { border-color: #ffb35c; }

.rs-panel .rs-btn-hot {
    background: #ffb35c;
    border-color: #ffb35c;
    color: #24160a;
}

.rs-panel .rs-btn-hot:hover { background: #ffc57e; }

.rs-panel .rs-tabs {
    display: flex;
    gap: 6px;
    margin: 4px 0 10px;
}

.rs-panel .rs-tab {
    background: none;
    border: 1px solid #3a5058;
    border-radius: 6px;
    color: #b8ab95;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 10px;
    cursor: pointer;
}

.rs-panel .rs-tab.sel {
    background: #ffb35c;
    border-color: #ffb35c;
    color: #24160a;
}

.play-button {
    margin-top: 0.9rem;
    background: #ffb35c;
    color: #24160a;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 2.4rem;
    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: #ffc57e;
    transform: translateY(-1px);
}

.crash-note {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 80;
    background: rgba(8, 14, 16, 0.95);
    border: 1px solid #e06a5a;
    border-radius: 10px;
    padding: 14px 18px;
    color: #f2e9dc;
    font-weight: 700;
}

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

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

/* In-game corner buttons (menu/exit) */
.corner-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(10, 18, 20, 0.65);
    color: #f2e9dc;
    border: 1px solid rgba(242, 233, 220, 0.25);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
}

.corner-btn:hover {
    background: rgba(30, 44, 48, 0.8);
}

/* ---------- Panels (results, leaderboards, challenge banner) ----------
   Built by JS; styled here. Warm paper-on-dusk: deep panel, amber headings. */
.rs-scrim {
    position: absolute;
    inset: 0;
    z-index: 59;
    background: rgba(4, 8, 10, 0.6);
}

.rs-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 60;
    width: min(440px, calc(100% - 28px));
    max-height: calc(100% - 28px);
    overflow-y: auto;
    background: #081012;
    border: 1px solid #34494f;
    border-radius: 14px;
    padding: 18px 20px;
    color: #f2e9dc;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.rs-panel h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 650;
    font-size: 1.25rem;
    margin: 0 0 4px;
    color: #ffb35c;
}

.rs-panel .rs-sub {
    font-size: 0.78rem;
    color: #b8ab95;
    margin: 0 0 12px;
}

.rs-panel table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.rs-panel table td, .rs-panel table th {
    padding: 5px 6px;
    text-align: left;
    border-bottom: 1px solid rgba(242, 233, 220, 0.08);
}

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

.rs-panel .rs-me {
    color: #ffb35c;
    font-weight: 700;
}

.rs-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.rs-stat {
    flex: 1 1 90px;
    background: rgba(20, 35, 42, 0.7);
    border: 1px solid #2b4048;
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
}

.rs-stat .rs-num {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    color: #f2e9dc;
    font-variant-numeric: tabular-nums;
}

.rs-stat .rs-lbl {
    display: block;
    font-size: 0.66rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #b8ab95;
    margin-top: 2px;
}

/* Challenge banner (top of playfield when playing a friend's water) */
.rs-banner {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 42;
    background: rgba(8, 16, 18, 0.85);
    border: 1px solid #ffb35c;
    border-radius: 10px;
    padding: 7px 14px;
    color: #f2e9dc;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    max-width: calc(100% - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
}

.rs-banner .rs-vs {
    color: #ffb35c;
    font-weight: 700;
}

/* Achievement / info toasts */
.rs-toast {
    position: absolute;
    top: 54px;   /* below the RMChrome fullscreen/help cluster */
    right: 12px;
    z-index: 70;
    background: rgba(8, 16, 18, 0.94);
    border: 1px solid #ffb35c;
    border-left-width: 4px;
    border-radius: 10px;
    padding: 10px 14px;
    color: #f2e9dc;
    font-size: 0.82rem;
    max-width: 260px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
    animation: rs-toast-in 0.35s ease;
}

.rs-toast b { color: #ffb35c; }

@keyframes rs-toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .rs-toast { animation: none; }
    .play-button:hover { transform: none; }
}

@media (max-width: 480px) {
    .game-wrapper { padding: 0 6px; margin-top: 0.75rem; }
    .game-logo { font-size: 1.05rem; }
    .high-score-display { font-size: 0.7rem; padding: 0.3rem 0.55rem; }
    .start-screen h2 { font-size: 2rem; letter-spacing: 2px; }
    .start-screen .instructions p { font-size: 0.85rem; }
    .cond-btn { padding: 0.5rem 0.8rem; font-size: 0.76rem; }
    .mode-button { font-size: 0.8rem; padding: 0.55rem 0.9rem; }
}
