/* «Кто крайний?» — стиль «кафель». Общие токены и компоненты приложения и лендинга. */
:root {
  --ink: #0F2327;
  --muted: #4A5F63;
  --soft: #6B7E82;
  --line: #E3EAEB;
  --line2: #D7E2E4;
  --teal: #0A5C58;
  --teal-dark: #073F3C;
  --teal-tint: #D3EAE7;
  --orange: #F2711C;
  --orange-tint: #FDE3D1;
  --orange-soft: #F9B98C;
  --red: #B4231A;
  --brown: #8A3B0B;
  --white: #FFFFFF;
  --bg: #E6EEEF;
  --font: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: Unbounded, Manrope, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.tile {
  background-color: var(--bg);
  background-image: linear-gradient(var(--line2) 1px, transparent 1px), linear-gradient(90deg, var(--line2) 1px, transparent 1px);
  background-size: 26px 26px;
}
.display { font-family: var(--display); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- приложение: «телефон» в центре экрана */
.app { min-height: 100vh; min-height: 100dvh; display: flex; justify-content: center; }
.phone { width: 100%; max-width: 480px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; }
.topbar h1 { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 700; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--teal); color: var(--white); display: flex; align-items: center; justify-content: center; flex: 0 0 40px; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; background: var(--white); border: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; flex: 0 0 44px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: 0 0 36px; background: var(--orange-tint); }
.avatar.lg { width: 44px; height: 44px; flex-basis: 44px; font-size: 16px; background: var(--white); }
.main { flex: 1; padding: 4px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.modes-row { display: flex; gap: 8px; padding: 0 16px 8px; }
.modes-row a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 12px; font-size: 13px; font-weight: 800; text-decoration: none; }
.modes-row .king { background: var(--ink); color: var(--white); }
.modes-row .guest { background: var(--white); color: var(--ink); }

.card { background: var(--white); border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.flush { padding-bottom: 6px; gap: 0; }
.card h2, .h2 { margin: 0; font-family: var(--display); font-size: 17px; font-weight: 700; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.label { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; }
.section-label { margin: 2px 0 0; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: 700; }
.note { font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.45; margin: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 800; font-size: 15px; }
.row .sub { font-size: 12px; color: var(--muted); font-weight: 700; }
.row .num { width: 18px; font-weight: 800; color: var(--muted); }
.row.me { background: var(--teal-tint); border-radius: 12px; padding-left: 8px; padding-right: 8px; margin: 0 -8px; }
.empty { margin: 0; padding: 12px 0 10px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 700; color: var(--muted); }

.status { border-radius: 26px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.status.busy { background: var(--orange); color: var(--ink); }
.status.free { background: var(--teal); color: var(--white); }
.status.dark { background: var(--ink); color: var(--white); }
.status.turn { background: var(--teal); color: var(--white); }
.status .big { margin: 0; font-family: var(--display); font-size: 40px; line-height: 1; font-weight: 700; }
.status .timer { font-family: var(--display); font-size: 60px; line-height: 1; font-weight: 700; }
.status p { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.45; }
.status-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pill { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 4px 10px; display: inline-block; }
.pill.ink { background: var(--ink); color: var(--white); }
.pill.white { background: var(--white); color: var(--teal); }
.pill.teal { background: var(--teal-tint); color: var(--ink); }
.pill.orange { background: var(--orange-tint); color: var(--ink); }
.pill.hot { background: var(--orange); color: var(--ink); }
.pill.red { background: var(--red); color: var(--white); }
.bar { height: 10px; border-radius: 999px; background: rgba(15, 35, 39, 0.18); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: 999px; width: 0; transition: width .4s; }
.bar-caption { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; margin-top: 6px; gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 16px; border-radius: 14px; border: 0; font-weight: 800; font-size: 15px; text-decoration: none; text-align: center; }
.btn.lg { min-height: 58px; border-radius: 16px; font-size: 17px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--teal); color: var(--white); }
.btn.primary:hover { background: var(--teal-dark); color: var(--white); }
.btn.dark { background: var(--ink); color: var(--white); }
.btn.dark:hover { color: var(--white); }
.btn.light { background: var(--white); color: var(--ink); }
.btn.light.teal { color: var(--teal); }
.btn.outline { background: var(--white); color: var(--teal); border: 2px solid var(--teal); }
.btn.ghost { background: var(--white); color: var(--ink); border: 2px solid var(--line2); }
.btn.danger { background: var(--white); color: var(--red); border: 2px solid var(--red); }
.btn.clear { background: transparent; color: inherit; border: 2px solid currentColor; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > * { flex: 1 1 140px; }

.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 18px; border: 2px solid var(--white); background: var(--white); color: var(--ink); }
.choice[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-tint); }
.choice .chip { min-width: 58px; height: 44px; border-radius: 12px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; padding: 0 6px; }
.choice[aria-pressed="true"] .chip { background: var(--teal); color: var(--white); }
.choice .t { font-weight: 800; font-size: 16px; display: block; }
.choice .s { font-weight: 600; font-size: 13px; color: var(--muted); display: block; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tilebtn { min-height: 64px; border-radius: 16px; border: 2px solid var(--white); background: var(--white); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; }
.tilebtn[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-tint); }
.tilebtn b { font-size: 16px; }
.tilebtn span { font-size: 12px; font-weight: 700; }
.level { align-items: flex-start; text-align: left; min-height: 96px; padding: 12px; }
.level[aria-pressed="true"].ok { background: var(--teal); border-color: var(--teal); color: var(--white); }
.level[aria-pressed="true"].urgent { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.level[aria-pressed="true"].sos { background: var(--red); border-color: var(--red); color: var(--white); }
.bars { display: flex; gap: 3px; align-items: flex-end; height: 18px; }
.bars i { width: 6px; border-radius: 2px; background: currentColor; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chipbtn { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line2); background: var(--white); color: var(--ink); font-weight: 800; font-size: 14px; }
.chipbtn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.seg { display: flex; background: var(--white); border-radius: 16px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 44px; border-radius: 12px; border: 0; background: var(--white); color: var(--ink); font-weight: 800; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.check { display: flex; align-items: center; gap: 12px; min-height: 52px; cursor: pointer; }
.check + .check { border-top: 1px solid var(--line); }
.check input { width: 22px; height: 22px; accent-color: var(--teal); margin: 0; flex: 0 0 22px; }
.check .t { font-weight: 800; font-size: 15px; display: block; }
.check .s { font-weight: 600; font-size: 13px; color: var(--muted); display: block; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 800; color: var(--muted); }
.input { min-height: 48px; border: 2px solid var(--line2); border-radius: 12px; padding: 0 12px; font-size: 16px; font-weight: 700; background: var(--white); width: 100%; }
textarea.input { padding: 10px 12px; min-height: 80px; resize: vertical; }
.input.code { font-size: 18px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.counter { display: flex; align-items: center; gap: 12px; }
.counter .val { min-width: 28px; text-align: center; font-family: var(--display); font-size: 20px; font-weight: 700; }
.counter button { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line2); background: var(--white); font-size: 20px; font-weight: 800; }

.bubble { border-radius: 4px 14px 14px 14px; padding: 8px 12px; font-size: 14px; font-weight: 700; align-self: flex-start; background: #F1F5F5; max-width: 85%; }
.bubble.mine { border-radius: 14px 4px 14px 14px; align-self: flex-end; background: var(--ink); color: var(--white); }
.bubble.reply { background: var(--teal-tint); color: var(--teal); border-radius: 14px 4px 14px 14px; align-self: flex-end; }
.bubble .who { font-size: 11px; font-weight: 800; letter-spacing: .06em; opacity: .8; display: block; }

.banner { border-radius: 16px; padding: 12px 14px; font-size: 14px; font-weight: 800; display: flex; flex-direction: column; gap: 10px; }
.banner.hot { background: var(--orange); }
.banner.info { background: var(--white); }
.banner.red { background: var(--red); color: var(--white); }

.days { display: flex; gap: 5px; }
.days button { flex: 1; min-width: 0; min-height: 60px; border-radius: 14px; border: 0; background: var(--white); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; }
.days button[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.days b { font-size: 18px; }
.days small { font-size: 11px; font-weight: 800; }
.days em { font-size: 9px; font-weight: 800; font-style: normal; }
.slot { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-top: 1px solid #EEF3F3; }
.slot time { width: 44px; font-weight: 800; font-size: 14px; flex: 0 0 44px; }
.slot .free { flex: 1; min-height: 44px; border-radius: 12px; border: 2px dashed var(--teal); background: var(--white); color: var(--teal); font-weight: 800; font-size: 14px; text-align: left; padding: 0 12px; }
.slot .mine { flex: 1; min-height: 44px; border-radius: 12px; border: 0; background: var(--teal); color: var(--white); font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; }
.slot .taken { flex: 1; min-height: 44px; border-radius: 12px; background: var(--orange-tint); display: flex; align-items: center; gap: 10px; padding: 0 10px; font-weight: 800; font-size: 14px; }
.slot .past { flex: 1; min-height: 32px; display: flex; align-items: center; font-size: 13px; font-weight: 700; color: var(--soft); }
.slot.is-past time { color: var(--soft); }
.nowline { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.nowline span { font-size: 11px; font-weight: 800; background: var(--orange); border-radius: 999px; padding: 3px 8px; }
.nowline i { flex: 1; height: 2px; background: var(--orange); }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles > div { background: var(--white); border-radius: 16px; padding: 12px 10px; }
.tiles > div.hot { background: var(--orange); }
.tiles .v { font-size: 17px; font-weight: 800; margin-top: 4px; }
.tiles .k { font-size: 11px; font-weight: 800; letter-spacing: .04em; color: var(--muted); }
.tiles .hot .k { color: var(--ink); }
.timeline { position: relative; height: 44px; border-radius: 10px; background: var(--teal-tint); overflow: hidden; }
.timeline .future { position: absolute; top: 0; bottom: 0; right: 0; background: #EEF3F4; }
.timeline .seg-busy { position: absolute; top: 6px; bottom: 6px; background: var(--orange); border-radius: 3px; min-width: 4px; }
.timeline .nowmark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.hours { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; font-weight: 700; color: var(--muted); align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: -2px; margin-right: 6px; }
.heat { display: flex; flex-direction: column; gap: 4px; }
.heat .hr { display: flex; gap: 4px; align-items: center; }
.heat .hr > span:first-child { width: 22px; font-size: 11px; font-weight: 800; color: var(--muted); }
.heat .cell { flex: 1; height: 24px; border-radius: 5px; }
.heat .hd span { flex: 1; font-size: 10px; font-weight: 800; color: var(--muted); }
.lv0 { background: #EEF3F4; } .lv1 { background: var(--teal-tint); } .lv2 { background: var(--orange-soft); } .lv3 { background: var(--orange); }
.champ-bar { height: 8px; border-radius: 999px; background: #EEF3F4; margin-left: 22px; }
.champ-bar i { display: block; height: 100%; border-radius: 999px; background: var(--teal); }

.tabbar { position: sticky; bottom: 0; display: flex; background: var(--white); border-top: 1px solid var(--line2); padding: 4px 6px calc(10px + env(safe-area-inset-bottom)); z-index: 5; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--teal); font-weight: 800; }

.invite-card { border-radius: 24px; padding: 22px; background: var(--white); display: flex; flex-direction: column; gap: 12px; border: 3px dashed var(--orange); }
.invite-card .kicker { font-size: 12px; font-weight: 800; letter-spacing: .08em; color: var(--brown); }
.invite-card h1, .invite-card h2 { margin: 0; font-family: var(--display); font-size: 26px; line-height: 1.15; font-weight: 700; }
.invite-card .when { font-size: 18px; font-weight: 800; }
.invite-card .note { font-size: 15px; color: var(--ink); font-weight: 600; font-style: italic; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: 440px; width: calc(100% - 32px); background: var(--ink); color: var(--white); border-radius: 16px; padding: 14px 16px; font-weight: 700; font-size: 15px; z-index: 50; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.toast.err { background: var(--red); }
.modal-back { position: fixed; inset: 0; background: rgba(15, 35, 39, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 60; padding: 16px; }
.modal { background: var(--white); border-radius: 24px; padding: 20px; width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 12px; margin-bottom: env(safe-area-inset-bottom); }
.modal h2 { margin: 0; font-family: var(--display); font-size: 20px; }
.modal p { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.45; }
.loading { padding: 40px 16px; text-align: center; font-weight: 800; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .bar > i { transition: none; } }
