/* cyeta.ru — «Суета» */

@font-face { font-family: 'Rubik Glitch'; src: url('/assets/fonts/rubik-glitch.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Rubik Mono One'; src: url('/assets/fonts/rubik-mono-one.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Onest'; src: url('/assets/fonts/onest.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #FFF4DE;
  --surface: #FFFFFF;
  --ink: #1E1A2B;
  --muted: #6B6478;
  --line: #EADFC6;
  --red: #FF4D2E;
  --red-dark: #D63A1E;
  --yellow: #FFC63D;
  --teal: #0FA3B1;
  --stage-bg: #FFE8B8;
  --shadow: 0 10px 30px rgba(30, 26, 43, .14);
  --head: 'Rubik Glitch', 'Onest', system-ui, sans-serif;
  --num: 'Rubik Mono One', 'Onest', system-ui, sans-serif; /* цифры — без глитча, чтобы читались */
  --body: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16122B;
    --surface: #221C3B;
    --ink: #F6F0E4;
    --muted: #A79FB8;
    --line: #35304F;
    --stage-bg: #2A2347;
    --shadow: 0 10px 30px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--teal); }
h1, h2, h3 { line-height: 1.15; margin: 1.6em 0 .5em; }
h1 { font-family: var(--head); font-weight: 400; font-size: clamp(28px, 6vw, 44px); letter-spacing: .01em; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 18px; font-weight: 800; }
p { margin: 0 0 1em; }
code { font-size: .9em; background: var(--surface); padding: .1em .4em; border-radius: 6px; }
.muted { color: var(--muted); }
.kicker { color: var(--red); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; margin-bottom: .3em; }

.devbar { background: var(--yellow); color: #1E1A2B; text-align: center; font-size: 13px; padding: 4px 12px; font-weight: 700; }

/* шапка */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
}
.logo { text-decoration: none; color: var(--red); display: inline-flex; align-items: center; gap: 8px; }
.logo__mark { width: 48px; height: 44px; display: block; transform-origin: 50% 85%; }
.logo:hover .logo__mark { animation: shake .5s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-9deg); } 40% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg); } 80% { transform: rotate(4deg); }
}
@media (prefers-reduced-motion: reduce) { .logo:hover .logo__mark { animation: none; } }
.foot__mark { width: 26px; height: 24px; vertical-align: -6px; }
.logo__word { font-family: var(--head); font-size: 28px; letter-spacing: .04em; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 700; margin-left: 18px; font-size: 15px; }
.nav a:hover { color: var(--red); }

.main { flex: 1; }

/* сцена: вертикальная 9:16, вписывается в экран целиком */
.stage-wrap {
  display: flex; justify-content: center;
  padding: 0 0 16px;
}
.stage {
  position: relative;
  width: min(100vw, calc((100dvh - 120px) * 9 / 16), 420px);
  aspect-ratio: 9 / 16;
  background: var(--stage-bg);
  border-radius: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
@media (min-width: 440px) { .stage { border-radius: 24px; } }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* экраны поверх canvas */
.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 8% 9%;
  background: var(--stage-bg);
}
.screen.is-on { display: flex; }
.screen__title { font-family: var(--head); font-weight: 400; font-size: 17vw; font-size: clamp(56px, 24cqw, 96px); line-height: .9; margin: 0 0 .25em; color: var(--red); }
.stage { container-type: inline-size; }
.screen__lead { font-size: 16px; color: var(--muted); max-width: 26ch; margin-bottom: 1.6em; }
.screen__hint { font-size: 13px; color: var(--muted); margin: .4em 0 1.2em; }
.screen__me { font-size: 13px; color: var(--muted); margin-top: 1.4em; min-height: 1.4em; }
.screen__me a, .screen__me button { color: var(--teal); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.screen__count { font-family: var(--num); font-size: clamp(90px, 40cqw, 180px); color: var(--red); margin: 0; line-height: 1; }
.screen__kicker { color: var(--red); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: 14px; margin: 0 0 .4em; }
.screen__score { font-family: var(--num); font-size: clamp(64px, 28cqw, 120px); line-height: 1; margin: 0; color: var(--ink); }
.screen__score small { display: block; font-family: var(--body); font-size: 15px; font-weight: 700; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-top: .3em; }
.screen__place { font-weight: 800; color: var(--teal); min-height: 1.4em; margin: 0 0 1em; }
.screen__actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 260px; }

/* кнопки */
.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none; text-align: center;
  font: 800 17px/1 var(--body); padding: 16px 26px; border-radius: 999px;
  background: var(--red); color: #fff; box-shadow: 0 6px 0 var(--red-dark);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--red-dark); }
.btn--big { font-size: 19px; padding: 18px 34px; width: 100%; max-width: 260px; }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn--ghost:active { box-shadow: inset 0 0 0 2px var(--ink); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

.form { width: 100%; max-width: 260px; display: flex; flex-direction: column; gap: 10px; }
.input {
  font: 600 17px var(--body); padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); width: 100%;
}
.input:focus { outline: 0; border-color: var(--teal); }
.form__err { color: var(--red); font-size: 13px; min-height: 1.4em; margin: 0; }

/* текст под игрой */
.text { max-width: 720px; margin: 0 auto; padding: 8px 16px 40px; }
.cols { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .cols { grid-template-columns: 1fr 1fr; } }
.crumbs { font-size: 14px; color: var(--muted); margin-top: 16px; }
.crumbs a { color: var(--muted); }
.more { font-weight: 800; }

.top { list-style: none; margin: 0; padding: 0; }
.top__row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.top__row.is-1 .top__n { background: var(--yellow); color: #1E1A2B; }
.top__row.is-2 .top__n { background: #D9DEE3; color: #1E1A2B; }
.top__row.is-3 .top__n { background: #E2A277; color: #1E1A2B; }
.top__n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--line); flex: none; }
.top__name { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top__city { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; text-decoration: none; }
.top__score { font-family: var(--num); font-size: 20px; color: var(--red); }

.cities { list-style: none; padding: 0; margin: 0; }
.cities li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.cities a { font-weight: 800; }

.result { text-align: center; padding-top: 32px; }
.result__score { font-family: var(--num); font-size: clamp(72px, 18vw, 140px); line-height: 1; margin: 0; }
.result__score small { display: block; font-family: var(--body); font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.result__verdict { font-weight: 800; color: var(--teal); font-size: 20px; }

/* подвал */
.foot { border-top: 1px solid var(--line); padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); font-size: 14px; color: var(--muted); }
.foot__in { max-width: 720px; margin: 0 auto; }
.foot__brand { font-family: var(--head); color: var(--red); font-size: 18px; }
.foot__nav { margin: 8px 0; }
.foot__nav a { color: var(--muted); margin-right: 14px; }
.foot__note { margin: 0; font-size: 13px; }

/* тост */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 700;
  opacity: 0; transition: .25s; pointer-events: none; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: translateX(-50%); }
