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

body {
    font-family: -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, sans-serif;
    background: #0d1117;
    color: #e6edf3;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    border-bottom: 1px solid #30363d;
    padding: 0.75rem 1.5rem;
}

nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1100px;
    margin: 0 auto;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #58a6ff;
    text-decoration: none;
}

.tagline {
    color: #8b949e;
    font-size: 0.85rem;
}

.nav-link {
    margin-left: auto;
    color: #58a6ff;
    text-decoration: none;
    font-size: 0.9rem;
}

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

main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

footer {
    border-top: 1px solid #30363d;
    padding: 1rem 1.5rem;
    text-align: center;
    color: #8b949e;
    font-size: 0.8rem;
}

/* Landing */
.landing { text-align: center; padding-top: 4rem; }
.landing h1 { font-size: 2.2rem; margin-bottom: 1rem; }
.subtitle {
    color: #8b949e;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.chat-start {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: #238636;
    color: #fff;
}

.btn-primary:hover { background: #2ea043; }

.btn-secondary {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

.btn-secondary:hover { background: #30363d; }

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    max-width: 85%;
}

.message strong { display: block; margin-bottom: 0.3rem; }
.message.user {
    background: #1f6feb33;
    margin-left: auto;
}
.message.user strong { color: #58a6ff; }

.message.assistant { background: #21262d; }
.message.assistant strong { color: #3fb950; }

/* Markdown content in assistant messages */
.md-content p {
    margin: 0.4rem 0;
    line-height: 1.6;
}

.md-content pre {
    background: #0d1117;
    border: 1px solid #30363d;
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.6rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.md-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
}

.md-content code {
    background: #161b22;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.88em;
    color: #f0883e;
}

.md-content ul, .md-content ol {
    margin: 0.4rem 0 0.4rem 1.5rem;
    line-height: 1.6;
}

.md-content li { margin: 0.2rem 0; }

.md-content h1, .md-content h2,
.md-content h3, .md-content h4 {
    margin: 0.8rem 0 0.3rem;
    color: #e6edf3;
}

.md-content h3 { font-size: 1rem; }
.md-content h4 { font-size: 0.9rem; }

.md-content blockquote {
    border-left: 3px solid #30363d;
    padding-left: 0.75rem;
    color: #8b949e;
    margin: 0.4rem 0;
}

.md-content table {
    border-collapse: collapse;
    margin: 0.5rem 0;
    font-size: 0.85rem;
    width: 100%;
}

.md-content th, .md-content td {
    border: 1px solid #30363d;
    padding: 0.4rem 0.6rem;
    text-align: left;
}

.md-content th {
    background: #161b22;
    color: #e6edf3;
}

.md-content a {
    color: #58a6ff;
    text-decoration: none;
}

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

.md-content hr {
    border: none;
    border-top: 1px solid #30363d;
    margin: 0.6rem 0;
}

/* Legacy pre (non-markdown) */
.message pre {
    background: #161b22;
    padding: 0.75rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Thinking indicator */
.thinking-label {
    color: #8b949e;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0;
}

.chat-input {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 0;
    border-top: 1px solid #30363d;
}

.thinking-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background: #8b949e;
    border-radius: 50%;
    animation: thinking 1.4s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking {
    0%, 80%, 100% {
        transform: scale(0.4);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.chat-input button:disabled,
.chat-input input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-input input {
    flex: 1;
    padding: 0.7rem 1rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 1rem;
}

.chat-input button {
    padding: 0.7rem 1.5rem;
    background: #238636;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

/* Fixtures gallery */
.fixtures-header {
    margin-bottom: 2rem;
}

.fixtures-header h1 {
    margin-bottom: 0.5rem;
}

.fixtures-stats {
    color: #8b949e;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.fixtures-stats .stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-easy { background: #238636; color: #fff; }
.badge-medium { background: #9e6a03; color: #fff; }
.badge-hard { background: #da3633; color: #fff; }

.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filters button {
    padding: 0.4rem 0.8rem;
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.filters button.active {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #fff;
}

.fixture-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.fixture-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: border-color 0.15s;
}

.fixture-card:hover {
    border-color: #58a6ff;
}

.fixture-card h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: #e6edf3;
}

.fixture-card .question {
    color: #8b949e;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.fixture-card .topics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.topic-tag {
    background: #21262d;
    color: #8b949e;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Fixture detail modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    padding: 2rem;
    overflow-y: auto;
}

.modal-overlay.active { display: flex; }

.modal {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    margin: auto;
    padding: 1.5rem;
}

.modal h2 {
    margin-bottom: 0.5rem;
}

.modal .close-btn {
    float: right;
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal section {
    margin-top: 1.25rem;
}

.modal section h4 {
    color: #58a6ff;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.modal .criteria-list {
    list-style: none;
    padding: 0;
}

.modal .criteria-list li {
    padding: 0.2rem 0;
    font-size: 0.85rem;
    color: #8b949e;
}

.modal .criteria-list code {
    background: #21262d;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    color: #e6edf3;
}

/* Starter chips */
.starters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0 1rem 1rem;
}
.starter-chip {
    background: #21262d;
    color: #58a6ff;
    border: 1px solid #30363d;
    border-radius: 1rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.starter-chip:hover {
    background: #30363d;
    border-color: #58a6ff;
}
