/* Base + shared components */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-variation-settings: "opsz" 14;
  color: var(--bulma);
  background: #ECEAF4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; }
input { font: inherit; color: inherit; }
img { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Stage, demo panel, phone frame ---------- */
.stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 24px;
}
.demo-panel {
  width: 260px;
  flex: none;
  color: var(--trunks);
  font: 400 13px/20px var(--font);
}
.demo-panel h1 { font: 700 20px/28px var(--font); color: var(--bulma); }
.demo-panel h2 { font: 700 13px/20px var(--font); color: var(--bulma); margin: 20px 0 6px; }
.demo-sub { margin-top: 2px; }
.demo-hint { font-weight: 400; color: var(--trunks); }
.demo-list { display: flex; flex-direction: column; gap: 8px; }
.demo-fill {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--beerus); border-radius: var(--radius-i-sm);
  background: rgba(255, 255, 255, 0.6);
  font: 400 13px/20px var(--font); color: var(--trunks);
  transition: border-color .15s, background .15s;
}
.demo-fill:hover { border-color: var(--piccolo); background: var(--gohan); }
.demo-fill:active { transform: translateY(1px); }
.demo-name { font-weight: 700; color: var(--bulma); }
.demo-panel code {
  font: 500 12px/18px ui-monospace, 'Cascadia Mono', Consolas, monospace;
  background: var(--gohan);
  border: 1px solid var(--beerus);
  border-radius: 4px;
  padding: 0 4px;
  color: var(--bulma);
}
.demo-note { margin-top: 16px; }
.demo-reset {
  margin-top: 16px;
  padding: 8px 12px;
  border-radius: var(--radius-i-sm);
  border: 1px solid var(--beerus);
  background: var(--gohan);
  font: 700 13px/20px var(--font);
  color: var(--bulma);
}
.demo-reset:hover { border-color: var(--piccolo); color: var(--piccolo); }

.phone-slot { flex: none; position: relative; }
.phone {
  position: relative;
  width: 414px;
  height: 896px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--gohan);
  box-shadow: 0 24px 64px rgba(30, 24, 80, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
  transform-origin: top left;
  isolation: isolate;
}
.statusbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: var(--sb);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 90;
  pointer-events: none;
}
.statusbar-time { font: 600 15px/20px var(--font); letter-spacing: -0.5px; width: 54px; text-align: center; }
.screen-host { position: absolute; inset: 0; }
.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }

@media (max-width: 480px) {
  body { background: var(--gohan); }
  .stage { padding: 0; display: block; }
  .demo-panel { display: none; }
  .phone { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; transform: none !important; }
  .phone-slot { width: auto !important; height: auto !important; }
  .statusbar { display: none; }
  :root { --sb: max(env(safe-area-inset-top), 12px); --sb-dash: max(env(safe-area-inset-top), 12px); }
}
@media (max-width: 760px) and (min-width: 481px) {
  .demo-panel { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--radius-i-sm);
  font: 700 16px/24px var(--font);
  text-align: center;
  white-space: nowrap;
  transition: filter .15s, opacity .15s;
}
.btn-primary { background: var(--piccolo); color: var(--goten); }
.btn-primary:not(:disabled):hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.24; cursor: default; }
.btn-secondary { background: var(--goku); color: var(--bulma); border-radius: var(--radius-i-md); }
.btn-secondary:hover { background: #EDEDED; }
.btn-social {
  background: var(--gohan);
  border: 1px solid var(--beerus);
  padding: 16px 56px 16px 16px;
  gap: 16px;
  color: var(--bulma);
}
.btn-social:hover { border-color: #CFCFCF; }
.btn-social img { flex: none; }
.btn-social span { flex: 1; text-align: center; }
.btn.is-loading { pointer-events: none; }
.btn .spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.link {
  font: 400 16px/24px var(--font);
  text-decoration: underline;
  text-underline-position: from-font;
  color: var(--bulma);
  align-self: flex-start;
}
.link-bold { font-weight: 700; }
.link-muted { color: var(--trunks); font-weight: 700; }

.or { display: flex; align-items: center; gap: 12px; font: 400 12px/16px var(--font); color: var(--trunks); width: 100%; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--beerus); }

/* ---------- Form fields ---------- */
.form-block { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.fgroup {
  background: var(--gohan);
  border: 1px solid var(--beerus);
  border-radius: var(--radius-s-sm);
  display: flex;
  flex-direction: column;
  width: 100%;
}
.fgroup > .field + .field { border-top: 1px solid var(--beerus); }
.fgroup > .field { border-radius: 0; }
.fgroup > .field:first-child { border-top-left-radius: 7px; border-top-right-radius: 7px; }
.fgroup > .field:last-child { border-bottom-left-radius: 7px; border-bottom-right-radius: 7px; }
.fgroup > .field.is-error, .fgroup > .field:focus-within { border-radius: var(--radius-i-sm); }
.fgroup.single { border: 0; }
.fgroup.single > .field { border: 1px solid var(--beerus); border-radius: var(--radius-i-sm); }

.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 16px;
  border-radius: var(--radius-i-sm);
  background: var(--gohan);
}
.field-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.field-label { display: none; font: 400 12px/12px var(--font); color: var(--trunks); }
.field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: 400 16px/24px var(--font);
  color: var(--bulma);
  padding: 16px 0;
}
.field input::placeholder { color: var(--trunks); opacity: 1; }
.field.is-filled .field-label { display: block; }
.field.is-filled .field-body { padding: 12px 0 8px; }
.field.is-filled input { padding: 0; }
.field:focus-within { box-shadow: inset 0 0 0 1px var(--piccolo); z-index: 1; }
.field.is-error { box-shadow: inset 0 0 0 1.5px var(--chichi); z-index: 2; }
.field.is-error .field-label { color: var(--bulma); }
.field-trail { flex: none; display: flex; align-items: center; }
.field-toggle { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 4px; }
.field-toggle.text { width: auto; font: 400 14px/20px var(--font); text-decoration: underline; text-underline-position: from-font; }
.field.remembered { background: var(--goku); padding: 16px; gap: 8px; }
.field.remembered .who { flex: 1; font: 400 16px/24px var(--font); }
.avatar { border-radius: var(--radius-full); overflow: hidden; flex: none; background: var(--goku); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.icon-btn { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 4px; flex: none; }
.icon-btn:hover { background: var(--heles); }

.input-info { display: flex; gap: 4px; align-items: flex-start; font: 400 12px/16px var(--font); color: var(--dodoria); }
.input-info img { flex: none; }

/* ---------- PIN boxes ---------- */
.pin { position: relative; display: flex; gap: 8px; }
.pin-4 { width: 200px; height: 54px; }
.pin-6 { width: 100%; height: 71px; }
.pin-box {
  flex: 1;
  border: 1px solid var(--beerus);
  border-radius: var(--radius-s-sm);
  background: var(--gohan);
  display: grid;
  place-items: center;
  font: 700 18px/24px var(--font);
  color: var(--bulma);
  transition: border-color .12s, box-shadow .12s;
}
.pin.is-focused .pin-box.is-active { border-color: var(--piccolo); box-shadow: 0 0 0 3px var(--jiren); }
.pin.is-error .pin-box, .pin.is-error.is-focused .pin-box.is-active { border-color: var(--chichi); color: var(--chichi); }
.pin.is-error .pin-box.is-filled, .pin.is-error .pin-box.is-active { box-shadow: 0 0 0 3px var(--chichi-10); }
.pin-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  font-size: 16px;
  color: transparent;
  caret-color: transparent;
  cursor: pointer;
}

