/* Modern color scheme and typography */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e1e8ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

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

/* Sections */
section {
    background: var(--card-background);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

section h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--secondary-color);
    display: inline-block;
}

section h2 a {
    color: inherit;
    text-decoration: none;
    position: relative;
}

section h2 a:hover {
    color: var(--secondary-color);
}

section h2 a:hover::before {
    content: '#';
    position: absolute;
    left: -1.5rem;
    color: var(--secondary-color);
    opacity: 0.7;
}

/* Statistics list */
#micro-list, #mini-list, #maxi-list {
    list-style: none;
    padding: 0;
}

#micro-list li, #mini-list li, #maxi-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#micro-list li:last-child, #mini-list li:last-child, #maxi-list li:last-child {
    border-bottom: none;
}

#micro-list li span, #mini-list li span, #maxi-list li span {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 1.2rem;
}

/* Details/Summary styling */
details {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--secondary-color);
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
    border-radius: 8px;
    transition: all 0.3s ease;
    user-select: none;
}

summary:hover {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    transform: translateX(4px);
}

details[open] summary {
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
}

/* Solutions display */
.solution-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--background-color);
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

.solution-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.move-sequence {
    margin: 1.5rem 0;
    overflow-x: auto;
}

/* Table styling */
.moves-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.moves-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.moves-table th {
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.moves-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.moves-table tbody tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

.moves-table tbody tr:last-child {
    border-bottom: none;
}

.moves-table td {
    padding: 0.75rem;
    font-size: 0.95rem;
}

.moves-table .move-number {
    background: var(--secondary-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.moves-table .move-action {
    font-family: 'Fira Code', 'Courier New', monospace;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.moves-table .move-points {
    font-weight: 600;
    color: var(--success-color);
}

.moves-table .move-coverage-gain {
    color: var(--secondary-color);
    font-weight: 500;
}

.moves-table .move-total-coverage {
    font-weight: 500;
    color: var(--text-primary);
}

.moves-table .move-coverage-percent {
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--primary-color);
}

/* Histogram */
.histogram {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.histogram-bar {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, var(--secondary-color) 0%, rgba(52, 152, 219, 0.1) 100%);
    border-radius: 6px;
    color: white;
}

.bar-label {
    font-weight: 600;
}

.bar-count {
    opacity: 0.9;
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 0 1rem 1rem;
    }

    section {
        padding: 1.5rem;
    }

    section h2 {
        font-size: 1.5rem;
    }

    .moves-table {
        font-size: 0.85rem;
    }

    .moves-table th,
    .moves-table td {
        padding: 0.5rem 0.3rem;
    }

    .moves-table th {
        font-size: 0.75rem;
        padding: 0.75rem 0.3rem;
    }

    /* Keep move action large on mobile */
    .moves-table .move-action {
        font-size: 1.1rem;
        font-weight: 700;
    }

    /* Adjust other columns for space */
    .moves-table .move-coverage-gain,
    .moves-table .move-total-coverage {
        font-size: 0.85rem;
    }

    .moves-table .move-coverage-percent {
        font-size: 0.8rem;
        padding: 0.2rem 0.3rem;
    }

    .move-sequence {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.75rem;
    }

    section {
        padding: 1rem;
    }

    .moves-table th {
        font-size: 0.7rem;
        letter-spacing: 0;
    }

    /* Abbreviate headers on very small screens */
    .moves-table thead th:nth-child(3) {
        font-size: 0;
    }
    .moves-table thead th:nth-child(3)::before {
        content: "PTS";
        font-size: 0.7rem;
    }

    .moves-table thead th:nth-child(4) {
        font-size: 0;
    }
    .moves-table thead th:nth-child(4)::before {
        content: "GAIN";
        font-size: 0.7rem;
    }

    .moves-table thead th:nth-child(5) {
        font-size: 0;
    }
    .moves-table thead th:nth-child(5)::before {
        content: "TOTAL";
        font-size: 0.7rem;
    }

    .moves-table thead th:nth-child(6) {
        font-size: 0;
    }
    .moves-table thead th:nth-child(6)::before {
        content: "%";
        font-size: 0.7rem;
    }

    /* Ensure move action stays readable */
    .moves-table .move-action {
        font-size: 1rem;
        font-weight: 700;
    }
}