/* Inter — локально (Google Fonts не нужен: минус два соединения на старте) */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/fonts/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/fonts/inter-latin.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;
}

:root {
  --bg: #1A1818;
  --lane: 15px;
  --col-min: 118px;
  --panel: #1f1f1f;
  --panel-2: #282828;
  --line: #2e2e2e;
  --line-soft: #262626;
  --line-strong: #3d3d3d;
  --ink: #ffffff;
  --ink-90: #ececec;
  --dim: #b0b0b0;
  --dim-2: #8a8a8a;
  --dim-3: #6f6f6f;
  --accent: #7260F4;
  --accent-hover: #8674ff;
  --accent-soft: #B589F4;
  --font: 'Inter', -apple-system, 'system-ui', system-ui, Roboto, 'Segoe UI', 'Helvetica Neue', sans-serif;
  --r: 16px;
  --r-sm: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
button, a, .bar, .cell, .idea, .evtile { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-90);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent-soft); text-decoration: none; }
a:hover { color: #cdc7ff; }

button { font-family: inherit; }

.page { min-height: 100vh; padding: 28px clamp(18px, 4vw, 56px) 72px; }
.container { max-width: 1400px; margin: 0 auto; }

/* ---------- noise overlay: dark #161919 @ 35%, static grain ---------- */
.noise {
  position: fixed; inset: 0; z-index: 999; pointer-events: none; opacity: 0.35;
  overflow: hidden; will-change: transform; transform: translateZ(0);
}
.noise::after {
  content: ''; position: absolute; inset: 0;
  background-color: #161919;
  -webkit-mask-image: url('/noise.svg?v=2');
  mask-image: url('/noise.svg?v=2');
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
}

/* ---------- header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding-bottom: 40px; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; }
.brand-logo { display: block; height: 84px; width: auto; aspect-ratio: 276 / 256; border-radius: 16px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.city { font-size: 14px; color: var(--dim-2); margin-right: 4px; }

.btn-new {
  display: inline-flex; align-items: center; gap: 10px;
  height: 54px; padding: 0 20px;
  background: #48A25A; border: none; color: #fff;
  font-size: 18px; font-weight: 500; letter-spacing: -0.01em;
  border-radius: 9px; cursor: pointer;
  transition: background 0.3s cubic-bezier(0.2, 0, 0.3, 1);
}
@media (hover: hover) { .btn-new:hover { background: #55b268; } }

/* cu.ru letter-roll hover animation */
.roll { display: inline-flex; overflow: hidden; }
.roll .l {
  display: inline-flex; flex-direction: column; height: 1.35em; line-height: 1.35em;
  transition: transform 0.8s cubic-bezier(0.625, 0.05, 0, 1);
  transition-delay: calc(var(--i) * 18ms);
}
.roll .l > span { display: block; height: 1.35em; }
@media (hover: hover) { .cu-roll-host:hover .roll .l { transform: translateY(-1.35em); } }
.btn-icon { flex: none; display: block; }

.avatar-you {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--panel); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--ink); cursor: pointer;
  transition: border-color 140ms ease;
}
.avatar-you:hover { border-color: var(--accent); }
.btn-login {
  display: inline-flex; align-items: center; gap: 10px;
  height: 54px; padding: 0 20px 0 15px;
  background: #3d3d3d; border: none; cursor: pointer;
  border-radius: 9px; font-size: 18px; font-weight: 500; color: var(--ink);
  transition: background 0.3s cubic-bezier(0.2, 0, 0.3, 1);
}
.btn-login:hover { background: #4a4a4a; }

/* ---------- layout ---------- */
.layout { display: flex; flex-wrap: wrap; gap: 56px; align-items: flex-start; }
.main { flex: 1 1 882px; min-width: 0; }

.intro { max-width: 720px; padding-bottom: 36px; }
.intro-title { margin: 0; font-size: clamp(34px, 4.5vw, 52px); font-weight: 700; line-height: 1.06; letter-spacing: -0.03em; color: var(--ink); text-wrap: balance; }
.intro-title em { font-style: normal; color: var(--accent); }
.intro-sub { margin: 0; padding-top: 16px; font-size: 16px; line-height: 1.6; color: var(--dim); text-wrap: pretty; }
.only-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .only-touch { display: inline; } .only-mouse { display: none; } }

.week-head { display: flex; align-items: flex-end; justify-content: space-between; padding-bottom: 12px; }
.week-head-label { font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim-2); }
.week-head-range { font-size: 12px; color: var(--dim-2); }

