/* General */
* { 
    user-select: none; 
    -webkit-user-select: none; 
    -moz-user-select: none; 
    -ms-user-select: none; 
    outline: none; 
    -webkit-touch-callout: none;
    box-sizing: border-box;
    -ms-overflow-style: none;
    scrollbar-width: none;
    touch-action: manipulation;
}

::-webkit-scrollbar {
    display: none;
}

/* Nuclear zoom prevention on html root */
html {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html, body {
    overscroll-behavior: none;
    overflow: hidden;
    position: fixed;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    touch-action: none;
}

body {
    font-family: 'Courier New', Courier, monospace;
    text-align: center; 
    background-color: #1a1a1a; 
    color: #ffd700;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: space-evenly;
    margin: 0; 
    transition: filter 0.5s, background-color 2s;
    padding: 6px 0;
}

/* ── Dynamic Background Scaling Fix ── */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    background: url('images/background.jpg') no-repeat center center;
    background-size: cover;
    z-index: -10;
    pointer-events: none;
    transition: background-image 0.5s ease-in-out;
}

.battle-bg::before { background-image: linear-gradient(rgba(68,17,17,0.85),rgba(68,17,17,0.85)), url('images/background.jpg') !important; }
body.body-jail::before { background-image: url('images/jail.webp') !important; }

.jail-bg { filter: grayscale(90%) sepia(20%) brightness(60%); }

/* ── Mute Button ── */
#mute-btn {
    position: fixed;
    bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    left: calc(15px + env(safe-area-inset-left, 0px));
    z-index: 10000;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #ffd700;
    border-radius: 6px;
    color: #ffd700;
    font-size: 20px;
    padding: 8px 12px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    line-height: 1;
}
#mute-btn:active { transform: scale(0.95); }

/* Glitch Effect */
@keyframes glitch-anim {
    0%   { filter: none; transform: translate(0); }
    6%   { filter: hue-rotate(90deg) brightness(2.5); transform: skewX(12deg) translateX(8px); }
    12%  { filter: invert(1); transform: skewX(-7deg) translateX(-6px); }
    18%  { filter: none; transform: translate(0); }
    24%  { filter: hue-rotate(200deg) saturate(10) brightness(2); transform: skewX(9deg) translateX(14px); }
    30%  { filter: brightness(0.02); transform: skewX(-12deg) translateX(-10px); }
    36%  { filter: none; transform: translate(0); }
    42%  { filter: hue-rotate(270deg) brightness(3); transform: skewX(6deg); }
    48%  { filter: invert(0.95) hue-rotate(45deg) saturate(5); transform: translateX(16px); }
    54%  { filter: brightness(4); transform: skewX(-8deg) translateX(-7px); }
    60%  { filter: none; transform: translate(0); }
    66%  { filter: hue-rotate(135deg) saturate(8) brightness(0.15); transform: skewX(5deg); }
    72%  { filter: invert(1) brightness(2); transform: skewX(-4deg) translateX(-12px); }
    78%  { filter: none; transform: translate(0); }
    84%  { filter: hue-rotate(310deg) brightness(3); transform: skewX(10deg) translateX(9px); }
    90%  { filter: brightness(0.05); transform: translate(0); }
    96%  { filter: hue-rotate(60deg) saturate(12) brightness(2.5); transform: skewX(-6deg); }
    100% { filter: none; transform: translate(0); }
}

.glitch-effect { animation: glitch-anim 0.2s steps(1) infinite; }

