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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-color);
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* Navigation Bar */
nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-color);
}

.logo-container img {
    height: 45px;
    width: auto;
    display: block;
    object-fit: contain;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-text .ai {
    color: var(--secondary-color);
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    gap: 30px;
    list-style: none;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.3s;
    position: relative;
}

.nav-links a:hover {
    color: var(--secondary-color);
}

.nav-links a.active {
    color: var(--secondary-color);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--secondary-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

.page-header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 20px;
}

.page-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 300;
}

/* Footer */
footer {
    background: rgba(44, 62, 80, 0.95);
    color: white;
    text-align: center;
    padding: 30px 20px;
    margin-top: auto;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: opacity 0.3s;
}

footer a:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 30px;
    flex-wrap: wrap;
}

.footer-discord {
    margin: 15px 0;
    flex: 0 0 auto;
}

.footer-newsletter {
    margin: 15px 0;
    flex: 1 1 auto;
    min-width: 300px;
}

.footer-newsletter form {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    max-width: 100%;
    margin: 0;
}

.footer-newsletter input[type="email"] {
    padding: 10px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    min-width: 250px;
    transition: border-color 0.3s, background 0.3s;
}

.footer-newsletter input[type="email"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.footer-newsletter input[type="email"]:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.15);
}

.footer-newsletter button {
    padding: 10px 20px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    white-space: nowrap;
}

.footer-newsletter button:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.footer-newsletter .success-message {
    color: #27ae60;
    font-size: 0.9rem;
    margin-top: 10px;
    display: none;
}

.footer-newsletter .success-message.show {
    display: block;
}

.footer-bottom {
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.footer-discord {
    margin: 15px 0;
}

.discord-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #5865F2;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.3s, transform 0.2s;
    white-space: nowrap;
}

.discord-button:hover {
    background: #4752C4;
    transform: translateY(-2px);
    text-decoration: none;
}

.discord-button::before {
    content: "💬";
    font-size: 1.2rem;
}

/* Discord button in tip cards */
.tip-card .discord-button {
    margin-top: 10px;
}

/* Responsive Discord button and footer layout */
@media (max-width: 768px) {
    .discord-button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .footer-discord {
        margin: 10px 0;
    }
    
    .footer-top {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .footer-newsletter {
        width: 100%;
        min-width: auto;
    }
    
    .footer-newsletter form {
        justify-content: center;
        max-width: 400px;
        margin: 0 auto;
    }
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.board-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    width: 100%;
    overflow: hidden;
}

#board {
    width: 100% !important;
    max-width: 500px !important;
    max-height: 500px !important;
    aspect-ratio: 1;
    position: relative;
    box-sizing: border-box;
}

.controls {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.input-group input[readonly] {
    background-color: #f8f9fa;
    cursor: text;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-color), #2980b9);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
}

.btn-secondary {
    background: var(--primary-color);
    color: white;
}

.btn-secondary:hover {
    background: #34495e;
    transform: translateY(-2px);
}

.btn-link {
    flex: 1;
    padding: 14px 20px;
    text-align: center;
    font-weight: 600;
}

