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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
}

nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #e94560;
    margin-right: 1rem;
}

.nav-links {
    display: flex;
    gap: 0.75rem;
}

.nav-links a {
    color: #a0a0b8;
    text-decoration: none;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.nav-links a:hover {
    background: #0f3460;
    color: #fff;
}

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

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

h1 { margin-bottom: 1rem; color: #fff; }
h2 { margin: 1.5rem 0 0.75rem; color: #e0e0e0; }
h3 { margin-bottom: 0.5rem; color: #a0a0b8; font-size: 0.85rem; text-transform: uppercase; }

.btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: #0f3460;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.btn:hover { background: #1a4f8a; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }

.btn-discord {
    background: #5865f2;
    font-size: 1.1rem;
    padding: 0.7rem 2rem;
}

.btn-discord:hover { background: #4752c4; }

.btn-invite {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.9rem;
    padding: 0.5rem 1.2rem;
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1rem;
    text-align: center;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    padding: 1rem;
}

.stat {
    font-size: 2rem;
    font-weight: 700;
    color: #e94560;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th, td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #0f3460;
}

th {
    background: #16213e;
    color: #a0a0b8;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    color: #a0a0b8;
    font-size: 0.85rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.9rem;
}

.form-group textarea { resize: vertical; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success { background: #1a4a2a; border: 1px solid #2ecc71; }
.alert-error { background: #4a1a1a; border: 1px solid #e74c3c; }

.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

code {
    background: #0f3460;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85em;
}

.text-muted { color: #6b7280; }

/* --- Settings page --- */

.settings-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.settings-header h1 {
    margin-bottom: 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.settings-card {
    padding: 1.25rem;
}

.settings-card h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.cookies-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.cookies-header h2 {
    margin: 0;
}

.badge-ok {
    background: #1a4a2a;
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.badge-none {
    background: #3a3a3a;
    color: #6b7280;
    border: 1px solid #555;
}

.btn-help {
    margin-left: auto;
    background: #533483;
    color: #e0e0e0;
}
.btn-help:hover { background: #6c44a2; }

/* --- Modal --- */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #0f3460;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: #a0a0b8;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}
.modal-close:hover { color: #fff; }

.modal-body {
    padding: 1.25rem;
}

.modal-body h3 {
    color: #e94560;
    font-size: 0.9rem;
    text-transform: none;
    margin: 1.25rem 0 0.5rem;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p,
.modal-body li {
    color: #c0c0d0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.modal-body ul,
.modal-body ol {
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
}

.modal-body li {
    margin-bottom: 0.3rem;
}

.modal-body a {
    color: #8ab4f8;
}
.modal-body a:hover { color: #afd0ff; }

.alert-info {
    background: #1a2a4a;
    border: 1px solid #3a6abf;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #c0c0d0;
}

.card-link {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, transform 0.1s;
}
.card-link:hover {
    border-color: #e94560;
    transform: translateY(-2px);
}

/* --- Results list --- */

.results-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.result-card {
    display: block;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, transform 0.1s;
}
.result-card:hover {
    border-color: #e94560;
    transform: translateY(-1px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.result-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: #fff;
}

.result-module {
    display: inline-block;
    background: #0f3460;
    color: #8ab4f8;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.result-date {
    color: #6b7280;
    font-size: 0.85rem;
}

.result-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.result-score-section {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 140px;
}

.result-percentage {
    font-size: 1.5rem;
    font-weight: 700;
}

.score-perfect { color: #2ecc71; }
.score-good { color: #f1c40f; }
.score-bad { color: #e74c3c; }
.score-none { color: #6b7280; }

.result-score-text {
    color: #6b7280;
    font-size: 0.85rem;
}

.result-bar-container {
    flex: 1;
}

.result-bar {
    height: 8px;
    background: #1a1a2e;
    border-radius: 4px;
    overflow: hidden;
}

.result-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.bar-perfect { background: #2ecc71; }
.bar-good { background: #f1c40f; }
.bar-bad { background: #e74c3c; }

.result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-slug {
    font-size: 0.8rem;
    color: #6b7280;
}

.result-arrow {
    color: #6b7280;
    font-size: 1.1rem;
}

/* --- Detail page --- */

.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.detail-header h1 {
    margin-bottom: 0;
}

.run-card {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.run-latest {
    border-color: #2ecc71;
    box-shadow: 0 0 0 1px rgba(46, 204, 113, 0.2);
}

.run-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.run-date {
    color: #a0a0b8;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.badge-latest {
    background: #1a4a2a;
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.btn-epitest {
    background: #533483;
}
.btn-epitest:hover {
    background: #6c44a2;
}

.run-score-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.run-percentage {
    font-size: 2.5rem;
    font-weight: 700;
    min-width: 90px;
}

.run-score-details {
    flex: 1;
}

.run-score-text {
    color: #a0a0b8;
    margin-bottom: 0.4rem;
}

/* --- Skills grid --- */

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.skill-item {
    background: #1a1a2e;
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    border-left: 3px solid transparent;
}

.skill-pass { border-left-color: #2ecc71; }
.skill-partial { border-left-color: #f1c40f; }
.skill-fail { border-left-color: #e74c3c; }

.skill-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
}

.skill-emoji {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.skill-emoji-pass { background: #2ecc71; }
.skill-emoji-partial { background: #f1c40f; }
.skill-emoji-fail { background: #e74c3c; }

.skill-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: #e0e0e0;
}

.skill-score {
    font-size: 0.8rem;
    color: #a0a0b8;
    margin-bottom: 0.3rem;
}

.skill-crashed {
    color: #e74c3c;
    font-size: 0.75rem;
}

.skill-bar {
    height: 4px;
    background: #0f3460;
    border-radius: 2px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    border-radius: 2px;
}

/* --- External items --- */

.external-items {
    margin-top: 1rem;
}

.external-items h4 {
    color: #a0a0b8;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.ext-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ext-item {
    background: #1a1a2e;
    border-radius: 4px;
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ext-type {
    color: #8ab4f8;
    font-weight: 500;
}

.ext-value {
    color: #e0e0e0;
    font-weight: 600;
}

.ext-comment {
    color: #6b7280;
    font-size: 0.75rem;
}
