@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800;900&display=swap');

:root {
    --bg-body: #060B19;
    --surface-glass: rgba(18, 24, 41, 0.65);
    --surface-border: rgba(255, 255, 255, 0.05);
    --primary: #10B981;
    --primary-hover: #059669;
    --primary-glow: rgba(16, 185, 129, 0.4);
    --secondary: #FCD34D;
    --secondary-hover: #F59E0B;
    --danger: #EF4444;
    --text-light: #F8FAFC;
    --text-muted: #64748B;
    --tile-bg: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
    --tile-hover: linear-gradient(180deg, #334155 0%, #1E293B 100%);
    --tile-safe: linear-gradient(135deg, #10B981 0%, #047857 100%);
    --tile-mine: linear-gradient(135deg, #EF4444 0%, #991B1B 100%);
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.08), transparent 25%);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    height: 100vh;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background: rgba(10, 15, 30, 0.95);
    border-right: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid var(--surface-border);
    margin-bottom: 20px;
}

.close-sidebar {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0 15px;
}

.menu-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 15px 0 5px 10px;
    font-weight: 800;
}

.menu-item {
    text-decoration: none;
    color: var(--text-light);
    padding: 12px 15px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.menu-item.active {
    background: var(--primary-glow);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    margin-right: 15px;
}

/* Base Glassmorphism */
.glass-panel {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: 20px;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(18, 24, 41, 0.8);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--surface-border);
    z-index: 10;
}

.wallet-container {
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
}

.wallet-label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

.wallet-balance {
    font-size: 18px;
    font-weight: 800;
    color: var(--secondary);
    letter-spacing: 0.5px;
}

/* Main Area */
.game-area {
    display: flex;
    flex: 1;
    padding: 40px;
    gap: 60px;
    align-items: center;
    justify-content: center;
}

/* Sidebar Controls */
.controls {
    width: 100%;
    max-width: 360px;
    padding: 35px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.input-with-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.input-with-buttons:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.input-with-buttons input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: white;
    padding: 15px;
    font-size: 18px;
    font-weight: 600;
    outline: none;
    font-family: var(--font-main);
}

.quick-btns {
    display: flex;
    background: rgba(255, 255, 255, 0.02);
}

.quick-btns button {
    background: transparent;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    padding: 0 15px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s;
}

.quick-btns button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.mines-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

#minesDisplay {
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 15px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 16px;
    min-width: 55px;
    max-width: 100%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.multiplier-info, .profit-info {
    font-size: 14px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#nextMultiplier, #potentialProfit {
    font-size: 24px;
    font-weight: 900;
    display: block;
    margin-top: 5px;
    color: white;
}

#potentialProfit {
    color: var(--primary);
}

.btn-primary, .btn-secondary {
    padding: 20px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    font-family: var(--font-main);
}

.btn-primary {
    background: var(--primary);
    color: #022c22;
    box-shadow: 0 4px 0 #059669, 0 10px 20px -5px var(--primary-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 4px 0 #059669, 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 4px 0 #059669, 0 0 0 15px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 4px 0 #059669, 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-primary:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 0px 0 #059669, 0 5px 10px -5px var(--primary-glow);
}

.btn-secondary {
    background: var(--secondary);
    color: #451a03;
    box-shadow: 0 4px 0 #d97706, 0 10px 20px -5px var(--secondary-glow);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 0px 0 #d97706, 0 5px 10px -5px var(--secondary-glow);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 4px 0 rgba(0,0,0,0.5) !important;
    background: #334155;
    color: #94a3b8;
}

/* Grid Board */
.board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding: 25px;
    width: 100%;
    max-width: 500px;
}

.tile-container {
    width: 100%;
    aspect-ratio: 1/1;
    perspective: 1000px;
    cursor: pointer;
}

.tile {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    will-change: transform;
}

.tile.revealed {
    transform: rotateY(180deg);
    cursor: default;
}

.tile-front, .tile-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tile-front {
    background: var(--tile-bg);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.05), 0 6px 0 #0f172a, 0 8px 15px rgba(0, 0, 0, 0.4);
    transition: 0.2s;
    border: 1px solid rgba(255,255,255,0.02);
}

.tile-front:hover {
    background: var(--tile-hover);
    transform: translateY(2px);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.05), 0 4px 0 #0f172a, 0 5px 10px rgba(0, 0, 0, 0.4);
}

.tile-front:active {
    transform: translateY(6px);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.05), 0 0px 0 #0f172a;
}