.btn-chesscom {
    background: linear-gradient(135deg, #7fa650, #6b8e3f);
    color: white;
}

.btn-chesscom:hover {
    background: linear-gradient(135deg, #6b8e3f, #5a7533);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(127, 166, 80, 0.4);
}

.btn-lichess {
    background: linear-gradient(135deg, #dbd5c7, #c4b59a);
    color: #2c3e50;
}

.btn-lichess:hover {
    background: linear-gradient(135deg, #c4b59a, #a8967a);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(196, 181, 154, 0.4);
}

.dice {
    font-size: 1.2rem;
}

.fen-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fen-display label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

/* Analysis Links Box (moved to bottom) */
.analysis-links-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    grid-column: 1 / -1; /* Span full width */
    margin-top: 20px;
}

.analysis-links-box h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 1.3rem;
}

.analysis-links-box .link-buttons {
    display: flex;
    gap: 15px;
    flex-direction: row;
    flex-wrap: wrap;
}

.analysis-links-box .link-buttons .btn-link {
    flex: 1;
    min-width: 200px;
}

/* Legacy styles for backwards compatibility */
.analysis-links {
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.analysis-links h3 {
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.1rem;
}

.link-buttons {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.info {
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.info p {
    margin-bottom: 10px;
    line-height: 1.6;
    color: var(--text-light);
}

.info .description {
    font-size: 0.9rem;
    font-style: italic;
}

#current-position {
    color: var(--secondary-color);
    font-weight: 700;
}

/* Content Pages */
.content-page {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow);
    margin: 20px auto;
    max-width: 900px;
}

.content-page h2 {
    color: var(--primary-color);
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.content-page h3 {
    color: var(--primary-color);
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.4rem;
}

.content-page p {
    line-height: 1.8;
    margin-bottom: 15px;
    color: var(--text-color);
}

.content-page ul, .content-page ol {
    margin-left: 20px;
    margin-bottom: 15px;
    line-height: 1.8;
}

.content-page li {
    margin-bottom: 8px;
    color: var(--text-color);
}

.content-page a {
    color: var(--secondary-color);
    text-decoration: none;
}

.content-page a:hover {
    text-decoration: underline;
}

.tip-card {
    background: #f8f9fa;
    border-left: 4px solid var(--secondary-color);
    padding: 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.tip-card h3 {
    margin-top: 0;
    color: var(--secondary-color);
}

/* Homepage CTA Section */
.cta-section {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.4);
}

.cta-section h2 {
    color: white;
    margin-bottom: 20px;
    font-size: 2rem;
}

.cta-section p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.cta-button {
    background: white;
    color: #3498db;
    font-size: 1.2rem;
    padding: 18px 40px;
    display: inline-block;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

.homepage-feature {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 30px;
    margin-top: 40px;
    text-align: center;
}

/* Contact Form Styles */
.contact-form {
    max-width: 600px;
    margin: 30px 0;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.contact-info {
    color: var(--text-light);
}

.contact-info a {
    color: var(--secondary-color);
    text-decoration: none;
}

.contact-info a:hover {
    text-decoration: underline;
}

/* Position Analysis Box (separate box - compact) */
.position-analysis-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    grid-column: 1 / -1; /* Span full width */
    margin-top: 20px;
}

.position-analysis-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* AI Analysis Box */
.ai-analysis-box {
    margin-top: 20px;
}

.ai-analysis-content {
    line-height: 1.7;
    color: var(--text-color);
}

.ai-analysis-content p {
    margin: 12px 0;
    padding: 0;
    line-height: 1.6;
}

.ai-analysis-content p strong {
    color: var(--primary-color);
    font-size: 1.05em;
    display: block;
    margin-bottom: 8px;
    margin-top: 16px;
}

.ai-analysis-content p:first-child strong {
    margin-top: 0;
}

.ai-analysis-content p:first-child {
    margin-top: 0;
}

.ai-analysis-content p:last-child {
    margin-bottom: 0;
}

/* AI Loading Animation - Matrix Style */
.ai-loading-container {
    text-align: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matrix-animation {
    position: relative;
    z-index: 2;
    width: 100%;
}

.matrix-text {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: #00ff41;
    text-shadow: 
        0 0 5px #00ff41,
        0 0 10px #00ff41,
        0 0 15px #00ff41,
        0 0 20px #00ff41;
    letter-spacing: 3px;
    margin-bottom: 30px;
    animation: pulse-glow 2s ease-in-out infinite;
    position: relative;
    z-index: 3;
}

.matrix-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

/* Create chess symbols raining down */
.matrix-rain::before {
    content: '♔♕♖♗♘♙♚♛♜♝♞♟';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 200%;
    font-size: 24px;
    color: #00ff41;
    text-shadow: 
        0 0 5px #00ff41,
        0 0 10px #00ff41,
        0 0 15px #00ff41;
    animation: matrix-fall 3s linear infinite;
    line-height: 1.5;
    letter-spacing: 20px;
    opacity: 0.6;
}

.matrix-rain::after {
    content: '♔♕♖♗♘♙♚♛♜♝♞♟';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 200%;
    font-size: 20px;
    color: #00ff41;
    text-shadow: 
        0 0 5px #00ff41,
        0 0 10px #00ff41,
        0 0 15px #00ff41;
    animation: matrix-fall 2.5s linear infinite;
    animation-delay: 0.5s;
    line-height: 1.5;
    letter-spacing: 30px;
    opacity: 0.4;
    transform: translateX(50px);
}

/* Additional chess symbol columns using pseudo-elements would be complex,
   so we'll use a background pattern approach for more symbols */
.matrix-rain {
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 30px,
            rgba(0, 255, 65, 0.1) 30px,
            rgba(0, 255, 65, 0.1) 35px
        );
    background-size: 100% 60px;
    animation: matrix-scroll 2s linear infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        text-shadow: 
            0 0 5px #00ff41,
            0 0 10px #00ff41,
            0 0 15px #00ff41,
            0 0 20px #00ff41;
    }
    50% {
        opacity: 0.7;
        text-shadow: 
            0 0 3px #00ff41,
            0 0 6px #00ff41,
            0 0 9px #00ff41,
            0 0 12px #00ff41;
    }
}

@keyframes matrix-fall {
    0% {
        top: -50%;
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

@keyframes matrix-scroll {
    0% {
        background-position: 30% -200px, 50% -180px, 70% -220px, 10% -190px;
    }
    100% {
        background-position: 30% 0, 50% 0, 70% 0, 10% 0;
    }
}

#ai-analysis-error {
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 6px;
    padding: 15px;
    margin-top: 10px;
}

/* AI Analysis Button */
#load-ai-analysis-btn {
    background: #00ff41 !important;
    color: #000 !important;
    border: 2px solid #00ff41 !important;
    padding: 12px 24px !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5) !important;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3) !important;
}

#load-ai-analysis-btn:hover {
    background: #00cc33 !important;
    border-color: #00cc33 !important;
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5) !important;
    transform: translateY(-2px) !important;
}

