﻿/* Game Styles */
#game-container {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    position: relative;
}

#main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 98%;
    max-width: 1800px;
    margin: 0 auto;
    padding-bottom: 5px;
    padding-top: 3px;
}

#header {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    max-height: 65px;
    overflow: visible;
    width: 100%;
    margin: 2px 10px 2px 10px;
}

#header-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
    text-decoration: none;
    overflow: visible;
    gap: 30px;
}

#header-right {
    display: none; /* Hide score from header - now shown below back-to-menu button */
}


#score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 500px;
    height: fit-content;

    padding: 8px;
    background-color: #ffffff;
    color: var(--theme-red-base);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;

    border: 1px solid var(--theme-gold-base);
    border-radius: 8px;
    margin-top: auto;
    margin-bottom: auto;
    margin-right: 10px;
    box-sizing: border-box; /* Padding and border are included in width */
}

#face-container {
    width: 100%;
    max-width: 1070px;
    height: 26vh;
    min-height: 200px;
    max-height: 360px;
    position: relative;
    perspective: 1000px;
    margin-bottom: 2px;
    overflow: hidden;
    touch-action: none;
    -ms-touch-action: none;
    cursor: grab;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Racebolt (very-hard): pan the viewport, not native image drag / text selection */
/* Scope to #face-front only so flipped result panel stays selectable */
body.racebolt-mode #face-front,
body.racebolt-mode #face-front * {
    user-select: none !important;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body.racebolt-mode #face-front #face-image {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
}

#face-container.racebolt-dragging {
    cursor: grabbing;
}

/* Racebolt on-screen arrows: reliable touch + no iOS tap flash / scroll handoff */
body.racebolt-mode .arrow {
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    /* Minimum comfortable tap target (mobile) */
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}


#face-flip-container {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    border: 0px solid var(--theme-gold-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#face-flip-container.flip {
    transform: rotateY(180deg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#face-front, #result-popup {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#face-front {
    transform: rotateY(0deg);
    overflow: hidden;
    height: 100%;
}

#image-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 0 10px;
}

/* Hard difficulty: three horizontal strips — pin to top of face area (not vertically centred) */
body.difficulty-hard-strips #main-container.eg-solo-match-stage #image-container {
    align-self: flex-start;
    align-items: flex-start;
    justify-content: center;
    padding-top: min(10px, 2vmin);
}

.difficulty-image {
    width: auto;
    max-width: 45%;
    height: 90%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid var(--theme-gold-base);
}

@media (max-width: 768px) {
  .difficulty-image {
    width: auto;
    max-width: 42%;
    height: 85%;
    max-height: 220px;
  }

  #image-container {
    gap: 15px;
    padding: 0 5px;
  }

  #header {
    max-height: none;
    margin: 3px 5px;
  }

  #header-left {
    justify-content: center;
  }

  #game-icon-left,
  #game-icon-right,
  #game-icon {
    height: 40px;
    width: 40px;
  }

  #game-title {
    font-size: 28px;
  }

  #header-left {
    gap: 10px;
  }

  /* Mobile: smaller score display */
  #game-score-display {
    font-size: 22px;
  }

  #map-container {
    height: 41vh;
    min-height: 330px;
    max-height: 520px;
  }

  #face-container {
    height: 24vh;
    min-height: 180px;
    max-height: 310px;
  }

  #confirm-guess {
    padding: 8px 16px;
    font-size: 14px;
    margin-bottom: 3px;
  }

  #instructions {
    font-size: 12px;
    margin: 3px auto;
  }

  #back-to-menu {
    padding: 12px 16px 8px 16px;
  }

  .button-subtitle {
    font-size: 12px;
  }
}

#face-image {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%) scale(5);
    transform-origin: center center;
    transition: transform 0.1s ease;
    border-radius: 50%;
    border: 1px solid var(--theme-gold-base);
    pointer-events: none;       /* ❗ Keep - prevents cheating via direct mouse drag */
    user-select: none;          /* ✅ Prevents accidental selection */
    -webkit-user-drag: none;    /* ✅ Prevents browser drag behavior on Safari */
    /* touch-action: none; ❌ Remove — we now handle gestures on the container instead */
}


