/*
 * Game-style light theme — readable body, pixel-game accents.
 * Cream background, dark high-contrast text, vibrant primaries.
 */

:root {
    --bg: #fffbf0;
    --surface: #ffffff;
    --surface-2: #fef3c7;
    --border: #1a1a1a;
    --shadow: #1a1a1a;
    --text: #1a1a1a;
    --text-soft: #404040;
    --text-muted: #6b7280;
    --green: #16a34a;
    --green-soft: #dcfce7;
    --yellow: #f59e0b;
    --yellow-soft: #fef3c7;
    --pink: #ec4899;
    --red: #dc2626;
    --blue: #2563eb;
    --blue-soft: #dbeafe;
}

* { box-sizing: border-box; }

body {
    font-family: 'Nunito', system-ui, -apple-system, sans-serif;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
    min-height: 60vh;
}

h1, h2, h3, h4 {
    font-family: 'Nunito', sans-serif;
    color: var(--text);
    line-height: 1.25;
    margin-top: 0;
}
h1 { font-size: 2rem; font-weight: 900; margin: 1rem 0; }
h2 { font-size: 1.4rem; font-weight: 800; margin: 1.5rem 0 1rem; }
h3 { font-size: 1.15rem; font-weight: 700; margin: 1rem 0 0.5rem; }

.logo {
    font-family: 'Press Start 2P', monospace;
}

a { color: var(--blue); text-decoration: none; font-weight: 600; }
a:hover { color: var(--text); text-decoration: underline; }

p { margin: 0.5rem 0; }
strong { font-weight: 800; }

code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    background: var(--surface-2);
    padding: 1px 6px;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.9em;
}

.muted { color: var(--text-muted); font-weight: 500; }

/* ============== Header ============== */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 4px solid var(--border);
    box-shadow: 0 4px 0 var(--green);
}
/* Logo — three colored letter tiles + suffix word */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    line-height: 1;
}
.logo:hover { text-decoration: none; }
.logo-tile {
    font-family: 'Press Start 2P', monospace;
    display: inline-block;
    width: 34px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    color: #fff;
    border: 2.5px solid var(--border);
    box-shadow: 2px 2px 0 var(--shadow);
    font-size: 0.85rem;
    text-shadow: 1px 1px 0 var(--shadow);
}
.logo-tile + .logo-tile { margin-left: -2.5px; }
.logo-tile-1 { background: var(--green); }
.logo-tile-2 { background: var(--yellow); color: var(--text); text-shadow: 1px 1px 0 #fff; }
.logo-tile-3 { background: var(--pink); }
.logo-suffix {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-left: 0.3rem;
}
.logo:hover .logo-tile { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow); }
.logo-tile { transition: transform 0.05s ease, box-shadow 0.05s ease; }
.site-header nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-header nav a {
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.site-header nav a:hover { color: var(--green); text-decoration: none; }

/* ============== Buttons ============== */
.btn, button {
    display: inline-block;
    padding: 0.55rem 1.25rem;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    background: var(--green);
    color: #ffffff;
    border: 2.5px solid var(--border);
    box-shadow: 4px 4px 0 var(--shadow);
    cursor: pointer;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.05s ease, box-shadow 0.05s ease, background 0.1s ease;
}
.btn:hover, button:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--shadow);
    color: #fff;
    text-decoration: none;
}
.btn:active, button:active {
    transform: translate(3px, 3px);
    box-shadow: 1px 1px 0 var(--shadow);
}
.btn-primary { background: var(--blue); }
.btn-primary:hover { background: #1d4ed8; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-small { padding: 0.35rem 0.85rem; font-size: 0.9rem; box-shadow: 3px 3px 0 var(--shadow); }
.btn-danger { background: var(--red); }
.btn-link {
    background: none;
    color: var(--blue);
    border: none;
    box-shadow: none;
    padding: 0.5rem 0;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 700;
}
.btn-link:hover { transform: none; box-shadow: none; text-decoration: underline; color: var(--text); }
.btn-link-danger {
    background: none;
    color: var(--red);
    border: none;
    box-shadow: none;
    padding: 0;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
}
.btn-link-danger:hover { transform: none; box-shadow: none; text-decoration: underline; color: var(--red); }
button:disabled, .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: 4px 4px 0 var(--shadow);
}

