:root {
    --gr-gap: 14px;
    --gr-rock-top: #6b4a2f;
    --gr-rock-bottom: #402b1a;
    --gr-vein: #f0b429;
    --gr-vein-glow: rgba(240, 180, 41, 0.55);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

.gr-shell {
    --gr-rock-top: #6b4a2f;
    --gr-rock-bottom: #402b1a;
    --gr-vein: #f0b429;
    --gr-vein-glow: rgba(240, 180, 41, 0.55);
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: max(16px, calc(16px + var(--safe-area-inset-bottom)));
    display: flex;
    flex-direction: column;
    gap: var(--gr-gap);
    position: relative;
    z-index: 1;
}

.gr-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.gr-back-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
}

.gr-back-btn:hover,
.gr-back-btn:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.gr-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.gr-brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--gold-glow);
    box-shadow: 0 0 12px var(--gold-glow);
    flex: 0 0 auto;
}

.gr-brand-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    color: var(--gold);
    text-shadow: 0 0 14px var(--gold-glow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gr-depth-badge {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    display: inline-flex;
    gap: 7px;
    align-items: baseline;
}

.gr-depth-badge strong {
    color: var(--cyan);
    font-size: 0.95rem;
    letter-spacing: 0;
}

.gr-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.gr-icon-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid rgba(240, 180, 41, 0.32);
    background: rgba(0, 0, 0, 0.3);
    color: var(--gold);
    cursor: pointer;
    transition: var(--transition);
}

.gr-icon-btn:hover,
.gr-icon-btn:focus-visible {
    border-color: var(--gold);
    color: var(--gold-light);
    background: rgba(240, 180, 41, 0.12);
}

.gr-ach-btn svg {
    filter: drop-shadow(0 0 6px rgba(240, 180, 41, 0.35));
}

.gr-hud {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}

.gr-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    text-align: center;
    min-width: 0;
}

.gr-stat-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.gr-stat-value {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.gr-stat-gold .gr-stat-value {
    color: var(--gold);
    text-shadow: 0 0 16px var(--gold-glow);
    font-size: 1.4rem;
}

.gr-layer-panel {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

.gr-layer-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 7px;
}

.gr-layer-name {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--gr-vein);
}

.gr-layer-progress {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.gr-offline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(240, 180, 41, 0.38);
    background: linear-gradient(100deg, rgba(240, 180, 41, 0.15), rgba(240, 180, 41, 0.04));
    color: var(--gold-light);
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(240, 180, 41, 0.1);
    animation: offline-in 0.35s ease-out;
}

.gr-offline::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 10px var(--gold);
    flex: 0 0 auto;
}

.gr-bar {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.gr-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--cyan), var(--gold));
    box-shadow: 0 0 12px var(--gold-glow);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Mine face === */
.rock-face {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    min-height: 220px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    background: var(--gr-rock-bottom);
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.6), var(--shadow-md);
    display: grid;
    place-items: center;
    isolation: isolate;
}

.rock-face:active {
    transform: translateY(1px);
}

.rock-strata {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(174deg,
            rgba(255, 255, 255, 0.05) 0 3px,
            rgba(0, 0, 0, 0.07) 3px 7px,
            transparent 7px 34px),
        linear-gradient(180deg, var(--gr-rock-top) 0%, var(--gr-rock-bottom) 100%);
    transition: background 0.6s ease;
    z-index: -2;
}

.rock-dust {
    position: absolute;
    inset: -10%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 235, 180, 0.22) 0 1px, transparent 2px),
        radial-gradient(circle at 68% 18%, rgba(255, 235, 180, 0.16) 0 1px, transparent 2px),
        radial-gradient(circle at 42% 72%, rgba(255, 235, 180, 0.18) 0 1px, transparent 2px),
        radial-gradient(circle at 86% 64%, rgba(255, 235, 180, 0.14) 0 1px, transparent 2px);
    background-size: 120px 90px, 150px 110px, 190px 140px, 170px 125px;
    opacity: 0.7;
    pointer-events: none;
    z-index: -1;
    animation: rock-dust-drift 18s linear infinite;
}

