:root {
    --bg-color: #d6d6d4;
    --text-color: #333333;
    --brand-green: #87b15c;
    --brand-green-hover: #61873f;
    
    /* Board Colors */
    --sq-light: #f6f6e8;
    --sq-dark: #87b15c;
    --sq-highlight: rgba(255, 255, 0, 0.4);
    --sq-selected: rgba(0, 0, 0, 0.2);
    --sq-valid-move: rgba(0, 0, 0, 0.4);
    
    --board-size: clamp(280px, 85vw, 400px);
}

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

body {
    font-family: 'Irish Grover', cursive;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Layout */
.portfolio-layout {
    display: flex;
    gap: clamp(2rem, 5vw, 5rem);
    justify-content: center;
    align-items: center;
    max-width: 1100px;
    width: 95%;
    margin: 0 auto;
    padding: 2rem 0;
}

/* Left Column */
.left-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    width: var(--board-size);
}

.title {
    font-family: 'Irish Grover', cursive;
    color: var(--brand-green);
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    margin-bottom: 1.5rem;
    transform: rotate(-2deg);
}

.board-wrapper {
    transform: rotate(-3deg);
    padding: 4px;
    background: #222; /* Board outer border */
    border-radius: 2px;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    align-self: center;
}

.chessboard {
    width: var(--board-size);
    height: var(--board-size);
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border: 1px solid #222;
}

.square {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    user-select: none;
}

.square.light { background-color: var(--sq-light); }
.square.dark { background-color: var(--sq-dark); }

.square.highlight { background-color: var(--sq-highlight) !important; }
.square.selected { background-color: var(--sq-selected) !important; }
.square.in-check { 
    background-color: rgba(255, 50, 50, 0.7) !important;
    box-shadow: inset 0 0 15px rgba(200, 0, 0, 0.8);
}

.square.valid-move::after {
    content: '';
    position: absolute;
    width: 25%;
    height: 25%;
    background-color: var(--sq-valid-move);
    border-radius: 50%;
}

.piece {
    width: 90%;
    height: 90%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: grab;
    z-index: 10;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3));
}

.piece:active {
    cursor: grabbing;
}

.btn-container {
    display: none; /* Removed */
}

.play-btn {
    background-color: var(--brand-green);
    color: #222;
    font-family: 'Irish Grover', cursive;
    font-size: 1.8rem;
    border: none;
    border-radius: 30px;
    padding: 0.5rem 2.5rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.1s, background-color 0.2s;
}

.play-btn:hover {
    background-color: var(--brand-green-hover);
    transform: translateY(-2px);
}

.play-btn:active {
    transform: translateY(1px);
}

/* Right Column */
.right-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: clamp(1.1rem, 4vw, 1.4rem);
    line-height: 1.4;
    padding-top: 2rem;
}

.floating-pieces {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
}

.floating-pieces img {
    width: 40px;
    height: 40px;
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.2));
}

.float-q {
    transform: rotate(-10deg) translateY(5px);
}

.float-k {
    transform: rotate(15deg);
}

.desc-line {
    margin-bottom: 0.2rem;
}

.spacer {
    height: 1.5rem;
}

.highlight {
    color: var(--brand-green);
}

/* Registration Form */
.registration-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
    align-items: center;
    margin-top: 1rem;
}

.registration-form input {
    font-family: 'Irish Grover', cursive;
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
    border: 2px solid #222;
    border-radius: 8px;
    background: #f6f6e8;
    color: #222;
    width: 80%;
    max-width: 250px;
    text-align: center;
}

.registration-form input:focus {
    outline: none;
    border-color: var(--brand-green);
}

.start-btn {
    font-size: 1.4rem;
    padding: 0.5rem 1.5rem;
    margin-top: 0.5rem;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-color);
    border: 3px solid #222;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 90%;
}

.modal-content h2 {
    font-family: 'Irish Grover', cursive;
    font-size: clamp(2rem, 8vw, 3rem);
    color: var(--brand-green);
    margin-bottom: 1rem;
}

.modal-content p {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    margin-bottom: 2rem;
    color: #222;
}

/* Responsive */
@media (max-width: 800px) {
    .portfolio-layout {
        flex-direction: column;
        gap: 2rem;
        padding-top: 2rem;
    }
    
    .left-col {
        display: contents;
    }
    
    .title {
        order: 1;
        align-self: center;
        margin-left: 0;
        margin-bottom: 0;
    }
    
    .right-col {
        order: 2;
        align-items: flex-start;
        text-align: left;
        padding-top: 0;
        width: auto;
    }
    
    .floating-pieces {
        width: 100%;
        justify-content: flex-end;
        padding-right: 0;
        margin-bottom: 1rem;
    }

    .board-wrapper {
        order: 3;
        align-self: center;
        margin-bottom: 0;
    }
    
    .registration-form {
        order: 4;
        width: 100%;
        margin-top: 0;
    }

    #reset-game-btn {
        order: 5;
        align-self: center;
        margin-top: 0;
    }
}