/* Legacy position-analysis class for backwards compatibility */
.position-analysis {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-top: 25px;
    border-top: 2px solid var(--border-color);
}

.position-analysis h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.analysis-main {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
    align-items: center;
}

.analysis-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-stat label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    white-space: nowrap;
}

.analysis-stat span {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
}

.evaluation-value.positive {
    color: #27ae60;
}

.evaluation-value.negative {
    color: #e74c3c;
}

.evaluation-value.neutral {
    color: var(--text-color);
}

.move-value {
    font-family: 'Courier New', monospace;
    color: var(--secondary-color);
}

/* WDL Statistics (compact) */
.wdl-stats {
    margin: 15px 0;
    padding: 12px;
    background: white;
    border-radius: 8px;
}

.wdl-stats label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.85rem;
}

.wdl-bar {
    display: flex;
    height: 24px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wdl-segment {
    height: 100%;
    transition: width 0.3s ease;
}

.wdl-win {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.wdl-draw {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.wdl-loss {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.wdl-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Top Moves (compact) */
.top-moves {
    margin: 15px 0;
    padding: 12px;
    background: white;
    border-radius: 8px;
}

.top-moves label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.85rem;
}

#top-moves-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#top-moves-list li {
    padding: 6px 10px;
    margin-bottom: 4px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--secondary-color);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

#top-moves-list li strong {
    color: var(--primary-color);
    margin-right: 8px;
}

.move-eval {
    float: right;
    color: var(--text-light);
    font-weight: 600;
}

/* Principal Variation (compact) */
.principal-variation {
    margin: 15px 0;
    padding: 12px;
    background: white;
    border-radius: 8px;
}

.principal-variation label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.85rem;
}

.pv-moves {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-color);
    line-height: 1.5;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    word-break: break-all;
}

/* Homepage Hero Section - Two Columns */
.homepage-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
    align-items: start;
}

.hero-text {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hero-text h2 {
    color: var(--primary-color);
    margin-top: 0;
    font-size: 2rem;
}

.hero-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
}

.hero-cta {
    display: flex;
    align-items: stretch;
}

.hero-cta .cta-section {
    margin-bottom: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Responsive Design */
@media (max-width: 968px) {
    main {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    main {
        gap: 20px;
    }

    .board-container {
        padding: 15px;
        min-height: auto;
    }

    #board {
        max-width: 100%;
    }

    .controls {
        padding: 20px;
    }

    .position-analysis-box,
    .analysis-links-box {
        padding: 20px;
        margin-top: 15px;
    }

    .analysis-links-box .link-buttons {
        flex-direction: column;
    }

    .analysis-links-box .link-buttons .btn-link {
        min-width: 100%;
        width: 100%;
    }

    .analysis-main {
        grid-template-columns: 1fr;
    }

    .nav-container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .content-page {
        padding: 25px;
    }

    .homepage-hero {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .hero-cta .cta-section {
        padding: 30px 20px;
    }

    .footer-newsletter form {
        flex-direction: column;
        max-width: 100%;
    }

    .footer-newsletter input[type="email"] {
        min-width: 100%;
        width: 100%;
    }

    .footer-newsletter button {
        width: 100%;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .board-container {
        padding: 10px;
    }

    #board {
        max-width: 100%;
    }

    .controls,
    .position-analysis-box,
    .analysis-links-box {
        padding: 15px;
    }
}

/* Chessboard.js overrides - force responsive sizing */
.board-b72b1 {
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
}

/* Force the board table to be responsive */
.board-b72b1 table {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    table-layout: fixed !important;
}

/* Responsive adjustments for narrow screens */
@media (max-width: 1200px) {
    .board-container {
        padding: 15px;
    }
    
    #board {
        max-width: 100% !important;
        max-height: none !important;
    }
    
    /* Calculate max height based on container width */
    .board-container {
        max-width: 100%;
    }
}

@media (max-width: 968px) {
    .board-container {
        padding: 10px;
        min-height: auto;
    }
    
    #board {
        max-width: 100% !important;
        max-height: none !important;
    }
}

