/* Interactive Classroom Platform — shared stylesheet */

:root {
  color-scheme: light dark;

  --bg: #f4f7fb;
  --bg-elev: #ffffff;
  --bg-sunk: #eef2f8;
  --ink: #142033;
  --ink-soft: #5a6b82;
  --ink-faint: #8b9bb1;
  --line: #dde5f0;
  --line-soft: #eaf0f8;

  --brand: #1568b8;
  --brand-strong: #0f4d8c;
  --brand-tint: #e7f1fb;
  --accent: #f0932b;
  --ok: #1c8a5a;
  --ok-tint: #e3f5ec;
  --warn: #b8860b;
  --danger: #c8384c;
  --danger-tint: #fdeaed;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 32, 51, .05), 0 8px 24px rgba(20, 32, 51, .06);
  --shadow-lg: 0 18px 48px rgba(20, 32, 51, .14);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1521;
    --bg-elev: #14202f;
    --bg-sunk: #101b28;
    --ink: #e7eef7;
    --ink-soft: #9fb2c8;
    --ink-faint: #71879f;
    --line: #22334a;
    --line-soft: #1b2a3d;
    --brand: #4da3ff;
    --brand-strong: #7cbcff;
    --brand-tint: #12283f;
    --ok-tint: #12301f;
    --danger-tint: #35161d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1rem; }

.wrap { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: .86rem; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 14px; }

/* ------------------------------------------------------------------ header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding-block: 8px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
}

.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--brand), var(--brand-strong));
  color: #fff;
  font-weight: 800;
  font-size: .82rem;
  letter-spacing: .02em;
}

.brand small { display: block; font-weight: 500; font-size: .68rem; color: var(--ink-faint); letter-spacing: .06em; text-transform: uppercase; }

.navlinks { display: flex; gap: 4px; }
.navlinks a {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .92rem;
}
.navlinks a:hover { background: var(--bg-sunk); color: var(--ink); }
.navlinks a.active { background: var(--brand-tint); color: var(--brand-strong); font-weight: 600; }

@media (max-width: 720px) { .navlinks { display: none; } }
@media (max-width: 420px) {
  .brand small { display: none; }
  .brand { font-size: .95rem; }
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-elev);
  color: var(--ink);
  font: inherit;
  font-size: .93rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .18s ease, background .18s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 32%, transparent); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { border-color: var(--line); background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--bg-sunk); color: var(--ink); }
.btn-danger { background: var(--danger-tint); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-lg { padding: 14px 26px; font-size: 1rem; border-radius: 12px; }
.btn-sm { padding: 6px 12px; font-size: .84rem; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }

.grid { display: grid; gap: 18px; }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }

.stat {
  position: relative;
  overflow: hidden;
  padding: 22px;
}
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-weight: 600; }
.stat .value { font-size: 2.4rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 6px 0 2px; }
.stat .note { font-size: .84rem; color: var(--ink-soft); }
.stat .ico {
  position: absolute; top: 18px; right: 18px;
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--brand-tint); color: var(--brand-strong);
}
.stat.live .ico { background: var(--ok-tint); color: var(--ok); }

/* ------------------------------------------------------------------ pills */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: var(--bg-sunk);
  color: var(--ink-soft);
}
.pill.ok { background: var(--ok-tint); color: var(--ok); }
.pill.live { background: var(--danger-tint); color: var(--danger); }
.pill.brand { background: var(--brand-tint); color: var(--brand-strong); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.live .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ------------------------------------------------------------------ forms */

label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }

input[type=text], input[type=number], input[type=date], input[type=time],
input[type=email], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: .94rem;
  color: var(--ink);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
textarea { resize: vertical; min-height: 84px; }

/* ------------------------------------------------------------------ lists */

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.list li:last-child { border-bottom: 0; }
.list .who { font-weight: 600; }

.avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-tint);
  color: var(--brand-strong);
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
}

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--ink-faint);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: .92rem;
}

/* ------------------------------------------------------------------ tiles */

.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform .14s ease, box-shadow .18s ease, border-color .18s;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.tile .code { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; }
.tile h3 { margin: 4px 0 8px; }

/* ------------------------------------------------------------------ tabs */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; font: inherit; font-size: .93rem; font-weight: 600;
  color: var(--ink-soft); padding: 10px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected=true] { color: var(--brand-strong); border-bottom-color: var(--brand); }

/* ------------------------------------------------------------------ poll */

.poll-option {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  cursor: pointer;
  font: inherit;
  text-align: left;
  overflow: hidden;
}
.poll-option:hover:not(:disabled) { border-color: var(--brand); }
.poll-option .bar {
  position: absolute; inset: 0 auto 0 0;
  background: var(--brand-tint);
  width: 0; transition: width .5s ease;
  z-index: 0;
}
.poll-option > span { position: relative; z-index: 1; }
.poll-option .pct { margin-left: auto; font-weight: 700; color: var(--brand-strong); }
.poll-option.chosen { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 20%, transparent); }

/* ------------------------------------------------------------------ toast */

#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  padding: 11px 20px; border-radius: 999px;
  background: var(--ink); color: var(--bg-elev);
  font-size: .9rem; font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200; max-width: calc(100% - 40px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--danger); color: #fff; }

/* ------------------------------------------------------------------ misc */

.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-sunk) 25%, var(--line-soft) 50%, var(--bg-sunk) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  color: transparent !important;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.section { padding: 44px 0; }
.section-head { margin-bottom: 22px; }
.section-head p { margin: 0; }

footer.site {
  border-top: 1px solid var(--line);
  padding: 26px 0;
  margin-top: 48px;
  color: var(--ink-faint);
  font-size: .87rem;
}

code.inline {
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: .85em;
  letter-spacing: .06em;
}