canvas {
    max-width: 100%;
    max-height: 100%;
}

#result-popup {
    transform: rotateY(180deg);
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    color: #333;
    /* Description scrolls inside its pane; popup can scroll if needed so the map image is never clipped */
    overflow-x: hidden;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* game.php: padding moved to .result-card__panes; clip horizontal overflow (ribbon may be cut at edges) */
body.game-view #result-popup {
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    max-width: 100%;
    box-sizing: border-box;
}

body.game-view #result-popup .result-card {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* No visible scrollbars (avoids brief flash when pane flip animation ends); scrolling unchanged */
body.game-view #result-popup,
body.game-view #result-popup .result-card,
body.game-view .result-pane--description .full-info {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body.game-view #result-popup::-webkit-scrollbar,
body.game-view #result-popup .result-card::-webkit-scrollbar,
body.game-view .result-pane--description .full-info::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

body.game-view #result-popup .result-card .result-card__panes {
    padding: 20px;
    box-sizing: border-box;
}

/* Keep default #face-container overflow:hidden when flipped — avoids page horizontal scroll from the ribbon */

/* Solo result card: summary → scrollable description → full map (ribbon cycles) */
.result-card {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    perspective: 1100px;
}

/* Corner ribbon: large square so the rotated strip reaches the container’s top-right vertex (not clipped by padding) */
.result-card__ribbon-wrap {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 30;
    width: 11.5rem;
    height: 11.5rem;
    overflow: visible;
    pointer-events: none;
}

