:root {
    --primary-color: #006d00;
    --secondary-color: #669966;
    --accent-color: #0d6efd;
    --success-color: #198754;
    --bg-color: #f8f9fa;
    --text-color: #2c3e50;
    --heading-color: #2b2b2b;
    --label-color: #4d4d4d;
    --highlight-color: #ff0;
    --highlight-glow: rgba(255, 255, 0, 0.4);
    --light-square: #f0f0dc;
    --dark-square: #779556;
    --drop-shadow-color: rgba(0, 0, 0, 0.15);
    --board-max-height: 70vmin;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

.container {
    width: 90%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 0;
}

.hero {
    background: linear-gradient(to right, #0f2027, #203a43, #2c5364);
    color: white;
    padding: 4rem 0;
}

.hero .container,
.hero-layout {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 2rem;
    text-align: center;
}

.hero-text,
.hero-board {
    flex: 1 1 500px;
    max-width: 800px;
}

.hero-board {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.hero h1 a {
    color: inherit;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
}

.hero h1 a:hover {
    opacity: 0.8;
}

.project-description {
    font-size: 1.2rem;
}

.color-link {
    text-decoration: underline;
    font-weight: bold;
    font-size: 1rem;
    margin-right: 1rem;
    cursor: pointer;
    color: white;
    transition: color 0.3s;
}

.color-link.selected {
    color: var(--accent-color);
}

.color-link.selected.negras {
    color: var(--success-color);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: 0.3s;
}

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

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

.btn:hover {
    opacity: 0.9;
}

#moveString {
    display: none;
}

#moveString strong.jugada-blancas {
    color: var(--accent-color);
}

#moveString strong.jugada-negras {
    color: var(--success-color);
}

.github-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
}

.github-link:hover {
    text-decoration: underline;
}

.board-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    margin-left: 32px;
    margin-bottom: 2em;
}

.board-wrapper {
    width: var(--board-max-height);
    height: var(--board-max-height);
    position: relative;
    transition: transform 0.4s ease;
    transform-origin: center;
}

.board-wrapper.rotated {
    transform: rotate(180deg);
}

.board-wrapper.rotated .piece {
    transform: rotate(180deg);
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    height: 100%;
    border: 4px solid #555;
    box-shadow: 0 0 10px var(--drop-shadow-color);
}

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

.piece {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 90%;
    height: 90%;
}

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

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

.rank-labels,
.file-label {
    position: absolute;
    font-size: 1.2rem;
    color: var(--label-color);
    font-weight: bold;
    pointer-events: none;
    z-index: 5;
}

.rank-labels {
    left: -32px;
    top: 0;
    display: grid;
    grid-template-rows: repeat(8, 1fr);
    height: 100%;
    width: 32px;
    justify-items: center;
    align-items: center;
}

.file-label {
    top: 100%;
    left: 0;
    width: 100%;
    height: 32px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    justify-items: center;
    align-items: center;
}

.square.highlight {
    outline: 4px solid var(--highlight-color);
    box-shadow: inset 0 0 16px var(--highlight-glow);
}

section {
    padding: 3rem 0;
    text-align: center;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--heading-color);
}

ul {
    list-style: none;
    padding-left: 0;
    margin: 1rem auto;
    max-width: 800px;
    text-align: left;
}

ul li::before {
    content: '\2713';
    margin-right: 0.5rem;
    color: var(--primary-color);
    font-weight: bold;
}

.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 280px;
    text-align: left;
}

footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1rem 0;
    font-size: 0.9rem;
    margin-top: 3rem;
}

.footer .a {
    color: inherit;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.imagen-inicio {
    text-align: center;
    margin-top: 2rem;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.imagen-inicio img {
    max-width: 80%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.imagen-inicio.fade-out {
    opacity: 0;
}

.analisis-container {
    text-align: center;
}

.tabla-contenedor {
    max-height: 500px;
    overflow-y: auto;
}

.scroll-delgado {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.scroll-delgado::-webkit-scrollbar {
    width: 3px;
}

.scroll-delgado::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-delgado::-webkit-scrollbar-thumb {
    background-color: #bbb;
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}


.intro {
    background-color: #ffffff;
    padding: 4rem 0;
}

.aplicaciones {
    background-color: #f3f5f7;
    padding: 4rem 0;
}

.aplicaciones h3 {
    margin-top: 1.5rem;
    color: var(--primary-color);
}

.aplicaciones ul li {
    margin-bottom: 0.5rem;
}



.ia {
    background-color: #ffffff;
    padding: 4rem 0;
}

.ia h3 {
    color: var(--secondary-color);
}

.ia-footer {
    margin-top: 2rem;
    font-weight: bold;
}


.open-source {
    background-color: #eef3ee;
    padding: 4rem 0;
}

.open-source h2 {
    color: var(--primary-color);
}

.open-source ul li {
    margin-bottom: 0.5rem;
}

.ia-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 800px;
    margin: 2rem auto;
    text-align: left;
}

.ia-item h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    color: var(--heading-color);
}

.ia-item p {
    margin: 0;
    color: var(--text-color);
    line-height: 1.5;
}

.ia-footer {
    margin-top: 2rem;
    font-size: 1rem;
    text-align: center;
    color: #444;
}

@media (min-width: 768px) {
    .ia-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.cadena-movimientos span.jugada-blancas {
    color: blue;
}

.cadena-movimientos span.jugada-negras {
    color: green;
}

.jugada-blancas {
    color: blue;
    font-weight: bold;
}

.jugada-negras {
    color: green;
    font-weight: bold;
}

.fila-podada {
    background-color: #198754;
}

#promotion-modal.hidden {
    display: none;
}

#promotion-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#promotion-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

#promotion-dialog {
    position: relative;
    z-index: 1001;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

#promotion-options button {
    margin: 5px;
    padding: 8px 12px;
    font-size: 18px;
    cursor: pointer;
}

.status-text {
    margin-top: 1rem !important;
}