/* ============================================================
   Quiz « Innover ensemble » — app styles.
   Tokens come from the Unitec design system (styles.css).
   Layout mirrors the Claude Design prototype (1a + results 2a).
   ============================================================ */

:root {
  /* Lining figures for every score / count (TheSans OsF has old-style figures). */
  --font-num: "Helvetica Neue", Arial, sans-serif;
  --app-max: 480px;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: #ECEBE8;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

.num { font-family: var(--font-num); font-variant-numeric: tabular-nums lining-nums; }

/* ---- App shell: phone column, full height ---- */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--app-max);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  color: var(--text-body);
  font-family: var(--font-sans);
}
@media (min-width: 481px) {
  .app { box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }
}

.screen[hidden] { display: none !important; }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---- Identity bar ---- */
.bar {
  flex: none;
  background: var(--brand);
  color: #fff;
  padding: max(14px, env(safe-area-inset-top)) 20px 10px;
}
.bar__row { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.bar__logo { height: 22px; width: auto; display: block; }

.lang { display: flex; border: 1px solid rgba(255,255,255,0.55); border-radius: var(--radius-pill); padding: 2px; gap: 2px; }
.lang__btn {
  appearance: none; border: none; border-radius: var(--radius-pill);
  padding: 5px 11px; font-family: var(--font-sans); font-weight: var(--fw-bold); font-size: 12px; letter-spacing: 0.06em;
  cursor: pointer; background: transparent; color: #fff;
  transition: background var(--dur-fast) var(--ease-standard);
}
.lang__btn[aria-pressed="true"] { background: #fff; color: var(--brand); }
.lang__btn:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,0.5); }