/* ============== Forms ============== */
form label {
    display: block;
    margin: 1rem 0;
    color: var(--text);
    font-weight: 700;
    font-size: 1rem;
}
form label small {
    display: block;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}
form input, form select, form textarea {
    display: block;
    width: 100%;
    max-width: 540px;
    margin-top: 0.4rem;
    padding: 0.6rem 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    background: var(--surface);
    color: var(--text);
    border: 2.5px solid var(--border);
    border-radius: 0;
    box-shadow: 3px 3px 0 var(--shadow);
}
form input:focus, form select:focus, form textarea:focus {
    border-color: var(--blue);
    outline: none;
    box-shadow: 4px 4px 0 var(--blue);
}
form textarea {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
}
form input[type="file"] {
    padding: 0.4rem;
    font-family: inherit;
    background: var(--yellow-soft);
}
form label.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}
form label.checkbox input { width: auto; margin: 0; box-shadow: none; }

/* ============== Flash ============== */
.flash {
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    border: 2.5px solid var(--border);
    background: var(--surface);
    box-shadow: 4px 4px 0 var(--shadow);
    font-weight: 600;
}
.flash-error { background: #fee2e2; border-left: 8px solid var(--red); }
.flash-success { background: var(--green-soft); border-left: 8px solid var(--green); }

/* ============== Hero ============== */
.hero {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--surface);
    border: 2.5px solid var(--border);
    box-shadow: 6px 6px 0 var(--green);
    margin-bottom: 2rem;
}
.hero h1 {
    font-size: 2.3rem;
    margin-bottom: 1rem;
}
.hero p { font-size: 1.1rem; color: var(--text-soft); }

/* ============== Course cards ============== */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}
.course-card {
    display: block;
    background: var(--surface);
    border: 2.5px solid var(--border);
    box-shadow: 5px 5px 0 var(--shadow);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: transform 0.05s ease, box-shadow 0.05s ease;
}
.course-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 var(--green);
    color: inherit;
    text-decoration: none;
}
.course-card-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-bottom: 2.5px solid var(--border);
    background: var(--yellow-soft);
    display: block;
}
.course-card-thumb-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background:
        linear-gradient(135deg, transparent 49%, rgba(0,0,0,0.05) 49%, rgba(0,0,0,0.05) 51%, transparent 51%) 0 0 / 16px 16px,
        linear-gradient(135deg, var(--yellow-soft), var(--green-soft));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    border-bottom: 2.5px solid var(--border);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    letter-spacing: 1px;
}
.course-card-body { padding: 1rem 1.1rem; }
.course-card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; font-weight: 800; }
.course-meta { color: var(--text-muted); font-size: 0.9rem; margin: 0.25rem 0; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.course-blurb { font-size: 0.95rem; color: var(--text-soft); margin: 0.5rem 0; }
.course-price {
    display: inline-block;
    margin: 0.75rem 0 0;
    padding: 0.2rem 0.6rem;
    background: var(--yellow);
    color: var(--text);
    border: 2px solid var(--border);
    font-weight: 800;
    font-size: 0.95rem;
    text-transform: uppercase;
}

/* ============== Course detail (public) ============== */
.course-detail-thumb {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border: 2.5px solid var(--border);
    box-shadow: 6px 6px 0 var(--shadow);
    margin-bottom: 1.5rem;
    display: block;
}
.course-detail-header { margin-bottom: 1.5rem; }
.course-detail-body {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2rem;
}
.course-cta {
    padding: 1.25rem;
    background: var(--surface);
    border: 2.5px solid var(--border);
    box-shadow: 5px 5px 0 var(--green);
    height: fit-content;
    position: sticky;
    top: 1rem;
}
.course-price-large {
    display: block;
    font-family: 'Press Start 2P', monospace;
    font-size: 1.1rem;
    margin: 0 0 1.25rem;
    text-align: center;
    padding: 0.85rem 0.5rem;
    background: var(--yellow);
    color: var(--text);
    border: 2.5px solid var(--border);
    box-shadow: 4px 4px 0 var(--shadow);
    text-shadow: 1px 1px 0 #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.course-price-large.free {
    background: var(--green);
    color: #fff;
    text-shadow: 1px 1px 0 var(--shadow);
}
.course-outline { padding-left: 1.5rem; }
.course-outline > li { margin: 0.75rem 0; }
.course-outline ul { padding-left: 1.25rem; margin: 0.25rem 0; list-style: none; }
.course-outline ul li::before { content: "▸ "; color: var(--green); font-weight: 800; }

@media (max-width: 720px) {
    .course-detail-body { grid-template-columns: 1fr; }
    .course-cta { position: static; }
    .hero h1 { font-size: 1.6rem; }
    h1 { font-size: 1.5rem; }
}

/* ============== Tabs ============== */
.category-tabs {
    display: flex;
    gap: 0;
    margin: 1rem 0 2rem;
    border-bottom: 2.5px solid var(--border);
}
.category-tabs a {
    padding: 0.6rem 1.5rem;
    color: var(--text);
    border: 2.5px solid transparent;
    border-bottom: none;
    margin-bottom: -2.5px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.category-tabs a:hover { color: var(--green); text-decoration: none; }
.category-tabs a.active {
    background: var(--surface);
    color: var(--green);
    border-color: var(--border);
    border-bottom-color: var(--surface);
}

/* ============== Breadcrumb ============== */
.breadcrumb {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 600;
}
.breadcrumb a { color: var(--text-muted); font-weight: 600; }
.breadcrumb a:hover { color: var(--blue); }

/* ============== Dashboard ============== */
.dashboard-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 2.5px solid var(--border);
    box-shadow: 6px 6px 0 var(--green);
    margin-bottom: 2rem;
}
.character {
    width: 110px;
    height: 110px;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.7), transparent 60%),
        linear-gradient(135deg, var(--yellow-soft), var(--green-soft));
    border: 3px solid var(--border);
    box-shadow: 4px 4px 0 var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text);
}
.character-tier-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.55rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}
.character-placeholder {
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    color: var(--text);
    text-shadow: 2px 2px 0 var(--yellow);
}
.character-stats h1 {
    margin: 0;
    color: var(--text);
}
.character-stats p { font-size: 1.05rem; color: var(--text-soft); }

