/* Кабинет стримера Скрайд, стиль Air W3: светлый фон, белые плитки парят над ним, тёмная металлическая карта.
   Токены и размеры из design/cabinet/README.md. */
:root {
  --bg: #f5f5f7;
  --tile: #ffffff;
  --label: #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #86868b;
  --sep: rgba(0, 0, 0, 0.08);
  --fill: rgba(11, 13, 20, 0.05);
  --track: #f0f0f3;
  --accent: #2a55ff;
  --btn: #0b0b0f;
  --on-btn: #ffffff;
  --success: #13803f;
  --success-soft: rgba(19, 128, 63, 0.12);
  --warning: #8f4e00;
  --warning-bar: #d98a1f;
  --warning-cell: rgba(217, 138, 31, 0.35);
  --warning-ink: #6a3d00;
  --live: #e0182d;
  --violet: #8b6bff;
  --shadow-tile: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.06);
  --shadow-tabbar: 0 1px 2px rgba(0, 0, 0, 0.04), 0 14px 36px rgba(0, 0, 0, 0.1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, 'SF Pro Display', 'SF Pro Text', Onest, system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --top: calc(
    var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px)
  );
  --bottom: calc(
    var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + var(--tg-content-safe-area-inset-bottom, 0px)
  );
  color-scheme: light;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
p,
h1,
h2 {
  margin: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid rgba(42, 85, 255, 0.5);
  outline-offset: 2px;
}

/* ---------- каркас ---------- */
.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
}
.screen {
  padding: calc(var(--top) + 28px) 16px calc(var(--bottom) + 110px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: enter 0.6s var(--ease) both;
}
.screen.no-tabs {
  padding-bottom: calc(var(--bottom) + 120px);
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 0 0 4px;
}
.title {
  font-size: 34px;
  line-height: 41px;
  font-weight: 700;
  letter-spacing: -0.8px;
}
.subtitle {
  font-size: 15px;
  color: var(--label-2);
  padding: 0 4px;
  margin-top: -4px;
}
.section {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 6px 0;
}
.section > b {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.section > span {
  font-size: 14px;
  color: var(--label-2);
}

/* ---------- плитки ---------- */
.tile {
  background: var(--tile);
  border-radius: 24px;
  box-shadow: var(--shadow-tile);
  padding: 16px 18px;
  min-width: 0;
}
.tile.r22 {
  border-radius: 22px;
}
.tile.r28 {
  border-radius: 28px;
}
.tile.list {
  padding: 2px 0;
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.small {
  font-size: 12px;
  color: var(--label-2);
}
.label {
  font-size: 13px;
  color: var(--label-2);
}
.big {
  font-size: 34px;
  line-height: 34px;
  font-weight: 700;
  letter-spacing: -1.4px;
  white-space: nowrap;
}
.mid {
  font-size: 26px;
  line-height: 26px;
  font-weight: 700;
  letter-spacing: -1.1px;
  white-space: nowrap;
}
.num24 {
  font-size: 24px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -1px;
  white-space: nowrap;
}
.blue {
  color: var(--accent);
}
.muted3 {
  color: var(--label-3);
}
.green {
  color: var(--success);
}
.amber {
  color: var(--warning);
}

/* ---------- кнопки и капсулы ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--btn);
  color: var(--on-btn);
  font-size: 16px;
  font-weight: 600;
  height: 48px;
  padding: 0 22px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform 0.2s var(--ease),
    opacity 0.3s;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}
.btn.ghost {
  background: var(--tile);
  color: var(--label);
  box-shadow: var(--shadow-tile);
}
.btn.wide {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--bottom) + 42px);
  height: 56px;
  font-size: 17px;
  letter-spacing: -0.2px;
  max-width: 398px;
  margin: 0 auto;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--tile);
  box-shadow: var(--shadow-tile);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: 0;
}
.chip.coin {
  padding-left: 9px;
}
.s-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  flex: none;
}
.pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--fill);
  font-size: 12px;
  font-weight: 500;
}
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  height: 50px;
  padding: 4px;
  background: var(--tile);
  border-radius: 999px;
  box-shadow: var(--shadow-tile);
}
.segmented button {
  border: 0;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--label);
  transition:
    background 0.35s var(--ease),
    color 0.35s;
}
.segmented button[aria-pressed='true'] {
  background: var(--btn);
  color: var(--on-btn);
}

/* ---------- строки списков ---------- */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  margin: 0 18px;
}
.row + .row {
  border-top: 0.5px solid var(--sep);
}
.row .grow {
  flex: 1;
  min-width: 0;
}
.row .t {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .s {
  font-size: 12px;
  color: var(--label-2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row .v {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}
.row.tap {
  cursor: pointer;
}
.bar {
  width: 6px;
  height: 34px;
  border-radius: 3px;
  flex: none;
  background: var(--accent);
}
.bar.short {
  background: var(--warning-bar);
}

/* ---------- прогресс ---------- */
.track {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: var(--track);
}
.track > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left;
  animation: grow 1.4s var(--ease) both;
}
.track.live > i {
  background: var(--live);
}
.track .mark {
  position: absolute;
  right: 0;
  top: -5px;
  width: 2px;
  height: 20px;
  border-radius: 1px;
  background: var(--label);
}
@keyframes grow {
  from {
    transform: scaleX(0);
  }
}
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--live);
  animation: livedot 1.6s ease-in-out infinite;
}
@keyframes livedot {
  50% {
    opacity: 0.35;
  }
}

/* ---------- карта Streamer ID ---------- */
.card3d {
  position: relative;
  height: 240px;
  margin: -8px -8px 0;
}
.card3d canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
}

/* ---------- календарь ---------- */
.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}
.cal .dow {
  text-align: center;
  font-size: 11px;
  color: var(--label-2);
}
.cal .d {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--track);
  color: var(--label-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border: 0;
  padding: 0;
}
.cal .d.counted {
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.cal .d.short {
  background: var(--warning-cell);
  color: var(--warning-ink);
  cursor: pointer;
}
.cal .d.future {
  background: transparent;
}
.cal .d.today {
  box-shadow: inset 0 0 0 2px var(--btn);
}
.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--label-2);
  margin-top: 12px;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* ---------- таб-бар ---------- */