.grid-scroll { overflow-x: auto; overflow-y: visible; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.grid-inner { min-width: 882px; }
.gutter { position: sticky; left: 0; z-index: 6; background: var(--bg); }

/* ---------- timeline ---------- */
.timeline-row { display: flex; }
.gutter { width: 56px; flex: none; }
.timeline-row .gutter { z-index: 6; }
.timeline { flex: 1; min-width: 826px; position: relative; height: 26px; }
.timeline-base { position: absolute; left: 0; right: 0; top: 12px; height: 1px; background: var(--line-strong); }
.timeline-ticks { position: absolute; inset: 0; display: flex; }
.timeline-tick { flex: 1; display: flex; justify-content: center; align-items: center; }
.timeline-tick > div { width: 1px; height: 7px; background: var(--line-strong); }
.now-fill { position: absolute; left: 0; top: 12px; height: 1px; background: var(--accent); }
.now-dot { position: absolute; top: 9px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--accent); }

/* ---------- grid ---------- */
.grid-row { display: flex; user-select: none; -webkit-user-select: none; }
.hour-head-spacer { height: 76px; }
.hour-label { height: 36px; display: flex; align-items: center; justify-content: flex-end; padding-right: 12px; font-size: 14px; color: var(--dim-3); }

.grid { flex: 1; min-width: 826px; position: relative; display: flex; border-left: 1px solid var(--line); }
.day-col { flex: 1; min-width: var(--col-min); border-right: 1px solid var(--line); scroll-snap-align: start; }
.day-head { height: 76px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 0 0 14px 12px; }
.day-wd { font-size: 13px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim-2); }
.day-numrow { display: flex; align-items: baseline; gap: 6px; }
.day-num { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; color: var(--ink); }
.day-num.today { color: var(--accent-soft); }
.day-mon { font-size: 11px; color: var(--dim-3); }
.day-today-tag { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-soft); }

.day-body { position: relative; border-top: 1px solid var(--line); }
.cell { position: relative; height: 36px; border-bottom: 1px solid var(--line-soft); cursor: crosshair; }
@media (hover: hover) { .cell:hover { background: rgba(255, 255, 255, 0.04); } }
.cell-fill { position: absolute; inset: 0; transition: background 120ms ease; pointer-events: none; }
.cell.sel .cell-fill { background: rgba(114, 96, 244, 0.22); box-shadow: inset 0 0 0 1.5px var(--accent); }
.cell-avatars { position: absolute; top: 0; right: 5px; bottom: 0; display: flex; align-items: center; pointer-events: none; }
.mini-avatar {
  width: 27px; height: 27px; border-radius: 50%; background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.22); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: var(--ink-90);
}

.bars-layer { position: absolute; left: 5px; top: 0; bottom: 0; right: 34px; pointer-events: none; }
.bar {
  position: absolute; box-sizing: border-box; pointer-events: auto; cursor: pointer;
  padding: 5px 6px 5px 8px; overflow: hidden;
  border-radius: 9px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: opacity 160ms ease, filter 140ms ease, transform 140ms ease;
}
@media (hover: hover) { .bar:hover { filter: brightness(1.08); transform: translateY(-1px); } }
.bar.faded { opacity: 0.35; }
.bar.open-outline { outline: 2px solid #fff; outline-offset: 1px; }
.bar-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 5px; }
.bar-title { flex: 1; min-width: 0; font-size: 15px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; }
.bar-count {
  flex: none; font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  padding: 2px 7px; border-radius: 999px; line-height: 1.5;
}

/* ---------- legend (inside how-card) ---------- */
.how-list { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; font-size: 16px; color: var(--dim); }
.legend-item { display: flex; align-items: center; gap: 11px; }
#howAction .btn-join { margin-top: 18px; }
#howAction .link-quiet { display: block; }
.legend-bar { width: 9px; height: 20px; border-radius: 3px; background: linear-gradient(180deg, #7260F4 0%, #5AB7F7 35%, #48A25A 70%, #EA7241 100%); }
.legend-circle { width: 21px; height: 21px; border-radius: 50%; background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.24); }
.legend-sel { width: 21px; height: 14px; border-radius: 4px; background: rgba(114, 96, 244, 0.22); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* ---------- sidebar ---------- */
.sidebar { width: 344px; flex: none; display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.card { border-radius: var(--r); background: var(--panel); padding: 24px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 16px; }
.card-title { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 17px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim-2); }
.card-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; flex: none; }
.card-count { font-size: 12px; color: var(--dim); }
.card-empty { font-size: 15px; line-height: 1.6; color: var(--dim-2); }

.sel-list { display: flex; flex-direction: column; gap: 9px; }
.sel-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-90); }
.sel-row-time { color: var(--dim); }
.link-quiet {
  background: none; border: none; padding: 10px 0 0; text-align: left; cursor: pointer;
  font-size: 14px; font-weight: 500; letter-spacing: 0.04em; color: var(--dim-2);
}
.link-quiet:hover { color: var(--accent-soft); }