/* Reuses .eg-primary-btn look (gradient strip); span — clicks bubble to .result-card--interactive */
.result-card__ribbon.eg-primary-btn {
    position: absolute;
    top: 3.35rem;
    right: -6.35rem;
    width: 18rem;
    min-height: 2.05rem;
    margin: 0;
    padding: 0.4rem 0.65rem;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: none;
    color: #fff;
    font-family: inherit;
    line-height: 1.1;
    text-align: center;
    border-radius: 6px;
    transform: rotate(45deg);
    transform-origin: center center;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.result-card--interactive {
    cursor: pointer;
}

.result-card--interactive:focus-visible {
    outline: 2px solid rgba(var(--theme-gold-rgb), 0.85);
    outline-offset: 3px;
}

/* .eg-primary-btn:hover replaces transform — keep the ribbon angle */
.result-card__ribbon.eg-primary-btn:hover:not(:disabled) {
    transform: rotate(45deg) translateY(-1px) scale(1.015);
}

.result-card__ribbon.eg-primary-btn:active:not(:disabled) {
    transform: rotate(45deg) translateY(0) scale(0.99);
}

.result-card__panes {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    z-index: 1;
    transform-style: preserve-3d;
    transform-origin: top center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Out phase: mirror of swing-in-top-fwd (fold away toward -100deg) */
@keyframes result-card-swing-out-top {
    0% {
        -webkit-transform: rotateX(0deg);
        transform: rotateX(0deg);
        -webkit-transform-origin: top;
        transform-origin: top;
        opacity: 1;
    }

    100% {
        -webkit-transform: rotateX(-100deg);
        transform: rotateX(-100deg);
        -webkit-transform-origin: top;
        transform-origin: top;
        opacity: 0;
    }
}

@-webkit-keyframes swing-in-top-fwd {
    0% {
        -webkit-transform: rotateX(-100deg);
        transform: rotateX(-100deg);
        -webkit-transform-origin: top;
        transform-origin: top;
        opacity: 0;
    }

    100% {
        -webkit-transform: rotateX(0deg);
        transform: rotateX(0deg);
        -webkit-transform-origin: top;
        transform-origin: top;
        opacity: 1;
    }
}

@keyframes swing-in-top-fwd {
    0% {
        -webkit-transform: rotateX(-100deg);
        transform: rotateX(-100deg);
        -webkit-transform-origin: top;
        transform-origin: top;
        opacity: 0;
    }

    100% {
        -webkit-transform: rotateX(0deg);
        transform: rotateX(0deg);
        -webkit-transform-origin: top;
        transform-origin: top;
        opacity: 1;
    }
}

.result-card__panes.result-card__panes--flip-out {
    -webkit-animation: result-card-swing-out-top 0.38s ease-in forwards;
    animation: result-card-swing-out-top 0.38s ease-in forwards;
}

.result-card__panes.result-card__panes--flip-in {
    -webkit-animation: swing-in-top-fwd 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
    animation: swing-in-top-fwd 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

/* Ensure cycling works: modifier classes set display:flex; must lose to [hidden] (see game.js apply()). */
.result-card .result-pane[hidden] {
    display: none !important;
}

.result-pane--summary {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* IQ mode (solo): after IQ guess is confirmed — Average IQ column (left), nation / faces / map score (right) */
body.game-view .result-card--iq-split .result-card__panes {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    align-content: start;
    gap: clamp(10px, 3vw, 22px);
}

body.game-view .result-card--iq-split .result-pane--description {
    order: 1;
    min-width: 0;
    /* Match summary pane typography (#result-content bold); plain .result-pane--description uses normal weight + left align and shifts the column */
    font-weight: bold;
    text-align: center;
    justify-content: flex-start;
    padding: 0;
    overflow: visible;
}

body.game-view .result-card--iq-split .result-pane--summary {
    order: 2;
    min-width: 0;
}

/* Identical padding on both stacks so titles and score bars share the same top edge */
body.game-view .result-card--iq-split .result-pane--summary .result-summary-inner,
body.game-view .result-card--iq-split #iq-guess-block .iq-summary-inner {
    padding: 0.35rem 0.25rem 0 0.25rem;
    margin: 0;
    box-sizing: border-box;
}

/* Pin IQ stack to the top: when the pane stretches this block, flex keeps content from sitting mid-column */
body.game-view .result-card--iq-split #iq-guess-block .iq-summary-inner {
    justify-content: flex-start;
    align-content: flex-start;
    flex: 0 0 auto;
    align-self: stretch;
    width: 100%;
    min-height: 0;
}

/* Don’t let scrollable .full-info grow/flex in ways that offset content vs the summary column */
body.game-view .result-card--iq-split .result-pane--description .full-info#iq-guess-block {
    flex: 0 0 auto;
    align-self: stretch;
    width: 100%;
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    min-height: 0;
}

@media (max-width: 520px) {
    body.game-view .result-card--iq-split .result-card__panes {
        grid-template-columns: minmax(0, 1fr);
    }
}

.result-summary-inner {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.2rem;
    text-align: center;
    /* keep title/faces clear of the corner ribbon */
    padding: 0.35rem 1.5rem 0 0.25rem;
    overflow: hidden;
}

/* Stack guess-score bar + face row: column width = both images combined → stat bar matches face row width */
.result-summary-media {
    display: grid;
    grid-template-columns: minmax(0, max-content);
    justify-items: stretch;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    gap: 0.2rem;
}

#result-popup .result-card .result-summary-media .result-stat {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    color: #ffffff;
    font-weight: 700;
    height: auto;
    min-height: 0;
}

.result-pane--description {
    flex: 1;
    min-height: 0;
    /* Clip here; scroll happens on .full-info so long text stays inside the card */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 2px;
    font-weight: normal;
    text-align: left;
}

.result-pane--description .full-info {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    margin: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    white-space: pre-wrap;
    font-weight: normal;
    font-size: 12px;
}

.result-pane--map {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: transparent;
    border-radius: 0;
    overflow: visible;
}

.result-map-full-wrap {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    box-sizing: border-box;
    overflow: visible;
}

.result-map-full {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center center;
}

#result-content {
    width: 100%;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    font-weight: bold;
    font-size: 12px;
    flex: 1;
    /* Let the result card shrink so inner panes (description) can scroll instead of growing the flip card */
    min-height: 0;
    overflow: hidden;
}

