/* Telefon gracza. Wzór: kanwa „Quiz – telefon gracza” (ekran 390 × 844).
   Cel: Safari 12+ / Chrome 70+, więc bez flex `gap` i bez `inset`; dvh i env() zawsze z wartością zapasową. */

html, body { overflow-x: hidden; }

body.phone {
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  font-variant-numeric: lining-nums;
}
/* Złota ramka 10 px od krawędzi ekranu (jak na zaproszeniu i stronie gali). */
body.phone::after {
  content: "";
  position: fixed;
  top: 10px; right: 10px; bottom: 10px; left: 10px;
  z-index: 20;
  border: 1px solid rgba(200, 164, 124, .35);
  pointer-events: none;
}

#app { position: relative; }

/* ------------------------------------------------------------ ekrany */
.screen {
  position: relative;
  display: none;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  overflow: hidden;
}
.screen.is-active {
  display: -webkit-box;
  display: flex;
  -webkit-animation: screen-in .38s ease-out both;
  animation: screen-in .38s ease-out both;
}
@-webkit-keyframes screen-in { from { opacity: 0; -webkit-transform: translateY(10px); } to { opacity: 1; -webkit-transform: none; } }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
body.is-offline .screen.is-active { opacity: .55; transition: opacity .3s; }
body.is-offline .foot, body.is-offline .foot-note { visibility: hidden; }

.kicker { margin: 0; color: var(--c-gold); font: 400 15px/1.4 var(--font-display); }
.lead { margin: 0; color: var(--c-text-2); font-size: 18px; line-height: 1.45; }
.note { margin: 14px 0 0; color: var(--c-muted); font-size: 13px; line-height: 1.5; }
.cnt { margin: 0; color: var(--c-gold); font-size: 13px; font-weight: 500; line-height: 1; }
.cnt-top { position: relative; margin-top: 48px; text-align: center; }
.foot-note { position: relative; margin: 0 32px 48px; color: var(--c-muted); font-size: 14px; line-height: 1.5; }

