/* ==========================================================================
   Attendance · checkin.syauee7.cn
   One stylesheet, zero dependencies. Light + dark, mobile first.
   ========================================================================== */

:root {
  color-scheme: light dark;

  --bg: #f2f3f8;
  --bg-2: #e9ebf3;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --ink: #0c0f1d;
  --ink-2: #363b50;
  --muted: #767d94;
  --line: rgba(13, 16, 32, 0.09);
  --line-strong: rgba(13, 16, 32, 0.16);

  --brand: #3d43e0;
  --brand-soft: rgba(61, 67, 224, 0.1);
  --present: #0f9d76;
  --present-soft: rgba(15, 157, 118, 0.12);
  --late: #c2760a;
  --late-soft: rgba(194, 118, 10, 0.12);
  --excused: #2f6fd0;
  --excused-soft: rgba(47, 111, 208, 0.12);
  --absent: #d13b3b;
  --absent-soft: rgba(209, 59, 59, 0.12);
  --idle: #9aa0b4;
  --idle-soft: rgba(154, 160, 180, 0.14);

  --radius: 26px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(12, 15, 29, 0.04), 0 22px 48px -30px rgba(12, 15, 29, 0.45);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #08090f;
    --bg-2: #0d0f18;
    --surface: rgba(20, 22, 33, 0.78);
    --surface-solid: #141621;
    --ink: #f2f3f9;
    --ink-2: #c3c7d6;
    --muted: #8b91a6;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);

    --brand: #8b8fff;
    --brand-soft: rgba(139, 143, 255, 0.16);
    --present: #35d6a4;
    --present-soft: rgba(53, 214, 164, 0.14);
    --late: #f0b34a;
    --late-soft: rgba(240, 179, 74, 0.14);
    --excused: #79a8f5;
    --excused-soft: rgba(121, 168, 245, 0.14);
    --absent: #ff7b7b;
    --absent-soft: rgba(255, 123, 123, 0.14);
    --idle: #7b8298;
    --idle-soft: rgba(123, 130, 152, 0.16);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 60px -34px rgba(0, 0, 0, 0.9);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ambient light */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
}
body::before {
  width: 62vw;
  height: 62vw;
  top: -26vw;
  left: -14vw;
  background: radial-gradient(circle, var(--brand-soft), transparent 62%);
  opacity: 0.9;
}
body::after {
  width: 54vw;
  height: 54vw;
  bottom: -30vw;
  right: -12vw;
  background: radial-gradient(circle, var(--present-soft), transparent 64%);
  opacity: 0.75;
}

::selection { background: var(--brand); color: #fff; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ------------------------------------------------------------------ shell */

.shell {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 20px 20px 56px;
}
.shell.wide { max-width: 1180px; }

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #22d3ee));
  color: #fff;
  box-shadow: 0 6px 16px -8px var(--brand);
}
.brand-mark svg { width: 16px; height: 16px; }

.ghost-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.ghost-link:hover { border-color: var(--line-strong); color: var(--ink); transform: translateY(-1px); }

/* ------------------------------------------------------------------- hero */

.kicker {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.display {
  margin: 0;
  font-size: clamp(30px, 9vw, 42px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 700;
}
.display.big { font-size: clamp(38px, 12vw, 56px); }

.lede {
  margin: 12px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  max-width: 34ch;
}

.hero { padding: 4px 0 22px; }

/* ------------------------------------------------------------------- card */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  padding: 22px;
}

.card + .card { margin-top: 14px; }
.card.tight { padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }

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

.section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.field { display: block; margin-bottom: 14px; }

.lbl {
  display: block;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.input,
textarea.input {
  width: 100%;
  padding: 14px 15px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--muted); opacity: 0.85; }
.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

textarea.input { min-height: 128px; resize: vertical; font-size: 13.5px; font-family: var(--mono); line-height: 1.7; }

.hint {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.hint.err { color: var(--absent); font-weight: 600; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 20px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.99); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(150deg, var(--brand), color-mix(in srgb, var(--brand) 62%, #22d3ee));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 26px -12px var(--brand);
}
.btn.primary:hover { box-shadow: 0 14px 30px -12px var(--brand); }

.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 8px 14px; font-size: 13px; }
.btn.quiet { background: transparent; border-color: var(--line); }

.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* -------------------------------------------------------- check-in disc */

.disc-wrap {
  display: grid;
  place-items: center;
  padding: 26px 0 18px;
}

.disc {
  position: relative;
  width: 176px;
  height: 176px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 26%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 62%),
    var(--surface-solid);
  box-shadow:
    0 0 0 1px var(--line-strong),
    0 26px 50px -26px rgba(12, 15, 29, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: var(--ink);
  display: grid;
  place-items: center;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease;
}
.disc:hover { transform: translateY(-2px); }
.disc:active { transform: scale(0.985); }

.disc::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid var(--line);
  animation: breathe 3.6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.035); opacity: 0.25; }
}

.disc-inner { display: grid; justify-items: center; gap: 2px; }

.disc-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
}
.disc-main {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* success state */
.disc.done {  background:
    radial-gradient(circle at 50% 30%, var(--present-soft), transparent 64%),
    var(--surface-solid);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--present) 40%, transparent), 0 26px 50px -26px rgba(15, 157, 118, 0.55);
  color: var(--present);
}
.disc.done::after { animation: none; border-color: color-mix(in srgb, var(--present) 30%, transparent); }
.disc.done .disc-label { color: color-mix(in srgb, var(--present) 78%, var(--muted)); }

