/* Ученик: телефон, солнце в окно, палец. Карточка каталога — с полем слева и отверстием под стержень. */
html,
body {
  min-height: 100%;
}
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input {
  -webkit-user-select: text;
  user-select: text;
}
img {
  -webkit-user-drag: none;
  pointer-events: none;
}
/* Печать — пусто. */
@media print {
  html,
  body {
    display: none !important;
  }
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  min-height: 100dvh;
}
.screen {
  min-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 24px 22px 40px 30px;
  box-shadow: 0 1px 0 var(--rule), 0 10px 24px -18px rgb(20 22 27 / 0.45);
}
/* поле каталожной карточки: одна вертикальная линия штемпельной краской */
.card::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--stamp);
  opacity: 0.85;
}
.hole {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--field);
  box-shadow: inset 0 1px 2px rgb(20 22 27 / 0.35);
}
.kicker {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 10px;
}
.card h1 {
  font-size: clamp(32px, 9vw, 44px);
  letter-spacing: -0.01em;
}
.lead {
  font-size: 18px;
  margin-top: 12px;
}
.muted {
  color: var(--ink-2);
}
.error {
  color: var(--danger);
  font-weight: 600;
  margin-top: 12px;
}

/* Вход */
.join form {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}
.join-session {
  margin-top: 14px;
  font-family: var(--display);
  font-size: 22px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 8px 0;
}
.field {
  display: grid;
  gap: 6px;
}
.field span {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.field input {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  font-size: 20px;
}
.code-input {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 24px !important;
}
.btn.big {
  min-height: 58px;
  font-size: 19px;
  width: 100%;
}

/* Ожидание: циферблат с медленной стрелкой */
.wait {
  text-align: left;
}
.dial {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 14px 0 22px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background:
    conic-gradient(from -1deg, var(--ink) 0 2deg, transparent 2deg 30deg, var(--ink) 30deg 32deg, transparent 32deg 60deg, var(--ink) 60deg 62deg, transparent 62deg 90deg, var(--ink) 90deg 92deg, transparent 92deg 120deg, var(--ink) 120deg 122deg, transparent 122deg 150deg, var(--ink) 150deg 152deg, transparent 152deg 180deg, var(--ink) 180deg 182deg, transparent 182deg 210deg, var(--ink) 210deg 212deg, transparent 212deg 240deg, var(--ink) 240deg 242deg, transparent 242deg 270deg, var(--ink) 270deg 272deg, transparent 272deg 300deg, var(--ink) 300deg 302deg, transparent 302deg 330deg, var(--ink) 330deg 332deg, transparent 332deg);
}
.dial::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--card);
}
.hand {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 14px;
  width: 3px;
  height: 42px;
  margin-left: -1.5px;
  background: var(--stamp);
  transform-origin: 50% 42px;
  animation: sweep 12s linear infinite;
  border-radius: 2px;
}
.dial .hand::after {
  content: '';
  position: absolute;
  left: -3.5px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
}
@keyframes sweep {
  to {
    transform: rotate(360deg);
  }
}
.count {
  margin-top: 18px;
  font-size: 18px;
}
.count .mono {
  font-size: 22px;
}

