:root {
    --bg-color: #fdf6e3;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.1);
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --print-note: #979ca2;
}

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

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
}

.app-container {
    max-width: 900px;
    width: 100%;
    padding: 1rem;
    transition: transform 0.3s ease;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #2563eb, #9333ea);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

h1 {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
}

/* ... keep previous styles intact until print ... */
header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

.notes-input-wrapper {
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.input-with-clear {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-with-clear input {
    width: 100%;
    padding-right: 2.5rem; /* Make room for the clear button */
}

.clear-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-btn:hover {
    color: var(--accent);
}

.fen-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

/* ... keep everything else identical ... */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.badge {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

input {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

input::placeholder {
    color: rgba(17, 24, 39, 0.4);
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow), inset 0 2px 4px rgba(0,0,0,0.02);
    background: #ffffff;
}

.actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.print-note {
    font-size: 0.85rem;
    color: var(--print-note);
    text-align: center;
    max-width: 400px;
    opacity: 0.9;
}

.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 400px;
    padding: 1.2rem;
    background: linear-gradient(135deg, #238636, #2ea043);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s cubic-bezier(0.1, 0, 0.2, 1);
    box-shadow: 0 2px 1px rgba(46, 160, 67, 0.2);
}

.primary-btn:hover {

    box-shadow: 0 4px 8px rgba(46, 160, 67, 0.3);
    background: linear-gradient(135deg, #2ea043, #3fb950);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn.generating {
    background: linear-gradient(135deg, #475569, #334155);
    pointer-events: none;
}

@keyframes generate-pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

.btn-icon {
    font-size: 1.3rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .fen-grid {
        grid-template-columns: 1fr;
    }
}

/* Base Print Styles - to be enhanced later */
.print-container {
    display: none;
}

@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    body, html {
        background: white !important;
        color: black !important;
        margin: 0;
        padding: 0;
        overflow: hidden; /* Stop any mysterious spill */
    }

    .app-container {
        display: none !important;
    }

    .print-container {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        justify-content: center;
        align-content: start;
        gap: 5mm;
        width: 100%;
    }

    .print-header {
        grid-column: span 2;
        font-family: 'Outfit', sans-serif;
        font-size: 16pt;
        font-weight: 600;
        text-align: center;
        margin-bottom: 2mm;
        border-bottom: 2px solid #4b5563; /* Darker border for school printers */
        padding-bottom: 5mm;
        color: #111827;
    }

    .board-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .board-container {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .puzzle-label {
        font-family: 'Outfit', sans-serif;
        font-size: 13pt;
        font-weight: 700;
        margin-bottom: 0mm;
        margin-left: 2mm;
        color: #111827;
        letter-spacing: 0.5px;
    }

    .chess-board {
        font-family: 'ChessAlpha2';
        font-size: 20pt; /* Shrunk from 21pt to fit added separators */
        line-height: 1;
        letter-spacing: 0;
        white-space: pre;
        text-align: center;
        color: #000;
        margin: 0;
    }

    .row-separator {
        grid-column: span 2;
        border-bottom: 2px solid #4b5563; /* Darker border for school printers */
        width: 100%;
        margin: 0;
    }
}