@media (prefers-color-scheme: dark) {
  .disc {
    background:
      radial-gradient(circle at 50% 26%, rgba(139, 143, 255, 0.26), transparent 62%),
      #1a1d2b;
  }
  .disc.done {
    background:
      radial-gradient(circle at 50% 30%, rgba(53, 214, 164, 0.2), transparent 64%),
      #17211d;
  }
}

.check-glyph {
  width: 52px;
  height: 52px;
  margin-bottom: 2px;
}
/* SVG elements ignore the HTML `hidden` attribute, so hide it explicitly. */
.check-glyph[hidden] { display: none; }

/* stroke draw animation */
.check-glyph path {
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: draw 0.62s cubic-bezier(0.65, 0, 0.35, 1) 0.06s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.status-line {
  text-align: center;
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}
.status-line strong { color: var(--ink); font-weight: 650; }

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill.present { color: var(--present); background: var(--present-soft); }
.pill.late { color: var(--late); background: var(--late-soft); }
.pill.excused { color: var(--excused); background: var(--excused-soft); }
.pill.absent { color: var(--absent); background: var(--absent-soft); }
.pill.unmarked { color: var(--idle); background: var(--idle-soft); }
.pill.live { color: var(--present); background: var(--present-soft); }
.pill.closed { color: var(--idle); background: var(--idle-soft); }

/* ------------------------------------------------------------------- stats */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}
.stat {
  background: var(--surface-solid);
  padding: 14px 10px;
  text-align: center;
}
.stat-num {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-key {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* -------------------------------------------------------------------- list */

.list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
}
.list-row .grow { flex: 1; min-width: 0; }
.list-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-meta {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* ------------------------------------------------------------------ footer */

.footnote {
  margin: 26px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.footnote a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--line-strong); }

/* ============================== console (admin) =========================== */

.console-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 4px 0 18px;
}

.layout {
  display: grid;
  gap: 14px;
  align-items: start;
}

@media (min-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr) 330px; }
}

.rate-head {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.ring {
  position: relative;
  width: 116px;
  height: 116px;
  flex: 0 0 auto;
}
.ring svg { display: block; transform: rotate(-90deg); }
.ring .track { stroke: var(--line); }
.ring .bar {
  stroke: var(--present);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.ring-num {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.ring-key {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.count-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 13px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.count-chip b {
  font-size: 16px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.count-chip.present b { color: var(--present); }
.count-chip.late b { color: var(--late); }
.count-chip.excused b { color: var(--excused); }
.count-chip.absent b { color: var(--absent); }

.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 16px 0 12px;
}
.search-row .input { min-height: 42px; padding: 10px 14px; font-size: 14.5px; flex: 1 1 auto; min-width: 0; }
.search-row .btn { flex: 0 0 auto; white-space: nowrap; }

@media (max-width: 520px) {
  .search-row { flex-wrap: wrap; }
  .search-row .input { width: 100%; }
  .search-row .btn { width: 100%; }
}

.session-line {
  margin: -6px 0 14px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.session-line strong { color: var(--ink); font-weight: 650; }

.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 8px;
}

.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-left-width: 4px;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
  min-height: 56px;
}
.chip:hover { transform: translateY(-1px); }
.chip:active { transform: scale(0.99); }

.chip .who { min-width: 0; flex: 1; }
.chip .nm {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip .sid {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.chip .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--idle);
  flex: 0 0 auto;
}

.chip[data-status="present"] { border-left-color: var(--present); background: color-mix(in srgb, var(--present-soft) 55%, var(--surface-solid)); }
.chip[data-status="present"] .dot { background: var(--present); }
.chip[data-status="late"] { border-left-color: var(--late); background: color-mix(in srgb, var(--late-soft) 55%, var(--surface-solid)); }
.chip[data-status="late"] .dot { background: var(--late); }
.chip[data-status="excused"] { border-left-color: var(--excused); background: color-mix(in srgb, var(--excused-soft) 55%, var(--surface-solid)); }
.chip[data-status="excused"] .dot { background: var(--excused); }
.chip[data-status="absent"] { border-left-color: var(--absent); background: color-mix(in srgb, var(--absent-soft) 55%, var(--surface-solid)); }
.chip[data-status="absent"] .dot { background: var(--absent); }
.chip[data-status="unmarked"] { border-left-color: var(--idle); }

.chip.busy { opacity: 0.55; pointer-events: none; }

/* session cards in the side column */
.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 15px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.session-item:hover { border-color: var(--line-strong); }
.session-item.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.session-item .who { flex: 1; min-width: 0; }

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--present);
  box-shadow: 0 0 0 3px var(--present-soft);
  flex: 0 0 auto;
}

.side-stack { display: grid; gap: 14px; }

details.settings summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
details.settings summary::-webkit-details-marker { display: none; }
details.settings summary::after {
  content: "+";
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0;
}
details.settings[open] summary::after { content: "−"; }
details.settings .inner { padding-top: 16px; }

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 60;
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 420px) {
  .shell { padding: 16px 15px 46px; }
  .card { padding: 18px; }
  .stat-num { font-size: 19px; }
  .roster { grid-template-columns: 1fr 1fr; }
}