/* ── Freedom Flash Overlay (also used for Welcome Stranger announcement) ── */
#freedom-flash {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 25000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #ffd700;
    font-size: clamp(18px, 5vw, 28px);
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-align: center;
    padding: 20px;
    line-height: 1.6;
    animation: freedomPulse 0.4s ease-in-out infinite alternate;
    pointer-events: none;
}
@keyframes freedomPulse {
    from { opacity: 0.6; text-shadow: 0 0 12px #ffd700; }
    to   { opacity: 1;   text-shadow: 0 0 50px #ffd700, 0 0 100px #ffaa00; }
}

/* ── Intro Modal & Swoop Animation ── */
#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.92);
    z-index: 40000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: max(env(safe-area-inset-top, 10px), 10px)
             max(env(safe-area-inset-right, 10px), 10px)
             max(env(safe-area-inset-bottom, 10px), 10px)
             max(env(safe-area-inset-left, 10px), 10px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#intro-modal {
    background: #2a2a2a;
    border: 4px solid #ffd700;
    padding: clamp(10px, 2vh, 15px);
    width: 100%;
    max-width: 420px;
    border-radius: 10px;
    text-align: center;
    flex-shrink: 0;
    transform: translateZ(0);
    will-change: transform;
    margin: auto;
}

.swoop-in {
    animation: swoopIn 0.7s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    transform: translateY(-100vh);
}

@keyframes swoopIn {
    to { transform: translateY(0); }
}

.origin-btn {
    width: 100%; padding: 8px; font-size: 14px; background: #333; 
    color: white; border: 2px solid #555; border-radius: 5px; text-align: left;
}
.origin-title { font-size: 14px; margin-bottom: 2px; font-weight: bold; }
.origin-title img { vertical-align: middle; margin-right: 5px; }
.desc-text { color: #dddddd; font-size: 10px; display: block; margin-bottom: 3px; line-height: 1.2;}
.benefit-text { color: #55ff55; font-size: 10px; font-weight: bold; display: block; }
.downside-text { color: #ff5555; font-size: 10px; font-weight: bold; display: block; }

@media (hover: hover) {
    .origin-btn:hover { background: #444; border-color: #ffd700; }
    button:not(:disabled) { cursor: pointer; }
}

/* ── Header Card ── */
#site-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    background: rgba(20, 20, 20, 0.88);
    border: 2px solid #ffd700;
    padding: 16px 16px;
    width: 110%;
    backdrop-filter: blur(6px);
    flex-shrink: 0;
}

#site-logo {
    height: 38px;
    width: auto;
    filter: drop-shadow(0 0 8px #ffd700);
    flex-shrink: 0;
}

#site-title {
    font-size: clamp(24px, 6.5vw, 34px);
    font-family: 'Courier New', Courier, monospace;
    color: #ffd700;
    margin: 0;
    font-weight: bold;
    text-shadow: 0 0 12px #ffd700, 0 0 25px rgba(255,215,0,0.4);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Eureka Flag */
#eureka-flag { 
    position: absolute; 
    bottom: -150vh; 
    left: 50%; 
    transform: translateX(-50%); 
    transition: bottom 4s cubic-bezier(0.4,0,0.2,1); 
    z-index: 2000; 
    pointer-events: none; 
    width: 200vw; 
    max-width: 1200px; 
}
#eureka-flag img { width: 100%; height: auto; vertical-align: middle; }

#eureka-flag.raised { 
    bottom: -15%; 
    animation: waveFlag 5s ease-in-out infinite alternate; 
}
@keyframes waveFlag {
    0%   { transform: translateX(-50%) rotate(-4deg) skewX(2deg); }
    100% { transform: translateX(-50%) rotate(4deg) skewX(-2deg); }
}

/* ── Battle Layer ── */
#battle-layer { 
    position: fixed; bottom: 0; left: 0; width: 100%; height: 250px; 
    display: none; justify-content: space-around; align-items: flex-end; 
    z-index: 100; overflow: hidden;
    opacity: 0; transform: translateY(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
#battle-layer.active { opacity: 1; transform: translateY(0); }

.waving-sword { 
    display: inline-block; padding-bottom: 10px;
    transform-origin: bottom center; 
    animation: meleeSlash 2s infinite ease-in-out;
}
@keyframes meleeSlash {
    0%, 100% { transform: translate(0,0px) rotate(-25deg) scale(0.9); }
    50%       { transform: translate(0,-15px) rotate(25deg) scale(1.1); }
}

/* ── Welcome Stranger nugget ── */
.welcome-stranger { 
    position: absolute;
    z-index: 22000;
    width: 220px;
    height: 180px;
    background: radial-gradient(circle at 30% 30%, #fff700, #ffaa00);
    border-radius: 45% 55% 40% 60%;
    box-shadow: 0 0 60px #ffd700, 0 0 120px #ffaa00, 0 0 200px rgba(255,200,0,0.5);
    animation: superPulse 0.6s infinite alternate;
    top: 25vh;
    left: 50%;
    transform: translateX(-50%);
    cursor: pointer;
}

/* Welcome Stranger appears with a dramatic zoom-in */
@keyframes wsAppear {
    from { transform: translateX(-50%) scale(0.1); opacity: 0; }
    to   { transform: translateX(-50%) scale(1);   opacity: 1; }
}
.welcome-stranger { animation: wsAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, superPulse 0.6s 0.6s infinite alternate; }

@keyframes superPulse { 
    from { transform: translateX(-50%) scale(1) rotate(-3deg); filter: brightness(1); } 
    to   { transform: translateX(-50%) scale(1.2) rotate(3deg); filter: brightness(1.5); } 
}

/* ── Drifting Nuggets ── */
.small-nugget {
    position: absolute; z-index: 50; width: 45px; height: 35px;
    background: radial-gradient(circle at 30% 30%, #fff700, #ffaa00); border-radius: 45% 55% 40% 60%;
    box-shadow: 0 0 15px #ffd700; 
    animation: drift 15s linear forwards; 
    touch-action: none;
    cursor: pointer;
}
@keyframes drift {
    from { transform: translateX(-60px) translateY(0) rotate(0deg); opacity: 1; }
    to   { transform: translateX(115vw) translateY(60px) rotate(360deg); opacity: 0; }
}

/* ── Rock ── */
#rock { 
    width: clamp(110px, 22vmin, 155px); 
    height: clamp(110px, 22vmin, 155px); 
    background: #5d4037; border-radius: 50%; 
    border: 8px solid #3e2723; 
    display: flex; align-items: center; justify-content: center; 
    font-size: clamp(40px, 9vmin, 58px); 
    z-index: 10;
    flex-shrink: 0;
    touch-action: none;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" style="font-size:24px"><text y="24">⛏️</text></svg>'), pointer;
    will-change: transform;
    transform-origin: center center;
    transition: transform 0.05s ease-out, filter 0.05s ease-out;
}

/* ── Simplified Rock Smash ── */
.rock-bounce {
    transform: scale(1.08) !important; 
    filter: brightness(1.15) !important; 
}

/* Specific fix to keep the rock grayscale while bouncing in jail */
#rock.jail-bg.rock-bounce {
    filter: grayscale(90%) sepia(20%) brightness(80%) !important; 
}

/* ── Timer Banner ── */
#timer-banner {
    background: rgba(68, 0, 0, 0.85); 
    padding: 8px 16px; 
    border: 2px solid #ff4444; 
    border-radius: 5px; 
    z-index: 10; 
    font-weight: bold;
    width: 90%; 
    max-width: 340px;
    flex-shrink: 0;
    font-size: clamp(12px, 3.5vw, 15px);
}

@keyframes timerFlash {
    0%   { border-color: #ff4444; background: rgba(68,0,0,0.85); box-shadow: none; }
    50%  { border-color: #ff8800; background: rgba(130,45,0,0.95); box-shadow: 0 0 18px rgba(255,100,0,0.7); }
    100% { border-color: #ff4444; background: rgba(68,0,0,0.85); box-shadow: none; }
}
.timer-urgent { animation: timerFlash 0.9s ease-in-out 1 forwards; }
#timer-banner.hidden { display: none !important; }

/* ── Ledger ── */
.ledger-box { 
    background: rgba(20,20,20,0.85); border: 3px double #ffd700; 
    padding: 10px 15px; border-radius: 10px; 
    width: 90%; max-width: 420px; z-index: 10; 
    backdrop-filter: blur(5px);
    flex-shrink: 1;
}

/* ── Skill bar label row ── */
.skill-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    margin-top: 10px;
    color: #ccc;
    text-align: left;
}

/* Goal label: faint until progress builds, then glows */
#skill-goal-label {
    color: #ffd700;
    font-size: 9px;
    opacity: 0.2;
    transition: opacity 0.8s ease, text-shadow 0.8s ease;
    white-space: nowrap;
}
#skill-goal-label.near {
    opacity: 0.7;
    text-shadow: 0 0 6px rgba(255,215,0,0.4);
}
#skill-goal-label.maxed {
    opacity: 1;
    animation: goalPulse 0.6s ease-in-out infinite alternate;
}
@keyframes goalPulse {
    from { text-shadow: 0 0 5px #ffd700; }
    to   { text-shadow: 0 0 18px #ffd700, 0 0 35px #ffaa00; }
}

.progress-container { 
    width: 100%; background: #444; height: 10px; border-radius: 6px; 
    margin-top: 4px; border: 1px solid #ffd700; 
}
#survey-fill { 
    width: 0%; height: 100%; 
    background: linear-gradient(90deg, #00ff00, #00cc00); 
    transition: width 0.2s; border-radius: 5px; 
}

/* When skill bar is maxed, glow gold */
#survey-fill.bar-maxed {
    background: linear-gradient(90deg, #ffd700, #fff700) !important;
    box-shadow: 0 0 10px #ffd700, 0 0 20px rgba(255,215,0,0.5);
    animation: barMaxPulse 0.5s ease-in-out infinite alternate;
}
@keyframes barMaxPulse {
    from { box-shadow: 0 0 6px #ffd700; }
    to   { box-shadow: 0 0 16px #ffd700, 0 0 30px #ffaa00; }
}

/* ── Shop Panel ── */
#shop-panel {
    width: 90%;
    max-width: 460px;
    background: rgba(28, 28, 28, 0.95);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 10;
    flex-shrink: 1;
}

/* Always 2-column grid — on every screen size */
.shop-container { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 6px; 
}

.shop-disabled {
    filter: grayscale(1) brightness(0.5);
    pointer-events: none;
    opacity: 0.6;
    transition: all 0.3s ease;
}

button { 
    padding: 9px 5px; font-size: 10px; background: #ffd700; border: none; 
    font-weight: bold; text-transform: uppercase; transition: background 0.1s, opacity 0.1s; 
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.2;
    touch-action: manipulation;
}
button:active { opacity: 0.8; }
button:disabled { 
    background: #555 !important; color: #888 !important; 
    border-color: #444 !important; cursor: default !important; 
    pointer-events: none !important; 
}

#buy-license { font-size: 8px !important; }
.rebel-btn { font-size: 8px !important; }

.btn-police    { background: #0044ff !important; color: white; border: 1px solid #fff; }
.btn-politician { background: #00cc66 !important; color: white; border: 1px solid #fff; }
.rebel-btn { grid-column: span 2; background: #003399; color: white; border: 2px solid #fff; }

/* ── Modal ── */
#custom-modal-overlay { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); z-index: 30000; 
    justify-content: center; align-items: center; padding: 20px; 
    touch-action: none;
}

#custom-modal { 
    background: #2a2a2a; border: 4px solid #ffd700; 
    padding: clamp(10px, 2vh, 22px) 20px; width: 100%; max-width: 450px; 
    border-radius: 10px; text-align: center;
    max-height: 95dvh; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex; flex-direction: column; justify-content: center;
    margin: auto;
    touch-action: pan-y;
}

.confetti { 
    position: absolute; width: 7px; height: 7px; background: #ffd700; 
    pointer-events: none; z-index: 100; border-radius: 50%; 
}

#modal-img { 
    max-width: 100%; max-height: 22vh; object-fit: cover; 
    border: 1px solid #444; margin-bottom: 1vh; display: none; 
    margin-left: auto; margin-right: auto; 
}

#modal-text {
    font-size: clamp(11px, 2.2vh, 14px);
    white-space: pre-wrap; line-height: 1.3; 
    padding: 0 5px; margin-bottom: 1vh;
}

#modal-source { font-size: 10px; color: #888; margin-top: 10px; font-style: italic; }
#modal-source a { color: #00aaff; text-decoration: none; transition: color 0.2s; }
#modal-source a:hover { color: #ffd700; text-decoration: underline; }

/* ── Responsive tweaks ── */
@media (max-width: 480px) {
    .shop-container { gap: 5px; }
    button { padding: 8px 4px; font-size: 9px; }
    #buy-license { font-size: 7px !important; }
    .rebel-btn { font-size: 7px !important; }
    #site-header { padding: 7px 14px; }
    #intro-modal { border-width: 3px; }
    #skill-goal-label { font-size: 8px; }
}

@media (max-height: 680px) {
    .ledger-box { padding: 7px 12px; }
    #rock { width: 100px; height: 100px; font-size: 38px; }
    #shop-panel { padding: 7px; }
    button { padding: 7px 4px; font-size: 9px; }
}

@media (max-height: 580px) {
    #rock { width: 80px; height: 80px; font-size: 30px; border-width: 5px; }
    .ledger-box { font-size: 11px; }
    #site-logo { height: 28px; }
    #site-title { font-size: 15px; }
}

/* ── Welcome Stranger Goal System ── */

/* Skill bar when fully maxed */
#survey-fill.skill-maxed {
    background: linear-gradient(90deg, #ffd700 0%, #fff700 40%, #ffaa00 60%, #ffd700 100%) !important;
    background-size: 200% 100% !important;
    animation: skillGoldShimmer 1.2s linear infinite !important;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.9) !important;
}
@keyframes skillGoldShimmer {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* Stranger label lights up when skill maxed */
#stranger-label.stranger-label-active {
    color: #ffd700 !important;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.9) !important;
    animation: labelFlicker 1.8s ease-in-out infinite alternate !important;
}
@keyframes labelFlicker {
    from { opacity: 0.75; }
    to   { opacity: 1; }
}

/* Skill-maxed toast notification */
#skill-max-toast {
    position: fixed;
    top: 28%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.93);
    border: 2px solid #ffd700;
    color: #ffd700;
    padding: 14px 22px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: clamp(13px, 3.5vw, 16px);
    font-weight: bold;
    z-index: 20000;
    text-align: center;
    line-height: 1.5;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    animation: toastIn 0.35s ease-out forwards, toastOut 0.5s ease-in 2s forwards;
    pointer-events: none;
    white-space: nowrap;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(0.9); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ── Welcome Stranger Widget ── */
#welcome-stranger-widget {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 9998;
    background: radial-gradient(ellipse at center, rgba(60, 45, 0, 0.95) 0%, rgba(20, 20, 20, 0.95) 80%);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 24px 28px 20px;
    text-align: center;
    cursor: pointer;
    touch-action: manipulation;
    max-width: 300px;
    width: 82vw;
    box-shadow:
        0 0 40px rgba(255, 215, 0, 0.55),
        0 0 80px rgba(255, 215, 0, 0.25),
        inset 0 0 30px rgba(255, 215, 0, 0.06);
    animation: strangerEntrance 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
               strangerGlow 1.6s ease-in-out 0.55s infinite alternate;
}
#welcome-stranger-widget:active {
    transform: translate(-50%, -50%) scale(0.96);
}