.course-progress-list { display: grid; gap: 1rem; }
.course-progress-card {
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 2.5px solid var(--border);
    box-shadow: 4px 4px 0 var(--shadow);
}
.course-progress-card h3 { margin: 0 0 0.5rem; }
.course-progress-card h3 a { color: var(--text); }
.course-progress-card h3 a:hover { color: var(--blue); }

.progress-bar {
    height: 18px;
    background: var(--surface-2);
    border: 2.5px solid var(--border);
    margin: 0.5rem 0 0.25rem;
    overflow: hidden;
    position: relative;
    box-shadow: inset 2px 2px 0 rgba(0,0,0,0.1);
}
.progress-fill {
    height: 100%;
    background: var(--green);
    transition: width 0.3s ease;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15);
}
.progress-text { font-size: 0.9rem; color: var(--text-muted); margin: 0 0 0.5rem; font-weight: 600; }

.complete-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    background: var(--green);
    color: #fff;
    border: 2.5px solid var(--border);
    box-shadow: 3px 3px 0 var(--shadow);
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

/* ============== Course outline / lessons ============== */
.module-section {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border: 2.5px solid var(--border);
    box-shadow: 5px 5px 0 var(--shadow);
}
.module-section h2 { margin-top: 0; color: var(--text); }

.lesson-list { list-style: none; padding: 0; margin: 0; }
.lesson-list li {
    padding: 0.5rem 0;
    border-bottom: 1px dashed #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.lesson-list li:last-child { border-bottom: none; }
.lesson-list li a { color: var(--text); font-weight: 600; }
.lesson-list li a:hover { color: var(--blue); text-decoration: none; }
.lesson-item.completed a { color: var(--green); }
.lesson-check {
    display: inline-block;
    width: 1.5em;
    color: var(--green);
    font-weight: 800;
}
.lesson-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============== Lesson view ============== */
.video-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin: 1rem 0;
    background: #000;
    border: 2.5px solid var(--border);
    box-shadow: 4px 4px 0 var(--shadow);
}
.video-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}

