* {
    margin:0;
    padding:0;
    font-family:'Avenir Next', Avenir, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

html, body {
  width:100%;
  height:100%;
}

html, body {
    background: linear-gradient(#badbe4, #aaf7e1);
}

#sound-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

#sound-toggle:hover {
    background: rgba(0, 0, 0, 0.5);
}

#sound-toggle:active {
    transform: scale(0.95);
}

#discord-button {
    position: absolute;
    top: 70px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #5865F2;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    text-decoration: none;
}

#discord-button:hover {
    background: #4752C4;
}

#discord-button:active {
    transform: scale(0.95);
}

#world {
  position: absolute;
  width:75%;
  height: 100%;
  right:0;
  overflow: hidden;
}

.panel {
    position:absolute;
    top:0;
    left:0;
    padding: 2em 3em;
    width: 25%;
    box-sizing: border-box;
}

.game-title {
    z-index:100;
    position:relative;
    text-align:center;
}

.game-title .title {
    font-family: 'Playfair Display', serif;
    font-weight:700;
    font-size:3em;
}

.game-title .byline {
    font-family: 'Playfair Display', serif;
    text-transform:uppercase;
    color:#333;
    letter-spacing:0.2em;
    font-size:0.8em;
    font-weight:600;
    margin-top:0.5em;
}

a {
    font-family: 'Playfair Display', serif;
    letter-spacing:0.2em;
    font-weight:600;
    text-decoration: none;
}

table {
    width: 100%;
    box-sizing: border-box;
    margin-top: 2em;
}

td {
    letter-spacing:0.1em;
    font-size:0.7em;
    text-transform:uppercase;
    font-weight:400;
}

td:first-child {
    width: 30%;
    text-align: right;
    padding-right: 0.5em;
}

td:nth-child(2) {
    width: 70%;
    text-align: left;
    padding-left: 0.5em;
}

.stat {
    margin-top: 2em;
    text-align:center;
}

.stat p {
    width:100%;
    text-align:center;
    font-family:'Playfair Display';
    font-size:2em;
}

.stat label {
    text-align:center;
    text-transform:uppercase;
    letter-spacing:0.25em;
    font-size:0.8em;
    width:100%;
    float:left;
}

#variable-content {
    position: fixed;
    top: 32%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    padding: 20px 28px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 1em;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
    color: #333;
    width: auto;
    max-width: min(420px, 85vw);
    display: inline-block;
}

@keyframes flickerAnimation {
  0%   { opacity:1; }
  50%  { opacity:0; }
  100% { opacity:1; }
}

@-o-keyframes flickerAnimation{
  0%   { opacity:1; }
  50%  { opacity:0; }
  100% { opacity:1; }
}

@-moz-keyframes flickerAnimation{
  0%   { opacity:1; }
  50%  { opacity:0; }
  100% { opacity:1; }
}

@-webkit-keyframes flickerAnimation{
  0%   { opacity:1; }
  50%  { opacity:0; }
  100% { opacity:1; }
}

.animate-flicker {
   -webkit-animation: flickerAnimation 1.5s infinite;
   -moz-animation: flickerAnimation 1.5s infinite;
   -o-animation: flickerAnimation 1.5s infinite;
    animation: flickerAnimation 1.5s infinite;
}


/* Sphere wallet section */
#sphere-wallet-section {
    margin-top: 1.5em;
    text-align: center;
}

.sphere-btn {
    display: block;
    width: 100%;
    padding: 1em 1em;
    background-color: #f97316;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.2s;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(249, 115, 22, 0.4); }
    50% { box-shadow: 0 0 20px rgba(249, 115, 22, 0.8); }
}

.sphere-btn:hover:not(:disabled) {
    background-color: #ea580c;
}

.sphere-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

.sphere-btn-small {
    padding: 0.3em 0.8em;
    background: none;
    color: #9ca3af;
    border: 1px solid #9ca3af;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.5em;
    transition: all 0.2s;
}

.sphere-btn-small:hover {
    color: #f97316;
    border-color: #f97316;
}

#sphere-wallet-info {
    margin: 0.8em 0;
}

.sphere-wallet-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3em 0;
}

.sphere-wallet-row label {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.65em;
    color: #9ca3af;
}

.sphere-wallet-row p {
    font-family: 'Playfair Display';
    font-size: 0.9em;
    margin: 0;
    text-align: right;
    word-break: break-all;
}

#sphere-error {
    margin-top: 0.5em;
    padding: 0.5em;
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #ef4444;
    font-size: 0.75em;
    text-align: center;
}

