:root {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --text: #111111;
  --muted: #6f6f76;
  --line: #e3e3e8;
  --accent: #e51616;
  --accent-dark: #b90f13;
  --accent-2: #ff7a1a;
  --info: #171717;
  --danger: #e5163d;
  --success: #16a15d;
  --energy: #f2c94c;
  --disabled: #dadde3;
  --shadow: 0 18px 46px rgba(17, 17, 17, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: Manrope, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(229, 22, 22, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(17, 17, 17, 0.05), transparent 360px),
    var(--bg);
  overflow-x: hidden;
}

.vk-miniapp body {
  background: var(--bg);
}

.vk-miniapp-body .app-shell {
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-right: calc(12px + env(safe-area-inset-right));
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  padding-left: calc(12px + env(safe-area-inset-left));
}

.vk-scheme-dark {
  --bg: #111214;
  --surface: #1b1d21;
  --surface-2: #23262b;
  --text: #f4f5f7;
  --muted: #aeb4bf;
  --line: #343842;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
}

.vk-scheme-dark body,
.vk-scheme-dark .ticket-grid .tile,
.vk-scheme-dark .question-tile,
.vk-scheme-dark .answer-button,
.vk-scheme-dark .secondary-button,
.vk-scheme-dark .modal-dialog {
  color: var(--text);
  background: var(--surface);
}

.legal-page {
  width: min(760px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.legal-page h1 {
  margin-bottom: 18px;
  font-size: 34px;
}

.legal-page p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.55;
}

button {
  font: inherit;
}

.app-shell {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  margin-bottom: 4px;
  padding: 12px 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.9)),
    repeating-linear-gradient(
      135deg,
      rgba(17, 17, 17, 0.025) 0,
      rgba(17, 17, 17, 0.025) 1px,
      transparent 1px,
      transparent 18px
    );
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(17, 17, 17, 0.1);
  backdrop-filter: blur(16px);
}

.landing-mode .topbar {
  display: none;
}

.landing-mode .app-shell {
  padding-top: 20px;
}

.topbar-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.topbar-brand > div {
  min-width: 0;
}

.brand-mark {
  width: 96px;
  height: 44px;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.05;
  letter-spacing: 0;
  font-weight: 900;
}

h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: 0;
  font-weight: 900;
}

h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

p {
  margin: 0;
}

.screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
  gap: 18px;
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.icon-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.tile:hover,
.answer-button:hover {
  transform: translateY(-1px);
}

.icon-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible,
.tile:focus-visible,
.answer-button:focus-visible {
  outline: 3px solid rgba(0, 167, 142, 0.26);
  outline-offset: 2px;
}

.icon-button {
  width: 44px;
  color: var(--accent-dark);
  background: var(--surface);
  border-color: var(--line);
  font-size: 24px;
  box-shadow: 0 8px 22px rgba(18, 28, 45, 0.08);
}

.primary-button,
.secondary-button,
.danger-button {
  padding: 0 18px;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 12px 26px rgba(229, 22, 22, 0.24);
}