.plan-list { display: flex; flex-direction: column; gap: 16px; }
.plan-row { display: flex; gap: 12px; cursor: pointer; }
.plan-row:hover { opacity: 0.75; }
.plan-bar { width: 4px; flex: none; border-radius: 2px; }
.plan-body { min-width: 0; flex: 1; }
.plan-title { font-size: 14px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
.plan-meta { padding-top: 5px; display: flex; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--dim-2); }

.person-list { display: flex; flex-direction: column; gap: 14px; }
.person { display: flex; align-items: center; gap: 12px; }
.person-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.16); display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 500; color: var(--ink-90);
}
.person-name { font-size: 13px; font-weight: 500; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-meta { padding-top: 3px; font-size: 11px; color: var(--dim-2); }

/* ---------- звезда (как на гитхабе) ---------- */
.star-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px; min-height: 38px;
  background: var(--panel-2); border: none; border-radius: 10px;
  color: var(--dim); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.3s cubic-bezier(0.2, 0, 0.3, 1), color 140ms ease;
}
.star-btn:hover { background: #3d3d3d; color: var(--ink); }
.star-btn.starred { color: #EA7241; }
.star-btn .star-n { font-variant-numeric: tabular-nums; color: var(--ink-90); }
.star-btn.starred .star-n { color: #EA7241; }
.star-btn.star-big { margin-top: 16px; font-size: 16px; padding: 10px 16px; min-height: 44px; }

/* ---------- event detail card ---------- */
.side-top { display: flex; flex-direction: column; gap: 14px; }
.card-detail { border: 1px solid var(--line-strong); overflow-y: auto; }
.card-detail.empty {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px dashed var(--line-strong); background: transparent;
  color: var(--dim-3); font-size: 13px; line-height: 1.6;
}
.detail-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.detail-arrow {
  width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: none; border-radius: 10px; color: var(--ink); font-size: 18px; cursor: pointer;
  transition: background 0.3s cubic-bezier(0.2, 0, 0.3, 1);
}
.detail-arrow:hover { background: #3d3d3d; }
.detail-counter { font-size: 13px; color: var(--dim-2); }

/* ---------- заголовок панели деталей ---------- */
.popup-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.popup-when-row { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; }
.popup-dot { width: 8px; height: 8px; border-radius: 50%; }
.popup-when { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim-2); }
.popup-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--ink); text-wrap: pretty; }
.popup-close { flex: none; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--dim-2); cursor: pointer; background: var(--panel-2); border: none; border-radius: 10px; }
.popup-close:hover { color: var(--ink); }

.capacity-box { margin-top: 20px; padding: 18px 18px 20px; background: var(--panel-2); border-radius: var(--r-sm); }
.capacity-label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim-2); }
.capacity-nrow { display: flex; align-items: baseline; gap: 9px; padding-top: 6px; }
.capacity-n { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; color: var(--ink); }
.capacity-word { font-size: 16px; color: var(--dim); }
.spots-row { display: flex; gap: 6px; padding-top: 16px; flex-wrap: wrap; }
.spot { width: 18px; height: 18px; border-radius: 50%; }
.spots-text { padding-top: 12px; font-size: 14px; color: var(--dim); }

.facts { margin-top: 20px; display: flex; flex-direction: column; gap: 11px; }
.fact { display: flex; justify-content: space-between; gap: 16px; font-size: 16px; }
.fact-k { color: var(--dim-2); flex: none; }
.fact-v { color: var(--ink-90); text-align: right; overflow-wrap: anywhere; }

.author-row { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.author-avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.16); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 500; color: var(--ink-90); }
.author-name { font-size: 16px; font-weight: 500; color: var(--ink); }
.author-meta { padding-top: 3px; font-size: 13px; color: var(--dim-2); }

