/* Student phone app. Builds on /shared/theme.css (tokens, .glass, .grain). */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  min-height: 100dvh;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }

/* ---------- moving light ---------- */
.sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; background: radial-gradient(140% 90% at 50% 0%, var(--ink-2), var(--ink) 70%); }
.sky-blob {
  position: absolute;
  width: 95vmax; height: 95vmax;
  border-radius: 50%;
  opacity: 0.7;
  will-change: transform;
  animation: drift 38s var(--ease-in-out) infinite alternate;
}
.sky-blob--teal   { left: -50vmax; top: -40vmax; background: radial-gradient(closest-side, rgba(70, 230, 195, 0.42), rgba(70, 230, 195, 0) 70%); }
.sky-blob--violet { right: -50vmax; top: 18vh; background: radial-gradient(closest-side, rgba(155, 140, 255, 0.5), rgba(155, 140, 255, 0) 70%); animation-duration: 46s; animation-delay: -12s; }
.sky-blob--amber  { left: -30vmax; bottom: -50vmax; background: radial-gradient(closest-side, rgba(255, 189, 110, 0.36), rgba(255, 189, 110, 0) 70%); animation-duration: 54s; animation-delay: -27s; }
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(9vw, 6vh, 0) scale(1.08); }
  100% { transform: translate3d(-6vw, 10vh, 0) scale(0.96); }
}

/* ---------- layout ---------- */
.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 14px)
    calc(env(safe-area-inset-right, 0px) + 20px)
    calc(env(safe-area-inset-bottom, 0px) + 16px)
    calc(env(safe-area-inset-left, 0px) + 20px);
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 640; font-size: 15px; letter-spacing: 0.01em; color: var(--text-dim); }
.brand em { font-style: normal; color: var(--teal); }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 12px var(--teal); }

.net-hint {
  font-size: 13px;
  color: var(--amber);
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 189, 110, 0.1);
  border: 1px solid rgba(255, 189, 110, 0.25);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  pointer-events: none;
}
.net-hint.is-visible { opacity: 1; transform: none; }

.stage { position: relative; flex: 1; display: grid; }
.view {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.35s var(--ease-out), transform 0.45s var(--ease-out), visibility 0s linear 0.45s;
}
.view.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: 0.08s, 0.08s, 0s; }

.foot {
  margin-top: 18px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-faint);
  text-wrap: balance;
}

/* ---------- type ---------- */
.eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  display: inline-flex; align-items: center; gap: 9px;
}
.headline {
  margin: 0;
  font-size: clamp(34px, 10.2vw, 48px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.headline--sm { font-size: clamp(27px, 7.6vw, 34px); line-height: 1.08; }
.lede { margin: 14px 0 0; font-size: 17.5px; line-height: 1.5; color: var(--text-dim); text-wrap: pretty; }

/* ---------- idle ---------- */
.view--idle { justify-content: center; gap: 30px; padding: 24px 0 8px; }
.idle-copy { padding: 0 4px; }

.progress-card { padding: 20px 20px 16px; border-radius: 24px; }
.progress-now { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 16px; }
.progress-label { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); }
.progress-title { font-size: 21px; font-weight: 650; letter-spacing: -0.01em; }
.progress-who {
  font-size: 14px; font-weight: 560;
  color: var(--sec-color, var(--teal));
  padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--sec-color, var(--teal)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--sec-color, var(--teal)) 32%, transparent);
}
.progress-who:empty { display: none; }

.progress-track { position: relative; height: 14px; display: flex; align-items: center; }
.progress-segs { display: flex; gap: 4px; width: 100%; height: 8px; }
.seg {
  position: relative;
  min-width: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.seg-fill {
  position: absolute; inset: 0;
  background: var(--c);
  opacity: 0.85;
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  transition: transform 0.7s var(--ease-out);
}
.seg.is-past .seg-fill { opacity: 0.38; }
.progress-marker {
  position: absolute; top: 50%; left: 0;
  width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 3px rgba(6, 7, 15, 0.85), 0 0 16px var(--sec-color, var(--teal));
  transform: translateX(var(--x, 0px));
  transition: transform 0.7s var(--ease-out);
}
.progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 13px; color: var(--text-faint); }