/* Отсчёт */
.countdown {
  text-align: center;
}
.digit {
  font-family: var(--display);
  font-weight: 700;
  font-size: min(58vw, 300px);
  line-height: 1;
  color: var(--ink);
}
.digit.tick {
  animation: press 0.5s ease-out;
}
@keyframes press {
  from {
    transform: scale(1.12);
    opacity: 0.2;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* Вопрос */
.q-screen {
  justify-content: flex-start;
  padding-top: 10px;
}
.q-top {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0 -16px;
  padding: 8px 16px 0;
  background: var(--field);
  box-shadow: 0 6px 8px -8px rgb(20 22 27 / 0.35);
}
.timer {
  height: 10px;
  background: var(--card);
  border: 1px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
}
.timer span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--stamp);
  transform-origin: left center;
}
.timer.low span {
  background: var(--danger);
}
.q-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 10px 2px 10px;
  font-size: 15px;
  color: var(--ink-2);
}
.q-left {
  font-size: 26px;
  color: var(--ink);
}
.q-left.low {
  color: var(--danger);
}
.q-card {
  padding-bottom: 36px;
  overflow: hidden;
}
.q-meta {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 10px;
}
.q-text {
  font-size: clamp(22px, 6.2vw, 30px);
  font-weight: 400;
  line-height: 1.22;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.q-img {
  display: block;
  max-width: 100%;
  max-height: 38vh;
  margin-top: 14px;
  border: 1px solid var(--rule);
}
.q-hint {
  margin: 14px 2px 8px;
  font-size: 15px;
  color: var(--ink-2);
  min-height: 1em;
}
.options {
  display: grid;
  gap: 10px;
}
.opt {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 14px 10px 10px;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  font-size: 19px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.opt .letter {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 18px;
}
.opt.multi .letter {
  border-radius: 3px;
}
.opt[aria-pressed='true'],
.opt[aria-checked='true'] {
  background: var(--stamp-soft);
  border-color: var(--stamp);
}
.opt[aria-pressed='true'] .letter,
.opt[aria-checked='true'] .letter {
  background: var(--stamp);
  border-color: var(--stamp);
  color: var(--card);
}
.opt:active {
  transform: translateY(1px);
}
.opt:disabled {
  cursor: default;
}
.options.locked .opt:not([aria-pressed='true']):not([aria-checked='true']) {
  opacity: 0.45;
}
.text-answer {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.text-answer #submit {
  width: auto;
  flex: none;
  margin-top: 0;
  padding: 0 16px;
  font-size: 17px;
}
.text-answer input {
  flex: 1;
  min-width: 0;
  width: 100%;
  min-height: 60px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: var(--r);
  background: var(--card);
  font-size: 20px;
}
#submit {
  margin-top: 14px;
}

/* Штамп «Принято» — главный знак «ответ дошёл» */
.received {
  position: fixed;
  z-index: 5;
  left: 0;
  right: 0;
  top: 44%;
  width: max-content;
  max-width: calc(100% - 48px);
  margin: 0 auto;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 6px 14px 4px;
  border: 3px solid var(--stamp);
  border-radius: 6px;
  color: var(--stamp);
  transform: rotate(-7deg);
  font-family: var(--display);
  font-weight: 700;
  font-size: 34px;
  line-height: 1;
  background: rgb(255 255 255 / 0.94);
  box-shadow: 0 10px 30px -10px rgb(20 22 27 / 0.5);
}
.received small {
  font-size: 12px;
  margin-top: 3px;
}
.received.on {
  display: flex;
  animation: stampin 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.received.late {
  color: var(--ink-2);
  border-color: var(--ink-2);
}
@keyframes stampin {
  from {
    transform: rotate(-7deg) scale(1.6);
    opacity: 0;
  }
  to {
    transform: rotate(-7deg) scale(1);
    opacity: 1;
  }
}

/* Конец */
.done {
  overflow: hidden;
}
.done .kicker {
  padding-right: 104px;
}
.score {
  margin-top: 24px;
  border-top: 1px solid var(--rule);
  padding-top: 16px;
}
.score-num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 64px;
  line-height: 1;
}
.score-num .of {
  font-size: 30px;
  font-weight: 400;
}
.seal {
  position: absolute;
  right: 18px;
  top: 22px;
  padding: 6px 12px;
  border: 3px solid var(--stamp);
  border-radius: 6px;
  color: var(--stamp);
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  transform: rotate(8deg);
}

.net {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  top: 0;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--card);
  text-align: center;
  font-weight: 600;
}
#s-msg .btn {
  margin-top: 22px;
}

@media (prefers-reduced-motion: reduce) {
  .hand {
    animation: none;
    transform: rotate(40deg);
  }
}