.tile-back {
    transform: rotateY(180deg);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.tile.safe .tile-back {
    background: var(--tile-safe);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3), 0 0 20px var(--primary-glow);
}

.tile.mine .tile-back {
    background: var(--tile-mine);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3), 0 0 20px var(--danger-glow);
}

.tile.mine-revealed .tile-back {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

/* SVGs */
.icon-diamond {
    width: 50%;
    height: 50%;
    stroke: white;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.6));
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-3px); }
    100% { transform: translateY(0px); }
}

.icon-mine {
    width: 50%;
    height: 50%;
    stroke: white;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
}

/* Toasts */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
    max-width: calc(100vw - 40px);
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
    border-left: 4px solid var(--primary);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 600;
    font-size: 15px;
    word-wrap: break-word;
    will-change: transform;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    border-left-color: var(--danger);
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 11, 25, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: 0.4s;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    padding: 50px 60px;
    text-align: center;
    transform: scale(1);
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay.hidden .overlay-content {
    transform: scale(0.9);
}

.overlay h2 {
    font-size: 42px;
    margin-bottom: 15px;
    font-weight: 900;
}

.overlay p {
    font-size: 28px;
    color: var(--primary);
    font-weight: 900;
    margin-bottom: 40px;
    text-shadow: 0 0 20px var(--primary-glow);
}

/* Provably Fair */
.provably-fair {
    display: none !important;
}
#fairBtn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: 0.2s;
}
#fairBtn:hover { color: white; }

#fairInfo {
    margin-top: 15px;
    background: rgba(0,0,0,0.4);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
    font-size: 12px;
    text-align: left;
    word-break: break-all;
}
#fairInfo code {
    display: block;
    color: var(--primary);
    margin-top: 5px;
    margin-bottom: 15px;
    font-family: monospace;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes idleDrift {
    0% { transform: translateX(0px); }
    100% { transform: translateX(-3000px); }
}

.idle-spin {
    animation: idleDrift 40s linear infinite;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        background: #060B19;
    }
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.8);
    }
    .close-sidebar {
        display: block;
    }
    .menu-toggle {
        display: block;
    }
    
    body { overflow-x: hidden; overflow-y: auto; }
    .app-container { height: auto; min-height: 100vh; }
    .game-area {
        flex-direction: column-reverse;
        padding: 20px;
        gap: 20px;
        align-items: stretch;
    }
    .board-container {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .controls { max-width: 100%; margin: 0 auto; width: 100%; }
    .grid { 
        padding: 10px; 
        gap: 8px; 
        width: 100%; 
        max-width: 450px; 
        margin: 0 auto; 
    }

    /* Performance Overrides for Mobile */
    .glass-panel, .navbar, .overlay {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: #060B19 !important;
    }
    .toast {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: #0F172A !important;
    }
    .icon-diamond, .icon-mine {
        filter: none !important;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 10px 15px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .wallet-container {
        flex-wrap: wrap;
        justify-content: center;
    }
    .overlay-content {
        padding: 30px 20px;
    }
    .overlay h2 { font-size: 28px; }
    .input-with-buttons { flex-wrap: wrap; }
    .input-with-buttons input { min-width: 100%; }
    .quick-btns { width: 100%; }
    .quick-btns button { flex: 1; padding: 10px 0; }
}

/* Footer (Rodapé) */
.footer {
    background: rgba(10, 15, 30, 0.95);
    border-top: 1px solid var(--surface-border);
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: auto;
    width: 100%;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-title {
    font-size: 20px;
    font-weight: 900;
    background: linear-gradient(90deg, #EF4444, #B91C1C);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.footer-desc {
    color: var(--text-muted);
    font-size: 13px;
    max-width: 300px;
    line-height: 1.5;
}

.footer-links {
    display: flex;
    gap: 30px;
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-column h4 {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.footer-column a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: 0.2s;
}

.footer-column a:hover {
    color: var(--primary);
}

.footer-bottom {
    width: 100%;
    max-width: 1200px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-copy {
    color: var(--text-muted);
    font-size: 12px;
}

.footer-18 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.icon-18 {
    width: 30px;
    height: 30px;
    border: 2px solid var(--danger);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--danger);
    font-weight: 900;
    font-size: 14px;
}

@media (max-width: 768px) {
    .footer {
        padding: 20px;
    }
    .footer-content {
        flex-direction: column;
    }
    .footer-links {
        flex-direction: column;
        gap: 20px;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}
