/* LearnGameHosted - Mobile-first, light & trustworthy UI
   Simple components: Topbar, Cards, Lists, Badges, Forms.
*/
:root {
    --bg: #f6f8fb;
    --panel: #ffffff;
    --panel2: #f2f5fb;
    --border: rgba(15, 23, 42, 0.10);
    --text: rgba(15, 23, 42, 0.92);
    --muted: rgba(15, 23, 42, 0.62);
    --brand: #2563eb; /* calm blue */
    --brand2: rgba(37, 99, 235, 0.10);
    --danger: #dc2626;
    --danger2: rgba(220, 38, 38, 0.10);
    --warn: #f59e0b;
    --warn2: rgba(245, 158, 11, 0.14);
    --ok: #16a34a;
    --ok2: rgba(22, 163, 74, 0.10);
    --radius: 18px;
    --shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
    --pad: 14px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: radial-gradient(1100px 600px at 15% -10%, rgba(37,99,235,0.10), transparent 55%), radial-gradient(900px 520px at 90% 0%, rgba(22,163,74,0.06), transparent 55%), var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji","Segoe UI Emoji";
}

a {
    color: inherit;
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
        text-decoration-thickness: 2px;
        text-underline-offset: 3px;
    }

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 14px;
}

.page {
    padding: 16px 0 56px;
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
    background: rgba(246,248,251,0.82);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
    letter-spacing: 0.2px;
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--brand);
    box-shadow: 0 0 0 6px var(--brand2);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-pill {
    /*display: none;*/ /* mobile-first: hide */
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

@media (min-width: 720px) {
    .user-pill {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }
}

/* Common blocks */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--pad);
    box-shadow: var(--shadow);
}

.muted {
    color: var(--muted);
}

.offline-banner {
    background: var(--warn2);
    border-bottom: 1px solid rgba(245,158,11,0.25);
    color: rgba(120, 74, 0, 0.95);
    padding: 10px 14px;
    font-weight: 700;
    font-size: 13px;
}

/* Forms */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
}

    .field > span {
        font-weight: 800;
        font-size: 13px;
        color: var(--muted);
    }

.input {
    width: 100%;
    padding: 12px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    outline: none;
}

    .input:focus {
        border-color: rgba(37,99,235,0.35);
        box-shadow: 0 0 0 4px rgba(37,99,235,0.10);
    }

textarea.input {
    resize: vertical;
}

.grid {
    display: grid;
    gap: 12px;
}

@media (max-width: 520px) {
    .grid {
        grid-template-columns: 1fr !important;
    }
}

/* Buttons */
.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 12px 12px;
    font-weight: 900;
    letter-spacing: 0.2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary {
    color: white;
    background: linear-gradient(135deg, var(--brand), #1d4ed8);
    box-shadow: 0 10px 20px rgba(37,99,235,0.18);
}

.btn-outline {
    background: var(--panel);
    border-color: var(--border);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.btn-danger {
    color: var(--danger);
    background: var(--danger2);
    border-color: rgba(220,38,38,0.18);
}

.btn-sm {
    padding: 9px 10px;
    border-radius: 12px;
    font-size: 13px;
}

.w100 {
    width: 100%;
}

/* Alerts */
.alert {
    border-radius: 16px;
    padding: 12px 12px;
    border: 1px solid var(--border);
    background: var(--panel2);
    font-weight: 700;
}

    .alert.success {
        border-color: rgba(22,163,74,0.25);
        background: var(--ok2);
        color: rgba(14, 90, 40, 0.95);
    }

    .alert.error {
        border-color: rgba(220,38,38,0.25);
        background: var(--danger2);
        color: rgba(140, 20, 20, 0.95);
    }

/* Page structure */
.page-wrap {
    padding: 16px 0 56px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.page-title {
    margin: 0;
    font-size: 24px;
}

.subline {
    margin: 6px 0 0;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.section {
    margin-top: 14px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.section-title {
    margin: 0;
    font-size: 16px;
}

.section-hint {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
}

/* Typography helpers used across pages */
.h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 0.2px;
}

.h2 {
    margin: 0;
    font-size: 16px;
    letter-spacing: 0.2px;
}

/* Auth / centered pages */
.auth-shell {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 0 56px;
}

.auth-card {
    width: 100%;
    max-width: 520px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.auth-header h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0.2px;
}

.auth-header p {
    margin: 8px 0 0;
    color: var(--muted);
}

.auth-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

    .auth-footer a {
        color: var(--brand);
        font-weight: 900;
    }

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 14px;
    color: var(--muted);
    font-weight: 700;
}

    .check input {
        width: 18px;
        height: 18px;
    }

/* Grids used in pages */
.grid-2 {
    grid-template-columns: 1fr 1fr;
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0,1fr));
}

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

/* Dashboard helpers */
.kpi-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0,1fr));
}

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