.rock-rubble {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 13% 22%, rgba(20, 10, 4, 0.4) 0 2px, transparent 3px),
        radial-gradient(circle at 78% 78%, rgba(20, 10, 4, 0.35) 0 3px, transparent 4px),
        radial-gradient(circle at 61% 34%, rgba(255, 235, 190, 0.12) 0 2px, transparent 3px),
        radial-gradient(circle at 34% 84%, rgba(255, 235, 190, 0.1) 0 2px, transparent 3px),
        radial-gradient(circle at 90% 36%, rgba(20, 10, 4, 0.32) 0 2px, transparent 3px);
    pointer-events: none;
    z-index: -1;
}

.rock-cracks {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: rgba(18, 9, 4, 0.4);
    stroke-width: 0.8;
    pointer-events: none;
    z-index: -1;
    transition: stroke 0.25s ease, opacity 0.25s ease;
}

.rock-cracks path {
    vector-effect: non-scaling-stroke;
}

.rock-face.crit-hit .rock-cracks {
    stroke: var(--gr-vein);
    opacity: 0.8;
}

.rock-vein {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 44%;
    height: 16%;
    background:
        radial-gradient(closest-side, var(--gr-vein-glow), transparent 72%),
        linear-gradient(90deg, transparent, var(--gr-vein) 22%, #fff6d6 50%, var(--gr-vein) 78%, transparent);
    opacity: 0.42;
    filter: blur(1px);
    transform: rotate(-6deg);
    border-radius: 50%;
    transition: opacity 0.5s ease, background 0.6s ease;
    z-index: -1;
    animation: vein-pulse 3.4s ease-in-out infinite;
}

.rock-pick {
    width: min(46%, 210px);
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55));
    transform: rotate(-8deg);
    transition: transform 0.12s ease;
    animation: pick-idle 3.8s ease-in-out infinite;
}

.impact-ring {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 2px solid var(--gr-vein);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
    pointer-events: none;
    z-index: 4;
}

.impact-ring.is-crit {
    border-width: 3px;
    box-shadow: 0 0 18px var(--gr-vein-glow);
}

.impact-ring.is-active {
    animation: impact-ring 0.36s ease-out;
}

.pick-rivet {
    fill: var(--gr-vein);
}

.rock-face.swing .rock-pick {
    animation: pick-swing 0.2s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.rock-face.crit-hit .rock-vein {
    opacity: 1;
    filter: blur(0);
}

.crit-tag {
    position: absolute;
    top: 14%;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: clamp(0.85rem, 3.4vw, 1.15rem);
    letter-spacing: 2px;
    color: #fff3c4;
    text-shadow: 0 0 18px var(--gold), 0 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 4;
    pointer-events: none;
    animation: crit-pop 0.7s ease-out;
}

.float-layer,
.coin-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 3;
}

.float-num {
    position: absolute;
    transform: translate(-50%, -50%);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: clamp(0.9rem, 4vw, 1.35rem);
    color: var(--gold-light);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
    opacity: 0;
    white-space: nowrap;
}

.float-num.is-active {
    animation: float-up 0.95s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.float-num.is-crit {
    font-size: clamp(1.2rem, 6vw, 2.1rem);
    color: #fff2b8;
    text-shadow: 0 0 20px var(--gold), 0 2px 6px rgba(0, 0, 0, 0.9);
}

.float-num.is-crit.is-active {
    animation: float-up-crit 1.1s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.coin-dot {
    position: absolute;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, #fff4c2, var(--gold) 55%, var(--gold-dark));
    border: 1px solid rgba(0, 0, 0, 0.35);
    opacity: 0;
}

.coin-dot.is-active {
    animation: coin-burst 0.72s cubic-bezier(0.15, 0.6, 0.4, 1) forwards;
}

/* === Shop === */
.gr-shop {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}

.gr-shop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.gr-shop-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.gr-buy-mode {
    display: inline-flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.32);
    padding: 4px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

.gr-mode-btn {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-weight: 800;
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
}

.gr-mode-btn.active {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #1b1206;
}

.gr-upgrade-list {
    display: grid;
    gap: 8px;
}

.gr-shop-hint {
    margin-bottom: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 92, 92, 0.14);
    border: 1px solid rgba(255, 92, 92, 0.4);
    color: #ffb4b4;
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
}

.gr-upgrade {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 10px;
    align-items: center;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 9px 10px;
    transition: var(--transition);
}

.gr-upgrade.affordable {
    border-color: rgba(240, 180, 41, 0.45);
    background: rgba(240, 180, 41, 0.07);
}

.gr-upgrade-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    color: var(--gold);
    font-size: 1.1rem;
    line-height: 1;
}

