/* ILCL Learn — redesigned portal stylesheet (ilcl-learn.html).
   Built on the ILCL design system: navy / gold / warm-gray grounds, Cormorant Garamond headings,
   DM Sans text, contrast-safe text colours, 1.5px line icons. Every class the portal's script
   uses is styled here. Subject pages (learn/**) use subject.css. */

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

:root {
  --navy:        #1C2951;
  --navy-mid:    #243363;
  --navy-light:  #2D3F7A;
  --gold:        #C9A664;
  --gold-light:  #E2C98A;
  --gold-pale:   #F5EDD8;
  --gold-deep:   #85652A;
  --white:       #ffffff;
  --off-white:   #FAFAF8;
  --bg:          #F4F2EE;
  --bg-2:        #E8E4DC;
  --text:        #1C2951;
  --text-sec:    #3D4A6B;
  --text-muted:  #5F6985;
  --on-navy:     #BFC3CE;
  --on-navy-sub: #A4A9B9;
  --border:      rgba(28,41,81,.10);
  --border-gold: rgba(201,166,100,.25);
  --teal:        #2F9C8E;
  --teal-deep:   #1F7A6E;
  --coral:       #E8645A;
  --red:         #B3382C;
  --green:       #2E7D4F;
  --blue:        #2563B0;
  --purple:      #7C6FC4;
  --success:     #2ECC71;
  --success-tint:#E7F4EC;
  --danger-tint: #FBEAE8;
  --card-shadow: 0 2px 12px rgba(28,41,81,.08);
  --lift-shadow: 0 12px 35px rgba(28,41,81,.10);
  --radius:      16px;
  --radius-sm:   8px;
  --font-serif:  "Cormorant Garamond", Georgia, serif;
  --font-sans:   "DM Sans", system-ui, sans-serif;
  --side-w:      264px;
}

html { font-variant-numeric: lining-nums; }
html, body { min-height: 100%; font-family: var(--font-sans); font-size: 15.5px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; border-radius: 6px; }
.nav-item:focus-visible, .side-user button:focus-visible { outline-color: var(--gold); }