#result-content h2 {
    color: var(--theme-red-base);
    text-align: center;
    margin: 0px 0;
    font-size: 24px;
}


#result-content pre {
    white-space: pre-wrap;
    overflow-x: hidden;
    margin: 10px 0;
    text-align: left;
    width: 100%;
}

/* Solo result card: population description — no extra vertical margin (would break flex + scroll) */
#result-popup #result-content .result-pane--description pre.full-info {
    margin: 0;
}

#result-content .image-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    /* gap: 10px;
    margin: 10px 0; */
}

.arrow {
    position: absolute;
    font-size: 24px;
    color: var(--theme-gold-base);
    background-color: transparent;
    padding: 5px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    display: none; /* Hidden by default, shown only in normal mode */
}

.arrow:hover {
    background-color: rgba(var(--theme-gold-rgb), 0.2);
    color: var(--theme-gold-base);
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 10px var(--theme-gold-base);
}

#arrow-up { top: 10px; left: 50%; transform: translateX(-50%); }
#arrow-right { right: 10px; top: 50%; transform: translateY(-50%); }
#arrow-down { bottom: 10px; left: 50%; transform: translateX(-50%); }
#arrow-left { left: 10px; top: 50%; transform: translateY(-50%); }

#map-container {
    width: 100%;
    max-width: 1600px;
    height: 46vh;
    min-height: 420px;
    max-height: 650px;
    border-radius: 1000px;
    border: 1px solid var(--map-frame-border);
    margin: 2px auto;
    position: relative;
    overflow: hidden;
    touch-action: manipulation; /* Replaces touch-action: auto; */
    -ms-touch-action: manipulation; /* For broader compatibility */
}

#confirm-guess {
    width: 100%;
    max-width: 1070px;
    padding: 12px 24px;
    background-color: var(--theme-red-base);
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 20px;
    font-weight: 400;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    margin-bottom: 3px;
    border-top: 1px solid var(--theme-gold-base);
    box-sizing: border-box;
}

#confirm-guess:hover:not(.disabled) {
    background-color: var(--theme-red-deep);
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(var(--theme-red-rgb), 0.5);
    animation: pulse-gold 0s infinite ease-in-out;

}

#confirm-guess:active:not(.disabled) {
    transform: scale(0.95);


}


#confirm-guess:not(.disabled) {

    animation: pulse-gold 1.2s infinite ease-in-out;


}

#confirm-guess.disabled {
    background-color: #000000;
    color: #ffffff;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#left-timer-container, #right-timer-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    margin: 0;
    padding: 0;
    /*
     * Elapsed time (above the shrinking bar): dark track — same family as body — so it contrasts with the
     * remaining-time strip (starts white → red). A white track + white bar made the timer invisible at t=30s.
     */
    background: linear-gradient(135deg, var(--page-bg-start), var(--page-bg-end));
}

#right-timer-container {
    display: none; /* Hide the second container since we're using only one */
}

/* Timer strip: color is set in game.js (smooth white → #c62828); dark track is #left-timer-container */
#left-timer-bar, #right-timer-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    transition: height 0.1s linear;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

#left-timer-bar.timer-bar--shake, #right-timer-bar.timer-bar--shake {
    animation: vibrate-1 0.2s infinite;
}

#left-timer-bar.timer-bar--shake-hard, #right-timer-bar.timer-bar--shake-hard {
    animation: vibrate-2 0.1s infinite;
}

@keyframes vibrate-1 {
    0% { transform: translateY(0); }
    25% { transform: translateY(-2px); }
    50% { transform: translateY(2px); }
    75% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

@keyframes vibrate-2 {
    0% { transform: translateY(0); }
    20% { transform: translateY(-4px); }
    40% { transform: translateY(4px); }
    60% { transform: translateY(-4px); }
    80% { transform: translateY(4px); }
    100% { transform: translateY(0); }
}

#close-popup {
    width: 100%;
    padding: 12px 20px;
    background-color: var(--theme-red-base);
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 400;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    margin-top: 10px;
    border-top: 1px solid var(--theme-gold-base);
}

