:root {
    /* New Palette */
    --primary-color: #7B2B1F;
    /* Blood Orange/Deep Rust */
    --secondary-color: #662350;
    /* Plum/Dark Berry */
    --accent-color: #D7CCC8;
    /* Borders/Dividers */
    --bg-color: #FAE4CA;
    /* Creamy Beige */
    --card-bg: #FFFFFF;
    /* Surface */
    --text-color: #3E2723;
    /* Dark Chocolate */

    --shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --btn-radius: 20px;

    /* Chess Board Colors matching the theme */
    --board-light: #F5F5F5;
    /* Slightly off-white to contrast with pieces, or keep accent */
    --board-dark: #7B2B1F;
    /* Primary color for dark squares */

    --highlight-move: rgba(123, 43, 31, 0.5);
    --highlight-check: rgba(183, 28, 28, 0.6);
}

@font-face {
    font-family: 'Church of Chocolate';
    src: url('Church of Chocolate.ttf') format('truetype');
}

@font-face {
    font-family: 'Kefa';
    src: url('KefaIII.ttf') format('truetype');
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Kefa', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-y: auto;
    position: relative;
    font-size: 16px;
    /* Body text size */
}

/* App Shell Layout */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    width: 100%;
}

/* Header */
.dashboard-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
    justify-content: flex-start;
    width: 100%;
    padding: 20px;
}

.logo-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    cursor: pointer;
}

.dashboard-header h1 {
    font-size: 24px;
    color: var(--text-color);
    font-weight: 800;
    letter-spacing: 1px;
    font-family: 'Kefa', serif;
    margin: 0;
}

/* Dashboard Grid/Layout */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    padding-bottom: 0px;
    align-items: center;
    padding-top: calc(20vh - 20px);
}

/* Game Container - Dashboard CardStyle */
.dashboard-card {
    background: transparent !important;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    border: none;
    width: 100%;
    max-width: 100%;
    align-items: center;
    gap: 1rem;
}

h2.game-title {
    font-family: 'Kefa', serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

/* Subheaders */
.turn-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    font-size: 18px;
    color: var(--secondary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.turn-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--accent-color);
    transition: background-color 0.3s ease;
}

/* Chessboard */
.board-wrapper {
    padding: 0;
    background: var(--primary-color);
    border-radius: 0;
    /* Slightly tighter than card radius */
    width: 100vw;
    max-width: 100%;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.chessboard {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary-color);
    box-sizing: border-box;
}

.square {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(20px, 8vw, 45px);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    position: relative;
}

.light {
    background-color: var(--board-light);
    color: var(--primary-color);
}

.dark {
    background-color: var(--board-dark);
    color: white;
    --highlight-move: rgba(255, 255, 255, 0.5);
}

.piece {
    pointer-events: none;
    z-index: 10;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transform: scale(1.6);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.piece:active {
    cursor: grabbing;
    transform: scale(1.8);
}

.selected {
    background-color: rgba(255, 235, 59, 0.6) !important;
}

.highlight {
    position: relative;
}

.highlight::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background-color: var(--highlight-move);
    border-radius: 50%;
}

.capture-hint::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 80%;
    background-color: transparent;
    border: 4px solid var(--highlight-move);
    border-radius: 50%;
    box-sizing: border-box;
}

.in-check {
    background-color: var(--highlight-check) !important;
}

/* Game Info */
.game-info {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    padding: 0 20px;
}

/* Primary Button Styling */
.btn-reset {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.8rem;
    border-radius: var(--btn-radius);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
    font-family: inherit;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
}

.btn-reset:hover {
    transform: scale(1.05);
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-reset:active {
    transform: scale(0.95);
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}
/* ===========================================================================
   Website adjustments — keep the phone layout, make it sane on desktop too.
   =========================================================================== */

.dashboard-header {
    gap: 16px;
    flex-wrap: wrap;
}

.chess-back {
    margin-left: auto;
    text-decoration: none;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 16px;
    border-radius: var(--btn-radius);
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
}

.chess-back:hover {
    background: var(--primary-color);
    color: #fff;
}

/* The original board is width:100vw (mobile-first). Cap it so it doesn't
   swallow a desktop viewport, and stop 100vw causing a horizontal scrollbar. */
.board-wrapper {
    width: 100%;
    max-width: min(92vw, 560px);
    margin: 0 auto;
    border-radius: var(--radius);
    overflow: hidden;
}

.game-info {
    max-width: min(92vw, 560px);
    margin-left: auto;
    margin-right: auto;
    margin-top: 14px;
}

@media (min-width: 700px) {
    .dashboard-grid {
        padding-top: 24px;
        gap: 18px;
    }
}

@media (max-width: 420px) {
    .dashboard-header {
        padding: 14px;
        gap: 10px;
    }

    .dashboard-header h1 {
        font-size: 20px;
    }

    .chess-back {
        padding: 6px 12px;
        font-size: 14px;
    }
}