/* ═════════ Sign in ═════════ */
#auth-shell { min-height: 100vh; display: flex; background: var(--off-white); }
.auth-art { flex: 1.1; background: var(--navy); color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; right: -150px; top: 14%; width: 300px; height: 600px; border-radius: 300px 0 0 300px; border: 1.5px solid rgba(201,166,100,.45); box-shadow: -30px 0 0 -29px rgba(201,166,100,.0), inset 40px 0 0 -38px rgba(201,166,100,.4), inset 80px 0 0 -78px rgba(201,166,100,.3); pointer-events: none; }
.auth-art .art-logo { width: 240px; height: auto; display: block; }
.auth-art .art-tagline { font-size: .875rem; font-style: italic; color: var(--on-navy-sub); margin-top: 10px; }
.auth-art h1 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(2.8rem, 5vw, 4.7rem); line-height: 1.04; position: relative; }
.auth-art h1 i { color: var(--gold); }
.auth-art p { font-size: 1.1rem; font-weight: 300; color: var(--on-navy); max-width: 30rem; margin-top: 22px; position: relative; }
.auth-art ul { list-style: none; display: flex; gap: 32px; flex-wrap: wrap; font-size: .9rem; color: var(--on-navy); position: relative; }
.auth-art li { display: flex; align-items: center; gap: 10px; }
.auth-art li svg { width: 20px; height: 20px; color: var(--gold); fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.auth-pane { flex: .9; display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-logo { text-align: left; margin-bottom: 26px; }
.auth-logo img { display: none; height: 38px; width: auto; }
.auth-logo .brand, .auth-logo .sub, .auth-logo .tagline { display: none; }
.auth-logo.logo-failed .brand { display: block; font-family: var(--font-serif); font-size: 2rem; color: var(--navy); line-height: 1; }
.auth-logo.logo-failed .sub { display: block; font-size: .8rem; color: var(--text-muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.auth-eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-deep); display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.auth-eyebrow::before { content: ""; width: 24px; height: 1.5px; background: var(--gold); }
.auth-title { font-family: var(--font-serif); font-weight: 500; font-size: 2.6rem; line-height: 1.08; margin-bottom: 24px; }
.auth-title i { color: var(--gold-deep); }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.auth-tab { padding: 0 20px; height: 42px; font-size: .875rem; font-weight: 500; color: var(--text-sec); cursor: pointer; border-radius: 30px; border: 1px solid var(--border-gold); background: var(--white); font-family: var(--font-sans); }
.auth-tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-divider { text-align: center; font-size: .8rem; color: var(--text-muted); margin: 18px 0; display: flex; align-items: center; gap: 14px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-forgot { text-align: right; margin: -6px 0 12px; }
.auth-forgot a { font-size: .8125rem; color: var(--navy); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--gold); }
.auth-note { margin-top: 22px; padding: 14px 16px; border-radius: 12px; background: var(--gold-pale); border: 1px solid var(--border-gold); font-size: .8125rem; color: var(--text-sec); }
#g_id_signin { margin-bottom: 4px; }

/* ═════════ Forms and buttons ═════════ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .8125rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea,
.inline-form input, .inline-form select, .inline-form textarea {
  width: 100%; padding: 11px 14px; min-height: 46px; border: 1px solid #7A849E; border-radius: var(--radius-sm);
  font-size: .9375rem; font-family: var(--font-sans); color: var(--text); background: var(--off-white); outline: none;
}
.form-group input[type=checkbox], .form-group input[type=radio], .inline-form input[type=checkbox], .inline-form input[type=radio], .form-group input[type=file] { width: auto; min-height: 0; padding: 0; accent-color: var(--navy); }
.form-group textarea, .inline-form textarea { resize: vertical; min-height: 84px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.inline-form input:focus, .inline-form select:focus, .inline-form textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(28,41,81,.12); background: #fff; }
.form-error { font-size: .8125rem; color: var(--red); margin-top: 10px; min-height: 18px; font-weight: 500; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn-primary { width: 100%; height: 48px; background: var(--navy); color: #fff; border: 1px solid var(--navy); border-radius: var(--radius-sm); font-size: .9375rem; font-weight: 500; font-family: var(--font-sans); cursor: pointer; margin-top: 8px; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary:hover { background: var(--navy-light); }
.btn-primary:disabled { opacity: .6; cursor: default; }

.btn-sm { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: .8125rem; font-weight: 500; cursor: pointer; font-family: var(--font-sans); }
.btn-sm:not(.primary):not(.danger):not(.success):not(.ghost) { background: transparent; color: var(--navy); border-color: var(--border-gold); }
.btn-sm.primary { background: var(--navy); color: #fff; }
.btn-sm.primary:hover { background: var(--navy-light); }
.btn-sm.danger { background: var(--danger-tint); color: var(--red); border-color: rgba(179,56,44,.25); }
.btn-sm.danger:hover { background: #f6d9d5; }
.btn-sm.success { background: var(--success-tint); color: var(--green); border-color: rgba(46,125,79,.25); }
.btn-sm.success:hover { background: #d6ecdf; }
.btn-sm.ghost { background: transparent; color: var(--navy); border-color: var(--border-gold); }
.btn-sm.ghost:hover { background: var(--gold-pale); }
.btn-add { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 20px; background: var(--navy); color: #fff; border: none; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; cursor: pointer; font-family: var(--font-sans); margin-bottom: 16px; }
.btn-add:hover { background: var(--navy-light); }
.btn-add svg { width: 16px; height: 16px; }
.btn-open { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; background: var(--navy); color: #fff !important; border: none; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; font-family: var(--font-sans); cursor: pointer; text-decoration: none; width: fit-content; }
.btn-open:hover { background: var(--navy-light) !important; }
.btn-open svg { width: 15px; height: 15px; transition: transform .2s; }
.btn-open:hover svg { transform: translateX(3px); }
.btn-back { display: inline-flex; align-items: center; gap: 8px; font-size: .875rem; font-weight: 500; color: var(--navy); background: none; border: none; cursor: pointer; padding: 0; margin-bottom: 18px; font-family: var(--font-sans); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--gold); }
.btn-back:hover { color: var(--gold-deep); }
.btn-back svg { width: 16px; height: 16px; }
.cta-link { display: inline-flex; align-items: center; height: 40px; margin-top: 14px; padding: 0 20px; background: var(--navy); color: #fff; border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500; text-decoration: none; }
.cta-link:hover { background: var(--navy-light); }
.btn-view { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 14px; background: var(--navy); color: #fff; border-radius: 6px; font-size: .8rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn-view:hover { background: var(--navy-light); }
.btn-dl { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 14px; background: transparent; color: var(--navy); border: 1px solid var(--border-gold); border-radius: 6px; font-size: .8rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn-dl:hover { background: var(--gold-pale); }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═════════ Portal shell: sidebar + content ═════════ */
#portal-shell { display: none; min-height: 100vh; }
.side { width: var(--side-w); flex: none; background: var(--navy); color: #fff; display: flex; flex-direction: column; gap: 26px; padding: 30px 18px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.header-brand { padding: 0 8px; display: flex; flex-direction: column; gap: 10px; }
.header-brand img { width: 176px; height: auto; display: block; }
.header-tagline { font-size: .78rem; font-style: italic; color: var(--on-navy-sub); line-height: 1.4; }
.portal-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 12px; border-radius: 10px; font-size: .9rem; color: var(--on-navy); background: none; border: none; cursor: pointer; text-align: left; font-family: var(--font-sans); white-space: nowrap; }
.nav-item svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav-quiz-icon { width: 22px; height: 22px; object-fit: contain; flex: none; }
.nav-item:hover:not(.locked) { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--navy-mid); color: #fff; font-weight: 500; }
.nav-item.active svg { color: var(--gold); }
.nav-item.locked { color: var(--on-navy-sub); opacity: .65; cursor: default; }
.nav-item.admin-nav { color: var(--gold-light); }
.nav-label { font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--on-navy-sub); padding: 0 12px 8px; }
.side-grow { flex: 1; }
.side-user { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.12); }
.side-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1rem; flex: none; }
.side-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 calc(100% - 56px); }
.header-name { font-size: .875rem; font-weight: 500; color: #fff; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-role { font-size: .75rem; color: var(--on-navy-sub); }
.btn-logout, .btn-header-profile { white-space: nowrap; height: 34px; padding: 0 14px; background: transparent; border: 1px solid rgba(255,255,255,.28); border-radius: 8px; color: #fff; font-size: .8125rem; font-weight: 500; font-family: var(--font-sans); cursor: pointer; }
.btn-logout:hover, .btn-header-profile:hover { background: rgba(255,255,255,.1); }
.side-user .btn-header-profile, .side-user .btn-logout { flex: 1 1 calc(50% - 6px); }

.portal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.portal-main { flex: 1; padding: 44px 56px 72px; max-width: 1180px; width: 100%; }
#preview-banner { background: var(--gold-pale); color: var(--navy); padding: 10px 24px; text-align: center; font-size: .875rem; font-weight: 500; border-bottom: 1px solid var(--border-gold); }
.view { display: none; }
.view.active { display: block; }

.section-title { font-family: var(--font-serif); font-weight: 500; font-size: 2.9rem; line-height: 1.06; color: var(--navy); margin-bottom: 10px; letter-spacing: -.005em; }
.section-title i { color: var(--gold-deep); }
.section-title[style*="font-size:1rem"], .section-title[style*="font-size:1.1rem"] { font-family: var(--font-sans) !important; font-size: .75rem !important; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.section-subtitle { font-size: 1rem; font-weight: 300; color: var(--text-sec); margin-bottom: 28px; max-width: 42rem; }

/* ═════════ Stats, cards, notices ═════════ */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--card-shadow); }
.stat-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 10px; }
.stat-value { font-family: var(--font-serif); font-weight: 500; font-size: 2.7rem; color: var(--navy); line-height: 1; font-variant-numeric: lining-nums; }
.stat-value.gold { color: var(--gold-deep); }
.stat-value.teal { color: var(--teal-deep); }
.stat-value.coral { color: var(--red); }
.stat-value.blue { color: var(--blue); }
.stat-value.purple { color: #5C4FA0; }

.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-bottom: 32px; }
.action-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--card-shadow); cursor: pointer; display: flex; flex-direction: column; gap: 14px; transition: border-color .2s, box-shadow .2s, transform .2s; }
.action-card:hover { border-color: var(--border-gold); box-shadow: var(--lift-shadow); transform: translateY(-3px); }
.action-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--gold-pale); color: var(--gold-deep); }
.action-icon.navy, .action-icon.gold, .action-icon.teal, .action-icon.coral, .action-icon.purple { background: var(--gold-pale); }
.action-icon svg { width: 22px; height: 22px; stroke: var(--gold-deep) !important; fill: none; }
.action-icon.quiz-icon img { width: 32px; height: 32px; object-fit: contain; }
.action-label { font-weight: 600; font-size: 1rem; color: var(--navy); }
.action-desc { font-size: .875rem; color: var(--text-sec); line-height: 1.5; margin-top: -6px; }

