/* ═══════════════════════════════════════════════════════════
   Physics Simplified — global stylesheet (light + dark theme)
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #f7f8fc;
  --bg-soft: #eef0f8;
  --card: #ffffff;
  --card-2: #f3f4fa;
  --text: #171a23;
  --muted: #5d6474;
  --line: #e4e7f0;
  --accent: #5b5bd6;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(91, 91, 214, 0.1);
  --amber: #d97706;
  --green: #15803d;
  --green-soft: rgba(22, 163, 74, 0.12);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.1);
  --shadow: 0 8px 30px rgba(23, 26, 35, 0.07);
  --shadow-sm: 0 2px 10px rgba(23, 26, 35, 0.05);
  --nav-bg: rgba(247, 248, 252, 0.85);
  --hero-glow: rgba(91, 91, 214, 0.14);
}

html[data-theme="dark"] {
  --bg: #0d0f17;
  --bg-soft: #12141f;
  --card: #161927;
  --card-2: #1c2032;
  --text: #e8eaf2;
  --muted: #9aa1b5;
  --line: #262b3d;
  --accent: #7c7cf0;
  --accent-2: #a78bfa;
  --accent-soft: rgba(124, 124, 240, 0.14);
  --amber: #fbbf24;
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --nav-bg: rgba(13, 15, 23, 0.85);
  --hero-glow: rgba(124, 124, 240, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.25s, color 0.25s;
}

h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 22px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 10px; border: 1px solid transparent;
  font: 600 15px/1 inherit; font-family: inherit; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
  text-decoration: none !important;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 4px 16px var(--accent-soft); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(91, 91, 214, 0.35); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: transparent; }
.btn-green { background: var(--green-soft); color: var(--green); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ── Public navbar ───────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: var(--nav-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 26px; height: 66px; }
.nav-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text); text-decoration: none !important; }
.nav-logo img { height: 36px; width: 36px; }
.nav-logo .lg-word b { color: var(--accent); }
.nav-links { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--muted); font-size: 14.5px; font-weight: 500; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-cta { display: flex; gap: 10px; align-items: center; }
.nav .nav-toggle-btn { display: none; }   /* beats .theme-btn's display rule on desktop */

.theme-btn {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  font-size: 16px; display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 0.15s;
}
.theme-btn:hover { border-color: var(--accent); }