/* ---------- Bottom sheet ---------- */
.sheet-layer { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-scrim { position: absolute; inset: 0; background: var(--zeno); animation: fade-in .2s ease-out both; }
.sheet {
  position: relative;
  background: var(--gohan);
  border-radius: 16px 16px 0 0;
  padding: 0 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 24px;
  max-height: calc(100% - var(--sb));
  overflow-y: auto;
  scrollbar-width: none;
  animation: sheet-up .28s cubic-bezier(.2, .8, .2, 1) both;
}
.sheet-layer.is-closing .sheet { animation: sheet-down .2s ease-in both; }
.sheet-layer.is-closing .sheet-scrim { animation: fade-out .2s ease-in both; }
.sheet-head { margin: 0 -20px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 12px; }
.grabber { width: 41px; height: 4px; border-radius: 2px; background: var(--beerus); }
.sheet-title { width: 100%; padding: 8px 20px; text-align: center; font: 600 18px/24px var(--font); }
.sheet-title.w-medium { font-weight: 500; line-height: 28px; }
.sheet-title.w-bold { font-weight: 700; line-height: 28px; }
.sheet-divider { width: 100%; height: 1px; background: var(--beerus); }
.sheet-text { font: 400 16px/24px var(--font); }
.sheet-center { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.btn-group { display: flex; flex-direction: column; gap: 8px; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { from { transform: none; } to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

/* Segmented control (Facial / Finger print) */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--goku); border-radius: var(--radius-s-sm); }
.seg button { flex: 1; height: 32px; border-radius: 8px; font: 400 14px/20px var(--font); text-align: center; }
.seg button.is-on { background: var(--gohan); }

/* Simulated biometric scan */
.scan-art { width: 80px; height: 80px; position: relative; }
.scan-art.is-scanning::after {
  content: '';
  position: absolute;
  left: 8px; right: 8px; height: 2px;
  background: var(--piccolo);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--piccolo);
  animation: scan 1.2s ease-in-out infinite alternate;
}
@keyframes scan { from { top: 12px; } to { top: 66px; } }
.sim-note { font: 400 12px/16px var(--font); color: var(--trunks); text-align: center; }

/* ---------- Snackbar ---------- */
.snackbar {
  position: absolute;
  top: var(--sb);
  left: 16px;
  right: 16px;
  z-index: 80;
  pointer-events: none;  /* informational only — never block taps on the header underneath */
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-s-sm);
  background: var(--goku);
  box-shadow: var(--shadow-snackbar);
  animation: snack-in .25s ease-out both;
}
.snackbar.is-leaving { animation: snack-out .2s ease-in both; }
.snackbar-icon { width: 32px; height: 32px; flex: none; border-radius: var(--radius-s-sm); background: var(--jiren); display: grid; place-items: center; }
.snackbar-text { font: 400 14px/24px var(--font); padding: 4px 0; }
@keyframes snack-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes snack-out { to { opacity: 0; transform: translateY(-12px); } }

/* ---------- Tab bar ---------- */
.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  background: linear-gradient(var(--gohan), var(--beerus));
  border-top: 1px solid var(--heles);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}
.tabbar-row { display: flex; height: 60px; }
.tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font: 400 12px/16px var(--font);
  color: var(--trunks);
  text-align: center;
  text-decoration: none;
}
.tab.is-on { color: var(--piccolo); }
.tab svg { width: 24px; height: 24px; }
.tab-badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 4px);
  min-width: 16px;
  max-width: 34px;
  padding: 0 4px;
  border-radius: 100px;
  background: var(--dodoria);
  color: var(--gohan);
  font: 500 12px/16px var(--font);
  text-align: center;
}
.home-indicator { height: 21px; position: relative; }
.home-indicator::after { content: ''; position: absolute; left: 50%; bottom: 8px; width: 144px; height: 5px; margin-left: -72px; border-radius: 100px; background: var(--popo); }
@media (max-width: 480px) {
  .home-indicator { height: env(safe-area-inset-bottom); }
  .home-indicator::after { display: none; }
}

/* ---------- Misc ---------- */
.page-dots { display: flex; justify-content: center; align-items: center; gap: 5.33px; height: 16px; }
.page-dots i { width: 5.33px; height: 5.33px; border-radius: 50px; background: var(--trunks); opacity: 0.3; transition: opacity .2s; }
.page-dots i.is-on { opacity: 1; }
.page-dots.light i { background: var(--gohan); }
.hscroll { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: none; }
.skeleton { background: linear-gradient(90deg, #ececec 25%, #f6f6f6 50%, #ececec 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-s-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Student names that open the Student profile (SC.studentAttr, js/student/data.js) */
[data-student] { cursor: pointer; }
[data-student]:hover { text-decoration: underline; text-underline-offset: 2px; }
