/* Палітра: фіолетовий і оливковий — як у презентації лекції; червоний пульс — «ви» */
:root {
  --paper: #F5F3FA;
  --surface: #FFFFFF;
  --ink: #24163F;
  --muted: #6B6184;
  --violet: #4B2E83;
  --violet-soft: #E9E3F4;
  --olive: #83830F;
  --pulse: #D6455D;
  --line: #D9D2E8;
  --radius-lg: 22px;
  --radius-sm: 12px;
  --display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --body: 'Onest', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--body); color: var(--ink); background: var(--paper);
  font-size: 17px; line-height: 1.45;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--pulse); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- студентський екран ---------- */
.app { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); padding: 4px 2px 14px; }
.topbar b { color: var(--violet); font-family: var(--display); font-weight: 600; letter-spacing: .04em; }
.screen { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.screen.anim { animation: enter .35s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.kicker { color: var(--muted); font-size: 15px; }
.title { font-size: 26px; }
.q { font-size: 21px; font-weight: 600; line-height: 1.3; }
.card { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; border: 1px solid var(--line); }
.note { font-size: 15px; color: var(--muted); }
.note b { color: var(--ink); }

.opt { display: block; width: 100%; text-align: left; padding: 16px 18px; min-height: 58px; border-radius: var(--radius-sm);
  border: 2px solid var(--line); background: var(--surface); font-size: 18px; transition: border-color .15s, background .15s; }
.opt:hover { border-color: var(--violet); }
.opt.on { border-color: var(--pulse); background: #FCEEF1; }
.opt.was { box-shadow: inset 4px 0 0 var(--olive); }
.stack { display: flex; flex-direction: column; gap: 10px; }

.btn { display: block; width: 100%; padding: 17px 20px; border-radius: 999px; border: 0; background: var(--violet); color: #fff;
  font-weight: 600; font-size: 18px; min-height: 58px; }
.btn:disabled { opacity: .35; cursor: default; }
.btn.ghost { background: transparent; color: var(--violet); border: 2px solid var(--violet-soft); }
.progress { height: 6px; border-radius: 3px; background: var(--violet-soft); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--violet); transition: width .3s; }

.codeinput { font-family: var(--display); font-size: 44px; letter-spacing: .3em; text-align: center; width: 100%; padding: 16px 0 16px .3em;
  border-radius: var(--radius-lg); border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.err { color: var(--pulse); font-size: 15px; min-height: 1.2em; }

.wait { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 40px 0; }
.beat { width: 180px; height: 60px; }
.beat path { fill: none; stroke: var(--pulse); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw 2.4s ease-in-out infinite; }
@keyframes draw { 50% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -320; } }
.big { font-family: var(--display); font-size: 48px; font-weight: 600; color: var(--violet); line-height: 1; }

/* лінія життя */
.week { font-family: var(--display); font-size: 34px; font-weight: 600; color: var(--violet); line-height: 1.1; }
.week small { display: block; font-family: var(--body); font-size: 16px; font-weight: 500; color: var(--olive); margin-top: 6px; letter-spacing: 0; }
.track { position: relative; padding: 30px 6px 30px; touch-action: none; }
.track .rail { position: relative; height: 4px; background: var(--line); border-radius: 2px; }
.track .fill { position: absolute; left: 0; top: 0; height: 4px; background: var(--pulse); border-radius: 2px; }
.track .tick { position: absolute; top: -8px; width: 2px; height: 20px; background: var(--violet); transform: translateX(-1px); }
.track .tick.legal { background: var(--olive); }
.track .tick span { position: absolute; top: 24px; left: 50%; transform: translateX(-50%) rotate(-40deg); transform-origin: top center;
  white-space: nowrap; font-size: 11px; color: var(--muted); }
.track .thumb { position: absolute; top: -14px; width: 32px; height: 32px; margin-left: -16px; border-radius: 50%; background: var(--pulse);
  box-shadow: 0 0 0 6px rgba(214,69,93,.18); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 6px rgba(214,69,93,.18); } 20% { box-shadow: 0 0 0 12px rgba(214,69,93,.10); } }
.track input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; margin: 0; }
.steppers { display: flex; gap: 10px; }
.steppers button { flex: 1; min-height: 52px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); font-size: 22px; }
.stage { border-left: 4px solid var(--violet); padding: 4px 0 4px 14px; font-size: 17px; min-height: 5.5em; }