.members-row { margin-top: 16px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.member-chip { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.16); display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 500; color: var(--ink-90); }
.members-label { font-size: 13px; color: var(--dim-2); margin-right: 4px; }
/* список записавшихся для организатора: имя + кликабельный @username */
.member-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.member-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.member-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-you { color: var(--dim-2); font-weight: 400; }
.member-tg { flex: none; font-size: 14px; color: var(--accent-soft); padding: 4px 8px; border-radius: 8px; background: var(--panel-2); }
@media (hover: hover) { .member-tg:hover { background: #3d3d3d; color: #cdc7ff; } }

.btn-join {
  display: block; width: 100%; margin-top: 20px; padding: 14px; text-align: center;
  background: var(--accent); color: #fff; border: none; cursor: pointer; border-radius: 16px;
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  transition: background 140ms ease;
}
.btn-join:hover { background: var(--accent-hover); }
.btn-join:disabled { opacity: 0.6; cursor: default; }
.joined-tag {
  margin-top: 20px; padding: 13px; text-align: center; border: 1px solid rgba(114, 96, 244, 0.55); border-radius: 16px;
  color: var(--accent-soft); font-size: 15px; font-weight: 600;
}
.joined-tag.muted { color: var(--dim-2); border-color: var(--line-strong); font-weight: 500; font-size: 14px; }
.btn-ghost {
  display: block; width: 100%; margin-top: 10px; padding: 12px; text-align: center;
  background: #3d3d3d; border: none; color: var(--ink-90); cursor: pointer; border-radius: 16px;
  font-size: 15px; font-weight: 500;
}
.btn-ghost:hover { background: #4a4a4a; color: var(--ink); }

/* ---------- floating create button (mobile) ---------- */
.fab {
  display: none;
  position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  background: #48A25A; color: #fff; border: none; border-radius: 16px;
  padding: 15px 24px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  box-shadow: 0 12px 32px rgba(72, 162, 90, 0.4); cursor: pointer;
}
.fab:active { background: #55b268; }

/* ---------- modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 10, 10, 0.72);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; overflow-y: auto;
}
.overlay[hidden], .toast[hidden], .fab[hidden] { display: none; }
.modal {
  width: 430px; max-width: 100%; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55); padding: 30px;
}
.modal-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--ink); padding-bottom: 8px; }
.modal-sub { font-size: 15px; line-height: 1.6; color: var(--dim-2); padding-bottom: 18px; }

.field { padding-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim-2); padding-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--panel-2); border: 1px solid transparent;
  color: var(--ink); font-size: 17px; padding: 12px 14px; font-family: inherit; border-radius: var(--r-sm);
}
.field select {
  -webkit-appearance: none; appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field input { -webkit-appearance: none; appearance: none; }
.field input[type=number] { -moz-appearance: textfield; }
.field input::-webkit-outer-spin-button, .field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field input::placeholder, .field textarea::placeholder { color: var(--dim-3); }
.field textarea { resize: vertical; min-height: 64px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.form-error { color: #ff8a7a; font-size: 14px; padding-bottom: 10px; min-height: 16px; }

.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0 2px; }
.qr-img { display: block; background: var(--panel-2); border-radius: var(--r-sm); padding: 12px; }
.qr-hint { font-size: 14px; line-height: 1.5; color: var(--dim-2); text-align: center; }
.login-divider { display: flex; align-items: center; gap: 12px; padding: 14px 0; color: var(--dim-3); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.code-row { text-align: center; }
.code-hint { font-size: 14px; color: var(--dim-2); padding-bottom: 8px; }
.code-big { font-size: 32px; font-weight: 700; letter-spacing: 0.12em; color: var(--accent-soft); }

.tg-link {
  display: block; margin-top: 8px; padding: 14px; text-align: center; background: var(--accent); border-radius: 16px;
  color: #fff !important; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; cursor: pointer;
}
.tg-link:hover { background: var(--accent-hover); color: #fff !important; }
.login-wait { padding-top: 14px; font-size: 14px; color: var(--dim-2); text-align: center; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 100;
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--r-sm); color: var(--ink-90);
  font-size: 15px; padding: 13px 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  max-width: min(90vw, 480px);
}

/* ---------- app shell: ДОСКА (body.board) не скроллится на десктопе; /new/ и /admin/ — обычные страницы ---------- */
@media (min-width: 1101px) {
  .topbar { padding-bottom: 12px; }
  .brand-logo { height: 64px; }
  .intro-title { font-size: clamp(26px, 2.4vw, 38px); }
  .page { padding: 14px 24px; }
  .container { width: 100%; max-width: none; }

  body.board { height: 100vh; height: 100dvh; overflow: hidden; }
  .board .page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
  .board .container { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .board .layout { flex: 1; min-height: 0; flex-wrap: nowrap; gap: 28px; align-items: stretch; }
  .board .main { display: flex; flex-direction: column; min-height: 0; }
  .board .intro { padding-bottom: 10px; max-width: none; }
  .board .intro-sub { display: none; }
  .board .week-head { display: none; }
  .board .grid-scroll { flex: 1; min-height: 0; overflow: auto; }
  .board .sidebar { height: 100%; min-height: 0; padding-top: 0; gap: 16px; width: 360px; }
  .board #cardHow { flex: none; }
  .board .card-detail { flex: 1; min-height: 0; }
}

/* ---------- планшет и телефон (≤1100px): страница скроллится ---------- */
@media (max-width: 1100px) {
  :root { --lane: 0px; }
  .layout { gap: 36px; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .sidebar .card { flex: 1 1 280px; }
  .card-detail.empty { min-height: 140px; }
  .card-detail { scroll-margin-top: 12px; }

  /* узкие колонки: полоса мероприятия компактнее — название на всю ширину, счётчик под ним */
  .gutter { width: 48px; }
  .hour-label { font-size: 12px; padding-right: 8px; }
  .day-head { padding-left: 8px; }
  .day-num { font-size: 26px; }
  .cell-avatars { right: 3px; }
  .mini-avatar { width: 24px; height: 24px; font-size: 10px; }
  .bars-layer { left: 3px; right: 29px; }
  .bar { padding: 4px 6px; border-radius: 8px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35); }
  .bar-top { flex-direction: column; align-items: flex-start; gap: 3px; }
  .bar-title { font-size: 13px; line-height: 1.15; width: 100%; }
  .bar-count { font-size: 11px; padding: 1px 6px; line-height: 1.45; }
  .bar.short .bar-count { display: none; }
  .bar.tight .bar-title { font-size: 12px; }
}

/* планшет вертикально (701–1100px): все 7 дней помещаются без горизонтального скролла */
@media (min-width: 701px) and (max-width: 1100px) {
  :root { --col-min: 0px; }
  .grid-inner, .timeline, .grid { min-width: 0; }
}

/* ---------- телефон ---------- */
@media (max-width: 700px) {
  :root { --col-min: max(112px, calc((100vw - 28px - 48px) / 2.5)); }
  .page { padding: 16px 14px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding-bottom: 22px; gap: 10px; }
  .brand-logo { height: 56px; border-radius: 12px; }
  .topbar-right { gap: 10px; }
  .city { display: none; }
  .topbar .btn-new { display: none; }
  .btn-login { height: 46px; font-size: 15px; padding: 0 16px 0 12px; border-radius: 8px; }
  .fab { display: block; }
  .intro { padding-bottom: 22px; }
  .intro-title { font-size: clamp(30px, 8.6vw, 34px); }
  .intro-sub { font-size: 15px; padding-top: 12px; }
  .grid-scroll { scroll-snap-type: x proximity; scroll-padding-left: 48px; }
  .grid-inner { min-width: 0; }
  .timeline, .grid { min-width: 0; }
  .timeline-tick > div { height: 5px; }
  .layout { gap: 24px; }
  .sidebar { flex-direction: column; gap: 12px; }
  .sidebar .card { flex: none; width: 100%; }
  /* панель деталей — сразу под доской; пустую не показываем */
  .card-detail { order: -1; }
  .card-detail.empty { display: none; }
  .card { padding: 20px; }
  .popup-title { font-size: 23px; }
  .how-list { font-size: 15px; gap: 11px; }
  .overlay { padding: 4vh 12px 16px; align-items: flex-start; }
  .modal { padding: 24px 20px; border-radius: 20px; }
  .modal-title { font-size: 24px; }
  .code-big { font-size: 28px; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); max-width: calc(100vw - 28px); font-size: 14px; }
}

/* iPad и другие тач-экраны: ряды выше, чтобы попадать пальцем */
@media (pointer: coarse) {
  .btn-login, .btn-new { min-height: 46px; }
  .detail-arrow, .popup-close { width: 40px; height: 40px; }
  .star-btn { min-height: 44px; }
}
