:root {
    --primary-color: #b31b1b;
    /* Academic Red */
    --accent-color: #801313;
    /* Darker Red */
    --bg-color: #ffffff;
    --text-color: #333;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --border-color: #dee2e6;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 40px;
}

.header-image-container {
    width: 100%;
    text-align: center;
    /* background-color: var(--light-gray); */
    background-color: #ffffff;
    margin-bottom: 30px;
}

.header-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.header-content {
    text-align: center;
}

.logo-container {
    margin-bottom: 20px;
}

.project-logo {
    max-width: 280px;
    /* Increased from 150px */
    height: auto;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
    color: var(--text-color);
}

.authors {
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.affiliations {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
}

.links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    background-color: #333;
    /* Dark Gray for buttons */
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
    /* Ensure uniform black border */
    border: 1px solid #000;
}

.btn:hover {
    background-color: var(--primary-color);
    /* Red on hover */
}

.btn i,
.btn-icon {
    margin-right: 8px;
}

.btn-icon {
    height: 20px;
    vertical-align: middle;
}

/* Main Content */
main {
    padding: 40px 0;
}

section {
    margin-bottom: 40px;
    /* Reduced from 60px */
    padding-top: 20px;
    /* Reduced from 40px */
    border-top: 1px solid var(--border-color);
    /* Single separator line */
}

section:first-of-type {
    border-top: none;
    padding-top: 0;
}

h2 {
    font-size: 2rem;
    /* border-bottom: 2px solid var(--primary-color); Removed to avoid double lines */
    padding-bottom: 10px;
    margin-bottom: 20px;
    /* Reduced from 30px */
    color: var(--primary-color);
}

h3 {
    font-size: 1.5rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #444;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

/* Player 1 specific header border */
#player1-column h3 {
    border-left-color: #597481;
}

/* Overview */
.overview-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Removed media query for row direction to keep it column (image below text) */

.overview-image img {
    width: 100%;
    border-radius: 8px;
    /* box-shadow: 0 4px 6px rgba(0,0,0,0.1); Removed shadow */
}

/* Images & Figures */
img {
    max-width: 100%;
    height: auto;
}

.method-image,
.failure-analysis {
    text-align: center;
    margin: 20px 0;
}

.caption {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
    text-align: center;
    font-style: italic;
}

.results-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 768px) {
    .results-group {
        flex-direction: row;
        align-items: flex-start;
        /* Align top */
    }

    .result-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .result-item img {
        /* max-height: 400px; Removed to allow full width/height */
        object-fit: contain;
        width: 100%;
    }
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 30px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

th,
td {
    padding: 12px 15px;
    text-align: center;
    border: 1px solid var(--border-color);
}

th {
    background-color: var(--light-gray);
    color: var(--text-color);
    font-weight: 700;
    border-bottom: 2px solid var(--primary-color);
    /* Red accent */
}

.section-header td {
    background-color: var(--medium-gray);
    font-weight: 700;
    text-align: left;
    padding-left: 20px;
    color: var(--text-color);
}

.highlight-row {
    background-color: #fdf2f2;
    /* Very light red for emphasis */
}

.setting-row td {
    border-top: 2px solid var(--primary-color);
}

/* Citation */
pre {
    background-color: var(--light-gray);
    padding: 20px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    color: #666;
    font-size: 0.9rem;
    background-color: var(--light-gray);
}

/* Replay Section */
.replay-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

@media (min-width: 768px) {
    .replay-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
}

.player-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.3s ease;
}

.center-column {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 100px;
    /* Added margin to move board down */
}

.chat-box {
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    height: 380px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.placeholder-text {
    color: #999;
    font-style: italic;
    display: block;
    text-align: left;
}

.dimmed {
    opacity: 0.5;
}

.active {
    opacity: 1;
    border-color: var(--primary-color);
}

.player-column.active h3 {
    color: var(--primary-color);
}

/* Player 1 specific theme */
#player1-column.active {
    border-color: #597481;
}

#player1-column.active h3 {
    color: #597481;
}

/* Tic Tac Toe Board */
.tictactoe-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 5px;
    width: 200px;
    /* Reduced from 240px */
    height: 200px;
    /* Reduced from 240px */
    background-color: #333;
    border: 5px solid #333;
    border-radius: 5px;
}

.board-row {
    display: contents;
    /* Use grid layout from parent */
}

.board-cell {
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.4rem;
    /* Adjusted font size for smaller board */
    font-weight: bold;
    cursor: default;
}

.cell-x {
    color: var(--primary-color);
}

.cell-o {
    color: #597481;
    /* Player 1 Theme Color */
}

/* Controls */
.replay-controls {
    text-align: center;
    width: 100%;
}

#turn-indicator {
    margin-bottom: 35px;
    /* Increased from 10px to move button down */
    font-weight: 600;
    height: 80px;
    /* Fixed height to keep button position stable */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
    /* Smaller font size */
    line-height: 1.4;
}

/* Typing Cursor */
.typing-cursor {
    display: inline-block;
    width: 8px;
    background-color: var(--text-color);
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Styled Tags in Reasoning */
.tag-p0 {
    color: var(--primary-color);
    font-weight: bold;
}

.tag-p1 {
    color: #597481;
    font-weight: bold;
}

/* Qualitative Table Styling */
.qualitative-table td:not(:first-child) {
    text-align: left;
}

.qualitative-table td:not(:first-child) strong {
    color: var(--primary-color);
}