@media (max-width: 860px) {
  .nav-links { display: none; position: absolute; top: 66px; left: 0; right: 0;
    background: var(--card); border-bottom: 1px solid var(--line); flex-direction: column;
    padding: 18px; gap: 14px; box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
  .nav .nav-toggle-btn { display: inline-flex; }
  .nav-cta .btn-ghost { display: none; }
}

/* ── Hero ────────────────────────────────────────────────── */
.hero { position: relative; overflow: hidden; padding: 72px 0 60px; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto;
  height: 620px; background: radial-gradient(ellipse at 70% 30%, var(--hero-glow), transparent 60%);
  pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 40px; align-items: center; position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px;
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  font-size: 13px; font-weight: 600; margin-bottom: 18px;
}
.hero h1 { font-size: clamp(34px, 4.6vw, 54px); margin-bottom: 18px; }
.hero h1 .grad { background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { color: var(--muted); font-size: 17.5px; max-width: 480px; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-3d { position: relative; }
.hero-3d canvas { width: 100%; height: 440px; display: block; cursor: grab; touch-action: none; }
.hero-3d canvas:active { cursor: grabbing; }
.hero-3d .hint { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); opacity: 0.8; pointer-events: none; }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-3d canvas { height: 320px; }
}

/* ── Sections ────────────────────────────────────────────── */
section.block { padding: 76px 0; }
section.block.alt { background: var(--bg-soft); }
.sec-head { text-align: center; max-width: 640px; margin: 0 auto 46px; }
.sec-head .kicker { color: var(--accent); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 2.5px; }
.sec-head h2 { font-size: clamp(26px, 3.2vw, 36px); margin: 10px 0 12px; }
.sec-head p { color: var(--muted); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; box-shadow: var(--shadow-sm); transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent-soft); }
.card .icon { font-size: 26px; width: 52px; height: 52px; border-radius: 13px;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.card h3 { font-size: 18.5px; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 14.5px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat { text-align: center; padding: 26px 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.stat .num { font-size: 34px; font-weight: 800; background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .lbl { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
@media (max-width: 720px) { .stats { grid-template-columns: 1fr 1fr; } }

/* about */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; align-items: center; }
.about-grid ul { list-style: none; margin-top: 18px; }
.about-grid li { padding: 8px 0 8px 30px; position: relative; color: var(--muted); }
.about-grid li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }

/* courses */
.course-card { display: flex; flex-direction: column; position: relative; }
.course-card.popular { border-color: var(--accent); box-shadow: 0 10px 34px var(--accent-soft); }
.course-price { font-size: 30px; font-weight: 800; margin: 4px 0 2px; }
.course-price span { font-size: 13px; font-weight: 500; color: var(--muted); }
.course-card .tag { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.course-card ul { list-style: none; margin: 14px 0 22px; flex: 1; }
.course-card li { padding: 5px 0 5px 26px; position: relative; color: var(--muted); font-size: 14px; }
.course-card li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }

/* pricing */
.price-card { position: relative; text-align: center; }
.price-card.popular { border-color: var(--accent); box-shadow: 0 10px 34px var(--accent-soft); }
.price-card .pop-tag { position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 16px; border-radius: 999px; }
.price-card .price { font-size: 40px; font-weight: 800; margin: 14px 0 2px; }
.price-card .per { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.price-card ul { list-style: none; margin-bottom: 24px; text-align: left; }
.price-card li { padding: 7px 0 7px 28px; position: relative; color: var(--muted); font-size: 14px; border-bottom: 1px dashed var(--line); }
.price-card li:last-child { border-bottom: 0; }
.price-card li::before { content: "✓"; position: absolute; left: 2px; color: var(--green); font-weight: 700; }

/* testimonials */
.testi { display: flex; flex-direction: column; gap: 14px; }
.testi .quote { color: var(--text); font-size: 15px; font-style: italic; }
.testi .who { display: flex; align-items: center; gap: 12px; }
.testi .avatar { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; }
.testi .who small { color: var(--muted); display: block; }
.testi .stars { color: #f59e0b; letter-spacing: 2px; }

/* FAQ */
.faq { max-width: 760px; margin: 0 auto; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 18px 22px; margin-bottom: 12px; }
.faq summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::after { content: "+"; font-size: 22px; color: var(--accent); transition: transform 0.2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); margin-top: 12px; font-size: 14.5px; }

/* CTA band */
.cta-band { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-radius: 22px; padding: 54px 40px; text-align: center; color: #fff; }
.cta-band h2 { font-size: clamp(24px, 3vw, 34px); margin-bottom: 12px; }
.cta-band p { opacity: 0.9; margin-bottom: 26px; }
.cta-band .btn { background: #fff; color: var(--accent); }

/* footer */
footer.site-footer { border-top: 1px solid var(--line); padding: 46px 0 30px; background: var(--bg-soft); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; margin-bottom: 30px; }
.footer-grid h4 { font-size: 14px; margin-bottom: 12px; }
.footer-grid a { display: block; color: var(--muted); font-size: 14px; padding: 3px 0; }
.footer-grid p { color: var(--muted); font-size: 14px; max-width: 300px; }
.footer-bottom { border-top: 1px solid var(--line); padding-top: 18px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; flex-wrap: wrap; gap: 8px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* ── Flash messages ──────────────────────────────────────── */
.flash-wrap { max-width: 720px; margin: 18px auto 0; padding: 0 22px; }
.flash { padding: 13px 18px; border-radius: 11px; font-size: 14.5px; margin-bottom: 10px; border: 1px solid; }
.flash-success { background: var(--green-soft); color: var(--green); border-color: transparent; }
.flash-error { background: var(--red-soft); color: var(--red); border-color: transparent; }
.flash-info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-wrap { min-height: calc(100vh - 66px); display: flex; align-items: center; justify-content: center; padding: 46px 20px; }
.auth-card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 38px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 560px; }
.auth-card .auth-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-card .auth-logo img { height: 54px; }
.auth-card h1 { font-size: 24px; text-align: center; margin-bottom: 6px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 400 14.5px/1.5 inherit; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.check-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; font-size: 13.5px; }
.check-row label { display: flex; align-items: center; gap: 7px; color: var(--muted); cursor: pointer; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }

/* ── App (student portal / admin) layout ─────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .side-logo { display: flex; align-items: center; gap: 10px; padding: 20px; border-bottom: 1px solid var(--line);
  font-weight: 800; color: var(--text); text-decoration: none !important; }
.sidebar .side-logo img { width: 34px; height: 34px; }
.side-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
  color: var(--muted); font-size: 14.5px; font-weight: 500; text-decoration: none !important;
  transition: background 0.15s, color 0.15s;
}
.side-nav a:hover { background: var(--card-2); color: var(--text); }
.side-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-nav a .badge { margin-left: auto; }
.side-foot { padding: 14px; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 6px; }
.side-user .avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; font-size: 15px; }
.side-user .nm { font-size: 14px; font-weight: 600; line-height: 1.2; }
.side-user small { color: var(--muted); font-size: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 26px;
  border-bottom: 1px solid var(--line); background: var(--nav-bg); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 19px; margin-right: auto; }
.content { padding: 26px; max-width: 1060px; width: 100%; margin: 0 auto; }

.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: rgba(245, 158, 11, 0.14); color: var(--amber); }
.badge-muted { background: var(--card-2); color: var(--muted); }

.bell { position: relative; }
.bell .dot { position: absolute; top: -4px; right: -6px; background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px; }

@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; z-index: 80; transition: left 0.25s; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .side-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 70; }
  .side-overlay.show { display: block; }
  .menu-btn { display: inline-flex !important; }
}
.menu-btn { display: none; }

/* ── Question list & detail ──────────────────────────────── */
.q-item { display: flex; gap: 16px; align-items: flex-start; padding: 20px; margin-bottom: 14px; }
.q-item .q-ic { font-size: 22px; width: 46px; height: 46px; flex-shrink: 0; border-radius: 12px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; }
.q-item h3 { font-size: 16.5px; }
.q-item h3 a { color: var(--text); }
.q-item h3 a:hover { color: var(--accent); text-decoration: none; }
.q-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12.5px; margin-top: 6px; }

.q-files { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.q-files a.file-img img { max-height: 260px; border-radius: 12px; border: 1px solid var(--line); }
.file-pdf, .file-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--text); font-size: 13.5px; font-weight: 600;
}
.file-pdf:hover { border-color: var(--accent); text-decoration: none; }
video.q-video { width: 100%; max-width: 720px; border-radius: 12px; border: 1px solid var(--line); background: #000; }
.video-embed { aspect-ratio: 16/9; width: 100%; max-width: 720px; border-radius: 12px; border: 1px solid var(--line); }

.solution-box { border: 1px solid var(--green); border-radius: 14px; padding: 20px; background: var(--green-soft); margin: 18px 0; }
.solution-box h3 { color: var(--green); margin-bottom: 10px; }

/* comments */
.comment { display: flex; gap: 12px; padding: 14px 0; }
.comment .avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; font-size: 13px; }
.comment .avatar.admin { background: linear-gradient(135deg, #d97706, #f59e0b); }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.comment-head .nm { font-weight: 700; font-size: 14px; }
.comment-head small { color: var(--muted); font-size: 12px; }
.comment-text { font-size: 14.5px; margin: 4px 0 6px; overflow-wrap: break-word; }
.comment-text.deleted { color: var(--muted); font-style: italic; }
.comment-acts { display: flex; gap: 14px; font-size: 12.5px; }
.comment-acts a, .comment-acts button { color: var(--muted); background: none; border: none; cursor: pointer; font: 600 12.5px inherit; font-family: inherit; padding: 0; }
.comment-acts a:hover, .comment-acts button:hover { color: var(--accent); text-decoration: none; }
.replies { margin-left: 24px; padding-left: 20px; border-left: 2px solid var(--line); }
.mention { color: var(--accent); font-weight: 600; background: var(--accent-soft); padding: 0 4px; border-radius: 5px; }
.comment-files { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.comment-files img { max-height: 160px; border-radius: 10px; border: 1px solid var(--line); }

.comment-form textarea { min-height: 84px; resize: vertical; }
.comment-form .cf-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.comment-form .file-lbl { font-size: 13px; color: var(--muted); cursor: pointer; padding: 8px 14px; border: 1px dashed var(--line); border-radius: 9px; }
.comment-form .file-lbl:hover { border-color: var(--accent); color: var(--accent); }

/* mention autocomplete */
.mention-box { position: absolute; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); z-index: 90; max-height: 180px; overflow-y: auto; min-width: 180px; display: none; }
.mention-box div { padding: 8px 14px; cursor: pointer; font-size: 13.5px; }
.mention-box div:hover, .mention-box div.sel { background: var(--accent-soft); color: var(--accent); }

/* ── Tables (admin) ──────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
.tbl th { text-align: left; padding: 13px 16px; background: var(--card-2); color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--bg-soft); }
.tbl .acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* notification list */
.notif { display: flex; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: var(--accent-soft); }
.notif .n-ic { font-size: 18px; }
.notif small { color: var(--muted); }

/* dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.tiles.six { grid-template-columns: repeat(6, 1fr); }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .tiles, .tiles.six, .tiles.three { grid-template-columns: 1fr 1fr; } }
@media (max-width: 380px) { .tiles, .tiles.six, .tiles.three { grid-template-columns: 1fr; } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.tile .t-num { font-size: 28px; font-weight: 800; }
.tile .t-lbl { color: var(--muted); font-size: 13px; }
.tile .t-ic { float: right; font-size: 22px; opacity: 0.8; }

/* misc */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; margin-right: auto; }
.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-family: inherit; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 56px 20px; }
.empty .e-ic { font-size: 40px; margin-bottom: 10px; }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.pagination .cur { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

details.inline-form { margin-top: 8px; }
details.inline-form summary { cursor: pointer; font-size: 13px; color: var(--accent); font-weight: 600; list-style: none; }
details.inline-form > div { margin-top: 10px; padding: 14px; background: var(--card-2); border-radius: 10px; }

.hidden-form { display: none; }

/* ── Concept blog ────────────────────────────────────────── */
.article-card { display: flex; gap: 16px; align-items: flex-start; padding: 22px; margin-bottom: 14px; }
.article-card .a-emoji { font-size: 30px; width: 58px; height: 58px; flex-shrink: 0; border-radius: 14px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.article-card h3 { font-size: 17.5px; margin-bottom: 4px; }
.article-card h3 a { color: var(--text); }
.article-card h3 a:hover { color: var(--accent); text-decoration: none; }
.article-card .a-excerpt { color: var(--muted); font-size: 14px; }

.article-body { font-size: 15.5px; line-height: 1.75; max-width: 780px; }
.article-body h2 { font-size: 21px; margin: 34px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.article-body h3 { font-size: 17px; margin: 24px 0 8px; }
.article-body p { margin: 12px 0; }
.article-body ul, .article-body ol { margin: 12px 0; padding-left: 26px; }
.article-body li { margin: 6px 0; }
.article-body img { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.article-body .eq-box { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 12px; padding: 14px 20px; margin: 18px 0; text-align: center; font-size: 17px; overflow-x: auto; }
.article-body .anim-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 20px 0; }
.article-body .anim-box canvas { width: 100%; display: block; border-radius: 8px; }
.article-body .anim-box .anim-cap { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 8px; }
.article-body .anim-box .anim-controls { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; font-size: 13px; }
.article-body .anim-box input[type=range] { flex: 1; min-width: 140px; accent-color: var(--accent); }
.article-body .example-box { background: var(--green-soft); border-left: 4px solid var(--green); border-radius: 10px; padding: 14px 18px; margin: 18px 0; font-size: 14.5px; }
.article-body .note-box { background: rgba(245, 158, 11, 0.12); border-left: 4px solid var(--amber); border-radius: 10px; padding: 12px 18px; margin: 18px 0; font-size: 14px; }
.article-body details.tryit { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 18px 0; }
.article-body details.tryit summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.article-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin: 8px 0 20px; }

/* votes, best answer, leaderboard */
.vote-btn { border: 1px solid var(--line) !important; border-radius: 999px !important; padding: 2px 10px !important; color: var(--muted); }
.vote-btn.voted { background: var(--accent-soft); color: var(--accent) !important; border-color: var(--accent) !important; }
.vote-btn.static { font-size: 12.5px; font-weight: 600; }
.comment.best-answer { background: var(--green-soft); border: 1px solid var(--green); border-radius: 14px; padding: 14px; margin: 10px 0; }
.rank-num { font-weight: 800; font-size: 18px; width: 40px; text-align: center; }
.rank-1 { color: #eab308; } .rank-2 { color: #94a3b8; } .rank-3 { color: #b45309; }
.reply-form-box { margin: 10px 0 6px; padding: 14px; background: var(--card-2); border-radius: 12px; }
.reply-form-box .reply-to { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }

/* ═══ Mobile refinements (final production pass) ═══════════════ */

/* never allow sideways scrolling of the whole page */
html, body { overflow-x: hidden; max-width: 100%; }

/* long equations / wide content inside articles scroll within their own box */
.article-body .eq-box { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.article-body { overflow-wrap: break-word; }
.anim-box .anim-controls { flex-wrap: wrap; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }

@media (max-width: 600px) {
  .container { padding: 0 16px; }
  section.block { padding: 48px 0; }
  .sec-head { margin-bottom: 32px; }
  .card { padding: 20px; }
  .hero { padding: 44px 0 40px; }
  .hero p.lead { font-size: 16px; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .cta-band { padding: 36px 22px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 22px; }
  /* comfortable tap targets */
  .btn { padding: 12px 20px; }
  .btn-sm { padding: 8px 14px; }
  .side-nav a { padding: 13px 14px; }
  /* article readability on phones */
  .article-body { font-size: 15px; }
  .article-body h2 { font-size: 19px; }
  .content { padding: 18px 14px; }
  .page-head h2 { font-size: 17px; }
  /* filter bars and forms stack cleanly */
  .filter-bar { gap: 8px; }
  .filter-bar input, .filter-bar select, .filter-bar button { flex: 1 1 100%; }
  /* tables already scroll via .table-wrap; tighten cells */
  .tbl th, .tbl td { padding: 10px 12px; }
  /* topbar title shrink so bell/theme fit */
  .topbar h1 { font-size: 16px; }
}

@media (max-width: 400px) {
  .footer-grid { grid-template-columns: 1fr; }
  .stat .num { font-size: 28px; }
}