/* ---------- question ---------- */
.view--question { padding: 22px 0 4px; }
.eyebrow--live { color: var(--amber); }
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.pulse::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: var(--amber);
  animation: pulse 1.8s var(--ease-out) infinite;
}
@keyframes pulse { from { transform: scale(1); opacity: 0.7; } to { transform: scale(3.2); opacity: 0; } }

.q-text {
  margin: 0;
  font-size: clamp(27px, 7.8vw, 36px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.q-hint { margin: 10px 0 0; font-size: 15.5px; color: var(--text-dim); transition: color 0.2s; }
.q-hint.is-warn { color: var(--amber); }
.q-hint.is-nudge { animation: nudge 0.38s var(--ease-out); }
@keyframes nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 60% { transform: translateX(4px); } }

.options { display: flex; flex-direction: column; gap: 11px; margin-top: 22px; }
.opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  min-height: 66px;
  padding: 15px 16px 15px 18px;
  border-radius: 22px;
  text-align: left;
  font-size: 18.5px;
  line-height: 1.25;
  font-weight: 560;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.16s var(--ease-out), opacity 0.25s;
}
.opt::after {
  /* selected glow layer: opacity only */
  content: '';
  position: absolute; inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  border: 1.5px solid var(--teal);
  background: linear-gradient(155deg, rgba(70, 230, 195, 0.22), rgba(70, 230, 195, 0.06) 60%);
  box-shadow: 0 0 28px -6px rgba(70, 230, 195, 0.55), inset 0 0 22px -10px rgba(70, 230, 195, 0.6);
  opacity: 0;
  transition: opacity 0.22s var(--ease-out);
}
.opt:active { transform: scale(0.975); }
.opt:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; }
.opt.is-selected::after { opacity: 1; }
.opt.is-blocked { opacity: 0.5; }
.opt-label { position: relative; z-index: 1; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt-key {
  position: relative; z-index: 1;
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.opt-check {
  position: relative; z-index: 1;
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.26);
  transition: border-color 0.2s;
}
.opt--multi .opt-check { border-radius: 9px; }
.opt-check::before {
  content: '';
  position: absolute; inset: -1.5px;
  border-radius: inherit;
  background: var(--teal);
  transform: scale(0.4);
  opacity: 0;
  transition: transform 0.25s var(--ease-out), opacity 0.2s;
}
.opt-check svg { position: relative; color: var(--ink); opacity: 0; transform: scale(0.5); transition: transform 0.28s var(--ease-out), opacity 0.18s; }
.opt.is-selected .opt-check { border-color: var(--teal); }
.opt.is-selected .opt-check::before { transform: none; opacity: 1; }
.opt.is-selected .opt-check svg { opacity: 1; transform: none; }

.save-state {
  margin: 16px 0 0;
  min-height: 22px;
  text-align: center;
  font-size: 14.5px;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 0.25s var(--ease-out);
}
.save-state.is-visible { opacity: 1; }
.save-state.is-saved { color: var(--teal); }
.save-state.is-error { color: var(--amber); }

/* ---------- closed ---------- */
.view--closed { justify-content: center; }
.closed-card { padding: 34px 26px 30px; text-align: center; }
.closed-icon {
  display: inline-grid; place-items: center;
  width: 62px; height: 62px; margin-bottom: 18px;
  border-radius: 50%;
  color: var(--violet);
  background: rgba(155, 140, 255, 0.13);
  border: 1px solid rgba(155, 140, 255, 0.35);
}
.view--closed.is-active .closed-icon { animation: pop 0.5s var(--ease-out) 0.1s both; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- larger / short screens ---------- */
@media (min-width: 520px) { .opt { font-size: 19.5px; } }
@media (max-height: 640px) {
  .view--idle { gap: 20px; }
  .opt { min-height: 58px; padding-block: 12px; }
  .options { gap: 9px; margin-top: 16px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .sky-blob, .pulse::after { animation: none; }
  .view, .view.is-active { transform: none; transition: opacity 0.2s linear, visibility 0s linear 0.2s; }
  .view.is-active { transition: opacity 0.2s linear, visibility 0s; }
  .opt, .opt:active { transform: none; }
  .seg-fill, .progress-marker, .opt-check::before, .opt-check svg, .net-hint { transition: none; }
  .q-hint.is-nudge, .view--closed.is-active .closed-icon { animation: none; }
}