.gr-upgrade-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gr-upgrade-body {
    min-width: 0;
}

.gr-upgrade-top {
    display: flex;
    align-items: baseline;
    gap: 8px;
    justify-content: space-between;
}

.gr-upgrade-name {
    font-weight: 800;
    font-size: 0.92rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gr-upgrade-level {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--cyan);
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
}

.gr-upgrade-desc {
    margin: 2px 0 0;
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.gr-upgrade-effect {
    display: inline-block;
    margin-top: 3px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--gold);
}

.gr-upgrade-buy {
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #1b1206;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 9px 12px;
    min-width: 84px;
    min-height: 44px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    transition: var(--transition-fast);
}

.gr-upgrade-buy:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.gr-upgrade-buy:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* === Full-screen layer banner === */
.gr-banner {
    position: fixed;
    inset: 0;
    z-index: var(--z-game-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    background: radial-gradient(circle at 50% 45%, rgba(240, 180, 41, 0.22), rgba(4, 6, 12, 0.92) 62%);
    backdrop-filter: blur(6px);
    animation: banner-in 0.35s ease-out;
}

.gr-banner-inner {
    animation: banner-pop 0.5s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.gr-banner-kicker {
    font-size: clamp(0.75rem, 3vw, 1rem);
    font-weight: 900;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: var(--gold);
    text-shadow: 0 0 22px var(--gold-glow);
}

.gr-banner-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 9vw, 4rem);
    font-weight: 900;
    margin-top: 8px;
    background: linear-gradient(135deg, #fff, var(--gold-light) 55%, var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.gr-banner-sub {
    margin-top: 6px;
    font-size: clamp(0.9rem, 4vw, 1.3rem);
    font-weight: 800;
    color: var(--cyan);
    letter-spacing: 1px;
}

/* === Story overlays === */
.gr-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-game-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(6, 5, 4, 0.9);
    backdrop-filter: blur(8px);
    overflow-y: auto;
}

.gr-overlay-card {
    background: linear-gradient(150deg, rgba(30, 22, 12, 0.97), rgba(10, 8, 6, 0.99));
    border: 1px solid rgba(240, 180, 41, 0.28);
    border-radius: var(--radius-xl);
    padding: 30px 26px;
    width: min(460px, 94vw);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 40px var(--gold-glow);
}

.gr-overlay-logo {
    display: block;
    margin: 0 auto 14px;
    width: 92px;
    height: 92px;
    filter: drop-shadow(0 6px 18px rgba(240, 180, 41, 0.35));
}

.gr-overlay-kicker {
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 3.5px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 10px;
}

.gr-overlay-title {
    font-family: var(--font-heading);
    font-size: clamp(1.35rem, 6vw, 1.85rem);
    font-weight: 900;
    margin: 0 0 14px;
    line-height: 1.2;
    color: var(--text-primary);
}