.tabbar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--bottom) + 26px);
  max-width: 398px;
  margin: 0 auto;
  height: 58px;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow-tabbar);
  z-index: 10;
}
.tabbar a {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition:
    background 0.35s var(--ease),
    color 0.35s;
}
.tabbar a[aria-current='page'] {
  background: var(--btn);
  color: var(--on-btn);
  font-weight: 600;
}

/* ---------- «Скоро» ---------- */
.soon {
  position: relative;
  border-radius: 26px;
  overflow: hidden;
}
.soon > .blurred {
  filter: blur(9px);
  opacity: 0.75;
  pointer-events: none;
}
.soon > .over {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(245, 245, 247, 0.6);
  text-align: center;
  padding: 0 24px;
}
.soon .tag {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--btn);
  color: var(--on-btn);
  font-size: 15px;
  font-weight: 600;
}

/* ---------- состояния ---------- */
.center {
  min-height: 70vh;
  justify-content: center;
  text-align: center;
  align-items: center;
}
.error {
  color: #c4291c;
  font-size: 14px;
}
.skeleton {
  background: linear-gradient(90deg, #ececf0 0%, #f6f6f8 50%, #ececf0 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 24px;
}
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom) + 100px);
  transform: translateX(-50%);
  background: var(--btn);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 20;
  animation: enter 0.4s var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
@keyframes grow-y {
  from {
    transform: scaleY(0);
  }
}