#close-popup:hover {
    background-color: var(--theme-red-deep);
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(var(--theme-red-rgb), 0.5);
}

#close-popup:active {
    transform: scale(0.95);
}

#score-tooltip {
    position: absolute;
    background-color: rgba(0,0,0,0.7);
    color: white;
    padding: 5px;
    border-radius: 5px;
    pointer-events: none;
    z-index: 10000;
}

/* #left-pillar, #right-pillar {
    position: fixed;
    top: 0;
    height: 100vh;
    width: auto;
    z-index: 1000;
    pointer-events: none;
}

#left-pillar {
    left: 0;
}

#right-pillar {
    right: 0;
    transform: scaleX(-1);
} */

/* Score display inside back-to-menu button - styled like ETHNOGUESSR title */
#game-score-display {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0 0 5px 0;
    background: none;
    border: none;
    text-align: center;
    box-sizing: border-box;

    /* Match ETHNOGUESSR title styling (without glow) */
    font-family: 'Cinzel', serif;
    font-size: 32px;
    color: var(--theme-gold-base);
    -webkit-text-stroke: 0.2px #000000;
    text-shadow:
        -1px -1px 0 #000000,
        1px -1px 0 #000000,
        -1px 1px 0 #000000,
        1px 1px 0 #000000;
    font-weight: normal;
}

#back-to-menu {
    position: relative;
    padding: 15px 16px 10px 16px;
    background-color: transparent;
    color: var(--theme-red-base);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    z-index: 10000;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1070px;
    transition: all 0.3s ease;
}

.button-subtitle {
    font-size: 14px;
    color: var(--theme-red-base);
    font-family: Arial, sans-serif;
    font-weight: normal;
    margin: 0;
    text-align: center;
    transition: all 0.3s ease;
}

#back-to-menu-popup {
  position: relative;
  /* no longer fixed */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  min-height: 50px;
  padding: 10px 18px;
  background: linear-gradient(180deg, var(--theme-red-base) 0%, var(--theme-red-deep) 100%);
  color: #fff;
  border: 1px solid var(--theme-gold-base);
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0.3px;
  white-space: nowrap;
  z-index: 10000;
  margin: 0 auto 14px auto;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.35),
    0 0 24px rgba(var(--theme-red-rgb), 0.24),
    0 0 56px rgba(var(--theme-red-rgb), 0.12);
  transition: transform 0.25s ease, box-shadow 0.3s ease, background 0.3s ease;
}

#back-to-menu-popup:hover {
  transform: translateY(-1px) scale(1.02);
  background: linear-gradient(180deg, var(--theme-red-hover) 0%, var(--theme-red-deep) 100%);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.4),
    0 0 22px rgba(var(--theme-gold-rgb), 0.24),
    0 0 46px rgba(var(--theme-red-rgb), 0.18);
}

#back-to-menu-popup:active {
  transform: translateY(0) scale(0.99);
}

#instructions {
    text-align: center;
    font-size: 16px;
    margin: 3px auto;
    color: var(--theme-gold-base);
    line-height: 1.3;
    max-width: 1600px;
    width: 100%;
}



#back-to-menu:hover {
    background: linear-gradient(145deg, rgba(var(--theme-gold-rgb), 0.15), rgba(var(--theme-gold-rgb), 0.15));
    border: 2px solid var(--theme-gold-base);
    box-shadow: 0 0 20px rgba(var(--theme-gold-rgb), 0.4),
                0 0 40px rgba(var(--theme-gold-rgb), 0.2) inset;
    transform: translateY(-2px);
}

#back-to-menu:hover .button-subtitle {
    color: var(--theme-gold-base);
}

#back-to-menu:hover #game-score-display {
    text-shadow:
        -1px -1px 0 #000000,
        1px -1px 0 #000000,
        -1px 1px 0 #000000,
        1px 1px 0 #000000,
        0 0 15px var(--theme-gold-base),
        0 0 30px var(--theme-gold-base);
}

#back-to-menu:active {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(var(--theme-gold-rgb), 0.3);
}