.primary-button:hover {
  background: linear-gradient(135deg, #f12020, #a80e12);
}

.secondary-button {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.secondary-button:hover {
  border-color: rgba(0, 167, 142, 0.5);
  box-shadow: 0 8px 20px rgba(18, 28, 45, 0.08);
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.compact-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.timer-panel {
  position: relative;
  min-width: auto;
  padding: 10px 16px 10px 43px;
  color: var(--accent);
  text-align: left;
  background: linear-gradient(145deg, #ffffff, #fff7f7);
  border: 1px solid rgba(229, 22, 22, 0.13);
  border-radius: 18px;
  box-shadow:
    0 14px 28px rgba(229, 22, 22, 0.1),
    0 8px 20px rgba(17, 17, 17, 0.07);
}

.timer-panel::before {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 18px;
  height: 18px;
  content: "";
  border: 2px solid currentColor;
  border-radius: 50%;
  transform: translateY(-50%);
}

.timer-panel::after {
  position: absolute;
  left: 24px;
  top: 50%;
  width: 7px;
  height: 2px;
  content: "";
  background: currentColor;
  border-radius: 999px;
  transform: translateY(-50%) rotate(-45deg);
  transform-origin: left center;
}

.timer-panel span {
  display: none;
}

.timer-panel strong {
  display: block;
  margin-top: 0;
  color: currentColor;
  font-size: 26px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.timer-panel.warning strong {
  color: var(--danger);
}

.exam-hero {
  position: relative;
  display: grid;
  min-height: 330px;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 24px;
  overflow: hidden;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.9)),
    repeating-linear-gradient(
      135deg,
      rgba(17, 17, 17, 0.04) 0,
      rgba(17, 17, 17, 0.04) 2px,
      transparent 2px,
      transparent 26px
    );
  border: 1px solid rgba(227, 227, 232, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.exam-hero::before {
  position: absolute;
  right: -170px;
  bottom: -150px;
  width: 520px;
  height: 300px;
  content: "";
  background: var(--accent);
  clip-path: polygon(0 42%, 72% 42%, 72% 16%, 100% 50%, 72% 84%, 72% 58%, 0 58%);
  opacity: 0.95;
  transform: rotate(-10deg);
}

.exam-hero::after {
  display: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 14px;
}

.hero-logo {
  width: 126px;
  height: 72px;
  object-fit: contain;
}

.hero-kicker {
  color: var(--accent);
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
}

.hero-copy h2 {
  max-width: 650px;
  font-size: 54px;
  line-height: 0.98;
  text-transform: uppercase;
}

.hero-text {
  max-width: 560px;
  color: #36363d;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 6px;
}

.hero-button {
  flex: 1 1 190px;
  min-width: 190px;
}

.hero-note {
  display: inline-flex;
  flex: 1 1 140px;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: #111;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 900;
}

.hero-stage {
  position: relative;
  z-index: 1;
  min-height: 270px;
  overflow: hidden;
  background-image:
    url("assets/brand/stopwatch-card.jpg"),
    url("assets/brand/u-sign-card.jpg");
  background-repeat: no-repeat;
  background-position:
    left 38px top 42px,
    right 34px top 12px;
  background-size:
    130px auto,
    108px auto;
}

.hero-asset {
  display: none;
  position: absolute;
  z-index: 1;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.hero-cones {
  right: 18px;
  bottom: 12px;
  width: 300px;
  filter: drop-shadow(0 22px 22px rgba(17, 17, 17, 0.12));
}

.hero-sign {
  top: 12px;
  right: 34px;
  width: 108px;
  transform: rotate(8deg);
  filter: drop-shadow(0 18px 18px rgba(229, 22, 22, 0.12));
}

.hero-stopwatch {
  top: 42px;
  left: 38px;
  width: 130px;
  opacity: 0.96;
  transform: rotate(-8deg);
  filter: drop-shadow(0 18px 24px rgba(17, 17, 17, 0.14));
}

.stats-panel {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 12px;
  padding: 4px 0 2px;
}

.stats-heading,
.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.stats-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.section-header {
  align-items: center;
  padding-top: 4px;
}

.section-header p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  min-width: 0;
  min-height: 88px;
  padding: 13px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 252, 0.96));
  border: 1px solid var(--line);
  border-top: 4px solid var(--info);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(18, 28, 45, 0.08);
}

.stat-card.success {
  border-top-color: var(--success);
}

.stat-card.danger {
  border-top-color: var(--danger);
}

.stat-card.accent {
  border-top-color: var(--accent-2);
}

.stat-card span,
.result-metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat-card strong,
.result-metrics strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 30px;
  line-height: 1;
}

.history-list {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
}

.history-list.is-open {
  display: flex;
}

.history-list[hidden] {
  display: none !important;
}

.history-item {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--danger);
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(18, 28, 45, 0.06);
}

.history-item.passed {
  border-left-color: var(--success);
}

.history-item strong {
  font-size: 14px;
}

.history-item span {
  color: var(--muted);
  font-size: 13px;
}

.ticket-grid,
.question-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ticket-grid {
  gap: 14px;
}

.tile {
  position: relative;
  min-height: 86px;
  overflow: hidden;
  padding: 13px;
  color: var(--text);
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.98));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(18, 28, 45, 0.08);
  cursor: pointer;
}

.tile::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--info));
}

.tile:hover {
  border-color: var(--accent);
  box-shadow: 0 14px 28px rgba(229, 22, 22, 0.14), 0 10px 24px rgba(17, 17, 17, 0.08);
}

.tile strong {
  display: block;
  font-size: 17px;
  line-height: 1.15;
}

.tile span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ticket-grid .tile {
  display: grid;
  min-height: 0;
  aspect-ratio: 1 / 1;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background: #ffffff;
  border: 2px solid rgba(229, 22, 22, 0.86);
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.08);
}

.ticket-grid .tile::before {
  height: 6px;
  background: var(--accent);
}

.ticket-grid .tile:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 26px rgba(17, 17, 17, 0.1);
}

.ticket-grid .tile .ticket-number {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: clamp(58px, 45%, 82px);
  aspect-ratio: 1 / 1;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 50%;
  font-size: clamp(26px, 3.8vw, 38px);
  font-weight: 900;
  line-height: 1;
  box-shadow: none;
}

.question-tile {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 146px;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 2px solid rgba(229, 22, 22, 0.86);
  box-shadow: 0 16px 34px rgba(229, 22, 22, 0.08), 0 10px 24px rgba(17, 17, 17, 0.08);
}