.kpi-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow);
}

.kpi-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.kpi-value {
    font-size: 20px;
    font-weight: 900;
    margin-top: 6px;
}

.empty {
    background: var(--panel);
    border: 1px dashed rgba(15,23,42,0.18);
    border-radius: var(--radius);
    padding: 14px;
    color: var(--muted);
    font-weight: 700;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 12px;
}

@media (min-width: 860px) {
    .kpis {
        grid-template-columns: repeat(4, minmax(0,1fr));
    }
}

.kpi {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow);
}

    .kpi .kpi-label {
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
    }

    .kpi .kpi-value {
        font-size: 18px;
        font-weight: 900;
        margin-top: 6px;
    }

.list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.item-main {
    min-width: 0;
}

.item-title {
    font-weight: 900;
    margin: 0;
}

.item-meta {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel2);
    font-size: 12px;
    font-weight: 900;
    color: var(--text);
}

    .badge.good {
        border-color: rgba(22,163,74,0.22);
        background: var(--ok2);
    }

    .badge.warn {
        border-color: rgba(245,158,11,0.25);
        background: var(--warn2);
    }

    .badge.bad {
        border-color: rgba(220,38,38,0.22);
        background: var(--danger2);
    }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-preview {
    margin-top: 8px;
    color: rgba(15,23,42,0.88);
    background: var(--panel2);
    border: 1px solid rgba(15,23,42,0.08);
    padding: 10px 12px;
    border-radius: 14px;
}

.split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 860px) {
    .split {
        grid-template-columns: 1.1fr 0.9fr;
    }
}

/* Simple footer links */
.footer-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-weight: 800;
}

    .footer-nav a {
        color: var(--brand);
    }

.footer-actions {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-full {
    width: 100%;
    text-align: center;
}

@media (min-width: 720px) {
    .footer-actions {
        flex-direction: row;
        justify-content: space-between;
    }

    .btn-full {
        width: auto;
        min-width: 180px;
    }
}


.page-nav {
    margin-bottom: 8px;
}

.back-link {
    text-decoration: none;
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.back-link {
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

.header-block {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 12px;
}

.primary-actions {
    display: flex;
    gap: 10px;
}

.summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 14px;
    margin: 10px 0 14px;
    color: var(--muted);
    font-size: 13px;
}

    .summary strong {
        color: #111;
    }

.summary-dot {
    opacity: .5;
}

.segmented {
    display: flex;
    gap: 8px;
    background: #f2f4f7;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.seg-btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 12px;
    border: 0;
    background: transparent;
    font-weight: 900;
    cursor: pointer;
}

.seg-active {
    background: #fff;
    border: 1px solid var(--border);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.back-link {
    text-decoration: none;
    font-weight: 900;
    font-size: 14px;
}

.footer-actions {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-full {
    width: 100%;
    text-align: center;
}


.divider {
    height: 1px;
    background: var(--border);
    margin: 14px 0;
}

.soft-box {
    background: rgba(0,0,0,0.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
}

.soft-title {
    font-weight: 900;
}

.soft-meta {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.link-btn {
    background: transparent;
    border: 0;
    padding: 0;
    margin-top: 10px;
    color: var(--primary);
    font-weight: 900;
    cursor: pointer;
}

.mobile-only {
    display: inline;
}

.desktop-only {
    display: none;
}

/* Ab Tablet / Desktop */
@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: inline;
    }
}

/* StudentSubjects – mobile-friendly cards */
.subject-card {
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 14px;
    padding: 12px;
    background: #fff;
}

.subject-actions {
    margin-top: 12px;
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr;
}

/* 2 buttons next to each other on small phones */
@media (min-width: 420px) {
    .subject-actions {
        grid-template-columns: 1fr 1fr;
    }
}

/* 3 buttons in a row on larger phones / tablets */
@media (min-width: 640px) {
    .subject-actions {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* Make buttons easier to tap */
.subject-actions .btn {
    padding-top: 10px;
    padding-bottom: 10px;
    border-radius: 12px;
}

/* Toggle chip: keep it readable & tappable */
.subject-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 999px;
}

.subject-fab {
    position: sticky;
    bottom: 12px;
    width: 100%;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,.12);
}

/* StudentSubjects cards */
.subject-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 14px;
    padding: 12px;
}

.subject-card-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
}

.subject-edit-link {
    padding: 4px 8px;
    border-radius: 10px;
}

    .subject-edit-link:hover {
        background: rgba(0,0,0,.05);
        text-decoration: none;
    }

/* Footer action bar */
.subject-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0,0,0,.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 576px) {
    .subject-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}