:root {
    --primary: #9d4edd;
    --primary-glow: #e0aaff;
    --secondary: #00b4d8;
    --secondary-glow: #90e0ef;
    --accent: #f72585;
    --bg-dark: #0a0b1e;
    --bg-panel: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #8b9bb4;
    --success: #00ff9d;
    --danger: #ff0055;

    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Effects */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -2;
    opacity: 0.6;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation: float 10s infinite alternate;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary);
    bottom: -50px;
    right: -50px;
    animation: float 8s infinite alternate-reverse;
}

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--glass-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--glass-border) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.05;
    z-index: -1;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, 30px);
    }
}

/* Layout */
.page {
    display: none;
    width: 100%;
    max-width: 480px;
    padding: 20px;
    animation: fadeIn 0.5s ease-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glass Card */
.glass-card {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    margin: 0 auto;
}

/* Wallet Page Styles */
.header-icon {
    font-size: 3rem;
    color: var(--primary-glow);
    text-align: center;
    margin-bottom: 5px;
    text-shadow: 0 0 20px var(--primary);
}

h1 {
    font-family: var(--font-heading);
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    background: linear-gradient(to right, #fff, #bbb);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.balance-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin-bottom: 30px;
    border: 1px solid var(--glass-border);
}

h2 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    font-weight: 500;
}

.balance {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 30px rgba(0, 255, 157, 0.3);
}

.balance .currency {
    font-size: 1rem;
    color: var(--success);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-wrapper {
    display: flex;
    gap: 10px;
}

input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 15px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.3);
}

.action-btn {
    padding: 12px 20px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(157, 78, 221, 0.4);
}

.action-btn:hover {
    background: var(--primary-glow);
    transform: translateY(-2px);
}

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    border: 1px solid var(--glass-border);
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-button {
    width: 100%;
    padding: 18px;
    margin-top: 10px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-heading);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-button:hover {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(247, 37, 133, 0.5);
}

/* Coinflip Game Styles */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.icon-btn:hover {
    color: #fff;
}

.mini-balance {
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 20px;
    font-family: var(--font-heading);
    font-weight: 700;
    border: 1px solid var(--glass-border);
}

.game-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.highlight {
    color: var(--accent);
}

/* Coin Container with 3D Perspective */
.coin-container {
    perspective: 1000px;
    width: 160px;
    height: 160px;
    position: relative;
    margin-bottom: 20px;
}

/* Coin Element */
.coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s;
}

/* Coin Sides - Both Heads and Tails */
.coin-side {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    backface-visibility: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 255, 255, 0.2);
    border: 8px solid rgba(255, 255, 255, 0.1);
}

/* Heads Side - Gold Gradient */
.heads {
    background: linear-gradient(135deg, #ffd700, #b8860b);
    color: #fff;
    transform: rotateY(0deg);
}

/* Tails Side - Silver Gradient */
.tails {
    background: linear-gradient(135deg, #c0c0c0, #787878);
    color: #fff;
    transform: rotateY(180deg);
}

/* Game Arena Background */
.game-arena {
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    background: radial-gradient(circle, rgba(157, 78, 221, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
}

.coin.flipping {
    animation: flip-3d 2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
    /* Replaced with JS calculated animation but good for fallback */
}

.result-message {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    min-height: 1.5em;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.result-message.win {
    color: var(--success);
    text-shadow: 0 0 20px rgba(0, 255, 157, 0.5);
}

.result-message.lose {
    color: var(--danger);
    text-shadow: 0 0 20px rgba(255, 0, 85, 0.5);
}

/* Bet Controls */
.bet-controls {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.bet-input-container {
    margin-bottom: 20px;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-with-icon input {
    padding-left: 40px;
    width: 100%;
}

.side-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.side-btn {
    flex: 1;
    padding: 15px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    color: var(--text-muted);
}

.side-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.side-btn.selected {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(157, 78, 221, 0.2) inset;
    color: #fff;
}

.side-icon {
    font-size: 1.5rem;
}

.side-name {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.side-btn.selected .side-icon {
    color: var(--primary);
    transform: scale(1.1);
}

.flip-button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    border: none;
    border-radius: 16px;
    color: white;
    font-weight: 700;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(0, 180, 216, 0.3);
}

.flip-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 180, 216, 0.5);
}

.flip-button:disabled {
    opacity: 0.7;
    cursor: wait;
    filter: grayscale(0.8);
}

@media (max-width: 400px) {
    .glass-card {
        padding: 20px;
    }

    .coin-container {
        width: 120px;
        height: 120px;
    }

    .coin-side {
        font-size: 3rem;
    }
}

/* ===== PROVABLY FAIR SECTION ===== */
.provably-fair-section {
    margin-top: 20px;
    background: rgba(0, 255, 157, 0.05);
    border: 1px solid rgba(0, 255, 157, 0.2);
    border-radius: 16px;
    padding: 20px;
}

.fair-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.fair-header i {
    font-size: 1.3rem;
    color: var(--success);
}

.fair-header h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    flex: 1;
    margin: 0;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    padding: 5px;
}

.info-btn:hover {
    color: var(--success);
    transform: scale(1.1);
}

.fair-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.fair-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.fair-item:last-child {
    border-bottom: none;
}

.fair-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.fair-value {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: #fff;
    font-weight: 600;
    cursor: help;
    transition: color 0.3s;
}

.fair-value:hover {
    color: var(--success);
}

.fee-highlight {
    color: var(--accent);
    font-weight: 700;
}

.seed-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.regenerate-btn {
    background: rgba(0, 255, 157, 0.1);
    border: 1px solid rgba(0, 255, 157, 0.3);
    color: var(--success);
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.regenerate-btn:hover {
    background: rgba(0, 255, 157, 0.2);
    transform: rotate(180deg);
}

.verify-btn {
    width: 100%;
    padding: 12px;
    background: rgba(0, 255, 157, 0.1);
    border: 1px solid rgba(0, 255, 157, 0.3);
    border-radius: 12px;
    color: var(--success);
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.verify-btn:hover {
    background: rgba(0, 255, 157, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.2);
}

/* Fee note in result message */
.fee-note {
    font-size: 0.75rem;
    opacity: 0.7;
    display: block;
    margin-top: 5px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    max-width: 500px;
    width: 100%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: #fff;
    font-size: 1.2rem;
}

.modal-close:hover {
    background: rgba(255, 0, 85, 0.3);
    border-color: var(--danger);
    transform: rotate(90deg);
}

.modal-content h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    color: var(--text-main);
    line-height: 1.6;
}

.modal-body p {
    margin-bottom: 15px;
}

.modal-body ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 10px;
}

.modal-body strong {
    color: var(--primary-glow);
}

/* Smooth scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-glow);
}