/* ---------- онбординг: стили утверждённой версии 15, сцена на весь экран ---------- */
.ob {
  --ink: #1d1d1f;
  --muted: #86868b;
  --blue: #0071e3;
  --ob-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  position: relative;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  height: 100dvh;
  min-height: 640px;
  overflow: hidden;
  background: var(--bg);
}
.ob #gl {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--top) + 140px);
  height: 400px;
  width: 100%;
  display: block;
  touch-action: pan-y;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 42px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 42px);
}
.ob .copy {
  position: absolute;
  left: 28px;
  right: 28px;
  text-align: center;
}
.ob .top {
  top: calc(var(--top) + 68px);
}
.ob .t1 {
  font-size: 34px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.6px;
  margin: 0;
  min-height: 38px;
}
.ob .t2 {
  font-size: 17px;
  line-height: 1.45;
  color: var(--muted);
  margin: 8px 0 0;
  min-height: 25px;
}
.ob .fx {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 1s var(--ob-ease),
    transform 1s var(--ob-ease);
}
.ob .fx.in {
  opacity: 1;
  transform: none;
}
.ob .meter {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--top) + 550px);
  text-align: center;
}
.ob .meter .big {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.1;
}
.ob .meter .cap {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.2px;
}
.ob .meter .chips {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: #e8e8ed;
}
.ob .meter .chips span {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition:
    background 0.5s var(--ob-ease),
    color 0.5s;
}
.ob .meter .chips span.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.ob .status {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--top) + 120px);
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--muted);
}
.ob .actions {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: calc(var(--bottom) + 38px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ob .btn {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  width: 100%;
  height: 54px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  transition:
    transform 0.15s var(--ob-ease),
    opacity 0.3s;
}
.ob .btn:active {
  transform: scale(0.98);
}
.ob .btn.hold {
  position: relative;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.ob .btn.hold::before {
  content: '';
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  background: rgba(255, 255, 255, 0.16);
}
.ob .btn.hold span {
  position: relative;
}
.ob .btn[disabled] {
  opacity: 0.3;
  pointer-events: none;
}
.ob .btn[hidden],
.ob .link[hidden] {
  display: none;
}
.ob .link {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  color: var(--blue);
  font-size: 17px;
  cursor: pointer;
  padding: 10px;
}
.ob .field {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: calc(var(--bottom) + 116px);
}
.ob.with-link .field {
  bottom: calc(var(--bottom) + 166px);
}
.ob .field[hidden] {
  display: none;
}
.ob .field .step {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 4px 8px;
  letter-spacing: 0.2px;
}
.ob .field .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  border-radius: 12px;
  padding: 0 8px 0 16px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  font-size: 17px;
  margin: 0;
  min-height: 0;
}
.ob .field .row.code span {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 3px;
}
.ob .field .row .muted {
  color: var(--muted);
}
.ob .field .row .tag {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding-right: 8px;
  transition: color 0.4s;
}
.ob .field .row .tag.ok {
  color: #248a3d;
}
.ob .mini {
  appearance: none;
  border: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: #f0f0f3;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.3s;
}
.ob .mini:active {
  background: #e3e3e8;
}
.ob .field .rules {
  background: #fff;
  border-radius: 12px;
  padding: 2px 16px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.ob .field .rules p {
  margin: 0;
  padding: 11px 0;
  font-size: 15px;
  line-height: 1.3;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.ob .field .rules p:last-child {
  border-bottom: 0;
}
.ob .field .check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 4px 0;
  font-size: 15px;
  cursor: pointer;
}
.ob .field .check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--ink);
}
.ob .field input:not([type='checkbox']) {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  font: inherit;
  font-size: 17px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  outline: none;
}
.ob .field .note {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 4px 0;
  min-height: 18px;
}
.ob .field .note.ok::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34c759;
  margin-right: 8px;
  vertical-align: 1px;
}
.ob .dots {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--top) + 30px);
  display: flex;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.6s;
}
.ob .dots i {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: #d2d2d7;
  transition:
    width 0.5s var(--ob-ease),
    background 0.5s;
}
.ob .dots i.on {
  width: 18px;
  background: var(--ink);
}
.ob .flash {
  position: absolute;
  left: 50%;
  top: calc(var(--top) + 340px);
  width: 10px;
  height: 10px;
  margin: -5px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
  opacity: 0;
  pointer-events: none;
}
.ob .flash.go {
  animation: ob-flash 1.2s var(--ob-ease);
}
@keyframes ob-flash {
  0% {
    opacity: 0;
    transform: scale(1);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(90);
  }
}
.ob .ring {
  position: absolute;
  left: 50%;
  top: calc(var(--top) + 340px);
  width: 300px;
  height: 300px;
  margin: -150px;
  border-radius: 50%;
  border: 2px solid rgba(42, 85, 255, 0.5);
  opacity: 0;
  pointer-events: none;
}
.ob .ring.go {
  animation: ob-ring 1.4s var(--ob-ease);
}
@keyframes ob-ring {
  0% {
    opacity: 0.9;
    transform: scale(0.3);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}
@media (max-height: 740px) {
  .ob #gl {
    top: calc(var(--top) + 110px);
    height: 330px;
  }
  .ob .meter {
    top: calc(var(--top) + 450px);
  }
  .ob .flash,
  .ob .ring {
    top: calc(var(--top) + 275px);
  }
}

/* ---------- вход в кабинет: карта влетает, садится на место, интерфейс всплывает по очереди ---------- */
.no-scroll,
.no-scroll body {
  overflow: hidden;
}
.screen.intro {
  animation: none;
}
.screen.intro > :not(.card3d) {
  opacity: 0;
  transform: translateY(22px);
}
.screen.intro.reveal > :not(.card3d) {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.8s var(--ease) calc(var(--i, 0) * 70ms),
    transform 1s var(--ease) calc(var(--i, 0) * 70ms);
}
.card3d {
  position: relative;
  z-index: 2;
}
.card3d.gliding {
  transition: transform 1.1s cubic-bezier(0.65, 0, 0.35, 1);
}
.tabbar.intro {
  opacity: 0;
  transform: translateY(140%);
}
.tabbar.intro.reveal {
  opacity: 1;
  transform: none;
  transition:
    transform 1s var(--ease) 0.45s,
    opacity 0.6s ease 0.45s;
}