.segments { display: flex; gap: 4px; padding: 8px 0 6px; }
.segments[hidden] { display: none; }
.segments__seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.35); transition: background var(--dur-base) var(--ease-standard); }
.segments__seg--done { background: #fff; }
.segments__seg--current { background: rgba(255,255,255,0.9); }

/* ---- Shared primitives ---- */
.eyebrow {
  font-size: var(--fs-eyebrow); font-weight: var(--fw-bold); letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase; color: var(--brand);
}
.eyebrow--inverse { color: rgba(255,255,255,0.8); }
.eyebrow--block { display: block; margin-bottom: 4px; }
.accent-bar { display: block; width: 48px; height: var(--border-accent); background: var(--brand); }

.hero { flex: none; background: var(--brand); color: #fff; padding: 18px 20px 40px; }
.hero--center { text-align: center; padding-top: 16px; }
.hero__title { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 46px; line-height: 1.02; letter-spacing: var(--ls-display); color: #fff; margin: 12px 0; }
.hero__sub { margin: 0; font-size: 16px; line-height: 1.5; color: rgba(255,255,255,0.9); max-width: 320px; text-wrap: pretty; }

.sheet-card {
  flex: 1; position: relative; background: #fff; border-radius: 16px 16px 0 0; margin-top: -16px;
  padding: 28px 20px calc(56px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}

/* Buttons — mirrors UnitecDesignSystem Button (primary / secondary / ghost; md / lg; block) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; min-height: 44px;
  font-family: var(--font-sans); font-weight: var(--fw-bold); font-size: var(--fs-base); line-height: 1; letter-spacing: 0.01em;
  border-radius: var(--radius-md); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.btn--lg { padding: 14px 28px; min-height: 52px; font-size: var(--fs-lg); gap: 10px; }
.btn--block { display: flex; width: 100%; }
.btn--primary { background: var(--brand); color: var(--brand-contrast); border: var(--border-hairline) solid var(--brand); }
.btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn--primary:active { background: var(--brand-active); border-color: var(--brand-active); transform: translateY(1px); }
.btn--secondary { background: var(--surface-card); color: var(--text-strong); border: var(--border-hairline) solid var(--border-default); }
.btn--secondary:hover { background: var(--gray-50); }
.btn--secondary:active { transform: translateY(1px); }
.btn--ghost { background: transparent; color: var(--brand); border: var(--border-hairline) solid transparent; }
.btn--ghost:hover { background: var(--brand-tint-faint); }
.btn--ghost:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn[disabled]:active { transform: none; }
.btn[hidden] { display: none; }

/* ---- Start ---- */
.screen--start { overflow: auto; scrollbar-width: none; }
.screen--start::-webkit-scrollbar { display: none; }
.start__cta { margin-top: 8px; }

/* ---- Question ---- */
.q { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; background: #fff; padding: 18px 20px 24px; }
.q::-webkit-scrollbar { display: none; }
.q--enter { opacity: 0; transform: translateX(28px); }
.q--in { opacity: 1; transform: translateX(0); transition: opacity var(--dur-slow) var(--ease-standard), transform var(--dur-slow) var(--ease-standard); }

.q__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.bonus {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--brand-tint); color: var(--brand-active);
  font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 13px; white-space: nowrap;
  transition: background var(--dur-base) var(--ease-standard);
}
.bonus--off { background: var(--gray-100); color: var(--text-muted); }
.bonus--off .num { font-family: var(--font-display); }
.icon { flex: none; display: inline-block; }

.timer { height: 3px; background: var(--gray-100); border-radius: 2px; margin: 12px 0 20px; overflow: hidden; }
.timer__fill { height: 100%; width: 100%; background: var(--brand); border-radius: 2px; transition: width 100ms linear, background 300ms var(--ease-standard); }
.timer__fill--late { background: var(--warning); }

.q__text { font-size: 23px; line-height: 1.25; margin: 0 0 18px; text-wrap: pretty; }
.q__multi-hint { margin: -8px 0 14px; font-size: 13px; color: var(--text-subtle); }
.q__multi-hint[hidden] { display: none; }

/* Choice options (mcq / multi) */
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  appearance: none; display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  min-height: 60px; padding: 12px 14px; border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-default); background: #fff; color: var(--text-strong);
  font-family: var(--font-sans); font-size: 16px; line-height: 1.35; cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard), background var(--dur-fast) var(--ease-standard);
}
.opt--num { font-family: var(--font-num); }
.opt__chip {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 13px;
  border: 1.5px solid var(--border-default); background: var(--gray-50); color: var(--text-strong);
  transition: background var(--dur-fast) var(--ease-standard);
}
.opts--multi .opt__chip { border-radius: 6px; }
.opt__label { flex: 1; }
.opt__icon { display: inline-flex; }

.opt--selected { border-color: var(--brand); background: var(--brand-tint-faint); }
.opt--selected .opt__chip { border-color: var(--brand); background: var(--brand); color: #fff; }
.opt--correct { border-color: var(--success); background: var(--success-bg); }
.opt--correct .opt__chip { border-color: var(--success); background: var(--success); color: #fff; }
.opt--correct .opt__icon { color: var(--success); }
.opt--wrong { border-color: var(--danger); background: var(--danger-bg); }
.opt--wrong .opt__chip { border-color: var(--danger); background: var(--danger); color: #fff; }
.opt--wrong .opt__icon { color: var(--danger); }
.opt--missed { border-color: var(--success); background: #fff; }
.opt--missed .opt__chip { border-color: var(--success); background: #fff; color: var(--success); }
.opt--missed .opt__icon { color: var(--success); }
.opt--dim { border-color: var(--border-subtle); color: var(--text-subtle); }
.opt--dim .opt__chip { border-color: var(--border-subtle); background: #fff; color: var(--text-subtle); }
.opt[disabled] { cursor: default; }

/* True / false */
.opts--tf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opts--tf .opt {
  flex-direction: column; justify-content: center; gap: 10px; min-height: 130px; padding: 16px; text-align: center;
  font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 24px; letter-spacing: var(--ls-heading);
}

/* Slider */
.slider { background: var(--gray-50); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 26px 20px 18px; text-align: center; }
.slider__value { font-weight: var(--fw-bold); font-size: 40px; line-height: 1; letter-spacing: -0.03em; color: var(--brand); transition: color var(--dur-base) var(--ease-standard); }
.slider--ok .slider__value { color: var(--success); }
.slider--ko .slider__value { color: var(--danger); }
.slider__input { width: 100%; margin: 26px 0 8px; accent-color: var(--brand); height: 28px; cursor: pointer; }
.slider__input[disabled] { cursor: default; }
.slider__range { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-subtle); }
.slider__hint { margin: 14px 0 0; font-size: 13px; color: var(--text-subtle); }

/* Feedback */
.feedback { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border-radius: var(--radius-lg); }
.feedback[hidden] { display: none; }
.feedback--ok { background: var(--success-bg); color: var(--success); }
.feedback--ko { background: var(--danger-bg); color: var(--danger); }
.feedback__title { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 16px; line-height: 1.3; }
.feedback__text { font-size: 14px; line-height: 1.45; margin-top: 4px; color: var(--text-body); }
.feedback__insight { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid rgba(23,23,25,0.08); font-size: 14px; line-height: 1.5; color: var(--text-body); text-wrap: pretty; }

.q__foot { flex: none; padding: 12px 20px calc(20px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--border-subtle); }
.q__hint { margin: 0; min-height: 52px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text-subtle); }
.q__hint[hidden] { display: none; }

/* ---- Results (variant D: magenta hero + ring + theme bars) ---- */
.screen--results { position: relative; }
.results { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; transform-origin: 50% 0; transition: transform var(--dur-slow) var(--ease-standard); }
.results::-webkit-scrollbar { display: none; }
.results--behind { transform: scale(0.96); }

.ring { position: relative; width: 184px; height: 184px; margin: 14px auto 10px; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring__track { fill: none; stroke: rgba(255,255,255,0.25); stroke-width: 10px; }
.ring__fill { fill: none; stroke: #fff; stroke-width: 10px; stroke-linecap: round; stroke-dasharray: 0 502.65; transition: stroke-dasharray 900ms var(--ease-out); }
.ring__label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring__score { font-weight: var(--fw-bold); font-size: 44px; line-height: 1; letter-spacing: -0.03em; }
.ring__unit { font-size: 13px; opacity: 0.85; margin-top: 6px; }
.results__title { font-family: var(--font-display); font-weight: var(--fw-bold); font-size: 20px; line-height: 1.2; }
.results__sub { font-size: 15px; margin-top: 4px; }

.sheet-card--results { padding: 24px 20px calc(40px + env(safe-area-inset-bottom)); gap: 22px; }

.theme { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border-subtle); }
.theme__label { font-size: 15px; font-weight: var(--fw-bold); color: var(--text-strong); }
.theme__fraction { font-size: 14px; font-weight: var(--fw-bold); color: var(--text-muted); }
.theme__track { grid-column: 1 / -1; height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.theme__bar { height: 100%; width: 0; background: var(--brand); border-radius: 3px; transition: width 700ms var(--ease-out); }

.insights { margin-top: 4px; }
.insight { padding: 12px 0; border-top: 1px solid var(--border-subtle); }
.insight__heading { font-size: 12px; font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--text-subtle); margin-bottom: 4px; }
.insight__text { margin: 0; font-size: 15px; line-height: 1.5; text-wrap: pretty; }

.results__actions { display: flex; flex-direction: column; gap: 6px; }

/* ---- E-mail bottom sheet ---- */
.scrim {
  position: absolute; inset: 0; background: rgba(23,23,25,0.45); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-base) var(--ease-standard);
}
.scrim--on { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg);
  padding: 14px 20px calc(28px + env(safe-area-inset-bottom));
  max-height: 92%; overflow: auto;
  transform: translateY(100%); transition: transform var(--dur-slow) var(--ease-standard);
  visibility: hidden;
}
.sheet--on { transform: translateY(0); visibility: visible; }
.sheet__handle { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--gray-300); margin: 0 auto 20px; }
.sheet__form, .sheet__done { display: flex; flex-direction: column; gap: 14px; }
.sheet__form[hidden], .sheet__done[hidden] { display: none; }
.sheet__form .eyebrow { margin-top: -4px; }
.sheet__title { font-size: 24px; line-height: 1.15; letter-spacing: var(--ls-display); margin: -6px 0 0; }
.sheet__text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--text-muted); }
.sheet__privacy { margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-subtle); text-align: center; }

/* Input — mirrors UnitecDesignSystem Input (size lg) */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--text-strong); }
.field__input {
  width: 100%; padding: 14px 16px; font-family: var(--font-sans); font-size: var(--fs-lg); color: var(--text-body);
  background: var(--surface-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); outline: none;
  transition: border-color var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.field__input:focus { border-color: var(--brand); box-shadow: var(--shadow-focus); }
.field--error .field__input, .field--error .field__input:focus { border-color: var(--danger); }
.field__error { font-size: var(--fs-xs); color: var(--danger); }
.field__error[hidden] { display: none; }

.done__badge { width: 56px; height: 56px; border-radius: 50%; background: var(--success-bg); color: var(--success); display: flex; align-items: center; justify-content: center; }
.done__title { font-size: 26px; line-height: 1.15; letter-spacing: var(--ls-display); margin: 0; }
.done__link { text-align: center; font-size: 14px; font-weight: var(--fw-bold); color: var(--brand); padding: 8px; }

/* ---- Status (loading / error) ---- */
.screen--status { align-items: center; justify-content: center; padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  .q--in, .results, .sheet, .scrim, .ring__fill, .theme__bar, .timer__fill { transition: none; }
}
