/* Сторінка учасника (телефон) */
html,
body {
  min-height: 100%;
  overscroll-behavior: none;
}
#app {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
#view {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Верхня панель ── */
#topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.me {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 8px 12px;
  cursor: pointer;
  text-align: left;
}
.me-role {
  font-size: 20px;
}
.me-name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
}
.me-score b {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--cyan);
}
.me-score small {
  font-size: 11px;
  color: var(--muted);
}
.conn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  flex: none;
}
.conn.ok {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

/* ── Загальні блоки ── */
.card {
  background: rgba(18, 26, 54, 0.92);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 18px;
  margin-top: 14px;
}
.h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  margin: 8px 0 6px;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}
.lead {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}
.big-btn {
  width: 100%;
  font-size: 18px;
  padding: 16px;
  border-radius: 16px;
  margin-top: 12px;
}
.center {
  text-align: center;
}
.stack > * + * {
  margin-top: 10px;
}

/* ── Реєстрація ── */
.reg {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px 0;
}
.reg-logo {
  font-size: 64px;
  text-align: center;
}
.reg .h1 {
  text-align: center;
  font-size: 30px;
}
.reg .lead {
  text-align: center;
}
.role-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.role-pick button {
  padding: 16px 10px;
  border-radius: 16px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
}
.role-pick button span {
  display: block;
  font-size: 32px;
  margin-bottom: 4px;
}
.role-pick button.sel {
  border-color: var(--cyan);
  background: rgba(56, 249, 215, 0.12);
}
.role-pick button.sel.teacher {
  border-color: var(--amber);
  background: rgba(255, 181, 71, 0.12);
}
.err {
  color: var(--red);
  font-weight: 700;
  min-height: 22px;
  margin-top: 8px;
  font-size: 14px;
}

/* ── Очікування ── */
.wait {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 40px 0;
}
.wait-eyes {
  font-size: 80px;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  50% {
    transform: translateY(-10px);
  }
}
.tip {
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(56, 249, 215, 0.08);
  border: 1px dashed rgba(56, 249, 215, 0.4);
  font-size: 15px;
  text-align: left;
}

/* ── Цезар ── */
.cipher {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 10px 0;
}
.cipher .w {
  display: flex;
  gap: 4px;
}
.cipher span {
  width: 30px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--bg-2);
  border: 1px solid var(--pink);
  color: var(--pink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
}
.abc {
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 6px;
}
.abc table {
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 14px;
}
.abc td {
  border: 1px solid var(--line);
  padding: 4px 6px;
  text-align: center;
}
.abc tr:first-child td {
  color: var(--pink);
}
.abc tr:last-child td {
  color: var(--cyan);
}
.solved {
  font-size: 20px;
  font-weight: 800;
  color: var(--green);
  text-align: center;
  padding: 14px;
}

/* ── Хеш ── */
.hash-out {
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
  color: var(--cyan);
  margin-top: 6px;
}
.hash-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-2);
  margin-top: 8px;
}
.hash-item b {
  font-size: 16px;
}
.hash-item .salt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--amber);
}

/* ── Опитування ── */
.opt {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px;
  margin-top: 10px;
  border-radius: 16px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  font-weight: 700;
  font-size: 17px;
  overflow: hidden;
  cursor: pointer;
}
.opt .bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(56, 249, 215, 0.14);
  transition: width 0.6s;
}
.opt .lbl {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.opt.sel {
  border-color: var(--cyan);
}
.opt .pct {
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ── Квіз ── */
.qz-q {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.25;
  margin: 10px 0;
}
.qz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.qz-btn {
  min-height: 120px;
  border: none;
  border-radius: 18px;
  padding: 12px;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.3s;
}
.qz-btn .shape {
  font-size: 34px;
}
.qz-btn:active {
  transform: scale(0.96);
}
.qz-btn.o0 {
  background: #e5384f;
}
.qz-btn.o1 {
  background: #1e7fe0;
}
.qz-btn.o2 {
  background: #d99a0b;
}
.qz-btn.o3 {
  background: #1f9e5b;
}
.qz-btn.dim {
  opacity: 0.3;
}
.qz-btn.mine {
  outline: 4px solid #fff;
}
.qz-timer {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.qz-timer i {
  display: block;
  height: 100%;
  background: var(--cyan);
}
.result {
  text-align: center;
  padding: 26px 10px;
}
.result .emo {
  font-size: 70px;
}
.result .pts {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--cyan);
}
.result.bad .pts {
  color: var(--red);
}

/* ── Епідемія (у стилі месенджера) ── */
.ep-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(62, 224, 143, 0.12);
  border: 1px solid rgba(62, 224, 143, 0.5);
  margin-top: 10px;
  font-weight: 800;
}
.ep-status.sick {
  background: rgba(255, 77, 109, 0.18);
  border-color: var(--red);
  animation: pulse-red 1.2s ease-in-out infinite;
}
@keyframes pulse-red {
  50% {
    box-shadow: 0 0 24px rgba(255, 77, 109, 0.6);
  }
}
.ep-timer {
  font-family: var(--font-mono);
  font-size: 18px;
}
.chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 20% 10%, rgba(42, 171, 238, 0.08), transparent 40%),
    #0f1730;
  min-height: 300px;
}
.msg {
  max-width: 92%;
  align-self: flex-start;
  padding: 10px 12px;
  border-radius: 18px 18px 18px 6px;
  background: #1e2a4d;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.msg .from {
  font-weight: 800;
  font-size: 14px;
  color: #6ec3ff;
}
.msg .from.friend {
  color: #ffb547;
}
.msg .txt {
  font-size: 15px;
  line-height: 1.4;
  margin: 4px 0 6px;
}
.msg .link {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #8fd3ff;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(42, 171, 238, 0.12);
  word-break: break-all;
  margin-bottom: 8px;
}
.msg .acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.msg .acts button {
  border: none;
  border-radius: 10px;
  padding: 10px 8px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  color: #fff;
}
.msg .acts .a-open {
  background: #2aabee;
  grid-column: 1 / -1;
}
.msg .acts .a-flag {
  background: rgba(255, 77, 109, 0.25);
  color: #ffc0cc;
}
.msg .acts .a-skip {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}
.msg .outcome {
  font-weight: 800;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 10px;
  margin-top: 6px;
}
.outcome.good {
  background: rgba(62, 224, 143, 0.15);
  color: var(--green);
}
.outcome.bad {
  background: rgba(255, 77, 109, 0.18);
  color: #ff9db0;
}
.outcome.neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.msg .explain {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.cure {
  border-color: var(--red);
  background: rgba(255, 77, 109, 0.1);
}
.cure .opt {
  font-size: 15px;
  padding: 12px 14px;
}
.empty-chat {
  text-align: center;
  color: var(--muted);
  padding: 40px 10px;
}
.typing {
  align-self: flex-start;
  color: var(--muted);
  font-size: 13px;
}

/* ── Сейф ── */
.teams-prog .tp {
  margin-top: 10px;
}
.tp-head {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 14px;
}
.tp-bar {
  height: 14px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-top: 4px;
}
.tp-bar i {
  display: block;
  height: 100%;
  border-radius: 7px;
  transition: width 0.5s;
}
.task-q {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.3;
}
.task-q.mono {
  font-family: var(--font-mono);
}
.lock-over {
  text-align: center;
  padding: 30px 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--red);
}

/* ── Профіль (модалка) ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: end center;
}
.modal .sheet {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border-radius: 24px 24px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-strong);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  max-width: 90vw;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  font-weight: 700;
  box-shadow: var(--shadow);
}
.shake {
  animation: shake 0.4s;
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}
