/* ── Reset & base ─────────────────────────────────────────────────── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Georgia, 'Times New Roman', serif;
    background: #f7f6f2;
    color: #222;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────────── */
header {
    background: #1a1a1a;
    color: #fff;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-title {
    color: #fff;
    text-decoration: none;
    font-size: 1.25rem;
    font-family: sans-serif;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.site-title:hover {
    color: #ccc;
}

nav {
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: #aaa;
    text-decoration: none;
    font-family: sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    transition: color 0.15s;
}

nav a:hover {
    color: #fff;
}

nav a.active {
    color: #fff;
    border-bottom: 2px solid #fff;
    padding-bottom: 2px;
}

/* ── Main content ─────────────────────────────────────────────────── */
main {
    flex: 1;
    max-width: 960px;
    margin: 3rem auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* ── Profile section ──────────────────────────────────────────────── */
.profile {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.profile-image-wrapper {
    flex-shrink: 0;
}

.profile-image {
    width: 240px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: block;
}

.profile-bio h2 {
    font-size: 2rem;
    margin-bottom: 1.25rem;
    font-weight: normal;
}

.profile-bio p {
    line-height: 1.75;
    margin-bottom: 1rem;
    color: #333;
}

/* ── Project cards ────────────────────────────────────────────────── */
.project-cards {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.card {
    display: block;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: inherit;
    width: 260px;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    border-color: #aaa;
}

.card h3 {
    font-size: 1rem;
    font-family: sans-serif;
    margin-bottom: 0.4rem;
}

.card p {
    font-size: 0.875rem;
    color: #555;
    line-height: 1.5;
    margin: 0;
}

/* ── Footer ───────────────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 1.5rem;
    font-family: sans-serif;
    font-size: 0.8rem;
    color: #999;
    border-top: 1px solid #e0e0e0;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-family: sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: #333;
}

.btn-secondary {
    background: #e8e8e8;
    color: #222;
}

.btn-secondary:hover:not(:disabled) {
    background: #d4d4d4;
}

.btn-ghost {
    background: transparent;
    color: #888;
    border: 1px solid #ccc;
}

.btn-ghost:hover {
    color: #555;
    border-color: #999;
}

.btn-diff {
    background: #e8e8e8;
    color: #555;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

.btn-diff.active {
    background: #1a1a1a;
    color: #fff;
}

.btn-diff:hover:not(.active) {
    background: #d4d4d4;
}

/* ── Setup page ───────────────────────────────────────────────────── */
.setup-page {
    max-width: 480px;
}

.setup-page h2 {
    font-size: 1.75rem;
    font-weight: normal;
    margin-bottom: 1.5rem;
}

.setup-form fieldset {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.setup-form legend {
    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
    padding: 0 0.4rem;
}

.setup-form label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: sans-serif;
    font-size: 0.95rem;
    margin-right: 1rem;
    cursor: pointer;
}

.diff-radio-group {
    display: flex;
    gap: 0.75rem;
}

.hint {
    font-size: 0.8rem;
    color: #888;
    margin-left: 0.25rem;
}

.flash-messages {
    list-style: none;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-family: sans-serif;
    font-size: 0.9rem;
    color: #555;
}

.review-complete {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-family: sans-serif;
    color: #155724;
}

/* ── Trainer play page ────────────────────────────────────────────── */
.trainer-page {
    max-width: 680px;
}

.scramble-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 1.75rem 2rem;
    margin-bottom: 1.25rem;
}

.case-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    font-family: sans-serif;
}

.case-label {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #555;
}

.case-name {
    font-size: 0.9rem;
    color: #888;
}

.difficulty-badge {
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    background: #e8e8e8;
    color: #444;
    margin-left: auto;
}

.diff-0 { background: #e0e0e0; color: #555; }
.diff-1 { background: #d4edda; color: #155724; }
.diff-2 { background: #cce5ff; color: #004085; }
.diff-3 { background: #fff3cd; color: #856404; }
.diff-4 { background: #ffdce0; color: #721c24; }
.diff-5 { background: #e2d0f0; color: #4a1a72; }

.review-count {
    font-size: 0.8rem;
    color: #888;
    font-family: sans-serif;
}

.scramble-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.35rem;
    line-height: 1.6;
    color: #111;
    word-break: break-word;
}

.solution-block {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #eee;
}

.solution-label {
    font-family: sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    margin-bottom: 0.4rem;
}

.solution-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.15rem;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.action-row {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.difficulty-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
    font-family: sans-serif;
}

.difficulty-label {
    font-size: 0.85rem;
    color: #666;
    margin-right: 0.25rem;
}

/* ── Stats panel ──────────────────────────────────────────────────── */
.stats-panel {
    margin-bottom: 1.5rem;
    font-family: sans-serif;
}

.stats-panel summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    user-select: none;
}

.stats-panel summary:hover {
    color: #333;
}

.stats-table {
    margin-top: 0.75rem;
    border-collapse: collapse;
    font-size: 0.875rem;
    color: #444;
}

.stats-table th,
.stats-table td {
    border: 1px solid #e0e0e0;
    padding: 0.35rem 0.75rem;
    text-align: center;
}

.stats-table th {
    background: #f0f0f0;
    font-weight: 600;
}

.quit-form {
    margin-top: 0.5rem;
}

.shortcuts-table td,
.shortcuts-table th {
    text-align: left;
}

/* ── Setup stats ──────────────────────────────────────────────────── */
.setup-stats {
    margin-top: 2rem;
}

.setup-stats h3 {
    font-family: sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
    margin-bottom: 0.75rem;
}

/* ── Admin button ────────────────────────────────────────────────── */
.admin-btn {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    opacity: 0.25;
    cursor: pointer;
    padding: 0.25rem;
    transition: opacity 0.2s;
}
.admin-btn:hover { opacity: 0.7; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .profile {
        flex-direction: column;
    }

    .profile-image {
        width: 100%;
        max-width: 280px;
    }
}