.question-tile::before {
  height: 6px;
  background: var(--accent);
}

.question-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 18px 36px rgba(229, 22, 22, 0.18), 0 12px 26px rgba(17, 17, 17, 0.1);
}

.question-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 540 / 202;
  object-fit: contain;
  background:
    linear-gradient(110deg, transparent 0 36%, rgba(255, 255, 255, 0.85) 45%, transparent 56%),
    repeating-linear-gradient(
      135deg,
      #edf2f7 0,
      #edf2f7 8px,
      #f7fafc 8px,
      #f7fafc 16px
  );
  background-size: 220% 100%, auto;
  border-radius: 12px;
}

.question-tile .no-image {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 540 / 202;
  color: var(--muted);
  background:
    repeating-linear-gradient(
      135deg,
      #edf2f7 0,
      #edf2f7 8px,
      #f7fafc 8px,
      #f7fafc 16px
    );
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
}

.question-tile.answered {
  color: #667085;
  background: #eef0f3;
  border-color: #d5d9e1;
  box-shadow: none;
  cursor: default;
}

.question-tile.answered::after {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #fff;
  content: "✓";
  background: var(--success);
  border-radius: 50%;
  font-weight: 900;
}

.question-tile.answered img,
.question-tile.answered .no-image {
  filter: grayscale(1);
  opacity: 0.58;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 5px 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid rgba(229, 22, 22, 0.22);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(229, 22, 22, 0.07), 0 6px 16px rgba(18, 28, 45, 0.04);
}