/* ------------------------------------------------------------ pasek połączenia */
.conn {
  position: fixed;
  top: 20px; left: 20px; right: 20px;
  top: calc(20px + env(safe-area-inset-top));
  z-index: 30;
  display: -webkit-box;
  display: flex;
  align-items: center;
  max-width: 440px;
  margin: 0 auto;
  padding: 14px 16px;
  background: var(--c-text);
  color: var(--c-bg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: var(--shadow);
}
.conn .pulse { flex: none; margin-right: 12px; background: var(--c-gold-2); }
.conn-tip {
  position: fixed;
  left: 36px; right: 36px; bottom: 40px;
  bottom: calc(40px + env(safe-area-inset-bottom));
  z-index: 30;
  margin: 0;
  color: var(--c-muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

/* ------------------------------------------------------------ 1. dołączenie */
.join-head {
  position: relative;
  display: -webkit-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 50px 36px 0;
  text-align: center;
}
.join-emblem { display: block; width: 200px; height: 200px; margin-bottom: 26px; }
.title { margin: 8px 0 0; color: var(--c-text); font-size: 46px; line-height: 1; }
.join-lead { margin: 14px 0 0; color: var(--c-muted); font-size: 15px; line-height: 1.5; }

.join-form {
  position: relative;
  margin-top: auto;
  padding: 32px 36px 0;
}
.field { display: block; margin-bottom: 18px; }
.field-label { display: block; margin-bottom: 8px; color: var(--c-gold); font-size: 13px; font-weight: 500; line-height: 1; }
.field-input {
  display: block;
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid var(--c-gold);
  border-radius: 0;
  background: var(--c-bg-2);
  color: var(--c-text);
  font: 400 18px/1 var(--font-body);
  -webkit-appearance: none;
  appearance: none;
}
.field-input:focus { outline: 2px solid var(--c-gold-3); outline-offset: 2px; }
.form-error { margin: -4px 0 14px; color: var(--c-gold-3); font-size: 14px; font-weight: 500; }
.btn-primary {
  display: -webkit-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 58px;
  margin-top: 8px;
  padding: 0 22px;
  border: 0;
  border-radius: 0;
  background: var(--c-text);
  color: var(--c-bg);
  font: 500 16px/1 var(--font-body);
  cursor: pointer;
  -webkit-appearance: none;
}
.btn-primary:active { background: #e9ddd0; }
.btn-primary:disabled { opacity: .6; }
.arrow { width: 48px; height: 14px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.arrow .arrow-tip { fill: currentColor; stroke: none; }
.rodo { position: relative; margin: 20px 36px 40px; color: var(--c-muted); font-size: 12px; line-height: 1.5; }

/* ------------------------------------------------------------ 1a/1b. zapisy zamknięte (przed grą, po podium) */
.gate-main { position: relative; display: -webkit-box; display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; justify-content: center; padding: 40px 36px 56px; text-align: center; }
.gate-emblem { display: block; width: 180px; height: 180px; margin-bottom: 26px; }
.gate-orn { display: block; margin: 24px 0 26px; }
.gate-lead { margin: 0; color: var(--c-text); font: 400 26px/1.2 var(--font-display); }
.gate-pulse { margin: 26px 0 0; }
.gate-text { max-width: 300px; margin: 22px 0 0; color: var(--c-text-2); font-size: 15px; line-height: 1.5; }

/* ------------------------------------------------------------ 2. czekanie */
.wait-main {
  display: -webkit-box;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 36px;
  text-align: center;
}
.hello { margin: 12px 0 0; color: var(--c-text); font-size: 48px; line-height: 1.02; overflow-wrap: break-word; word-wrap: break-word; max-width: 100%; }
.wait-pulse { margin: 40px 0 28px; }
.wait-points { margin: 22px 0 0; color: var(--c-gold); font: 400 22px/1 var(--font-display); }
.foot {
  display: -webkit-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 36px 44px;
  text-align: center;
}

/* ------------------------------------------------------------ 3. odliczanie */
.cd-main { display: -webkit-box; display: flex; flex: 1 1 auto; align-items: center; justify-content: center; }
.cd-stage { position: relative; display: -webkit-box; display: flex; align-items: center; justify-content: center; width: 220px; height: 220px; }
.cd-ring { position: absolute; top: 0; left: 0; width: 220px; height: 220px; fill: none; overflow: visible; }
.cd-track { stroke: rgba(200, 164, 124, .35); stroke-width: 1; }
.cd-fill { stroke: var(--c-gold); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 653.5; stroke-dashoffset: 0; }
.cd-tip { fill: var(--c-gold); }
.cd-digit { color: var(--c-text); font: 400 120px/1 var(--font-display); }
.cd-stage.is-tick .cd-digit { -webkit-animation: cd-tick .5s cubic-bezier(.2, .8, .2, 1) both; animation: cd-tick .5s cubic-bezier(.2, .8, .2, 1) both; }
@-webkit-keyframes cd-tick { from { opacity: 0; -webkit-transform: scale(1.25); } to { opacity: 1; -webkit-transform: none; } }
@keyframes cd-tick { from { opacity: 0; transform: scale(1.25); } to { opacity: 1; transform: none; } }
.cd-note { margin: 0 32px 56px; color: var(--c-text-2); font-size: 16px; line-height: 1.4; text-align: center; }

/* ------------------------------------------------------------ 4. pytanie */
.timebar { position: relative; height: 4px; margin: 20px 20px 0; background: rgba(200, 164, 124, .2); overflow: hidden; }
.timebar-fill {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: var(--c-gold);
  -webkit-transform-origin: 0 50%;
  transform-origin: 0 50%;
}
.timebar-fill.is-low { background: var(--c-gold-3); }
.q-head { display: -webkit-box; display: flex; align-items: baseline; justify-content: space-between; padding: 22px 28px 0; }
.q-secs { margin: 0; color: var(--c-gold); font: 400 26px/1 var(--font-display); }
.q-secs small { margin-left: 3px; font: 500 12px/1 var(--font-body); }
.q-text {
  margin: 18px 28px 0;
  color: var(--c-text);
  font-size: 30px;
  line-height: 1.15;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.q-text.is-long { font-size: 25px; }
.q-text.is-xlong { font-size: 21px; }
.answers { margin-top: auto; padding: 24px 20px 28px; }

/* Przycisk odpowiedzi: ciemny bordo, złota podwójna ramka, romb z literą. Bez gradientów. */
.ans {
  position: relative;
  display: -webkit-box;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 74px;
  margin: 0 0 14px;
  padding: 12px 20px 12px 16px;
  border: 0;
  border-radius: 0;
  background: var(--c-bg-2);
  box-shadow: 0 0 0 1px var(--c-gold), 0 8px 16px rgba(18, 2, 2, .45);
  color: var(--c-text);
  font: 500 18px/1.25 var(--font-body);
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  transition: -webkit-transform .12s, transform .12s, box-shadow .12s;
}
.ans:last-child { margin-bottom: 0; }
.ans::before {
  content: "";
  position: absolute;
  top: 5px; right: 5px; bottom: 5px; left: 5px;
  border: 1px solid rgba(200, 164, 124, .45);
  pointer-events: none;
}
.ans:active { -webkit-transform: translateY(2px); transform: translateY(2px); box-shadow: 0 0 0 1px var(--c-gold), 0 3px 8px rgba(18, 2, 2, .45); }
.ans:disabled { cursor: default; }
.ans .rh { margin-right: 16px; }
.ans .rh svg { -webkit-filter: drop-shadow(0 2px 2px rgba(18, 2, 2, .5)); filter: drop-shadow(0 2px 2px rgba(18, 2, 2, .5)); }
.ans .rh path { stroke: #f3e2bf; stroke-width: .8; stroke-opacity: .7; }
.ans .rh b { font-size: 19px; }
.ans-text { min-width: 0; overflow-wrap: break-word; word-wrap: break-word; }
.ans.sel { background: var(--c-gold); color: var(--c-gold-ink); box-shadow: 0 0 0 1px var(--c-gold-3), 0 8px 18px rgba(18, 2, 2, .5), 0 0 0 5px rgba(200, 164, 124, .18); }
.ans.sel::before { border-color: rgba(106, 63, 26, .35); }
.ans.sel .rh path { fill: var(--c-bg); stroke: var(--c-gold-3); }
.ans.sel .rh b { color: var(--c-gold-3); }

/* ------------------------------------------------------------ 5–6. odpowiedź przyjęta, czas minął */
/* Treść zawsze na tej samej wysokości co ikona w „Odpowiedź przyjęta” (ok. ¼ ekranu od góry). */
.status-main {
  display: -webkit-box;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 28px 40px;
  padding-top: calc(30.9vh - 61px);
  text-align: center;
}
.screen-closed .status-main { padding-left: 36px; padding-right: 36px; }
.tick-ring { display: -webkit-box; display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; border: 1px solid var(--c-gold); border-radius: 50%; }
.tick-ring svg { width: 32px; height: 32px; fill: none; stroke: var(--c-gold); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.screen-answered.is-sending .tick-ring { -webkit-animation: pulse 1.6s ease-in-out infinite; animation: pulse 1.6s ease-in-out infinite; }
.status-title { margin: 26px 0 0; color: var(--c-text); font-size: 40px; line-height: 1.05; }
.screen-closed .status-title { margin-top: 28px; font-size: 44px; }
.status-text { margin: 14px 0 34px; color: var(--c-text-2); font-size: 16px; line-height: 1.5; }
.screen-closed .status-text { margin-bottom: 0; }
.status-main .ans { cursor: default; }
.choice-note { margin: 12px 0 0; color: var(--c-muted); font-size: 13px; line-height: 1.4; }
.hourglass { width: 54px; height: 72px; fill: none; stroke: var(--c-gold); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.hourglass .sand { fill: var(--c-gold); stroke: none; }

/* ------------------------------------------------------------ 7. wynik pytania */
.result-main { display: -webkit-box; display: flex; flex: 1 1 auto; flex-direction: column; justify-content: center; padding: 40px 32px; }
.result-loading { -webkit-align-self: center; align-self: center; }
.res-kicker { display: -webkit-box; display: flex; align-items: center; margin: 0; color: var(--c-gold); font-size: 14px; font-weight: 500; line-height: 1; }
.res-kicker svg { display: none; width: 20px; height: 20px; margin-right: 10px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.is-ok .res-ok, .is-bad .res-bad { display: block; }
.result-body.is-bad .res-kicker, .result-body.is-none .res-kicker { color: var(--c-muted); }
.res-big { margin: 14px 0 0; color: var(--c-text); font-size: 64px; line-height: .98; }
.is-ok .res-big { font-size: 104px; line-height: .9; }
.res-sub { margin: 14px 0 0; color: var(--c-text-2); font-size: 16px; line-height: 1.5; }
.is-ok .res-sub { margin-top: 8px; color: var(--c-gold); font: 400 18px/1.3 var(--font-display); }
.res-stats { display: -webkit-box; display: flex; margin-top: 48px; padding-top: 24px; border-top: 1px solid rgba(200, 164, 124, .35); }
.res-stat { flex: 1 1 0; min-width: 0; }
.res-stat + .res-stat { margin-left: 16px; }
.res-k { display: block; margin-bottom: 8px; color: var(--c-muted); font-size: 13px; font-weight: 500; line-height: 1; }
.res-v { display: block; color: var(--c-text); font: 400 32px/1 var(--font-display); }
.res-v small { font: 500 13px/1 var(--font-body); }

/* ------------------------------------------------------------ 8. koniec quizu */
.final-main { position: relative; display: -webkit-box; display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; padding: 58px 32px 32px; text-align: center; }
.final-emblem { display: block; width: 164px; height: 164px; margin-bottom: 26px; }
.final-title { margin: 10px 0 0; color: var(--c-text); font-size: 50px; line-height: 1; }
.final-orn { display: block; margin: 22px 0 30px; }
.final-k { margin: 0; color: var(--c-muted); font-size: 14px; font-weight: 500; line-height: 1; }
.final-rank { margin: 10px 0 0; color: var(--c-text); font: 400 88px/.9 var(--font-display); }
.final-rank small { color: var(--c-gold); font-size: 26px; }
.final-points { margin: 16px 0 0; color: var(--c-gold); font: 400 22px/1 var(--font-display); }
.final-note { color: var(--c-text-2); font-size: 15px; text-align: center; }

/* Niskie telefony (np. iPhone SE): mniejsze godło, żeby formularz zmieścił się bez przewijania. */
@media (max-height: 700px) {
  .join-head { padding-top: 34px; }
  .join-emblem { width: 140px; height: 140px; margin-bottom: 16px; }
  .title { font-size: 40px; }
  .final-main { padding-top: 40px; }
  .final-emblem { width: 120px; height: 120px; }
  .gate-emblem { width: 130px; height: 130px; margin-bottom: 16px; }
  .cnt-top { margin-top: 36px; }
  .ans { min-height: 64px; }
}