.notice-card { background: var(--gold-pale); border: 1px solid var(--border-gold); border-radius: 14px; padding: 22px 26px; margin-bottom: 24px; }
.notice-card[style*="border-left-color"] { border-left-color: var(--border-gold) !important; }
.notice-card h3 { font-family: var(--font-serif); font-weight: 500; font-size: 1.5rem; color: var(--navy); margin-bottom: 6px; }
.notice-card p { font-size: .9375rem; color: var(--text-sec); line-height: 1.65; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.subject-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--card-shadow); display: flex; flex-direction: column; gap: 14px; }
.subject-card:hover { box-shadow: var(--lift-shadow); }
.subject-icon-tile { width: 48px; height: 48px; border-radius: 12px; background: var(--gold-pale); color: var(--gold-deep); display: flex; align-items: center; justify-content: center; }
.subject-icon-tile svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.subject-card.is-soon .subject-icon-tile { background: var(--bg); color: var(--text-muted); }
.subject-tag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 30px; background: var(--bg); color: var(--text-sec); font-size: .75rem; font-weight: 500; white-space: nowrap; }
.subject-badge { font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: 5px 12px; border-radius: 30px; display: inline-block; width: fit-content; }
.subject-badge.available { background: var(--success-tint); color: var(--green); }
.subject-badge.soon { background: var(--bg); color: var(--text-muted); }
.subject-name { font-family: var(--font-serif); font-weight: 500; font-size: 1.55rem; line-height: 1.15; color: var(--navy); }
.subject-desc { font-size: .875rem; color: var(--text-sec); line-height: 1.6; flex: 1; }
.game-subject-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--text-muted); }
.game-best-score { font-weight: 600; color: var(--gold-deep); }

/* ═════════ Tables ═════════ */
.data-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--card-shadow); background: var(--white); }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th { background: var(--off-white); color: var(--text-muted); font-weight: 600; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; padding: 13px 16px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-sec); }
.data-table td:first-child { color: var(--navy); font-weight: 500; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--off-white); }
.data-table .empty-row td { text-align: center; color: var(--text-muted); padding: 40px 16px; }