.question-view,
.result-view,
.empty-state {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid rgba(229, 22, 22, 0.16);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.result-view {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.question-image {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: min(48vh, 480px);
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.question-image-placeholder {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-weight: 800;
}

.answer-list {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.answer-button {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 12px;
  color: var(--text);
  text-align: left;
  overflow-wrap: anywhere;
  white-space: normal;
  background: #fff;
  border: 1px solid rgba(229, 22, 22, 0.18);
  border-radius: 16px;
  cursor: pointer;
}

.answer-button.selected {
  background: #fff5f5;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(229, 22, 22, 0.12);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 24, 40, 0.58);
}

.modal[hidden] {
  display: none;
}

.modal-dialog {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.modal-message {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
}

.modal-message[hidden] {
  display: none;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-status {
  padding: 18px;
  color: #fff;
  background: linear-gradient(135deg, #128a55, var(--success));
  border-radius: 18px;
}

.result-status.failed {
  background: linear-gradient(135deg, #b42337, var(--danger));
}

.result-status span {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 4px 8px;
  color: #101828;
  background: #fff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

.result-status h2 {
  font-size: 32px;
}

.result-status p {
  margin-top: 8px;
  font-weight: 700;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 8px 0 2px;
}

.result-metrics div {
  min-width: 0;
  padding: 4px 0 8px;
  border-bottom: 3px solid var(--line);
}

.result-metrics div:nth-child(2) {
  border-bottom-color: var(--success);
}

.result-metrics div:nth-child(3) {
  border-bottom-color: var(--danger);
}

.review-list {
  display: grid;
  gap: 12px;
}

.review-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--danger);
  border-radius: 18px;
}

.review-card strong {
  color: var(--danger);
}

.review-image {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.review-image-placeholder {
  display: grid;
  min-height: 130px;
  place-items: center;
  color: var(--muted);
  background:
    repeating-linear-gradient(
      135deg,
      #edf2f7 0,
      #edf2f7 8px,
      #f7fafc 8px,
      #f7fafc 16px
    );
  border-radius: 14px;
  font-weight: 800;
}

.lead-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid rgba(229, 22, 22, 0.18);
  border-radius: 18px;
  box-shadow: none;
}

.lead-modal {
  z-index: 30;
}

.lead-modal-dialog {
  position: relative;
  width: min(430px, 100%);
}

.lead-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--accent-dark);
  background: #fff5f5;
  border: 1px solid rgba(229, 22, 22, 0.18);
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.lead-card-heading {
  display: grid;
  gap: 6px;
  padding-right: 36px;
}

.lead-card-heading span {
  width: fit-content;
  padding: 4px 8px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.lead-card-heading h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 24px;
}

.lead-card-heading p,
.lead-submit-note,
.lead-field small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.lead-form {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.lead-field {
  display: grid;
  min-width: 0;
  gap: 7px;
  font-weight: 800;
}

.lead-field input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
}

.lead-field input:focus {
  outline: 3px solid rgba(22, 161, 93, 0.18);
  border-color: rgba(22, 161, 93, 0.55);
}

.lead-submit {
  width: 100%;
}

.lead-submit:disabled {
  cursor: default;
  opacity: 0.72;
  transform: none;
}

.lead-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.lead-status[data-tone="success"] {
  color: var(--success);
}

.lead-status[data-tone="warning"],
.lead-status[data-tone="loading"] {
  color: var(--accent-dark);
}

.lead-status[data-tone="error"] {
  color: var(--danger);
}

.vk-scheme-dark .lead-card {
  background: var(--surface);
}

.vk-scheme-dark .lead-field input {
  color: var(--text);
  background: var(--surface-2);
}

.vk-scheme-dark .lead-modal-close {
  color: #fff;
  background: rgba(229, 22, 22, 0.22);
}

@media (max-width: 760px) {
  .app-shell {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 12px;
  }

  .vk-miniapp-body .app-shell {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-right: calc(10px + env(safe-area-inset-right));
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    padding-left: calc(10px + env(safe-area-inset-left));
  }

  .screen > * {
    justify-self: start;
    width: 100%;
    max-width: calc(100vw - 24px);
    min-width: 0;
  }

  .vk-miniapp-body .screen > * {
    max-width: calc(100vw - 20px);
  }

  .topbar {
    top: 6px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    min-height: 58px;
    padding: 8px 10px;
    border-radius: 18px;
  }

  .topbar-brand {
    gap: 8px;
  }

  .eyebrow {
    font-size: 10px;
  }

  h1 {
    font-size: 28px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  h2 {
    font-size: 21px;
  }

  .brand-mark {
    width: 56px;
    height: 32px;
  }

  .timer-panel {
    grid-column: 2;
    justify-self: start;
    min-width: 68px;
    margin-top: -2px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    text-align: left;
  }

  .timer-panel::before {
    display: none;
  }

  .timer-panel::after {
    display: none;
  }

  .timer-panel strong {
    font-size: 19px;
    line-height: 1;
  }

  .exam-hero {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 18px;
    border-radius: 20px;
  }

  .exam-hero::before {
    right: -260px;
    bottom: -190px;
    width: 470px;
    height: 270px;
  }

  .exam-hero::after {
    right: -18px;
    bottom: 22px;
    width: 230px;
    height: 54px;
  }

  .hero-logo {
    width: 102px;
    height: 56px;
  }

  .hero-copy h2 {
    width: 100%;
    max-width: 330px;
    font-size: 33px;
  }

  .hero-text {
    max-width: 310px;
    font-size: 15px;
  }

  .hero-actions {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .hero-button,
  .hero-note {
    width: 100%;
    min-width: 0;
  }

  .hero-stage {
    width: 100%;
    max-width: 100%;
    min-height: 146px;
    background-position:
      left 4px top 34px,
      right 12px top 8px;
    background-size:
      84px auto,
      68px auto;
  }

  .hero-cones {
    right: 6px;
    bottom: 8px;
    width: 168px;
  }

  .hero-sign {
    top: 8px;
    right: 12px;
    width: 68px;
  }

  .hero-stopwatch {
    top: 34px;
    left: 4px;
    width: 84px;
  }

  .stats-heading,
  .section-header {
    align-items: flex-start;
  }

  .stats-actions {
    min-width: 0;
    justify-content: flex-start;
  }

  .stats-grid {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    min-height: 78px;
    padding: 11px;
  }

  .stat-card strong,
  .result-metrics strong {
    font-size: 25px;
  }

  .history-list.is-open {
    display: grid;
  }

  .ticket-grid,
  .question-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .tile {
    min-height: 70px;
    padding: 8px;
  }

  .tile strong {
    font-size: 13px;
  }

  .tile span {
    margin-top: 4px;
    font-size: 11px;
  }

  .question-tile {
    min-height: 122px;
    padding: 6px;
  }

  .ticket-grid .tile .ticket-number {
    width: clamp(40px, 52%, 58px);
    min-height: 0;
    padding: 0;
    font-size: clamp(18px, 6vw, 25px);
  }

  .question-tile.answered::after {
    width: 22px;
    height: 22px;
    font-size: 13px;
  }

  .question-view,
  .result-view,
  .empty-state {
    width: 100%;
    max-width: 100%;
    padding: 12px;
  }

  .question-view {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }

  .question-view h2,
  .question-image,
  .question-image-placeholder,
  .answer-list,
  .answer-button {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .result-view {
    padding: 0;
  }

  .result-status h2 {
    font-size: 28px;
  }

  .result-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lead-card-heading h3 {
    font-size: 21px;
  }

}

@media (max-width: 420px) {
  h1 {
    font-size: 24px;
  }

  .stats-heading {
    display: grid;
  }

  .stats-actions {
    width: 100%;
  }

  .section-header {
    display: grid;
  }

  .stat-card span,
  .result-metrics span {
    font-size: 12px;
  }

  .question-tile {
    min-height: 112px;
  }
}
