/* 🌌 Antigravity Okey Styles */

:root {
    --okey-tile-w: 38px;
    --okey-tile-h: 54px;
    --okey-rack-w: 850px;
    --okey-rack-h: 120px;
    
    --color-red: #ef4444;
    --color-yellow: #eab308;
    --color-black: #1e293b;
    --color-blue: #3b82f6;
    
    --glow-red: rgba(239, 68, 68, 0.5);
    --glow-yellow: rgba(234, 179, 8, 0.5);
    --glow-black: rgba(30, 41, 59, 0.5);
    --glow-blue: rgba(59, 130, 246, 0.5);
}

.am-page-okey body {
    margin: 0;
    overflow: hidden;
    background: #000;
}

/* Skybox & Space Background */
#okey-skybox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, #0f172a 0%, #000000 100%);
    z-index: -2;
    overflow: hidden;
}

#okey-skybox::after {
    content: '';
    position: absolute;
    width: 200%; height: 200%;
    top: -50%; left: -50%;
    background-image: 
        radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.8) 100%, transparent),
        radial-gradient(1px 1px at 30% 40%, rgba(255,255,255,0.6) 100%, transparent),
        radial-gradient(2px 2px at 50% 60%, rgba(255,255,255,0.9) 100%, transparent),
        radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.5) 100%, transparent),
        radial-gradient(2px 2px at 90% 10%, rgba(255,255,255,0.8) 100%, transparent);
    background-size: 300px 300px;
    animation: rotateGalaxy 200s linear infinite;
    opacity: 0.5;
}

