* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Inter, Arial, sans-serif;
    background: radial-gradient(circle at top, #243b64, #090d18 65%);
    min-height: 100vh;
    color: white;
}

/* ===== Layout ===== */
.game-wrapper {
    min-height: 100vh;
    padding: 20px;
}

.game-header {
    max-width: 1400px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-header h1 {
    font-size: 25px;
}

.game-header span {
    opacity: 0.65;
}

.copy-btn {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    cursor: pointer;
}

.game-layout {
    max-width: 1400px;
    margin: auto;
    display: grid;
    grid-template-columns: 220px minmax(480px, 640px) 220px;
    gap: 25px;
    align-items: center;
}

.players-panel,
.controls {
    padding: 20px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.players-panel h2 {
    margin-bottom: 18px;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
}

.player-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.color-0 { background: #ef4444; }
.color-1 { background: #22c55e; }
.color-2 { background: #eab308; }
.color-3 { background: #3b82f6; }

.status {
    margin-left: auto;
    opacity: 0.7;
}

.turn-box {
    margin-top: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 14px;
}

.turn-box span {
    display: block;
    font-size: 12px;
    opacity: 0.5;
    margin-bottom: 4px;
}

/* ===== BOARD ===== */
.board-section {
    width: 100%;
}

.board {
    width: min(92vw, 640px);
    aspect-ratio: 1;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
    background: #e2e8f0;
    border: 3px solid #1e293b;
}

.cell {
    position: relative;
    border: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Yards */
.yard-red    { background: #ef4444; }
.yard-green  { background: #22c55e; }
.yard-yellow { background: #eab308; }
.yard-blue   { background: #3b82f6; }

.yard-inner {
    background: #ffffff;
    border-radius: 3px;
}

/* Path */
.path {
    background: #ffffff;
}

/* Home stretches */
.home-red    { background: #fca5a5; }
.home-green  { background: #86efac; }
.home-yellow { background: #fde047; }
.home-blue   { background: #93c5fd; }

/* Centre */
.center-cell { background: #1e293b; }
.center-red    { background: #ef4444; }
.center-green  { background: #22c55e; }
.center-yellow { background: #eab308; }
.center-blue   { background: #3b82f6; }

/* Safe stars */
.safe::after {
    content: "★";
    font-size: 9px;
    color: #64748b;
    position: absolute;
    top: 1px;
    right: 2px;
}

/* ===== Coloured start squares (with star) ===== */
.start-red {
    background: #fca5a5 !important;
}
.start-green {
    background: #86efac !important;
}
.start-yellow {
    background: #fde047 !important;
}
.start-blue {
    background: #93c5fd !important;
}

.start-red.safe::after,
.start-green.safe::after,
.start-yellow.safe::after,
.start-blue.safe::after {
    color: #1e293b;
    font-weight: bold;
}

/* Token slots inside yards */
.token-slot {
    width: 68%;
    height: 68%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.13);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tokens */
.token {
    width: 78%;
    height: 78%;
    border-radius: 50%;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
    border: 2.5px solid #fff;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.4);
    cursor: default;
    z-index: 30;
    transition: transform 0.15s;
}

.token.color-0 { background: #ef4444; }
.token.color-1 { background: #22c55e; }
.token.color-2 { background: #eab308; }
.token.color-3 { background: #3b82f6; }

/* Highlight animation for movable tokens */
.token.highlight {
    animation: pulse 0.85s infinite;
    box-shadow: 0 0 0 3px #fff, 0 0 14px 5px rgba(255, 255, 255, 0.8);
    z-index: 60;
    cursor: pointer;
}

@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.28); }
    100% { transform: scale(1); }
}

/* ===== Controls ===== */
.controls {
    text-align: center;
}

.dice {
    width: 100px;
    height: 100px;
    margin: 0 auto 22px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 58px;
    background: rgba(255, 255, 255, 0.1);
    transition: transform 0.08s ease;
    user-select: none;
}

.roll-btn {
    width: 100%;
    border: 0;
    border-radius: 14px;
    padding: 15px;
    font-size: 15px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #7b42ff, #3b82f6);
    cursor: pointer;
}

.roll-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

#gameMessage {
    margin-top: 14px;
    font-size: 13px;
    opacity: 0.65;
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
    .players-panel,
    .controls {
        max-width: 640px;
        width: 100%;
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    .game-wrapper {
        padding: 10px;
    }
    .board {
        width: 96vw;
    }
}

/* ===== Extra styles used by other pages (index, create, join) ===== */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 35px;
}

.logo {
    width: 65px;
    height: 65px;
    display: grid;
    place-items: center;
    font-size: 38px;
    border-radius: 18px;
    background: linear-gradient(135deg, #ff3d71, #7b42ff);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
}

.brand h1 {
    font-size: 32px;
}

.brand p {
    opacity: 0.65;
}

.home-card,
.form-card {
    width: 100%;
    max-width: 450px;
    padding: 35px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
}

.home-card {
    text-align: center;
}

.home-card h2,
.form-card h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.subtitle,
.form-card p {
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 30px;
}

.primary-btn,
.secondary-btn {
    border: 0;
    border-radius: 14px;
    padding: 15px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.primary-btn {
    width: 100%;
    color: white;
    background: linear-gradient(135deg, #ff3d71, #7b42ff);
}

.secondary-btn {
    width: 100%;
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.primary-btn:hover,
.secondary-btn:hover,
.roll-btn:hover {
    transform: translateY(-2px);
}

.divider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    opacity: 0.4;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: white;
}

.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    opacity: 0.75;
}

.input-group input {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    outline: none;
}

.input-group input:focus {
    border-color: #8b5cf6;
}