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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

header {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Game Overview Section */
.game-overview {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    align-items: start;
}

.game-image {
    display: flex;
    justify-content: center;
}

.game-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.correct-grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.correct-grid-container h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #666;
}

.game-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stat {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
}

.stat-with-list {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background: #666;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 600;
    font-style: italic;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
    position: relative;
}

.info-icon:hover {
    background: #333;
}

.info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.5;
    white-space: pre-line;
    width: 280px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.info-icon:hover::after {
    opacity: 1;
    visibility: visible;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}

/* Scrollable Words List */
.words-list {
    margin-top: 0.5rem;
    max-height: 120px;
    overflow-y: auto;
    font-size: 0.75rem;
    color: #666;
    line-height: 1.4;
    padding-right: 0.5rem;
}

.words-list::-webkit-scrollbar {
    width: 6px;
}

.words-list::-webkit-scrollbar-track {
    background: #e5e5e5;
    border-radius: 3px;
}

.words-list::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 3px;
}

.words-list::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Boggle Grid Styling */
.boggle-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    width: 200px;
}

.correct-grid-container .boggle-grid {
    width: 280px;
}

.boggle-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8e8e8;
    border-radius: 4px;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.boggle-cell.cell-error {
    background: #fee2e2;
    color: #dc2626;
    border: 2px solid #dc2626;
}

/* Model Results Section */
.model-results {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.model-results h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.last-updated {
    font-size: 0.875rem;
    font-weight: 400;
    color: #666;
}

.subtitle {
    font-size: 0.875rem;
    font-weight: 400;
    color: #666;
}

.model-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.model-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.model-card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #333;
}

.model-card-content {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.model-card .boggle-grid {
    flex-shrink: 0;
    width: 180px;
}

.model-words-found {
    flex: 1;
    min-width: 0;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.model-words-found::-webkit-scrollbar {
    width: 5px;
}

.model-words-found::-webkit-scrollbar-track {
    background: #e5e5e5;
    border-radius: 3px;
}

.model-words-found::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 3px;
}

.model-words-found h4 {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.model-words-list {
    font-size: 0.7rem;
    color: #555;
    line-height: 1.5;
}

.mistaken-words-header {
    margin-top: 0.75rem;
    color: #dc2626;
}

.mistaken-words-list {
    background: #fef2f2;
    color: #b91c1c;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid #fecaca;
}

.model-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
}

.model-stat {
    color: #666;
}

.model-stat strong {
    color: #333;
}

/* Score Bar Chart */
.score-chart {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.chart-bar-container {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.chart-bar-container:last-child {
    margin-bottom: 0;
}

.chart-label {
    width: 140px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
    flex-shrink: 0;
}

.chart-bar-wrapper {
    flex: 1;
    height: 28px;
    background: #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.chart-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.chart-bar-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.chart-bar.max-score {
    background: linear-gradient(90deg, #94a3b8, #64748b);
}

.chart-bar.model-score {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

/* Error bars for chart */
.chart-error-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 2px;
    background: rgba(30, 58, 95, 0.4);
    z-index: 0;
}

.chart-error-cap {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 12px;
    background: rgba(30, 58, 95, 0.4);
}

.chart-error-cap-left {
    left: 0;
}

.chart-error-cap-right {
    right: 0;
}

.chart-bar-value-error {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translate(100%, -50%);
    color: #333;
    text-shadow: none;
    padding-left: 4px;
}

/* Thermometer Score Bar */
.thermometer-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e5e5;
}

.thermometer-label {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.thermometer-track {
    height: 12px;
    background: #e5e5e5;
    border-radius: 6px;
    overflow: hidden;
}

.thermometer-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease, background 0.3s ease;
}

.thermometer-fill.score-low {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.thermometer-fill.score-medium {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.thermometer-fill.score-high {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.thermometer-fill.score-best {
    background: linear-gradient(90deg, #10b981, #34d399);
}

/* Responsive Design */
@media (max-width: 900px) {
    .game-overview {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .game-overview .boggle-grid {
        margin: 0 auto;
    }

    .game-stats {
        flex-direction: row;
        justify-content: center;
    }

    .model-cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    main {
        padding: 1rem;
    }

    .game-overview,
    .model-results {
        padding: 1rem;
    }

    .game-stats {
        flex-direction: column;
    }
}