.badge { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 30px; font-size: .75rem; font-weight: 600; }
.badge-present, .badge-paid, .badge-active { background: var(--success-tint); color: var(--green); }
.badge-absent, .badge-unpaid, .badge-inactive { background: var(--danger-tint); color: var(--red); }
.badge-late { background: #FBF0DA; color: #8A5A0B; }
.badge-excused { background: #EEEBF8; color: #5C4FA0; }
.badge-published { background: var(--success-tint); color: var(--green); }
.badge-draft { background: var(--bg); color: var(--text-muted); }
.badge-enrolled { background: rgba(28,41,81,.08); color: var(--navy); }
.badge-public { background: var(--gold-pale); color: var(--gold-deep); }

/* ═════════ Reports ═════════ */
.report-list { display: flex; flex-direction: column; gap: 16px; }
.report-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--card-shadow); overflow: hidden; }
.report-header { padding: 22px 26px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; cursor: pointer; user-select: none; }
.report-header:hover { background: var(--off-white); }
.report-meta { flex: 1; }
.report-period { font-family: var(--font-serif); font-weight: 500; font-size: 1.55rem; color: var(--navy); line-height: 1.1; }
.report-subject { font-size: .875rem; color: var(--text-muted); margin-top: 4px; }
.report-cefr { font-family: var(--font-serif); font-weight: 500; font-size: 2rem; color: var(--gold-deep); white-space: nowrap; line-height: 1; }
.report-chevron { transition: transform .25s; color: var(--text-muted); flex-shrink: 0; margin-top: 4px; }
.report-card.open .report-chevron { transform: rotate(180deg); }
.report-body { display: none; padding: 0 26px 26px; border-top: 1px solid var(--border); }
.report-card.open .report-body { display: block; }
.report-comment { font-size: 1rem; line-height: 1.7; padding: 18px 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; color: var(--text-sec); font-family: var(--font-serif); font-style: italic; font-size: 1.15rem; }
.skill-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.skill-row:last-child { border-bottom: none; }
.skill-name { font-weight: 600; font-size: .9rem; }
.skill-cefr { font-family: var(--font-serif); font-weight: 500; font-size: 1.25rem; color: var(--gold-deep); white-space: nowrap; }
.skill-narrative { font-size: .875rem; color: var(--text-sec); line-height: 1.65; width: 100%; }
.fee-section-title { font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); margin: 24px 0 10px; }

