/* My Karate — phone first. Families mostly arrive from a phone at the side of a sports hall. */

:root {
    --brand: #7a1f1f;
    --brand-ink: #ffffff;
    --ink: #1d1d1f;
    --muted: #5f6368;
    --line: #e3e3e6;
    --bg: #f5f5f7;
    --card: #ffffff;
    --good: #2e7d32;
    --radius: 14px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #f2f2f4;
        --muted: #a8a8ae;
        --line: #33333a;
        --bg: #111114;
        --card: #1c1c21;
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

a { color: inherit; }

.top {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--brand);
    color: var(--brand-ink);
}

.brand { font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.signout { font-size: .9rem; opacity: .9; }

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

.foot {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px 40px;
    color: var(--muted);
    font-size: .85rem;
    text-align: center;
}

h1, h2 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.greeting { margin: 8px 0 4px; }
.welcome h1 { font-size: 1.7rem; margin-bottom: 2px; }
.welcome .big { color: var(--brand); margin-bottom: 8px; }
.lead { color: var(--muted); margin: 0 0 16px; }
.meta { color: var(--muted); margin: 4px 0 0; font-size: .92rem; }
.big { font-size: 1.35rem; font-weight: 700; margin: 0; }

.card {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin: 0 0 12px;
}

.empty p { margin: 8px 0; }

.button {
    display: inline-block;
    margin-top: 8px;
    padding: 12px 20px;
    border-radius: 999px;
    background: var(--brand);
    color: var(--brand-ink);
    text-decoration: none;
    font-weight: 600;
}

/* Family home */
.students { list-style: none; margin: 0; padding: 0; }

.student {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    min-height: 72px;
}

.avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--brand-ink);
    font-weight: 700;
    font-size: 1.1rem;
}

.who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.name { font-weight: 600; font-size: 1.05rem; }
.chevron { font-size: 1.6rem; color: var(--muted); }

/* Student dashboard */
.switcher {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 12px;
}

.switcher a {
    flex: none;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    text-decoration: none;
    font-weight: 600;
}

.switcher a.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.hero { display: flex; align-items: center; gap: 16px; }
.hero h1 { margin: 0; }
.belt { width: 96px; height: auto; flex: none; }
.grade { margin: 4px 0 0; font-weight: 600; }

.progress {
    height: 12px;
    margin: 12px 0 4px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}

.progress span { display: block; height: 100%; background: var(--good); border-radius: 999px; }

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.stat { margin: 0; display: flex; flex-direction: column; }
.stat .n { font-size: 1.8rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .9rem; }

.facts dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }

.back { margin: 16px 0 0; }

h2.section { margin: 20px 0 8px; }
.note { margin-top: 12px; }

/* Tabs under the student's name */
.tabs {
    display: flex;
    gap: 4px;
    margin: 0 0 12px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}

.tabs a {
    flex: none;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 3px solid transparent;
}

.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }

/* Gradings */
.grading summary {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.grading summary::-webkit-details-marker { display: none; }
.belt.small { width: 56px; }

.result { flex: none; font-weight: 700; font-size: .9rem; padding: 4px 10px; border-radius: 999px; background: var(--line); }
.result.pass { background: var(--good); color: #fff; }

.marks { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0 0; }
.marks dt { color: var(--muted); }
.marks dd { margin: 0; }
.notes { margin: 12px 0 0; white-space: pre-line; }

/* Lessons and trophy lists */
.lessons, .league { list-style: none; padding: 0; }

.lessons li, .league li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
}

.lessons li:first-child, .league li:first-child { border-top: 0; }
.when { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tags { display: flex; gap: 6px; }
.tag { font-size: .8rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--line); }
.tag.trophy { background: #f5c518; color: #3a2e00; }

.league .rank { width: 2ch; font-weight: 700; color: var(--muted); }
.league .name { flex: 1; }
.league .won { font-weight: 700; }
.league li.me { background: color-mix(in srgb, var(--brand) 10%, transparent); }

/* Syllabus */
.syllabus summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.syllabus summary::-webkit-details-marker { display: none; }
.syllabus .count { flex: none; min-width: 28px; text-align: center; font-weight: 700; color: var(--muted); }
.moves { margin: 12px 0 0; padding-left: 1.4em; }
.moves li { padding: 8px 0; border-top: 1px solid var(--line); }
.moves li:first-child { border-top: 0; }
.moves .move { display: block; font-weight: 600; }
.moves .instruction { display: block; margin-top: 4px; }
.moves .video { display: inline-block; margin-top: 6px; font-weight: 600; color: var(--brand); }

.pager { display: flex; align-items: center; justify-content: space-between; margin: 12px 0; }

/* Forms */
.form label { display: block; margin: 12px 0 0; font-weight: 600; font-size: .95rem; }
.form input, .form select, .form textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 12px;
    font: inherit;
    font-weight: 400;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.form input.short { max-width: 12ch; }
.form h3 { margin: 20px 0 0; font-size: 1rem; }
.form .button { border: 0; cursor: pointer; margin-top: 16px; font: inherit; font-weight: 600; }
.button.secondary { background: var(--card); color: var(--brand); border: 2px solid var(--brand) !important; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.error, .errors { color: #b3261e; font-size: .9rem; }
.errors ul { margin: 8px 0 0; padding-left: 1.2em; }
.input-validation-error { border-color: #b3261e !important; }
.notice { border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--card)); }
.link-card a { font-weight: 600; text-decoration: none; display: block; }
.facts-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 8px; }
.facts-list dt { color: var(--muted); }
.facts-list dd { margin: 0; font-weight: 600; }
.yesno { border: 0; padding: 0; margin: 12px 0 0; }
.yesno legend { font-weight: 600; padding: 0; }
.yesno-row { display: flex; align-items: center; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.yesno-row > span { flex: 1; }
.yesno-row label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.yesno-row input { width: auto; margin: 0; }
.tag.ok { background: var(--good); color: #fff; }

@media (max-width: 380px) { .row2 { grid-template-columns: 1fr; } }

/* Phases 2–5 */
.alert { border-color: #b3261e; background: color-mix(in srgb, #b3261e 8%, var(--card)); }
.alert h2 { color: #b3261e; }
.announcement { border-left: 4px solid var(--brand); }
.announcement h2 { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 1.1rem; }
.announcement p { margin: 4px 0 0; white-space: pre-line; }
.streak { margin: 0 0 12px; }
.streak .n { font-size: 1.6rem; font-weight: 700; color: var(--good); margin-right: 4px; }
.badges { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.badge { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); }
.badge.earned { background: color-mix(in srgb, #f5c518 18%, var(--card)); border-color: #e0b400; }
.badge.next { border-style: dashed; }
.badge-name { font-weight: 700; }
.links a { display: block; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; font-weight: 600; }
.links a:first-of-type { border-top: 0; }
.share { display: flex; flex-wrap: wrap; gap: 8px; }
.share .button { margin-top: 0; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.check input { width: auto !important; margin: 0 !important; }
.linkish { border: 0; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 600; color: var(--brand); }
.pager a { font-weight: 600; }

/* "View in portal": an owner looking at a family's portal, read-only. On every page. */
.preview-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.6rem 1rem;
    background: #b00020;
    color: #fff;
    font-size: 0.95rem;
}

.preview-bar form { margin: 0; }

.preview-bar button {
    padding: 0.35rem 1rem;
    border: 2px solid #fff;
    border-radius: 0.4rem;
    background: transparent;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