.player-info {
    margin-top: 2em;
    text-align: center;
}

.player-info label {
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-size: 0.8em;
    display: block;
    margin-bottom: 0.5em;
}

.player-info p {
    font-family: 'Playfair Display';
    font-size: 1.2em;
    margin: 0.5em 0;
}


/* Leaderboard styles */
#leaderboard {
    margin-top: 2em;
    text-align: center;
}

#leaderboard h3 {
    font-family: 'Playfair Display';
    font-size: 1.3em;
    margin-bottom: 0.5em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5em;
}

#leaderboard-table th,
#leaderboard-table td {
    padding: 0.4em;
    text-align: left;
    font-size: 0.85em;
}

#leaderboard-table th {
    background-color: #f0f0f0;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.75em;
    letter-spacing: 0.05em;
}

#leaderboard-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

#leaderboard-table tr:first-child td {
    font-weight: bold;
    color: #FFD700; /* Gold for 1st place */
}

#leaderboard-table tr:nth-child(2) td {
    font-weight: bold;
    color: #C0C0C0; /* Silver for 2nd place */
}

#leaderboard-table tr:nth-child(3) td {
    font-weight: bold;
    color: #CD7F32; /* Bronze for 3rd place */
}

/* ===== Mobile HUD & buttons (hidden on desktop) ===== */

#mobile-hud,
#mobile-start-btn,
#mobile-restart-btn,
#mobile-gameover,
#mobile-menu-btn,
#mobile-panel-close {
    display: none;
}

/* ===== Mobile overrides ===== */
@media (max-width: 768px) {

    /* Game world goes full screen */
    #world {
        width: 100% !important;
        right: 0;
    }

    /* Panel as a slide-over overlay */
    .panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        max-width: 320px;
        height: 100%;
        padding: 1.5em 1.5em;
        box-sizing: border-box;
        background: linear-gradient(#badbe4, #aaf7e1);
        z-index: 500;
        overflow-y: auto;
        transition: transform 0.25s ease;
        transform: translateX(0);
    }

    /* When panel is hidden */
    .panel.mobile-hidden {
        transform: translateX(-100%);
    }

    /* Backdrop when panel is open */
    #mobile-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 499;
    }

    #mobile-backdrop.visible {
        display: block;
    }

    /* Close button inside panel */
    #mobile-panel-close {
        display: block;
        position: absolute;
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        border: none;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.15);
        color: #333;
        font-size: 1.5em;
        line-height: 36px;
        text-align: center;
        cursor: pointer;
        padding: 0;
    }

    /* Hamburger menu button */
    #mobile-menu-btn {
        display: flex;
        position: absolute;
        top: 12px;
        left: 12px;
        z-index: 300;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 8px;
        background: rgba(0, 0, 0, 0.45);
        cursor: pointer;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
    }

    #mobile-menu-btn span {
        display: block;
        width: 20px;
        height: 2px;
        background: #fff;
        border-radius: 1px;
    }

    /* Floating HUD — shifted right to make room for hamburger */
    #mobile-hud {
        display: flex !important;
        position: absolute;
        top: 12px;
        left: 60px;
        z-index: 100;
        gap: 12px;
    }

    #mobile-hud > div {
        background: rgba(0, 0, 0, 0.45);
        color: #fff;
        border-radius: 8px;
        padding: 6px 12px;
        text-align: center;
        min-width: 60px;
    }

    #mobile-hud span {
        display: block;
        font-size: 0.55em;
        text-transform: uppercase;
        letter-spacing: 0.15em;
        opacity: 0.8;
    }

    #mobile-hud strong {
        display: block;
        font-size: 1.3em;
        font-family: 'Playfair Display', serif;
    }

    /* Start / Restart buttons */
    #mobile-start-btn,
    #mobile-restart-btn {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 200;
        padding: 16px 40px;
        font-size: 1.3em;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        border: none;
        border-radius: 12px;
        background-color: #f97316;
        color: #fff;
        cursor: pointer;
        animation: pulseGlow 2s ease-in-out infinite;
    }

    /* Game-over overlay text */
    #mobile-gameover {
        position: absolute;
        left: 50%;
        top: 35%;
        transform: translate(-50%, -50%);
        z-index: 190;
        text-align: center;
        color: #fff;
        font-size: 1.2em;
        font-weight: bold;
        text-shadow: 0 2px 6px rgba(0,0,0,0.6);
    }

    /* Move sound / discord buttons so they don't overlap HUD */
    #sound-toggle {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    #discord-button {
        top: 56px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
}

