/* cyrillic-ext */
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/WnznHAc5bAfYB2QRah7pcpNvOx-pjSx6eIipYSxP.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/WnznHAc5bAfYB2QRah7pcpNvOx-pjSx6eIGpYSxP.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin-ext */
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/WnznHAc5bAfYB2QRah7pcpNvOx-pjSx6eIupYSxP.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/WnznHAc5bAfYB2QRah7pcpNvOx-pjSx6eIWpYQ.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nErXyi0A.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nMrXyi0A.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nFrXyi0A.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* hebrew */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nDrXyi0A.woff2) format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
/* latin-ext */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nPrXyi0A.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nBrXw.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nErXyi0A.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nMrXyi0A.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nFrXyi0A.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* hebrew */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nDrXyi0A.woff2) format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
/* latin-ext */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nPrXyi0A.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nBrXw.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* arabic */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nErXyi0A.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* cyrillic-ext */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nMrXyi0A.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nFrXyi0A.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* hebrew */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nDrXyi0A.woff2) format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
/* latin-ext */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nPrXyi0A.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Rubik';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url(../fonts/iJWKBXyIfDnIV7nBrXw.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic */
@font-face {
  font-family: 'Rubik Mono One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/UqyJK8kPP3hjw6ANTdfRk9YSN98zTKUbcw.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin-ext */
@font-face {
  font-family: 'Rubik Mono One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/UqyJK8kPP3hjw6ANTdfRk9YSN985TKUbcw.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Rubik Mono One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/UqyJK8kPP3hjw6ANTdfRk9YSN983TKU.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Все размеры интерфейса — в em: они масштабируются вместе с игрой (переменная --s). */
:root {
  --ink: #1d1b15;
  --cream: #efe4c8;
  --paper: #f3ead3;
  --rust: #b8442a;
  --amber: #e0892f;
  --olive: #7b7a2d;
  --page: #24170e;
  --font-head: 'Rubik Mono One', 'Arial Black', sans-serif;
  --font-body: 'Rubik', system-ui, sans-serif;
  --font-sign: 'Caveat', 'Segoe Script', cursive;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--page);
  background-image: radial-gradient(circle at 50% 30%, #3b2616 0%, var(--page) 70%);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

#stage {
  --s: 1;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: calc(16px * var(--s));
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

#game { display: block; }

.hidden { display: none !important; }

/* ---------- Экраны ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  /* env(safe-area-*) — отступы под вырез/чёлку и полоску жестов на телефонах */
  padding: calc(3.2em + env(safe-area-inset-top)) 1.5em calc(2em + env(safe-area-inset-bottom));
  text-align: center;
}
.screen.active { display: flex; animation: fade-in 0.25s ease-out; }
.screen.passive { pointer-events: none; }
.spacer { flex: 1; }

@keyframes fade-in { from { opacity: 0; transform: translateY(0.6em); } to { opacity: 1; transform: none; } }

/* ---------- Лого ---------- */
.logo { margin-top: 2em; display: flex; flex-direction: column; align-items: center; }
.logo h1 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 400;
  font-size: 3.4em;
  line-height: 1;
  color: var(--cream);
  letter-spacing: 0.02em;
  text-shadow:
    0.06em 0.06em 0 var(--ink), -0.03em -0.03em 0 var(--ink), 0.03em -0.03em 0 var(--ink), -0.03em 0.03em 0 var(--ink),
    0.1em 0.12em 0 rgba(0, 0, 0, 0.35);
}
.logo-band {
  margin-top: 0.35em;
  background: var(--ink);
  color: var(--cream);
  font-family: Georgia, 'Cooper Black', serif;
  font-weight: 700;
  font-size: 1.6em;
  padding: 0.05em 0.5em 0.15em;
  border: 0.12em solid var(--cream);
  transform: rotate(-2deg);
}
.tagline {
  margin: 1.1em 0 0;
  color: var(--cream);
  font-weight: 700;
  font-size: 1.05em;
  text-shadow: 0.08em 0.08em 0 var(--ink);
}

/* ---------- Кнопки ---------- */
.buttons { display: flex; flex-direction: column; gap: 0.8em; align-items: center; }
.buttons.row { flex-direction: row; justify-content: center; }

.btn {
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 1.15em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 9em;
  padding: 0.65em 1.2em;
  color: var(--ink);
  background: var(--cream);
  border: 0.16em solid var(--ink);
  border-radius: 0.5em;
  box-shadow: 0.22em 0.22em 0 var(--ink);
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s;
}
.btn.primary { background: var(--amber); }
.btn.small { font-size: 0.9em; min-width: 0; padding: 0.5em 0.9em; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translate(0.18em, 0.18em); box-shadow: 0.04em 0.04em 0 var(--ink); }
.btn:disabled { opacity: 0.6; cursor: default; }
.buttons.row .btn { min-width: 0; flex: 1; max-width: 10em; }

.link-btn {
  margin-top: 0.8em;
  background: none;
  border: none;
  color: var(--cream);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1em;
  text-decoration: underline;
  text-shadow: 0.08em 0.08em 0 var(--ink);
  cursor: pointer;
}

#hud {
  position: absolute;
  top: calc(0.8em + env(safe-area-inset-top));
  left: calc(0.8em + env(safe-area-inset-left));
  right: calc(0.8em + env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 5;
}
.icon-btn {
  pointer-events: auto;
  width: 2.6em;
  height: 2.6em;
  padding: 0.45em;
  background: rgba(239, 228, 200, 0.9);
  border: 0.14em solid var(--ink);
  border-radius: 0.5em;
  box-shadow: 0.14em 0.14em 0 var(--ink);
  cursor: pointer;
}
.icon-btn svg { width: 100%; height: 100%; fill: var(--ink); stroke: var(--ink); display: block; }
#btn-sound { margin-left: auto; }
#btn-sound .off { display: none; }
#btn-sound.off .on { display: none; }
#btn-sound.off .off { display: block; }

/* ---------- Приготовься ---------- */
.ready-title {
  margin: 2.4em 0 0;
  font-family: var(--font-head);
  font-weight: 400;
  font-size: 2em;
  color: var(--amber);
  text-shadow: 0.07em 0.07em 0 var(--ink), -0.035em -0.035em 0 var(--ink), 0.035em -0.035em 0 var(--ink), -0.035em 0.035em 0 var(--ink);
}
.ready-hint {
  margin-bottom: 6.5em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  color: var(--cream);
  font-weight: 700;
  text-shadow: 0.08em 0.08em 0 var(--ink);
}
.tap-icon { width: 3em; height: 3em; animation: tap 0.9s ease-in-out infinite; }
.tap-icon svg { width: 100%; height: 100%; fill: var(--cream); stroke: var(--ink); stroke-width: 2.5; }
@keyframes tap { 50% { transform: translateY(0.35em) scale(0.92); } }

#screen-pause { justify-content: center; background: rgba(29, 27, 21, 0.45); }
#screen-pause .ready-title { margin: 0 0 1.2em; }

/* ---------- Проигрыш ---------- */
#screen-over { padding-top: calc(2.2em + env(safe-area-inset-top)); background: linear-gradient(rgba(29, 27, 21, 0.35), rgba(29, 27, 21, 0)); }
.over-title {
  margin: 0 0 0.7em;
  white-space: pre-line;
  font-family: var(--font-head);
  font-weight: 400;
  font-size: 1.55em;
  line-height: 1.2;
  color: var(--cream);
  text-shadow: 0.07em 0.07em 0 var(--ink), -0.035em -0.035em 0 var(--ink), 0.035em -0.035em 0 var(--ink), -0.035em 0.035em 0 var(--ink);
  animation: drop 0.45s cubic-bezier(.2, 1.6, .5, 1);
}
@keyframes drop { from { transform: translateY(-1.5em) scale(0.9); opacity: 0; } }

.contract {
  width: 100%;
  max-width: 21em;
  padding: 1em 1.1em 0.9em;
  background: var(--paper);
  background-image: repeating-linear-gradient(transparent 0 1.45em, rgba(29, 27, 21, 0.06) 1.45em 1.5em);
  border: 0.16em solid var(--ink);
  border-radius: 0.4em;
  box-shadow: 0.3em 0.3em 0 var(--ink);
  transform: rotate(-1deg);
  animation: slide-up 0.4s ease-out;
  margin-bottom: 1.1em;
}
@keyframes slide-up { from { transform: translateY(4em) rotate(-1deg); opacity: 0; } }

.contract-row { display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.medal-box { display: flex; flex-direction: column; align-items: center; width: 6.5em; }
.medal {
  width: 4.2em;
  height: 4.2em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8 0 12%, transparent 30%), var(--medal, #ccc);
  border: 0.22em solid var(--medal-rim, #888);
  box-shadow: 0 0 0 0.14em var(--ink), 0.16em 0.2em 0 0.14em var(--ink);
  position: relative;
}
.medal span {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  border: 0.14em dashed var(--medal-rim, #888);
}
.medal.empty { background: rgba(29, 27, 21, 0.12); border-color: rgba(29, 27, 21, 0.25); box-shadow: none; }
.medal.empty span { display: none; }
.medal-name { margin-top: 0.4em; font-size: 0.72em; font-weight: 700; line-height: 1.15; min-height: 1.2em; }

.scores { text-align: right; }
.scores .label { font-size: 0.78em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #6b5a44; }
.scores .value { font-family: var(--font-head); font-size: 1.9em; line-height: 1.05; margin-bottom: 0.15em; }
.new-best {
  display: inline-block;
  background: var(--rust);
  color: var(--cream);
  padding: 0.05em 0.35em;
  border-radius: 0.25em;
  font-size: 0.9em;
  transform: rotate(-4deg);
}

#sign-form {
  margin-top: 0.8em;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5em;
  text-align: left;
}
#sign-btn { flex: 1 0 100%; }
.sign-label { font-weight: 700; padding-bottom: 0.45em; }
.sign-line { position: relative; flex: 1; border-bottom: 0.12em solid var(--ink); min-width: 0; }
#sign-name {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-sign);
  font-size: 1.7em;
  line-height: 1.2;
  padding: 0 0.1em;
  color: #1c2b6b;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
#sign-name::placeholder { color: rgba(29, 27, 21, 0.3); }
.signature {
  display: none;
  font-family: var(--font-sign);
  font-size: 1.9em;
  line-height: 1.1;
  color: #1c2b6b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: rotate(-3deg);
}
.stamp {
  display: none;
  position: absolute;
  right: -0.2em;
  top: -0.9em;
  padding: 0.1em 0.4em;
  border: 0.16em solid var(--rust);
  border-radius: 0.3em;
  color: var(--rust);
  font-family: var(--font-head);
  font-size: 0.75em;
  opacity: 0.85;
  transform: rotate(-12deg);
  pointer-events: none;
}
#sign-form.signed #sign-name,
#sign-form.signed #sign-btn { display: none; }
#sign-form.signed .signature { display: block; }
#sign-form.signed .stamp { display: block; animation: stamp 0.35s cubic-bezier(.3, 1.8, .6, 1); }
@keyframes stamp { from { transform: rotate(-12deg) scale(2.5); opacity: 0; } }

.status { margin-top: 0.55em; min-height: 1.2em; font-size: 0.8em; font-weight: 500; line-height: 1.3; }
.status.error { color: var(--rust); font-weight: 700; }

/* ---------- Рекорды ---------- */
#screen-leaders { justify-content: center; background: rgba(29, 27, 21, 0.45); }
.leaders {
  width: 100%;
  max-width: 22em;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 1.1em 1.2em 1.2em;
  background: var(--paper);
  border: 0.16em solid var(--ink);
  border-radius: 0.4em;
  box-shadow: 0.3em 0.3em 0 var(--ink);
}
.leaders h2 { margin: 0 0 0.6em; font-family: var(--font-head); font-weight: 400; font-size: 1.25em; }
#leaders-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  min-height: 3em;
  text-align: left;
}
#leaders-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  padding: 0.35em 0.3em;
  border-bottom: 0.08em dashed rgba(29, 27, 21, 0.3);
}
#leaders-list li:nth-child(1) .rank { background: #f0c24b; }
#leaders-list li:nth-child(2) .rank { background: #c9c9c4; }
#leaders-list li:nth-child(3) .rank { background: #c9803f; }
#leaders-list li.me { background: rgba(224, 137, 47, 0.25); }
#leaders-list .rank {
  flex: none;
  width: 1.8em;
  text-align: center;
  font-weight: 900;
  border: 0.1em solid var(--ink);
  border-radius: 50%;
  font-size: 0.85em;
  line-height: 1.7em;
}
#leaders-list .name { flex: 1; font-family: var(--font-sign); font-size: 1.45em; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#leaders-list .pts { font-family: var(--font-head); font-size: 1em; }
.leaders .btn { margin-top: 1em; align-self: center; }

/* ---------- Телефон, повёрнутый горизонтально ---------- */
#rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--page);
  color: var(--cream);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 18px;
  text-align: center;
  padding: 24px;
}
#rotate-hint svg { width: 64px; height: 64px; fill: none; stroke: var(--cream); stroke-width: 2.5; animation: rotate-phone 1.6s ease-in-out infinite; }
#rotate-hint svg rect { fill: var(--amber); stroke: var(--ink); }
@keyframes rotate-phone { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0deg); } }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #rotate-hint { display: flex; }
}
