:root {
    --primary: #6c5ce7;
    --primary-dark: #5649c0;
    --secondary: #00cec9;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-light: #f8fafc;
    --text-dim: #94a3b8;
    --glass: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);

    /* Board Colors */
    --board-light: #eee;
    --board-dark: #6c5ce7;
    --highlight: rgba(255, 255, 255, 0.4);
    --legal-move: rgba(0, 0, 0, 0.15);
    --legal-capture: rgba(255, 0, 0, 0.2);
    --last-move: rgba(255, 255, 0, 0.3);
    --selected: rgba(108, 92, 231, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow: hidden;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    margin-bottom: 20px;
}

h1 {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, var(--text-dim));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    margin-top: 5px;
    color: var(--text-dim);
}

.hidden {
    display: none !important;
}

/* Lobby Styling */
#lobby-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 32px;
    padding: 40px 20px;
    text-align: center;
    width: 100%;
    backdrop-filter: blur(10px);
}

.icon-wrapper {
    width: 80px;
    height: 80px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 24px;
}

.btn {
    padding: 16px 32px;
    border-radius: 16px;
    border: none;
    font-family: inherit;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-top: 24px;
}

.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 16px rgba(108, 92, 231, 0.3);
}

.primary:active {
    transform: translateY(2px);
    box-shadow: 0 4px 8px rgba(108, 92, 231, 0.3);
}

.subtext {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-dim);
}

/* Game Container */
#game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.score-board {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass);
    padding: 15px;
    border-radius: 24px;
    border: 1px solid var(--border);
}

.player {
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.player.active {
    opacity: 1;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 1px solid var(--border);
}

.player.active .avatar {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(108, 92, 231, 0.3);
}

.player .info {
    display: flex;
    flex-direction: column;
}

.player .name {
    font-weight: 600;
    font-size: 14px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #4cd137;
    border-radius: 50%;
    margin-top: 4px;
    display: none;
}

.player.active .status-dot {
    display: block;
}

.vs {
    font-weight: 800;
    color: var(--text-dim);
    font-size: 12px;
}

/* Chess Board */
.board-wrapper {
    position: relative;
    aspect-ratio: 1;
    width: 100%;
    background: var(--bg-card);
    border-radius: 12px;
    border: 4px solid var(--bg-card);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    height: 100%;
}

.cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell.light {
    background-color: var(--board-light);
}

.cell.dark {
    background-color: var(--board-dark);
}

.piece {
    width: 85%;
    height: 85%;
    z-index: 2;
    cursor: pointer;
    transition: transform 0.1s;
}

.piece:active {
    transform: scale(1.1);
}

.cell.selected {
    background-color: var(--selected) !important;
}

.hint {
    position: absolute;
    width: 25%;
    height: 25%;
    background: var(--legal-move);
    border-radius: 50%;
    z-index: 1;
}

.hint.capture {
    width: 80%;
    height: 80%;
    border: 4px solid var(--legal-capture);
    background: transparent;
}

.last-move {
    background-color: var(--last-move) !important;
}

/* Coordinates */
.coordinates {
    position: absolute;
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    pointer-events: none;
    font-weight: 600;
}

.letters {
    bottom: 2px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
}

.numbers {
    top: 0;
    left: 2px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 40px;
    border-radius: 32px;
    text-align: center;
    max-width: 90%;
    width: 200px;
}

.secondary {
    background: var(--glass);
    border: 1px solid var(--border);
    color: white;
}