* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #121614;
  color: #f3f0e7;
  font-family: "Segoe UI", "Liberation Sans", "Helvetica Neue", sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
}

#face {
  margin: calc(10px + env(safe-area-inset-top)) 16px 0;
  min-height: 44px;
  border: 1px solid #3c4a40;
  border-radius: 14px;
  background: transparent;
  color: #d6ff4a;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
}

#face:disabled {
  color: #a8b1a4;
  border-color: transparent;
}

#face[hidden] { display: none !important; }

#camera {
  position: fixed;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

#stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px 8px;
}

#label {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a8b1a4;
}

#count {
  margin: 0;
  font-size: clamp(120px, 34vw, 240px);
  font-weight: 760;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

#count.bump {
  animation: bump 140ms ease-out;
}

@keyframes bump {
  from { transform: scale(0.94); }
  to { transform: scale(1); }
}

#dock {
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
}

#finish {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 76px;
  border: 0;
  border-radius: 18px;
  background: #24302a;
  color: #f3f0e7;
  font: inherit;
  font-size: 20px;
  font-weight: 750;
}

#finish-fill {
  position: absolute;
  inset: 0;
  background: #d6ff4a;
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

#finish-label {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

#hold-hint {
  margin: 10px 0 0;
  text-align: center;
  color: #a8b1a4;
  font-size: 15px;
}

#result, #gate {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
  background: #121614;
}

#gate {
  z-index: 20;
  justify-content: center;
  text-align: center;
  font-size: 28px;
  line-height: 1.35;
}

html.in-telegram #gate { display: none; }

#result[hidden], #result-wait[hidden], #result-count[hidden], #result-label[hidden], #result-meta[hidden], #next[hidden] {
  display: none !important;
}

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

#result-title {
  margin: 0;
  font-size: 34px;
  font-weight: 750;
}

#result-count {
  margin: 8px 0 0;
  font-size: clamp(96px, 28vw, 180px);
  font-weight: 760;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

#result-label, #result-meta, #result-wait {
  margin: 0;
  font-size: 22px;
  color: #a8b1a4;
}

#next {
  width: 100%;
  min-height: 76px;
  border: 0;
  border-radius: 18px;
  background: #d6ff4a;
  color: #121614;
  font: inherit;
  font-size: 20px;
  font-weight: 750;
}

#next:disabled {
  opacity: 0.4;
}