.gr-story {
    text-align: left;
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.gr-story p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.gr-story p:first-child::first-letter {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.6em;
    line-height: 1;
    color: var(--gold);
    float: left;
    margin: 2px 6px 0 0;
}

.gr-epilogue-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.gr-epilogue-stats div {
    background: rgba(240, 180, 41, 0.08);
    border: 1px solid rgba(240, 180, 41, 0.22);
    border-radius: var(--radius-md);
    padding: 10px 6px;
    display: grid;
    gap: 3px;
}

.gr-epilogue-stats span {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.gr-epilogue-stats strong {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}

.gr-btn-primary {
    width: 100%;
    border: 0;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #1b1206;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 0.95rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 14px 18px;
    min-height: 48px;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(240, 180, 41, 0.28);
    transition: var(--transition);
}

.gr-btn-primary:hover,
.gr-btn-primary:focus-visible {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

/* === Layer palettes === */
.gr-shell[data-layer="1"] {
    --gr-rock-top: #7a5636;
    --gr-rock-bottom: #3f2a19;
    --gr-vein: #e0a83a;
    --gr-vein-glow: rgba(224, 168, 58, 0.5);
}

.gr-shell[data-layer="2"] {
    --gr-rock-top: #5b6472;
    --gr-rock-bottom: #2b313b;
    --gr-vein: #f2c14e;
    --gr-vein-glow: rgba(242, 193, 78, 0.55);
}

.gr-shell[data-layer="3"] {
    --gr-rock-top: #4a5f7e;
    --gr-rock-bottom: #1d2740;
    --gr-vein: #a8e6ff;
    --gr-vein-glow: rgba(125, 211, 252, 0.65);
}

.gr-shell[data-layer="4"] {
    --gr-rock-top: #4a2415;
    --gr-rock-bottom: #171012;
    --gr-vein: #ff8a3d;
    --gr-vein-glow: rgba(255, 122, 61, 0.65);
}

.gr-shell[data-layer="5"] {
    --gr-rock-top: #4d3208;
    --gr-rock-bottom: #140f05;
    --gr-vein: #ffd75e;
    --gr-vein-glow: rgba(255, 215, 94, 0.85);
}

.gr-shell[data-layer="3"] .rock-vein {
    animation: vein-pulse 2.2s ease-in-out infinite;
}

.gr-shell[data-layer="4"] .rock-strata {
    background:
        repeating-linear-gradient(174deg,
            rgba(255, 140, 60, 0.09) 0 3px,
            rgba(0, 0, 0, 0.16) 3px 8px,
            transparent 8px 32px),
        linear-gradient(180deg, var(--gr-rock-top) 0%, var(--gr-rock-bottom) 100%);
}

.gr-shell[data-layer="4"] .rock-face {
    box-shadow: inset 0 -40px 70px rgba(255, 90, 20, 0.28), inset 0 0 60px rgba(0, 0, 0, 0.7), var(--shadow-md);
}

.gr-shell[data-layer="5"] .rock-face {
    box-shadow: inset 0 0 90px rgba(255, 196, 60, 0.3), inset 0 0 40px rgba(0, 0, 0, 0.6), 0 0 34px var(--gold-glow);
}

/* === Motion === */
@keyframes pick-swing {
    0% { transform: rotate(-8deg) translate(0, 0); }
    35% { transform: rotate(-34deg) translate(-6px, -8px); }
    70% { transform: rotate(10deg) translate(5px, 7px); }
    100% { transform: rotate(-8deg) translate(0, 0); }
}

@keyframes pick-idle {
    0%, 100% { transform: rotate(-8deg) translateY(0); }
    50% { transform: rotate(-6deg) translateY(-3px); }
}

@keyframes impact-ring {
    0% { opacity: 0.85; transform: translate(-50%, -50%) scale(0.3); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(2.8); }
}

@keyframes rock-dust-drift {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-18px, -12px, 0); }
}

@keyframes offline-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

@keyframes vein-pulse {
    0%, 100% { opacity: 0.34; }
    50% { opacity: 0.62; }
}

@keyframes float-up {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
    18% { opacity: 1; transform: translate(-50%, -60%) scale(1.08); }
    100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}

@keyframes float-up-crit {
    0% { opacity: 0; transform: translate(-50%, -20%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -70%) scale(1.3); }
    60% { opacity: 1; transform: translate(-50%, -130%) scale(1.15); }
    100% { opacity: 0; transform: translate(-50%, -220%) scale(1); }
}

@keyframes coin-burst {
    0% { opacity: 0; transform: translate(0, 0) scale(0.5); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -80px)) scale(1); }
}

@keyframes crit-pop {
    0% { opacity: 0; transform: translateX(-50%) scale(0.6); }
    30% { opacity: 1; transform: translateX(-50%) scale(1.15); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(1); }
}

@keyframes banner-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes banner-pop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes gr-nudge {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-4px, 2px); }
    50% { transform: translate(4px, -2px); }
    75% { transform: translate(-2px, -2px); }
}

.gr-shell.nudge {
    animation: gr-nudge 0.24s ease-in-out;
}

/* === Focus === */
.rock-face:focus-visible,
.gr-mode-btn:focus-visible,
.gr-upgrade-buy:focus-visible,
.gr-btn-primary:focus-visible,
.gr-back-btn:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}

.rock-face:focus:not(:focus-visible) {
    outline: none;
}