/* справи */
.grid2 { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; align-items: stretch; }
.grid2 .h { font-size: 13px; color: var(--muted); align-self: end; text-align: center; padding-bottom: 2px; }
.grid2 .rh { font-size: 13px; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; }
.grid2 .opt { text-align: center; font-size: 16px; padding: 12px 8px; min-height: 64px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.row3 .opt { text-align: center; font-size: 15px; padding: 12px 6px; }
.case-text { font-size: 19px; line-height: 1.4; }

/* міні-результати на телефоні */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { position: relative; background: var(--violet-soft); border-radius: 8px; overflow: hidden; min-height: 36px; display: flex; align-items: center; }
.bar i { position: absolute; inset: 0 auto 0 0; background: #CFC3E6; }
.bar.me i { background: #F3B9C3; }
.bar span { position: relative; padding: 6px 10px; font-size: 15px; display: flex; justify-content: space-between; width: 100%; gap: 8px; }
.verdict { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; background: var(--violet-soft); }
.verdict.good { background: #EEF3D6; }
.verdict.bad { background: #FBE3E7; }
.hist { width: 100%; height: auto; display: block; }

/* ---------- екран викладача / проєктор ---------- */
body.projector { --paper: #1C1233; --surface: #2A1D49; --ink: #F3EEFF; --muted: #B3A7D1; --violet: #B79CF2; --violet-soft: #3A2B60;
  --olive: #D4D45A; --pulse: #FF6B84; --line: #463670; background: var(--paper); font-size: 18px; }
.pj { max-width: 1400px; margin: 0 auto; padding: 18px 28px 40px; }
.pj-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.pj-head h1 { font-size: 22px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 15px; }
.tab.on { background: var(--violet); color: #1C1233; border-color: var(--violet); font-weight: 600; }
.pj-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toggle { padding: 10px 16px; border-radius: 999px; border: 2px solid var(--pulse); background: transparent; color: var(--pulse); font-weight: 600; font-size: 15px; }
.toggle.on { background: var(--pulse); color: #1C1233; }
.small { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 14px; }
.pj-body { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.pj-body.full { grid-template-columns: 1fr; }
.join { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; text-align: center; }
.join .qr { background: #fff; padding: 12px; border-radius: 14px; display: inline-block; }
.join .qr svg { display: block; }
.join .code { font-family: var(--display); font-size: 56px; font-weight: 600; letter-spacing: .12em; color: var(--ink); margin-top: 12px; }
.join .url { font-size: 15px; color: var(--muted); word-break: break-all; }
.join .count { margin-top: 12px; font-size: 17px; }
.join .count b { font-family: var(--display); font-size: 30px; color: var(--pulse); }
.lobby-big { display: grid; grid-template-columns: auto 1fr; gap: 48px; align-items: center; min-height: 70vh; }
.lobby-big .join .code { font-size: 96px; }
.pj h2 { font-size: 30px; margin-bottom: 6px; }
.pj .sub { color: var(--muted); margin-bottom: 18px; }
.pq { margin-bottom: 22px; }
.pq .qt { font-size: 21px; font-weight: 600; margin-bottom: 8px; }
.sbar { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: center; margin: 4px 0; font-size: 15px; color: var(--muted); }
.sbar .seg { display: flex; height: 34px; border-radius: 8px; overflow: hidden; background: var(--violet-soft); }
.sbar .seg div { display: flex; align-items: center; justify-content: center; font-weight: 600; color: #1C1233; font-size: 15px; transition: flex-grow .5s; min-width: 0; overflow: hidden; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 15px; color: var(--muted); margin-bottom: 14px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 18px; }
.stat { background: var(--surface); border-radius: var(--radius-sm); padding: 14px 16px; }
.stat b { display: block; font-family: var(--display); font-size: 40px; color: var(--pulse); line-height: 1.1; }
.ctable { width: 100%; border-collapse: collapse; font-size: 16px; }
.ctable th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); }
.ctable td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ctable .mini { height: 12px; border-radius: 6px; background: var(--violet-soft); overflow: hidden; width: 160px; display: inline-block; vertical-align: middle; margin-right: 8px; }
.ctable .mini i { display: block; height: 100%; background: var(--pulse); }
.versus { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 22px; }
.versus .stat b { font-size: 64px; }
.quote { margin-top: 18px; font-size: 22px; border-left: 4px solid var(--olive); padding-left: 16px; }
.login { max-width: 420px; margin: 12vh auto; display: flex; flex-direction: column; gap: 14px; padding: 0 20px; }
.login input { font-size: 20px; padding: 14px 16px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.slist { display: flex; flex-direction: column; gap: 10px; }
.sitem { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--radius-sm); padding: 14px 16px; }
.sitem b { font-family: var(--display); color: var(--violet); }
@media (max-width: 900px) {
  .pj-body, .lobby-big, .versus { grid-template-columns: 1fr; }
  .sbar { grid-template-columns: 1fr; }
}

.link-big { font-family: var(--display); font-size: 30px; color: var(--pulse); margin: 16px 0 10px; word-break: break-all; }
.lobby-big .join .code { font-size: 72px; }