.lesson-content,
.content-box {
    background: var(--surface);
    border: 2.5px solid var(--border);
    box-shadow: 5px 5px 0 var(--shadow);
    padding: 1.75rem 2rem;
    margin: 1rem 0 2rem;
    font-size: 1.05rem;
    line-height: 1.75;
}
.content-box h1, .content-box h2, .content-box h3, .content-box h4 { color: var(--text); margin-top: 1.5rem; }
.content-box h2 { color: var(--green); font-size: 1.3rem; }
.content-box h1:first-child, .content-box h2:first-child { margin-top: 0; }
.content-box img { max-width: 100%; border: 2px solid var(--border); margin: 1rem 0; }
.content-box pre {
    background: #f9fafb;
    padding: 1rem;
    overflow-x: auto;
    border: 2px solid var(--border);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.92rem;
}
.content-box code { color: var(--text); }
.content-box blockquote {
    border-left: 5px solid var(--yellow);
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    background: var(--yellow-soft);
    color: var(--text-soft);
    font-style: italic;
}
.content-box a { color: var(--blue); text-decoration: underline; }
.content-box table { border-collapse: collapse; margin: 1rem 0; border: 2px solid var(--border); }
.content-box table th, .content-box table td { border: 1px solid var(--border); padding: 0.5rem 0.85rem; }
.content-box table th { background: var(--surface-2); font-weight: 800; }

/* ============== Lesson table (course outline) ============== */
.lesson-table-wrap { margin: 1.5rem 0; }
.module-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    margin: 1.75rem 0 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--yellow);
    border: 2.5px solid var(--border);
    box-shadow: 3px 3px 0 var(--shadow);
    display: inline-block;
}
.lesson-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 2.5px solid var(--border);
    box-shadow: 5px 5px 0 var(--shadow);
    margin: 0 0 2rem;
}
.lesson-table th {
    background: var(--text);
    color: #fff;
    padding: 0.65rem 1rem;
    text-align: left;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.lesson-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 1rem;
}
.lesson-table tr:last-child td { border-bottom: none; }
.lesson-table tbody tr:hover td { background: var(--yellow-soft); }
.lesson-table tr.completed td { background: var(--green-soft); }
.lesson-table tr.completed .col-status { color: var(--green); font-size: 1.2rem; }
.lesson-table .col-status { width: 36px; text-align: center; font-weight: 800; color: var(--text-muted); font-size: 1.1rem; }
.lesson-table .col-num { width: 48px; text-align: center; color: var(--text-muted); font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.lesson-table .col-title a { color: var(--text); font-weight: 700; }
.lesson-table .col-title a:hover { color: var(--blue); }
.lesson-table .col-meta { color: var(--text-muted); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.lesson-content h1, .lesson-content h2, .lesson-content h3, .lesson-content h4 {
    margin-top: 1.5rem;
    color: var(--text);
}
.lesson-content h1 { font-size: 1.6rem; }
.lesson-content h2 { font-size: 1.3rem; color: var(--green); }
.lesson-content h3 { font-size: 1.1rem; }
.lesson-content h1:first-child, .lesson-content h2:first-child { margin-top: 0; }
.lesson-content pre {
    background: #f9fafb;
    padding: 1rem;
    overflow-x: auto;
    border: 2px solid var(--border);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.92rem;
}
.lesson-content code { color: var(--text); }
.lesson-content table {
    border-collapse: collapse;
    margin: 1rem 0;
    border: 2px solid var(--border);
}
.lesson-content table th, .lesson-content table td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.85rem;
}
.lesson-content table th {
    background: var(--surface-2);
    font-weight: 800;
}
.lesson-content blockquote {
    border-left: 5px solid var(--yellow);
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    background: var(--yellow-soft);
    color: var(--text-soft);
    font-style: italic;
}
.lesson-content img { max-width: 100%; border: 2px solid var(--border); }
.lesson-content a { color: var(--blue); text-decoration: underline; }

.lesson-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2.5px dashed var(--border);
}
.lesson-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.lesson-nav a {
    color: var(--text);
    padding: 0.5rem 1rem;
    border: 2.5px solid var(--border);
    background: var(--surface);
    box-shadow: 3px 3px 0 var(--shadow);
    transition: transform 0.05s, box-shadow 0.05s;
    font-size: 0.95rem;
    font-weight: 700;
}
.lesson-nav a:hover {
    background: var(--surface-2);
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--shadow);
    text-decoration: none;
}

/* ============== Misc ============== */
hr {
    border: 0;
    border-top: 2.5px dashed var(--border);
    margin: 2rem 0;
}
img { max-width: 100%; }
::selection { background: var(--yellow); color: var(--text); }