@keyframes rotateGalaxy {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Antigravity Floating Animation */
@keyframes antigravityFloat {
    0% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-3px) rotate(1deg); }
    50% { transform: translateY(0px) rotate(0deg); }
    75% { transform: translateY(3px) rotate(-1deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes discardFloat {
    0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
    50% { transform: translate(-50%, -55%) rotate(5deg) scale(1.02); }
    100% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
}

/* Game Board */
html, body {
    overflow: hidden !important; /* Force hide scrollbars globally for this page */
}

.okey-board {
    position: fixed;
    top: 65px; /* Adjust for navbar */
    left: 0;
    width: 100vw;
    height: calc(100vh - 65px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    perspective: 1000px;
    overflow: hidden;
    z-index: 10;
}

/* Rack (Istaka) - Realistic Wood */
.okey-rack {
    width: var(--okey-rack-w);
    height: var(--okey-rack-h);
    background: 
        /* Rivets Left */
        radial-gradient(circle at 11px 25%, #ccc 1px, #666 3px, transparent 4px),
        radial-gradient(circle at 11px 75%, #ccc 1px, #666 3px, transparent 4px),
        /* Rivets Right */
        radial-gradient(circle at calc(100% - 11px) 25%, #ccc 1px, #666 3px, transparent 4px),
        radial-gradient(circle at calc(100% - 11px) 75%, #ccc 1px, #666 3px, transparent 4px),
        /* Left metal bracket */
        linear-gradient(to right, #4a4a4a 0px, #888 4px, #555 18px, #222 22px, transparent 22px),
        /* Right metal bracket */
        linear-gradient(to left, #4a4a4a 0px, #888 4px, #555 18px, #222 22px, transparent 22px),
        /* Shadow for top ledge */
        linear-gradient(to bottom, transparent 48%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.1) 53%, transparent 55%),
        /* Top wooden ledge */
        linear-gradient(to bottom, #e6bc82 0%, #cfa065 50%),
        /* Bottom wooden base */
        linear-gradient(to bottom, #d6a86e 50%, #c19056 100%);
    border: 1px solid #5c3a21;
    border-radius: 4px;
    box-shadow: inset 0 -4px 10px rgba(0,0,0,0.5), 0 10px 20px rgba(0,0,0,0.6);
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    padding: 10px 25px; /* Added side padding for metal brackets */
    gap: 2px;
    transition: all 0.3s ease;
}

.okey-rack.player-rack {
    margin-bottom: 30px;
    transform: rotateX(10deg);
    z-index: 10;
    width: 850px;
    height: 125px;
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 3px;
    padding: 8px 30px;
    align-content: center;
    justify-content: center;
    /* Keeps the wood background defined in .okey-rack */
}

/* Rack Slot */
.rack-slot {
    width: var(--okey-tile-w);
    height: var(--okey-tile-h);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}
.rack-slot:hover {
    background: rgba(255, 255, 255, 0.1);
}

.okey-rack.bot-rack-top {
    transform: rotateX(-10deg) scale(0.6);
    margin-top: 10px;
    opacity: 0.9;
}

.okey-rack.bot-rack-left {
    position: absolute;
    left: -100px;
    top: 50%;
    transform: translateY(-50%) rotateY(70deg) scale(0.6);
    opacity: 0.9;
}

.okey-rack.bot-rack-right {
    position: absolute;
    right: -100px;
    top: 50%;
    transform: translateY(-50%) rotateY(-70deg) scale(0.6);
    opacity: 0.9;
}

/* Wood Texture for back of the racks */
.bot-rack-back {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to right, #e6bc82, #d6a86e, #e6bc82);
    border-radius: 4px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2), 0 10px 20px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #c19056;
}

/* Sponsor Logo Placeholder */
.sponsor-logo {
    font-size: 34px;
    font-weight: 900;
    color: #eab308;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    background: transparent;
    padding: 10px;
    letter-spacing: 2px;
    z-index: 10; /* Ensure logo is visible */
    white-space: nowrap;
}

/* Animated AramaMotoru Logo */
.am-logo-fade {
    font-size: 34px;
    font-weight: 900;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    background: transparent;
    padding: 10px;
    animation: fadeInOut 2s ease-in-out infinite alternate;
}
.am-logo-fade .brand-arama { color: #ffffff; }
.am-logo-fade .brand-motoru { color: #001144; }

@keyframes fadeInOut {
    0% { opacity: 0.6; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1.02); text-shadow: 0 0 15px rgba(0,85,255,0.6); }
}

/* Confetti */
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 20px;
    background: #ffd300;
    top: 0;
    opacity: 0;
    animation: confetti-fall 3s ease-in-out forwards;
}

@keyframes confetti-fall {
    0% { top: -10%; opacity: 1; transform: rotate(0deg); }
    100% { top: 110%; opacity: 0; transform: rotate(720deg); }
}

/* Center Area (Kara Delik / Discard / Deck) */
.okey-center-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.okey-center-blackhole {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: #000;
    box-shadow: 0 0 40px 10px rgba(0, 85, 255, 0.7);
    z-index: 1;
}

.okey-center-blackhole::before {
    content: '';
    position: absolute;
    top: -15%; left: -15%; right: -15%; bottom: -15%;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0%, rgba(0, 85, 255, 1) 25%, transparent 50%, rgba(56, 189, 248, 1) 75%, transparent 100%);
    animation: blackholeSwirl 3s linear infinite;
    mask-image: radial-gradient(circle, transparent 40%, black 70%);
    -webkit-mask-image: radial-gradient(circle, transparent 40%, black 70%);
}

.okey-center-blackhole::after {
    content: '';
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    background: radial-gradient(circle, #000 60%, transparent 100%);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 1);
}

@keyframes blackholeSwirl {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Tiles */
.okey-tile {
    width: var(--okey-tile-w);
    height: var(--okey-tile-h);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    font-size: 24px;
    cursor: grab;
    user-select: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3), inset 0 0 5px rgba(255,255,255,1);
    transition: transform 0.1s;
    position: relative;
    border: 1px solid rgba(255,255,255,0.4);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.okey-tile.is-dragging {
    opacity: 0.8;
    cursor: grabbing;
    transform: scale(1.1);
    box-shadow: 0 15px 25px rgba(0,0,0,0.5);
    z-index: 999 !important;
}

.tile-number {
    font-size: 26px; /* slightly smaller to fit new tile size */
    font-weight: 900;
    line-height: 1;
}

.tile-dot-brand {
    font-size: 5px;
    font-weight: 900;
    margin-top: 1px;
    letter-spacing: 0px;
    text-align: center;
    line-height: 1.1;
    font-family: Arial, sans-serif;
}
.tile-dot-brand .brand-arama { color: #0055ff; }
.tile-dot-brand .brand-motoru { color: #001144; }

/* Tile Colors */
.tile-red { color: var(--color-red); box-shadow: 0 4px 6px rgba(0,0,0,0.3), inset 0 0 8px var(--glow-red); }
.tile-yellow { color: var(--color-yellow); box-shadow: 0 4px 6px rgba(0,0,0,0.3), inset 0 0 8px var(--glow-yellow); }
.tile-black { color: var(--color-black); box-shadow: 0 4px 6px rgba(0,0,0,0.3), inset 0 0 8px var(--glow-black); }
.tile-blue { color: var(--color-blue); box-shadow: 0 4px 6px rgba(0,0,0,0.3), inset 0 0 8px var(--glow-blue); }

/* Fake Okey */
.tile-fake-okey .tile-number {
    font-size: 16px;
}
.tile-fake-okey {
    background: linear-gradient(135deg, #f8fafc, #cbd5e1);
}

/* Real Okey Glow */
.tile-is-okey {
    animation: okeyGlow 2s infinite alternate;
}
@keyframes okeyGlow {
    from { box-shadow: 0 0 10px #0ea5e9, inset 0 0 10px #0ea5e9; }
    to { box-shadow: 0 0 20px #38bdf8, inset 0 0 20px #38bdf8; }
}

/* Discard & Draw Piles */
.pile {
    width: var(--okey-tile-w);
    height: var(--okey-tile-h);
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 6px;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.pile-draw { right: 40px; transform: translateY(-50%); border: none; top: 50%; }
.pile-draw .okey-tile { 
    position: absolute; 
    background: linear-gradient(135deg, #1e293b, #0f172a); 
    border-color: #334155; 
    color: transparent; 
    cursor: pointer;
    width: 60px;
    height: 85px;
    box-shadow: 0 0 15px rgba(255,255,255,0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10px;
}
.pile-draw .okey-tile:hover { transform: translateY(-5px); box-shadow: 0 5px 25px rgba(56, 189, 248, 0.6); }
.pile-draw .okey-tile svg { margin-bottom: 25px; filter: drop-shadow(0 0 8px rgba(0, 85, 255, 0.6)); width: 40px !important; height: 40px !important; }

.deck-count { 
    position: absolute; 
    bottom: 5px; 
    color: white !important; 
    font-weight: 900 !important; 
    font-size: 24px !important; 
    text-shadow: 0 2px 5px rgba(0,0,0,0.8);
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Poppins', sans-serif;
    line-height: 1;
}

.pile-discard-left { left: 150px; bottom: 25%; }
.pile-discard-right { right: 150px; top: 25%; }
.pile-discard-top { top: 100px; left: 25%; }
.pile-discard-bottom { bottom: 40px; left: calc(50% + 460px); }

.pile .okey-tile { position: absolute; }

.gosterge-container .okey-tile {
    animation: suckAndSpit 15s infinite ease-in-out;
    transform-origin: center center;
}

@keyframes suckAndSpit {
    0%, 80% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
    85% { transform: translate(130px, 0) scale(0) rotate(720deg); opacity: 0; }
    88% { transform: translate(130px, 0) scale(0) rotate(720deg); opacity: 0; }
    93%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
}

.pile-discard-bottom .okey-tile {
    animation: antigravityFloat 4s infinite ease-in-out;
}

/* Indicators */
.gosterge-container {
    position: absolute;
    top: 50%;
    left: 40px;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-size: 12px;
    opacity: 0.8;
}

.player-info {
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
    padding: 4px 12px 4px 6px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: bold;
    color: #000000;
    z-index: 15;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    border: 1px solid rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}
.player-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.player-info.active-turn {
    border-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.info-bottom { bottom: 175px; left: 50%; transform: translateX(-50%); }
.info-top { top: 120px; left: 50%; transform: translateX(-50%); }
.info-left { left: 100px; top: 50%; transform: translateY(-50%); }
.info-right { right: 100px; top: 50%; transform: translateY(-50%); }

/* Controls */
.okey-controls-left {
    position: absolute;
    bottom: 175px;
    left: calc(50% - 425px); /* Align with the left edge of the rack */
    display: flex;
    flex-direction: row;
    gap: 8px;
    z-index: 20;
}
.okey-controls-right {
    position: absolute;
    bottom: 175px;
    right: calc(50% - 425px); /* Align with the right edge of the rack */
    display: flex;
    flex-direction: row;
    gap: 8px;
    z-index: 20;
}
.btn-xs {
    font-size: 11px;
    padding: 2px 10px;
    line-height: 1.4;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.btn-xs:hover {
    opacity: 1;
}

/* Active Rack Glow */
.active-rack-glow {
    box-shadow: 0 0 20px #10b981, inset 0 0 15px rgba(16, 185, 129, 0.4) !important;
    border-color: #10b981 !important;
}

/* Turn Message */
.turn-message-toast {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(16, 185, 129, 0.9);
    color: white;
    padding: 10px 30px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 999;
}
.turn-message-toast.show {
    opacity: 1;
    animation: popInOut 2s forwards;
}

@keyframes popInOut {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    15% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    30% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
}

/* Win Overlay */
.okey-win-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    backdrop-filter: blur(10px);
}
.okey-win-overlay.show {
    opacity: 1;
    pointer-events: all;
}