.ws-nugget {
    font-size: clamp(56px, 14vw, 76px);
    display: block;
    margin-bottom: 6px;
    animation: nuggetRock 2.5s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.8));
}
.ws-title {
    font-family: 'Courier New', monospace;
    font-size: clamp(14px, 4vw, 18px);
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.9);
    margin-bottom: 4px;
    letter-spacing: 1px;
}
.ws-subtitle {
    font-family: 'Courier New', monospace;
    font-size: clamp(9px, 2.2vw, 11px);
    color: #aaa;
    margin-bottom: 14px;
    line-height: 1.4;
}
.ws-cta {
    font-family: 'Courier New', monospace;
    font-size: clamp(10px, 2.8vw, 13px);
    font-weight: bold;
    color: #000;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    padding: 9px 18px;
    border-radius: 6px;
    display: inline-block;
    animation: ctaPulse 0.75s ease-in-out infinite alternate;
    box-shadow: 0 2px 10px rgba(255, 170, 0, 0.5);
}

@keyframes strangerEntrance {
    from { transform: translate(-50%, -50%) scale(0) rotate(-8deg); opacity: 0; }
    to   { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}
@keyframes strangerGlow {
    from { box-shadow: 0 0 35px rgba(255,215,0,0.45), 0 0 70px rgba(255,215,0,0.2); }
    to   { box-shadow: 0 0 65px rgba(255,215,0,0.85), 0 0 120px rgba(255,215,0,0.45); }
}
@keyframes nuggetRock {
    0%, 100% { transform: rotate(-6deg) scale(1); }
    50%       { transform: rotate(6deg) scale(1.08); }
}
@keyframes ctaPulse {
    from { background: linear-gradient(135deg, #ffd700, #ffaa00); }
    to   { background: linear-gradient(135deg, #ffcc00, #ff8800); }
}

/* ── Reset Data Button ── */
#reset-data-btn {
    position: fixed;
    bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    right: calc(15px + env(safe-area-inset-right, 0px));
    z-index: 10000;
    background: rgba(20, 20, 20, 0.8);
    border: 2px solid #555;
    border-radius: 6px;
    color: #888;
    font-size: 15px;
    padding: 10px 14px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    line-height: 1;
    transition: color 0.2s, border-color 0.2s;
}
#reset-data-btn:hover {
    color: #ff4444;
    border-color: #ff4444;
}
#reset-data-btn:active { transform: scale(0.95); }

/* ── Back to Site Button ── */
#back-to-site-btn {
    position: fixed;
    top: calc(15px + env(safe-area-inset-top, 0px));
    left: calc(15px + env(safe-area-inset-left, 0px));
    z-index: 50000; /* High enough to be clicked over the intro overlay */
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #ffd700;
    border-radius: 6px;
    color: #ffd700;
    font-size: 14px;
    font-weight: bold;
    font-family: 'Courier New', Courier, monospace;
    padding: 8px 12px;
    text-decoration: none;
    backdrop-filter: blur(4px);
    line-height: 1;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    touch-action: manipulation;
}

#back-to-site-btn:active { 
    transform: scale(0.95); 
}

@media (hover: hover) {
    #back-to-site-btn:hover { 
        background: #ffd700; 
        color: #1a1a1a; 
    }
}

/* ── Responsive tweak for smaller screens ── */
@media (max-width: 480px) {
    #back-to-site-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
}
