/* Mobile-first, themed by Telegram's CSS vars with a dark fallback so the
   page also looks right in a plain browser during dev. */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: var(--tg-theme-bg-color, #0f0f13);
  --fg: var(--tg-theme-text-color, #eeeeee);
  --hint: var(--tg-theme-hint-color, #9a9aa5);
  --card: var(--tg-theme-secondary-bg-color, #1b1b22);
  --accent: var(--tg-theme-button-color, #7c5cff);
  --accent-fg: var(--tg-theme-button-text-color, #ffffff);
  --ok: #2ea04a;
  --bad: #d64545;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, system-ui, Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.4;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  max-width: 520px;
  margin: 0 auto;
}

.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }

h1 { font-size: 22px; font-weight: 700; }
.hint { color: var(--hint); font-size: 15px; }
.big-icon { font-size: 56px; line-height: 1; }

.progress { color: var(--hint); font-size: 14px; text-align: center; margin-bottom: 8px; }
.bar { height: 4px; background: var(--card); border-radius: 2px; overflow: hidden; margin-bottom: 20px; }
.bar > div { height: 100%; background: var(--accent); transition: width .25s ease; }

button {
  border: 0; border-radius: 14px; width: 100%;
  min-height: 54px; padding: 14px 18px;
  font-size: 17px; font-weight: 600; cursor: pointer;
  color: var(--fg); background: var(--card);
}
button:active { transform: scale(.98); }
button.primary { background: var(--accent); color: var(--accent-fg); }
button.ok { background: var(--ok); color: #fff; min-height: 64px; font-size: 19px; }
button.bad { background: var(--bad); color: #fff; min-height: 64px; font-size: 19px; }
button.ghost { background: transparent; color: var(--hint); }
.btn-col { display: flex; flex-direction: column; gap: 12px; margin-top: auto; padding-top: 20px; }

.q-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 16px; padding: 12px 0;
}
.q-card .label { font-size: 24px; font-weight: 700; }

input[type=text] {
  width: 100%; min-height: 54px; padding: 14px 16px;
  border: 1px solid var(--card); border-radius: 14px;
  background: var(--card); color: var(--fg); font-size: 18px;
  outline: none;
}
input[type=text]:focus { border-color: var(--accent); }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin: 14px 0; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--card); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; min-height: 26px;
  border-radius: 13px; background: rgba(0,0,0,.65); color: #fff;
  font-size: 15px; line-height: 26px; text-align: center; padding: 0;
}

.review-list { width: 100%; display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.review-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 12px; padding: 12px 14px; font-size: 16px;
}
.review-row .mark { font-size: 18px; }
.review-row .n { margin-left: auto; color: var(--hint); font-size: 14px; white-space: nowrap; }

.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--card); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.err { color: var(--bad); }