/* === Responsive === */
@media (max-width: 768px) {
    .gr-shell {
        padding: 10px;
        padding-bottom: max(10px, calc(10px + var(--safe-area-inset-bottom)));
        gap: 10px;
    }

    .gr-hud {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 10px;
    }

    .gr-stat-value {
        font-size: 1rem;
    }

    .gr-stat-gold .gr-stat-value {
        font-size: 1.3rem;
    }

    .rock-face {
        aspect-ratio: 5 / 4;
        min-height: 200px;
    }

    .gr-upgrade {
        grid-template-columns: 34px 1fr auto;
        gap: 8px;
        padding: 8px;
    }

    .gr-upgrade-icon {
        width: 34px;
        height: 34px;
    }

    .gr-upgrade-desc {
        font-size: 0.7rem;
    }

    .gr-upgrade-buy {
        min-width: 74px;
        padding: 9px 8px;
        font-size: 0.75rem;
    }

    .gr-overlay-card {
        padding: 24px 18px;
    }

    .gr-overlay-logo {
        width: 72px;
        height: 72px;
    }

    .gr-epilogue-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .gr-epilogue-stats strong {
        font-size: 0.85rem;
    }
}

@media (max-width: 420px) {
    .gr-topbar {
        gap: 8px;
    }

    .gr-brand-name {
        font-size: 1rem;
    }

    .gr-upgrade-top {
        flex-wrap: wrap;
    }
}

/* games/_base.css resets body padding on small screens with variables that are
   never declared, so the fixed site header would overlap the top bar. */
@media (max-width: 768px) {
    body {
        padding-top: max(var(--app-header-h), var(--safe-area-inset-top));
        padding-bottom: max(8px, var(--safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .float-num.is-active {
        animation: none !important;
        opacity: 1;
    }

    .coin-dot.is-active {
        animation: none !important;
        opacity: 0;
    }

    .gr-banner,
    .gr-banner-inner,
    .crit-tag {
        animation: none !important;
    }

    .rock-face:active {
        transform: none;
    }

    .rock-pick,
    .rock-dust,
    .impact-ring,
    .gr-offline {
        animation: none !important;
    }

    .impact-ring.is-active {
        opacity: 0;
    }
}

/* --- Short-phone layout ------------------------------------------------ */
.gr-overlay {
    inset: var(--app-header-h, 72px) 0 0;
    align-items: flex-start;
    padding: 12px;
}

.gr-overlay-card {
    margin: auto;
    max-height: calc(100dvh - var(--app-header-h, 72px) - 24px);
}

body:has(#goldRushShell) .achievements-button {
    visibility: hidden;
}

@media (max-width: 480px) {
    .gr-topbar { flex-wrap: nowrap; gap: 6px; }
    .gr-topbar-actions { gap: 4px; }
    .gr-icon-btn { width: 32px; height: 32px; }
    .gr-icon-btn svg { width: 16px; height: 16px; }
    .gr-back-btn {
        width: 32px;
        height: 32px;
        padding: 0;
        font-size: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .gr-back-btn::before { content: "←"; font-size: 15px; }
    .gr-brand { gap: 6px; min-width: 0; }
    .gr-brand-icon { width: 28px; height: 28px; }
    .gr-brand-name {
        font-size: 0.92rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .gr-depth-badge {
        font-size: 0.6rem;
        padding: 4px 7px;
        white-space: nowrap;
    }

    .gr-hud {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        padding: 8px 6px;
    }
    .gr-stat { padding: 4px 2px; gap: 1px; }
    .gr-stat-label { font-size: 0.48rem; letter-spacing: 0.02em; }
    .gr-stat-value { font-size: 0.9rem; }
    .gr-layer-panel { padding: 6px 10px; }
    .gr-layer-meta { font-size: 0.65rem; }
    .gr-offline { padding: 7px 9px; font-size: 0.72rem; }

    .gr-overlay-card { padding: 20px 16px; }
    .gr-overlay-logo { width: 64px; height: 64px; margin-bottom: 8px; }
    .gr-overlay-kicker { font-size: 0.62rem; letter-spacing: 2px; margin-bottom: 6px; }
    .gr-overlay-title { font-size: 1.25rem; margin-bottom: 8px; }
    .gr-story { gap: 6px; }
    .gr-story p { font-size: 0.82rem; line-height: 1.45; }
    .gr-btn-primary { padding: 10px 14px; min-height: 44px; font-size: 0.85rem; }
}

@media (max-width: 360px) {
    .gr-brand-icon {
        display: none;
    }

    #prologuePlay,
    #epilogueContinue {
        position: sticky;
        bottom: 0;
        z-index: 2;
        box-shadow: 0 -10px 22px rgba(6, 5, 4, 0.95), 0 8px 22px rgba(240, 180, 41, 0.18);
    }
}
