/* Строгий тёмный стиль по мотивам BEZH: Helvetica, верхний регистр с разрядкой,
   тонкие линии и рамки, без скруглений. Палитра — графит, слоновая кость, немного золота и бордовый
   Chinoesh FX (осветлён относительно логотипа, чтобы читаться на тёмном фоне). */
@font-face {
  font-family: "Michroma"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/michroma-latin.woff2") format("woff2");   /* только латиница: для надписи бренда */
}
:root {
  color-scheme: dark;
  --bg: #111110;       /* фон */
  --panel: #191817;    /* карточки, лист призов */
  --ink: #ECE7DF;      /* заголовки, рамки кнопок */
  --text: #BDB6AC;     /* основной текст */
  --muted: #7C766E;    /* второстепенный текст */
  --line: #2E2C29;     /* тонкие линии */
  --accent: #B23A2E;   /* бордовый бренда: указатель, номера, акценты */
  --gold: #BDA16A;     /* приглушённое золото: небольшие детали */
  --gold-line: #665638; /* сдержанная окантовка */
}

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

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { overflow: hidden; }

/*
  Экран помещается целиком: прокрутка внутри Telegram читается как жест закрытия.
  Колесо занимает оставшуюся высоту и уступает место результату первым.
*/
.app {
  max-width: 480px; height: 100vh; height: 100dvh; margin: 0 auto;
  display: flex; flex-direction: column; align-items: stretch;
  padding: max(clamp(14px, 2.6dvh, 28px), env(safe-area-inset-top)) 22px
           calc(clamp(12px, 2.2dvh, 24px) + env(safe-area-inset-bottom, 0px));
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand {
  color: var(--ink); font-size: 13px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .24em;
}
.lockup { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.mark { width: 34px; height: 34px; flex: none; }
.wordmark {
  font-family: "Michroma", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink); font-size: 13px; letter-spacing: .12em; white-space: nowrap;   /* регистр как в логотипе: «Chinoesh FX» */
}
.title {
  margin: 0 0 6px; color: var(--ink); font-size: 15px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .24em;
}
.balance {
  display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap;
  border: 1px solid var(--line); padding: 8px 12px;
  color: var(--ink); font-size: 15px; font-weight: 500; letter-spacing: .06em;
}
.balance small {
  color: var(--muted); font-size: 10px; font-weight: 400;
  text-transform: uppercase; letter-spacing: .18em;
}
#balance { color: var(--gold); }

.rule { width: 44px; border-bottom: 1px solid var(--gold); margin: clamp(12px, 2.2dvh, 22px) 0 clamp(8px, 1.4dvh, 14px); }
.rule.wide { width: 100%; border-color: var(--line); }

.subtitle, .eyebrow {
  margin: 0; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .2em;
}

.wheel-area {
  flex: 1 1 0; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  margin: clamp(6px, 1.6dvh, 18px) 0;
}
canvas { display: block; width: 100%; height: 100%; object-fit: contain; touch-action: none; }

.result {
  border-top: 1px solid var(--line);
  padding: clamp(10px, 1.8dvh, 18px) 0 0; margin-bottom: clamp(10px, 1.8dvh, 18px);
  text-align: center;
  animation: rise .4s ease both;
}
.result h2 {
  margin: 8px 0 clamp(10px, 1.6dvh, 14px); color: var(--ink);
  font-size: 18px; font-weight: 500; line-height: 1.35;
  text-transform: uppercase; letter-spacing: .12em; overflow-wrap: anywhere;
}
.code {
  appearance: none; cursor: pointer; border-radius: 0;
  border: 1px solid var(--gold-line); background: var(--panel); color: var(--gold);
  padding: 11px 24px; font: 500 17px/1 "SF Mono", Menlo, Consolas, monospace; letter-spacing: .18em;
}
.code:active { background: var(--gold); color: var(--bg); }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.action { text-align: center; }
.btn {
  appearance: none; cursor: pointer; width: 100%; border-radius: 0;
  background: transparent; border: 1px solid var(--ink); color: var(--ink);
  font-family: inherit; font-size: 13px; font-weight: 500; line-height: 1.4;
  text-transform: uppercase; letter-spacing: .24em;
  padding: clamp(13px, 2dvh, 17px) 16px; touch-action: manipulation;
  transition: background .15s ease, color .15s ease, opacity .2s ease;
}
.btn:active { background: var(--ink); color: var(--bg); }
.btn:disabled { opacity: .35; cursor: default; background: transparent; color: var(--ink); }
.btn.long { letter-spacing: .1em; }

#status { margin: 10px 0 0; min-height: 2.9em; color: var(--muted); font-size: 12px; line-height: 1.45; }

.link {
  appearance: none; background: none; border: 0; cursor: pointer; padding: 6px 0;
  color: var(--text); font: inherit; font-size: 11px;
  text-transform: uppercase; letter-spacing: .2em;
  border-bottom: 1px solid var(--line);
}
.link:active { color: var(--ink); border-color: var(--accent); }
footer { text-align: center; margin-top: clamp(4px, 1dvh, 10px); }

button:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

/* Список призов — отдельный лист поверх экрана; прокручивается только он. */
.sheet {
  position: fixed; inset: 0; z-index: 10; overflow-y: auto;
  background: var(--bg);
  padding: max(24px, env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom, 0px));
  animation: fade .2s ease both;
}
.sheet > * { max-width: 436px; margin-left: auto; margin-right: auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet .rule.wide { margin: 18px auto 4px; }
.close {
  appearance: none; cursor: pointer; border-radius: 0;
  width: 38px; height: 38px; background: transparent;
  border: 1px solid var(--line); color: var(--ink); font-size: 14px;
}
ol { list-style: none; counter-reset: p; padding: 0; margin-top: 0; }
li {
  counter-increment: p; display: flex; gap: 16px; align-items: baseline;
  padding: 15px 0; border-bottom: 1px solid var(--line);
  color: var(--ink); font-size: 14px; line-height: 1.4;
  text-transform: uppercase; letter-spacing: .08em; overflow-wrap: anywhere;
}
li::before { content: counter(p, decimal-leading-zero); color: var(--gold); font-size: 11px; letter-spacing: .1em; }
.note { color: var(--muted); font-size: 12px; line-height: 1.5; }

[hidden] { display: none !important; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Низкие экраны: подзаголовок дублируется в боте, место отдаём колесу. */
@media (max-height: 640px) {
  .subtitle { display: none; }
  .title { margin-bottom: 0; }
  .app.has-result .hint { display: none; }
}
@media (max-width: 350px) {
  .app { padding-left: 16px; padding-right: 16px; }
  .brand { letter-spacing: .16em; }
  .wordmark { font-size: 11px; letter-spacing: .08em; }
  .mark { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
