/* BASE RESET & FONTS */
body {
    margin: 0;
    font-family: 'Sarabun', sans-serif;
    background: #0f0f13; /* Deep dark background */
    color: #e0e0e0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* UI COMPONENTS */
.menu-container {
    background: rgba(30, 30, 35, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 50px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.6);
    max-width: 800px;
    width: 90%;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu-header h1 {
    font-size: 3rem;
    margin: 0;
    background: linear-gradient(135deg, #FFD700 0%, #FDB931 100%); /* Gold Gradient */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(253, 185, 49, 0.3);
}

.menu-header p {
    color: #888;
    margin-top: 5px;
}

.badge-pro {
    background: linear-gradient(45deg, #ff6f00, #ffca28);
    color: black;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.4em;
    vertical-align: super;
    font-weight: 800;
}

.menu-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 40px 0;
    flex-wrap: wrap;
}

.menu-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 30px 20px;
    border-radius: 20px;
    width: 160px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.menu-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-100%);
    transition: 0.5s;
}

.menu-card:hover::before {
    transform: translateX(100%);
}

.menu-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.08);
    border-color: #ffd700;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.card-icon {
    font-size: 40px;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.2));
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
}

.card-desc {
    font-size: 13px;
    color: #aaa;
}

/* MAIN GAME VIEW */
.main-container {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    background: #1a1a20;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 50px 100px -20px black;
}

.top-bar {
    height: 60px;
    background: #15151a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-back {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
}

.game-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.left-panel {
    flex: 2;
    background: #1a1a20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 20px;
}

/* BOARD SYSTEM */
.board-frame {
    background: #2a2a35;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 64px);
    grid-template-rows: repeat(8, 64px);
    background: #2a2a35;
}

.square {
    width: 64px;
    height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.square.dark {
    background: #40404a; /* Darker squares */
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}

.square.light {
    background: #2a2a35; /* Lighter squares matching bg */
}

/* Highlight move */
.square.highlight::after {
    content: '';
    width: 20px;
    height: 20px;
    background: #00e676;
    border-radius: 50%;
    opacity: 0.5;
    box-shadow: 0 0 10px #00e676;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.5; }
}

/* PIECES */
.piece {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.2s;
}

.piece:hover {
    transform: scale(1.1);
}

.piece.red {
    background: radial-gradient(circle at 30% 30%, #ff5252, #b71c1c);
    border: 2px solid #ff8a80;
}

.piece.white {
    background: radial-gradient(circle at 30% 30%, #ffffff, #cfd8dc);
    border: 2px solid #eceff1;
}

.piece.king {
    box-shadow: 0 0 15px gold, 0 5px 15px rgba(0,0,0,0.5);
}

.piece.king::after {
    content: '👑';
    font-size: 24px;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

.piece.ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.8;
}

/* CONTROLS */
.controls-bar {
    margin-top: 30px;
    background: #25252e;
    padding: 10px 30px;
    border-radius: 50px;
    display: flex;
    gap: 30px;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.turn-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}
.dot.red { background: #ff5252; color: #ff5252; }
.dot.white { background: #ffffff; color: #ffffff; }

.btn-tool {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.1);
    color: white;
    cursor: pointer;
    transition: 0.2s;
    font-size: 18px;
}
.btn-tool:hover { background: rgba(255,255,255,0.2); }

/* RIGHT PANEL */
.right-panel {
    width: 300px;
    background: #15151a;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.status-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 20px;
}

.status-label { font-size: 0.8em; color: #888; letter-spacing: 1px; }
.status-val { font-size: 1.5em; font-weight: bold; margin-top: 5px; color: #00e676; }

.history-box {
    flex: 1;
    background: rgba(0,0,0,0.2);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.history-header {
    padding: 15px;
    background: rgba(255,255,255,0.05);
    font-weight: bold;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-family: monospace;
    font-size: 14px;
}

.history-item {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #aaa;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }