/* ==========================================================
   Dino game - fully scoped. Site ke html/body ko touch nahi karta.
   Site variables use hote hain (--rule, --paper-2, --ink, --muted)
   aur fallback values bhi di gayi hain.
   ========================================================== */

.dino-card {
    width: 100%;
    max-width: 600px;
    margin: 2rem 0;
}

/* ---------- Game stage ---------- */

.dino-stage {
    position: relative;
    width: 100%;
    height: 170px;
    overflow: hidden;
    border: 1px solid var(--rule, #d9d9d9);
    border-radius: 6px;
    background: var(--paper-2, #f7f7f7);
    outline: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 0.8s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.dino-stage:focus-visible,
.dino-stage:focus {
    border-color: var(--ink, #535353);
    box-shadow: 0 0 0 3px rgba(83, 83, 83, 0.12);
}

/* ---------- Elements created by dino.js ---------- */

.dino-stage .runner-container {
    position: absolute;
    top: 10px;
    left: 0;
    width: 44px;            /* intro animation isse full width tak expand karti hai */
    height: 150px;
    max-width: 100%;
    overflow: hidden;
    z-index: 2;
}

.dino-stage .runner-canvas {
    position: absolute;
    top: 0;
    left: 0;
    height: 150px;
    max-width: 100%;
    image-rendering: pixelated;
    transition: filter 0.8s ease;
}

/* Mobile par touch area sirf game box tak */
.dino-stage .controller {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: transparent;
}

/* ---------- Night mode (sirf game box) ---------- */

.dino-stage.inverted {
    background: #1f2023;
    border-color: #3a3b40;
}

.dino-stage.inverted .runner-canvas {
    filter: invert(1);
}

/* ---------- Start hint ---------- */

.dino-hint {
    position: absolute;
    left: 0;
    right: 0;
    top: 58px;
    z-index: 3;
    text-align: center;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    color: var(--muted, #8a8a8a);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.dino-hint-touch {
    display: none;
}

@media (hover: none) {
    .dino-hint-desktop { display: none; }
    .dino-hint-touch   { display: inline; }
}

.dino-stage.is-playing .dino-hint {
    opacity: 0;
}

/* ---------- Controls legend ---------- */

.dino-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    margin: 0.75rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.82rem;
    color: var(--muted, #777);
}

.dino-controls kbd {
    display: inline-block;
    min-width: 1.5em;
    padding: 0.05em 0.45em;
    margin-right: 0.2em;
    text-align: center;
    font-family: inherit;
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--ink, #333);
    background: var(--paper-2, #f7f7f7);
    border: 1px solid var(--rule, #d0d0d0);
    border-bottom-width: 2px;
    border-radius: 4px;
}

#offline-resources {
    display: none;
}

@media (max-width: 420px) {
    .dino-controls {
        font-size: 0.78rem;
    }
}

/* ---------- Pause overlay ---------- */

.dino-paused {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(247, 247, 247, 0.75);
    color: var(--ink, #333);
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 0.85rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.dino-stage.is-paused .dino-paused {
    opacity: 1;
}

.dino-stage.inverted .dino-paused {
    background: rgba(31, 32, 35, 0.75);
    color: #ddd;
}

/* ---------- Pause button ---------- */

.dino-controls-btn {
    margin-left: auto;
}

.dino-btn {
    padding: 0.2em 0.9em;
    font: inherit;
    color: var(--ink, #333);
    background: var(--paper-2, #f7f7f7);
    border: 1px solid var(--rule, #d0d0d0);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.dino-btn:hover,
.dino-btn:focus-visible {
    border-color: var(--ink, #535353);
    outline: none;
}