/* ═════════ Tabs ═════════ */
.admin-tabs, .game-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.admin-tab, .game-tab { height: 42px; padding: 0 20px; border-radius: 30px; border: 1px solid var(--border-gold); background: var(--white); color: var(--text-sec); font-size: .875rem; font-weight: 500; cursor: pointer; font-family: var(--font-sans); display: inline-flex; align-items: center; gap: 8px; }
.admin-tab:hover, .game-tab:hover { background: var(--gold-pale); }
.admin-tab.active, .game-tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.admin-tab-panel, .game-tab-panel { display: none; }
.admin-tab-panel.active, .game-tab-panel.active { display: block; }
.admin-two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
#subjects-admin-content .admin-two-col { grid-template-columns: minmax(0, 1fr); gap: 32px; }
.inline-form { background: var(--white); border: 1px solid var(--border-gold); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.inline-form h4 { font-family: var(--font-serif); font-weight: 500; font-size: 1.4rem; color: var(--navy); margin-bottom: 16px; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ═════════ Modals ═════════ */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(28,41,81,.55); z-index: 500; align-items: center; justify-content: center; padding: 24px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--white); border-radius: 20px; padding: 32px; width: 100%; max-width: 460px; box-shadow: 0 32px 80px rgba(0,0,0,.35); }
.modal h3 { font-family: var(--font-serif); font-weight: 500; font-size: 1.9rem; color: var(--navy); margin-bottom: 16px; line-height: 1.1; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.modal-wide { max-width: 600px; max-height: 88vh; overflow-y: auto; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.profile-summary { margin-bottom: 18px; }
.profile-summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.profile-summary-row:last-child { border-bottom: none; }
.psr-label { color: var(--text-muted); }
.psr-value { font-weight: 500; color: var(--navy); text-align: right; }
.psr-action { font-size: .8125rem; color: var(--navy); font-weight: 500; margin-left: 6px; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.profile-danger-zone { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.pdz-text { font-size: .8125rem; color: var(--text-muted); margin-bottom: 10px; }

.welcome-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(28,41,81,.96); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .5s; cursor: pointer; }
.welcome-overlay.show { opacity: 1; }
#welcome-canvas, #quiz-welcome-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.welcome-text { position: relative; text-align: center; padding: 0 24px; transform: scale(.9); opacity: 0; transition: transform .6s cubic-bezier(.34,1.4,.64,1), opacity .6s; }
.welcome-overlay.show .welcome-text { transform: scale(1); opacity: 1; }
.welcome-logo { height: 64px; width: auto; display: block; margin: 0 auto 22px; }
.welcome-text h2 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(2.6rem, 6vw, 4rem); color: var(--gold); margin-bottom: 10px; line-height: 1.05; }
.welcome-text p { font-size: 1.2rem; font-weight: 300; color: var(--on-navy); }
.quiz-welcome-overlay { background: rgba(28,41,81,.96); }
.quiz-welcome-trophy { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 50%; border: 1.5px solid rgba(201,166,100,.6); display: flex; align-items: center; justify-content: center; color: var(--gold); animation: gameStreakPop .6s ease .3s both; }
.quiz-welcome-trophy svg { width: 42px; height: 42px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.quiz-welcome-h2 { font-size: clamp(2.4rem, 5.5vw, 3.6rem) !important; }

.page-loader { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.page-loader .loader-spinner { width: 34px; height: 34px; border: 3px solid var(--bg-2); border-top-color: var(--navy); border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto 16px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(90px); background: var(--navy); color: #fff; padding: 13px 24px; border-radius: 10px; font-size: .9rem; font-weight: 500; transition: transform .3s; z-index: 999; max-width: calc(100vw - 32px); pointer-events: none; box-shadow: 0 12px 40px rgba(28,41,81,.35); border: 1px solid rgba(201,166,100,.5); }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); border-color: var(--red); }

/* ═════════ Study calendar ═════════ */
.cal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
#cal-month-label { font-family: var(--font-serif); font-weight: 500; font-size: 2rem; color: var(--navy); flex: 1; min-width: 180px; }
.btn-cal-nav, .btn-cal-today { border: 1px solid var(--border-gold); border-radius: 30px; background: var(--white); cursor: pointer; font-family: var(--font-sans); color: var(--navy); }
.btn-cal-nav { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.btn-cal-today { height: 42px; padding: 0 20px; font-size: .875rem; font-weight: 500; }
.btn-cal-nav:hover, .btn-cal-today:hover { background: var(--gold-pale); }
.cal-legend { display: flex; align-items: center; gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-legend-item { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--text-muted); white-space: nowrap; }
.cal-legend-swatch { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; border: 1px solid rgba(28,41,81,.18); }
.cal-grid-header { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.cal-day-name { background: var(--off-white); text-align: left; font-size: .72rem; font-weight: 600; color: var(--text-muted); padding: 12px; text-transform: uppercase; letter-spacing: .12em; }
.cal-day-name-weekend { color: var(--text-muted); }
.cal-grid-body { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.cal-cell { min-height: 112px; background: var(--white); padding: 10px; cursor: pointer; overflow: hidden; }
.cal-cell:hover:not(.cal-cell-empty) { background: var(--gold-pale); }
.cal-cell-empty { background: var(--off-white); cursor: default; }
.cal-cell-weekend { background: var(--off-white); }
.cal-cell-weekend:hover:not(.cal-cell-empty) { background: var(--gold-pale); }
.cal-cell-holiday { background: var(--gold-pale); }
.cal-cell-holiday:hover:not(.cal-cell-empty) { background: #efe2c3; }
.cal-today { box-shadow: inset 0 0 0 2px var(--navy); }
.cal-date-num { font-size: .8125rem; font-weight: 500; color: var(--text-sec); margin-bottom: 4px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-date-num.today { background: var(--navy); color: #fff; }
.cal-pill { font-size: .75rem; font-weight: 500; padding: 3px 8px; border-radius: 6px; margin-bottom: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cal-pill:hover { opacity: .75; }
.cal-pill-class { background: var(--navy); color: #fff; cursor: default; }
.cal-pill-class:hover { opacity: 1; }
.cal-pill-time { opacity: .75; margin-left: 4px; }
.cal-more { font-size: .75rem; color: var(--text-muted); font-weight: 500; padding-top: 1px; }
.cal-holiday-label { font-size: .72rem; color: var(--gold-deep); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }

/* ═════════ Past and mock papers ═════════ */
.paper-list { display: flex; flex-direction: column; }
.paper-subject-heading { font-family: var(--font-serif); font-weight: 500; font-size: 1.8rem; color: var(--navy); padding: 22px 0 10px; border-bottom: 1px solid var(--border-gold); margin-top: 10px; }
.paper-subject-heading:first-child { margin-top: 0; padding-top: 0; }
.paper-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.paper-title { flex: 1; font-size: .95rem; font-weight: 500; color: var(--navy); min-width: 160px; }
.paper-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.paper-tag { font-size: .75rem; padding: 3px 10px; border-radius: 30px; background: var(--white); border: 1px solid var(--border); color: var(--text-sec); white-space: nowrap; }
.paper-actions { display: flex; gap: 8px; flex-shrink: 0; }
.paper-empty { color: var(--text-muted); padding: 40px 0; text-align: center; }
.paper-pair-actions { display: flex; gap: 16px; flex-shrink: 0; flex-wrap: wrap; align-items: center; }
.paper-pair-group { display: flex; align-items: center; gap: 6px; }
.paper-pair-label { font-size: .72rem; font-weight: 600; letter-spacing: .08em; color: var(--text-muted); white-space: nowrap; }
.btn-view.is-ms { background: var(--teal-deep); }
.admin-paper-box { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; min-width: 160px; }
.admin-paper-box-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.admin-paper-box-empty { display: flex; align-items: center; color: var(--text-muted); font-size: .8125rem; padding: 8px 12px; border: 1px dashed var(--border); border-radius: 8px; min-width: 160px; }

/* ═════════ Knowledge quiz game ═════════ */
#view-game.in-quiz > .btn-back, #view-game.in-quiz > .section-title, #view-game.in-quiz > .section-subtitle,
#view-game.in-quiz > .game-online-badge, #view-game.in-quiz > .game-tabs { display: none !important; }
#view-game.in-quiz #game-quiz-screen, #view-game.in-quiz #game-results-screen { max-width: 880px; margin: 0 auto; }
.game-online-badge { display: none; align-items: center; gap: 8px; font-size: .8125rem; font-weight: 500; color: var(--green); margin-bottom: 18px; }
.game-online-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.game-filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.game-filter-select, .lb-select, #lb-subject-select, #filter-curriculum, #filter-grade, #filter-subject, #filter-year, #gq-filter-subject, #att-month, #fee-month, #rep-month { padding: 0 14px; height: 42px; border: 1px solid #7A849E !important; border-radius: var(--radius-sm) !important; font-size: .875rem !important; color: var(--text) !important; background: var(--white) !important; font-family: var(--font-sans) !important; }
#filter-search { height: 42px; border: 1px solid #7A849E !important; border-radius: var(--radius-sm) !important; font-family: var(--font-sans) !important; background: var(--white) !important; }
#game-my-stats .stats-row { margin-bottom: 22px; }
.diff-picker-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 8px; }
.diff-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--border-gold); background: var(--white); cursor: pointer; text-align: left; font-family: var(--font-sans); color: var(--navy); }
.diff-btn:hover { background: var(--gold-pale); }
.diff-btn-label { font-family: var(--font-serif); font-weight: 500; font-size: 1.5rem; line-height: 1.1; }
.diff-btn-sub { font-size: .8125rem; color: var(--text-muted); }
.diff-easy .diff-btn-label { color: var(--teal-deep); }
.diff-medium .diff-btn-label { color: var(--blue); }
.diff-hard .diff-btn-label { color: #5C4FA0; }
.diff-extreme .diff-btn-label { color: var(--red); }

.game-quiz-top { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.game-q-progress { font-family: var(--font-serif); font-weight: 500; font-size: 1.7rem; color: var(--navy); white-space: nowrap; font-variant-numeric: lining-nums; }
.game-streak { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 30px; background: var(--gold-pale); border: 1px solid var(--border-gold); font-weight: 600; color: var(--gold-deep); font-size: .875rem; white-space: nowrap; opacity: 0; transform: scale(.8); transition: opacity .2s, transform .2s; }
.game-streak svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.game-streak.show { opacity: 1; transform: scale(1); }
.game-streak.pop { animation: gameStreakPop .4s ease; }
.game-timer-track { flex: 1; min-width: 80px; height: 10px; background: var(--bg-2); border-radius: 10px; overflow: hidden; }
.game-timer-fill { height: 100%; background: var(--gold); width: 100%; transition: width 1s linear; border-radius: 10px; }
.game-timer-fill.low { background: var(--red); }
.game-exit-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 50%; background: var(--white); color: var(--text-muted); cursor: pointer; flex-shrink: 0; }
.game-exit-btn:hover { color: var(--red); border-color: rgba(179,56,44,.4); }
.game-exit-btn svg { width: 16px; height: 16px; }
.game-pips { display: flex; gap: 6px; margin-bottom: 20px; }
.game-pip { flex: 1; height: 6px; max-width: 48px; border-radius: 6px; background: var(--bg-2); }
.game-pip.current { background: var(--gold); }
.game-pip.correct { background: var(--green); }
.game-pip.wrong { background: var(--red); }
.game-question-card { background: var(--white); border: 1px solid var(--border); border-radius: 20px; padding: 36px 40px; box-shadow: var(--lift-shadow); }
.game-question-text { font-family: var(--font-serif); font-weight: 500; font-size: 2.1rem; color: var(--navy); margin-bottom: 26px; line-height: 1.2; }
.game-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.game-option-btn { display: flex; align-items: center; gap: 14px; text-align: left; min-height: 72px; padding: 14px 18px; background: var(--white); border: 1.5px solid var(--border); border-radius: 14px; font-family: var(--font-sans); font-size: 1rem; font-weight: 500; color: var(--navy); cursor: pointer; transition: border-color .15s, background .15s, opacity .3s; }
.game-option-btn .opt-shape { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--bg); color: var(--navy); display: flex; align-items: center; justify-content: center; font-size: .875rem; font-weight: 600; }
.game-option-btn:hover:not(:disabled) { border-color: var(--gold); background: var(--gold-pale); }
.game-option-btn:disabled { cursor: default; }
.game-option-btn.dimmed { opacity: .4; }
.game-option-btn.correct { background: var(--success-tint); border-color: var(--green); }
.game-option-btn.correct .opt-shape { background: var(--green); color: #fff; }
.game-option-btn.wrong { background: var(--danger-tint); border-color: var(--red); animation: gameShake .4s; }
.game-option-btn.wrong .opt-shape { background: var(--red); color: #fff; }
.game-feedback-icon { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; flex-shrink: 0; }
.game-option-btn.correct .game-feedback-icon { color: var(--green); }
.game-option-btn.wrong .game-feedback-icon { color: var(--red); }
.game-feedback-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.game-results-card { background: var(--white); border: 1px solid var(--border); border-radius: 20px; padding: 40px 36px; box-shadow: var(--lift-shadow); text-align: center; }
.game-results-score { font-family: var(--font-serif); font-weight: 500; font-size: 6rem; color: var(--gold-deep); line-height: 1; font-variant-numeric: lining-nums; }
.game-badge { font-family: var(--font-serif); font-weight: 500; font-size: 2rem; color: var(--navy); margin-top: 8px; }
.game-results-sub { color: var(--text-muted); font-size: 1rem; margin-top: 6px; }
.game-breakdown { text-align: left; margin-top: 26px; display: flex; flex-direction: column; gap: 8px; }
.game-breakdown-row { display: flex; gap: 12px; padding: 12px 16px; border-radius: 10px; font-size: .875rem; background: var(--bg); opacity: 0; animation: gameFadeUp .35s ease forwards; }
.game-breakdown-row.correct { background: var(--success-tint); color: #1B5E3A; }
.game-breakdown-row.wrong { background: var(--danger-tint); color: #8E2A20; }
.game-breakdown-icon { flex-shrink: 0; font-weight: 600; }
.game-confetti-piece { position: fixed; top: -12px; width: 8px; height: 14px; border-radius: 2px; pointer-events: none; z-index: 998; animation: gameConfettiFall linear forwards; }
.game-new-badge-banner { display: flex; align-items: center; gap: 14px; background: var(--gold-pale); border: 1px solid var(--border-gold); border-radius: 14px; padding: 14px 18px; margin-bottom: 18px; text-align: left; animation: gameFadeUp .4s ease; }
.game-new-badge-banner .nb-label { font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-deep); }
.game-new-badge-banner .nb-icon { font-size: 1.8rem; flex-shrink: 0; }
.game-new-badge-banner .nb-name { font-family: var(--font-serif); font-weight: 500; font-size: 1.35rem; color: var(--navy); line-height: 1.1; }
.game-new-badge-banner .nb-desc { font-size: .8125rem; color: var(--text-sec); }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.badge-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 18px; box-shadow: var(--card-shadow); text-align: center; }
.badge-card .badge-icon { font-size: 2.2rem; margin-bottom: 10px; display: flex; width: 68px; height: 68px; margin-left: auto; margin-right: auto; align-items: center; justify-content: center; border-radius: 50%; background: var(--gold-pale); border: 1px solid var(--border-gold); }
.badge-card .badge-name { font-family: var(--font-serif); font-weight: 500; font-size: 1.4rem; color: var(--navy); margin-bottom: 4px; line-height: 1.1; }
.badge-card .badge-desc { font-size: .8125rem; color: var(--text-muted); line-height: 1.45; }
.badge-card .badge-earned-date { font-size: .72rem; color: var(--gold-deep); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-top: 10px; }
.badge-card.locked .badge-icon, .badge-card.locked .badge-name, .badge-card.locked .badge-desc { opacity: .5; filter: grayscale(1); }
.badge-progress { margin-top: 12px; }
.badge-progress-bar { height: 8px; border-radius: 8px; background: var(--bg-2); overflow: hidden; }
.badge-progress-fill { height: 100%; background: var(--gold); border-radius: 8px; transition: width .3s ease; }
.badge-progress-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; margin-top: 5px; font-variant-numeric: lining-nums; }

.lb-row { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: .95rem; background: var(--white); }
.lb-row:first-of-type { border-radius: var(--radius) var(--radius) 0 0; }
.lb-row:last-child { border-bottom: none; border-radius: 0 0 var(--radius) var(--radius); }
.lb-row.me { background: var(--gold-pale); }
.lb-rank { width: 32px; font-family: var(--font-serif); font-weight: 500; font-size: 1.5rem; color: var(--text-muted); font-variant-numeric: lining-nums; }
.lb-rank.top1 { color: var(--gold-deep); }
.lb-name { flex: 1; font-weight: 500; }
.lb-score { font-family: var(--font-serif); font-weight: 500; font-size: 1.5rem; color: var(--navy); font-variant-numeric: lining-nums; }
.lb-period-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.lb-period-tab { height: 38px; padding: 0 18px; border-radius: 30px; border: 1px solid var(--border-gold); background: var(--white); color: var(--text-sec); font-size: .8125rem; font-weight: 500; cursor: pointer; font-family: var(--font-sans); }
.lb-period-tab:hover:not(.active) { background: var(--gold-pale); }
.lb-period-tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.lb-metric-note { font-size: .8125rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 16px; max-width: 44rem; }
.lb-my-rank { margin: 0 0 14px; padding: 14px 18px; background: var(--navy); border-radius: 12px; font-size: .95rem; color: #fff; }
.lb-my-rank strong { color: var(--gold); font-family: var(--font-serif); font-size: 1.4rem; font-weight: 500; }

@keyframes gameShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes gameStreakPop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes gameFadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gameConfettiFall { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(600deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .game-option-btn.wrong, .game-streak.pop, .game-breakdown-row { animation: none !important; opacity: 1; }
  .game-confetti-piece { display: none !important; }
  .game-new-badge-banner { animation: none !important; }
  .action-card:hover { transform: none; }
}

/* ═════════ English worksheets (admin review and student play) ═════════ */
.wa-upload-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--card-shadow); }
.wa-upload-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.wa-upload-row input[type=file] { flex: 1 1 220px; font-size: .8125rem; }
.wa-upload-row select, .wa-add-item-row select { height: 40px; padding: 0 12px; border: 1px solid #7A849E; border-radius: 8px; font-size: .8125rem; background: var(--white); }
.wa-worksheet-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--white); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.wa-worksheet-row .wa-w-title { font-weight: 600; font-size: .9rem; flex: 1 1 200px; }
.wa-worksheet-row .wa-w-meta { font-size: .8rem; color: var(--text-muted); }
.wa-review-grid { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; margin-top: 16px; }
.wa-source-preview, .wa-play-refimg, .wa-item-card, .wa-cefr-ref-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--card-shadow); }
.wa-source-preview { padding: 10px; }
.wa-source-preview img, .wa-source-preview iframe { width: 100%; border: none; border-radius: 6px; }
.wa-item-card { padding: 16px 18px; margin-bottom: 10px; }
.wa-item-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.wa-item-type-badge { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 4px 10px; border-radius: 30px; background: var(--gold-pale); color: var(--gold-deep); }
.wa-item-card textarea, .wa-item-card input[type=text] { width: 100%; margin-bottom: 6px; padding: 10px 12px; border: 1px solid #7A849E; border-radius: 8px; font-family: var(--font-sans); font-size: .9rem; background: var(--off-white); }
.wa-mcq-option-row, .wa-blank-row, .wa-pair-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.wa-mcq-option-row input[type=radio] { flex-shrink: 0; }
.wa-mcq-option-row input[type=text] { margin-bottom: 0; }
.wa-blank-row input, .wa-pair-row input { margin-bottom: 0; flex: 1; }
.wa-add-item-row { display: flex; gap: 8px; align-items: center; margin: 14px 0; }
.wa-review-actions { display: flex; justify-content: space-between; margin-top: 20px; }
.wa-cefr-ref-toggle { display: flex; align-items: center; gap: 6px; font-size: .875rem; color: var(--navy); cursor: pointer; margin: 4px 0 14px; background: none; border: none; padding: 0; font-weight: 500; font-family: var(--font-sans); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--gold); }
.wa-cefr-ref-toggle svg { width: 14px; height: 14px; transition: transform .15s; }
.wa-cefr-ref-toggle.open svg { transform: rotate(90deg); }
.wa-cefr-ref-grid { display: none; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 20px; }
.wa-cefr-ref-grid.open { display: grid; }
.wa-cefr-ref-card { padding: 16px 18px; }
.wa-cefr-ref-level { font-family: var(--font-serif); font-weight: 500; font-size: 2rem; color: var(--navy); line-height: 1; }
.wa-cefr-ref-name { font-size: .72rem; font-weight: 600; color: var(--gold-deep); text-transform: uppercase; letter-spacing: .1em; margin: 4px 0 6px; }
.wa-cefr-ref-desc { font-size: .8125rem; color: var(--text-sec); line-height: 1.5; }
.wa-refimg-thumb { position: relative; margin-bottom: 10px; }
.wa-refimg-thumb img { width: 100%; border-radius: 6px; display: block; }
.wa-crop-wrap { position: relative; user-select: none; cursor: crosshair; border-radius: 6px; overflow: hidden; }
.wa-crop-wrap img { width: 100%; display: block; pointer-events: none; }
.wa-crop-box { position: absolute; border: 2px dashed var(--gold); background: rgba(201,166,100,.18); pointer-events: none; }
.wa-play-refimg { padding: 12px; margin-bottom: 18px; }
.wa-play-refimg img { width: 100%; border-radius: 6px; display: block; }
.wa-play-refimg .wa-refimg-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin-bottom: 8px; }

/* ═════════ Small screens: sidebar becomes a top bar, navigation a bottom bar ═════════ */
@media (max-width: 900px) {
  #auth-shell { flex-direction: column; }
  .auth-art { padding: 28px 24px 32px; gap: 28px; }
  .auth-art ul { display: none; }
  .auth-art h1 { font-size: 2.4rem; }
  .auth-pane { padding: 32px 20px 48px; }
  #portal-shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: sticky; top: 0; z-index: 100; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; overflow: visible; }
  .header-brand { flex-direction: row; align-items: center; padding: 0; }
  .header-brand img { width: 120px; }
  .header-tagline, .side-role, .side-avatar, .side-grow, .nav-label { display: none; }
  .side-user { border: none; padding: 0; flex-wrap: nowrap; gap: 8px; }
  .side-user-text { display: none; }
  .portal-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; flex-direction: row; gap: 0; background: var(--white); border-top: 1px solid var(--border); overflow-x: auto; padding: 0 4px; }
  .nav-item { flex-direction: column; justify-content: center; gap: 4px; height: 64px; min-width: 76px; padding: 0 8px; font-size: .72rem; color: var(--text-muted); border-radius: 0; }
  .nav-item:hover:not(.locked) { background: none; color: var(--navy); }
  .nav-item.active { background: none; color: var(--navy); }
  .nav-item.active svg { color: var(--gold-deep); }
  .nav-item.admin-nav { color: var(--gold-deep); }
  .nav-item.locked { color: var(--text-muted); }
  .portal-main { padding: 24px 16px 96px; }
  .section-title { font-size: 2.2rem; }
  .admin-two-col, .wa-review-grid, .form-row, .profile-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .action-grid { grid-template-columns: 1fr; }
  .game-options { grid-template-columns: 1fr; }
  .game-question-card { padding: 24px 20px; }
  .game-question-text { font-size: 1.7rem; }
  .cal-cell { min-height: 56px; padding: 5px 4px; }
  .cal-date-num { font-size: .7rem; width: 22px; height: 22px; }
  .cal-pill-time { display: none; }
  #toast { bottom: 84px; }
  .modal { padding: 24px 20px; }
}

/* Email confirmation banner + sign-up security check */
.verify-banner { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin: 0 0 1.25rem; padding: .85rem 1.1rem; background: var(--gold-pale); border: 1px solid var(--gold); border-radius: 12px; color: var(--navy); font-size: 14px; line-height: 1.5; }
.verify-banner[hidden] { display: none; }
.verify-banner .btn-sm { margin-left: auto; }
.captcha-slot { margin: .5rem 0 1rem; }

/* Sign-up consent line */
.auth-consent { margin: .9rem 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-muted, #5a6385); }
.auth-consent a { color: var(--navy); text-decoration: underline; }
