* { box-sizing: border-box; }
button, textarea { font: inherit; }
button { appearance: none; border: 0; cursor: pointer; }

.screen {
  display: flex;
  width: 100%;
  height: 100dvh;
  min-height: 640px;
  flex-direction: column;
  padding: 14px 20px max(24px, env(safe-area-inset-bottom));
  overflow: hidden;
  background: #fff;
  color: #17211b;
}
.screen--intro, .screen--categories { padding-top: max(30px, env(safe-area-inset-top)); }
.brand-row, .top-row { display: flex; flex: none; align-items: center; gap: 10px; }
.brand { display: inline-flex; min-width: 0; flex: 1; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; }
.brand img { width: 22px; height: 22px; flex: none; border-radius: 7px; object-fit: cover; }
.live-badge, .muted-badge { display: inline-flex; flex: none; align-items: center; gap: 6px; min-height: 26px; padding: 5px 10px 5px 8px; border-radius: 999px; background: #e9f6ee; color: #00813a; font-size: 11px; font-weight: 800; letter-spacing: .08em; line-height: 1; text-transform: uppercase; }
.live-badge i, .muted-badge i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #00a34a; box-shadow: 0 0 0 3px rgba(0,163,74,.15); }
.muted-badge { margin-left: auto; background: #f1f4ee; color: #46564b; }
.muted-badge i { background: #98a49b; box-shadow: none; }

.intro-copy { margin-top: 26px; }
.intro-copy h1, .page-title, .results-title, .reason-title, .success-block h1, .done-title, .photo-copy h1 { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.08; letter-spacing: -.025em; }
.intro-copy p, .results-note, .success-block p, .done-copy, .photo-copy p { margin: 16px 0 0; color: #6d7a70; font-size: 15px; line-height: 1.45; }
.pills { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.pills span { display: inline-flex; min-height: 28px; align-items: center; padding: 0 12px; border-radius: 999px; background: #f1f4ee; color: #46564b; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.section-heading { display: flex; align-items: baseline; gap: 8px; margin-top: 24px; }
.section-heading span { min-width: 0; flex: 1; overflow: hidden; color: #98a49b; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.section-heading b { flex: none; color: #98a49b; font-size: 12.5px; font-weight: 700; }
.section-heading--progress b { color: #00813a; }
.simple-list { flex: 1; min-height: 0; overflow-y: auto; margin-top: 6px; overscroll-behavior: contain; }
.simple-list div { display: flex; align-items: center; gap: 10px; min-height: 48px; border-bottom: 1px solid #edf1eb; }
.simple-list b { min-width: 0; flex: 1; font-size: 15.5px; }
.simple-list span, .title-row span { color: #98a49b; font-size: 13px; }

.bottom-actions { display: flex; flex: none; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 16px; }
.bottom-actions--row { flex-direction: row; margin-right: -20px; margin-bottom: -24px; margin-left: -20px; padding: 14px 18px 26px; border-top: 1px solid #e1e7df; background: #fff; }
.bottom-actions--row .button { min-width: 0; flex: 1; }
.intro-actions { margin: auto -2px -24px; padding: 14px 0 26px; gap: 6px; }
.button { display: inline-flex; min-height: 54px; align-items: center; justify-content: center; gap: 9px; padding: 0 20px; border-radius: 999px; font-size: 15.5px; font-weight: 700; color: #2a312b; }
.button--primary { background: #00a34a; color: #fff; box-shadow: 0 12px 24px -15px rgba(0,129,58,.8); }
.button--secondary { border: 1px solid #dce3dc; background: #fff; }
.button .icon { display: inline-grid; flex: none; place-items: center; font-size: 17px; line-height: 1; }
button:disabled { cursor: default; opacity: .45; }

.page-title { margin-top: 26px; }
.progress { height: 7px; flex: none; overflow: hidden; margin-top: 9px; border-radius: 999px; background: #eff2ed; }
.progress i { display: block; height: 100%; border-radius: inherit; background: #00a34a; }
/*
 * Разделов девять, и пять рядов карточек в рамку 402x715 не помещаются — прокручивается
 * сетка, а шапка с прогрессом и кнопки внизу стоят на месте. min-height:0 обязателен: без
 * него flex-элемент не даёт себя сжать и скролла не возникает, а align-content:start держит
 * ряды прижатыми к верху, когда разделов мало и высоты в избытке.
 */
.category-grid { display: grid; flex: 1; min-height: 0; align-content: start; overflow-y: auto; margin-top: 24px; grid-template-columns: repeat(2, minmax(0,1fr)); grid-auto-rows: max-content; gap: 12px; overscroll-behavior: contain; }
.category-card { display: flex; min-width: 0; flex-direction: column; overflow: hidden; padding: 0; border: 2px solid #e8ece6; border-radius: 18px; background: #fff; color: #17211b; text-align: left; }
.category-card__visual { position: relative; display: grid; width: 100%; height: 76px; flex: none; place-items: center; overflow: hidden; background-color: #f1f4ee; background-position: center; background-size: cover; }
/* Превью 960x400 дают запас под Retina и общий широкий crop карточки/hero. */
.category-card__visual--breakfast { background-image: url('/assets/vote/categories/breakfast.webp'); }
.category-card__visual--salads { background-image: url('/assets/vote/categories/salads.webp'); }
.category-card__visual--soups { background-image: url('/assets/vote/categories/soups.webp'); }
.category-card__visual--mains { background-image: url('/assets/vote/categories/mains.webp'); }
.category-card__visual--sides { background-image: url('/assets/vote/categories/sides.webp'); }
.category-card__visual--bakery { background-image: url('/assets/vote/categories/bakery.webp'); }
.category-card__visual--desserts { background-image: url('/assets/vote/categories/desserts.webp'); }
.category-card__visual--drinks { background-image: url('/assets/vote/categories/drinks.webp'); }
.category-card__visual--other { background-image: url('/assets/vote/categories/other.webp'); }
.done-mark { position: absolute; top: 8px; right: 8px; display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; background: #00a34a; color: #fff; font-size: 14px; font-style: normal; font-weight: 800; }
.is-done .category-card__visual { filter: saturate(.72); opacity: .62; }
.is-done .done-mark { opacity: 1; }
.category-card__caption { display: grid; width: 100%; min-height: 49px; flex: none; align-items: center; padding: 10px 12px; grid-template-columns: minmax(0,1fr) auto auto; gap: 7px; }
.category-card__caption b { overflow: hidden; font-size: 14.5px; text-overflow: ellipsis; white-space: nowrap; }
.category-card__caption small { color: #98a49b; font-size: 12px; font-weight: 700; }
.is-done .category-card__caption b { color: #46564b; }
.is-done .category-card__caption small { color: #00813a; }
.category-card__caption i, .dish-row>i { color: #c3ccc4; font-size: 20px; font-style: normal; }

.back-link { display: inline-flex; min-height: 32px; align-self: flex-start; align-items: center; gap: 5px; padding: 0; background: transparent; color: #46564b; font-size: 13.5px; font-weight: 700; }
.back-link .chevron { font-size: 24px; font-weight: 500; line-height: 1; }
.category-hero { display: grid; height: 120px; flex: none; place-items: center; margin-top: 8px; border-radius: 20px; overflow: hidden; background-color: #f1f4ee; background-position: center; background-repeat: no-repeat; background-size: cover; }
.title-row { display: flex; align-items: baseline; gap: 10px; margin-top: 16px; }
.title-row h1 { margin: 0; font-size: 28px; font-weight: 800; line-height: 1.08; letter-spacing: -.02em; }
.title-row span { margin-left: auto; }
.dish-list { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 12px; margin-top: 18px; overflow-y: auto; overscroll-behavior: contain; }

/* Полосу прокрутки прячем: сайт мобильный, и на десктопе в рамке телефона она съедает
   ширину карточек. Что список продолжается, видно по обрезанному ряду снизу. */
.category-grid, .simple-list, .dish-list { scrollbar-width: none; }
.category-grid::-webkit-scrollbar, .simple-list::-webkit-scrollbar,
.dish-list::-webkit-scrollbar { display: none; }
.dish-row { display: flex; min-width: 0; align-items: center; gap: 12px; padding: 0; background: transparent; color: #17211b; text-align: left; }
.dish-row img, .dish-placeholder { width: 64px; height: 64px; flex: none; border-radius: 16px; object-fit: cover; }
.dish-placeholder { display: grid; place-items: center; background: #f1f4ee; color: #fff; font-size: 20px; font-weight: 800; }
.dish-placeholder--warm { background: linear-gradient(135deg,#bb6642,#e7c260); }
.dish-placeholder--sand { background: linear-gradient(135deg,#8d6748,#d9a847); }
.dish-row__copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 5px; }
.dish-row__copy b { overflow: hidden; font-size: 15.5px; text-overflow: ellipsis; white-space: nowrap; }
.dish-row__copy small { display: flex; min-width: 0; align-items: center; gap: 7px; overflow: hidden; color: #98a49b; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.dish-row__copy em { display: inline-flex; flex: none; padding: 3px 9px; border-radius: 999px; background: #f1f4ee; color: #46564b; font-size: 12px; font-style: normal; font-weight: 700; }
.dish-score { display: inline-flex; flex: none; gap: 4px; color: #ffb020; font-size: 15.5px; }
.dish-score span { color: #17211b; }
.not-rated { flex: none; color: #98a49b; font-size: 12.5px; font-weight: 700; }

.screen--rating { padding: 0; }
.rating-header { flex: none; padding: 16px 20px 14px; }
.rating-header__row { display: grid; align-items: center; grid-template-columns: 1fr auto 1fr; gap: 10px; }
.rating-header__row>b { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.rating-header__row>span { justify-self: end; color: #98a49b; font-size: 13px; }
.rating-header .progress, .reason-header .progress { margin-top: 6px; }
.dish-photo { position: relative; min-height: 180px; flex: 1 1 440px; overflow: hidden; padding: 0; background: #f1f4ee; color: #fff; text-align: left; }
.dish-photo>img { width: 100%; height: 100%; object-fit: cover; }
.dish-photo::after, .photo-scrim { position: absolute; inset: 0; background: linear-gradient(180deg,transparent 64%,rgba(9,16,11,.42) 84%,rgba(9,16,11,.78) 100%); content: ''; }
.dish-photo__zoom, .photo-close { position: absolute; z-index: 2; top: 14px; right: 14px; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; background: #fff; box-shadow: 0 6px 16px -8px rgba(9,16,11,.45); color: #17211b; font-size: 20px; }
.dish-photo__caption { position: absolute; z-index: 2; right: 20px; bottom: 18px; left: 20px; display: flex; flex-direction: column; gap: 8px; }
.dish-photo__caption b { font-size: 28px; line-height: 1.06; letter-spacing: -.02em; }
.dish-photo__caption small { display: -webkit-box; overflow: hidden; color: rgba(255,255,255,.88); font-size: 14.5px; line-height: 1.42; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.rating-panel { flex: none; padding: 20px 20px 24px; }
.rating-label { display: block; margin-bottom: 10px; color: #46564b; font-size: 14.5px; font-weight: 700; }
.stars { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px; }
.stars button { height: 64px; padding: 0; border-radius: 18px; background: #f1f4ee; color: #c2ccc2; font-size: 26px; line-height: 1; }
.stars button.is-active { background: #fff6e6; color: #ffb020; }
.rating-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.round-button { display: grid; width: 54px; height: 54px; flex: none; place-items: center; border: 1px solid #dce3dc; border-radius: 50%; background: #fff; color: #46564b; font-size: 28px; line-height: 1; }
.notes-button { min-width: 0; flex: 1; overflow: hidden; border: 1px solid #dce3dc; background: #fff; color: #46564b; text-overflow: ellipsis; white-space: nowrap; }
.notes-button.is-active { border-color: #00a34a; background: #00a34a; color: #fff; }
.notes-count { display: grid; width: 22px; height: 22px; flex: none; place-items: center; border-radius: 50%; background: #fff; color: #00813a; font-size: 12.5px; font-weight: 800; }

.screen--photo { position: relative; padding: 0; background: #101510; }
.screen--photo>img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.9); }
.screen--photo .photo-scrim { background: linear-gradient(180deg,transparent 74%,rgba(9,16,11,.34) 88%,rgba(9,16,11,.7) 100%); }
.photo-close { top: max(18px,env(safe-area-inset-top)); right: 18px; font-size: 27px; }
.photo-gesture { position: absolute; z-index: 2; top: 50%; left: 50%; width: 168px; height: 168px; transform: translate(-50%,-58%); }
.photo-gesture::before { position: absolute; top: 83px; left: 28px; width: 112px; border-top: 2px dashed rgba(255,255,255,.8); transform: rotate(45deg); content: ''; }
.photo-gesture i { position: absolute; top: 13px; left: 13px; width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,.62); box-shadow: 0 0 0 1px rgba(255,255,255,.5),0 8px 22px -12px rgba(9,16,11,.6); }
.photo-gesture i+ i { inset: auto 13px 13px auto; }
.photo-copy { position: absolute; z-index: 2; right: 20px; bottom: max(34px,env(safe-area-inset-bottom)); left: 20px; color: #fff; }
.photo-copy p { margin-top: 8px; color: rgba(255,255,255,.88); font-size: 14.5px; line-height: 1.42; }

.screen--reasons { padding-top: max(16px,env(safe-area-inset-top)); }
.reason-header { flex: none; }
.progress--striped i { background: repeating-linear-gradient(115deg,#00a34a 0 4px,#b8e4ca 4px 9px); }
.dish-reason-title { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.dish-reason-title b { font-size: 21px; font-weight: 800; }
.dish-rating { color: #ffb020; font-size: 15px; letter-spacing: .05em; }
.not-rated-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: #f1f4ee; color: #6d7a70; font-size: 12.5px; font-weight: 700; }
.reason-title { margin-top: 22px; font-size: 28px; letter-spacing: -.015em; }
.reason-chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.reason-chips button { display: inline-flex; min-height: 48px; align-items: center; padding: 0 18px; border: 1px solid #dce3dc; border-radius: 999px; background: #fff; color: #17211b; font-size: 15px; font-weight: 500; }
.reason-chips button.is-selected { border-color: #00a34a; background: #00a34a; color: #fff; font-weight: 700; }
.reason-comment { width: 100%; min-height: 104px; margin-top: 18px; padding: 15px 16px; resize: none; border: 1px solid #dce3dc; border-radius: 16px; outline: 0; background: #fafbf8; color: #17211b; font-size: 14.5px; line-height: 1.45; }
.reason-comment::placeholder { color: #98a49b; opacity: 1; }
.reason-actions { padding-top: 12px; }

.screen--category-done { padding-top: max(16px,env(safe-area-inset-top)); }
.done-header>div:first-child { display: flex; min-height: 32px; align-items: center; gap: 10px; }
.done-header>div:first-child>span { margin-left: auto; color: #98a49b; font-size: 13px; }
.done-header .progress { margin-top: 6px; }
.success-icon { display: grid; width: 56px; height: 56px; flex: none; place-items: center; margin-top: 34px; border-radius: 50%; background: #00a34a; color: #fff; font-size: 26px; font-weight: 800; }
.done-title { margin-top: 20px; font-size: 28px; line-height: 1.1; }
.done-copy { margin-top: 10px; line-height: 1.5; }
.remaining-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.remaining-categories button { display: inline-flex; min-height: 44px; align-items: center; gap: 7px; padding: 0 15px; border: 1px solid #dce3dc; border-radius: 999px; background: #fff; color: #17211b; font-size: 14.5px; font-weight: 600; }
.remaining-categories span { color: #98a49b; font-weight: 500; }

.success-block { display: flex; flex: 1; flex-direction: column; align-items: flex-start; justify-content: center; }
.success-block .success-icon { margin: 0; }
.success-icon--large { width: 64px; height: 64px; font-size: 30px; }
.success-block h1 { margin-top: 22px; font-size: 32px; }
.success-block p { margin-top: 12px; font-size: 16px; line-height: 1.5; }
.finished-actions { gap: 10px; }

.results-title { margin-top: 20px; font-size: 28px; }
.result-pills { margin-top: 16px; }
.result-pills span { min-height: 30px; }
.results-note { margin-top: 14px; font-size: 14.5px; }
.screen--results>.bottom-actions { flex: none; }

/*
 * Гармошка категорий: разделители рисуют сами строки (border-top у каждой и замыкающая
 * линия у списка), поэтому у свёрнутого списка нет ни одного лишнего отступа.
 */
.results-acc { display: flex; flex: 1; min-height: 0; flex-direction: column; margin-top: 16px; overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid #e8ece6; scrollbar-width: none; }
.results-acc::-webkit-scrollbar { display: none; }
.acc-item { display: flex; flex: none; flex-direction: column; border-top: 1px solid #e8ece6; }
.acc-head { display: flex; min-height: 56px; align-items: center; padding: 9px 0; border: 0; background: none; color: inherit; gap: 10px; text-align: left; }
.acc-head>span { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.acc-head b { font-size: 16px; font-weight: 700; }
.acc-head small { color: #98a49b; font-size: 12.5px; }
.acc-head>i { width: 20px; flex: none; color: #c3ccc4; font-size: 15px; font-style: normal; line-height: 1; text-align: center; }
.acc-head.is-open>i { color: #00813a; }
.acc-body { display: flex; flex-direction: column; margin-bottom: 16px; padding-top: 13px; border-top: 1px solid #eff2ed; gap: 15px; }
.acc-row { display: flex; min-width: 0; align-items: center; gap: 12px; }
.acc-row img, .row-placeholder { width: 46px; height: 46px; flex: none; border-radius: 13px; object-fit: cover; }
.row-placeholder { display: grid; place-items: center; background: #f1f4ee; color: #fff; font-size: 17px; font-weight: 800; }
.acc-row__copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.acc-row__copy>span { display: flex; min-width: 0; align-items: center; gap: 6px; }
.acc-row b { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.acc-row small { overflow: hidden; flex: 0 1 auto; min-width: 0; color: #98a49b; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
/* Замечания всех гостей — плашка, а не текст: иначе счётчик теряется в составе позиции. */
.acc-row u { flex: none; padding: 3px 8px; border-radius: 999px; background: #f1f4ee; color: #46564b; font-size: 11.5px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.acc-row>i { flex: none; padding: 4px 9px; border-radius: 999px; background: #e9f6ee; color: #00813a; font-size: 12px; font-style: normal; font-weight: 700; }
.acc-row>em { flex: none; color: #17211b; font-size: 15px; font-style: normal; font-weight: 800; }
.acc-row>em::first-letter { color: #ffb020; }

/*
 * Каждый экран — свой компонент, но рамка телефона на десктопе центрирует именно .screen.
 * Хосты экранов и router-outlet убираем из потока, иначе между app-venue и .screen встают
 * лишние блоки и центрирование ломается.
 */
app-vote-flow, app-vote-intro, app-vote-categories, app-vote-rating, app-vote-reasons,
app-vote-category-done, app-vote-finished, app-vote-already-voted, app-vote-poll-closed,
app-vote-category, app-vote-results { display: contents; }
router-outlet { display: none; }

/* Позиция без фото: вместо снимка та же плашка-градиент, что и в списке. */
.dish-photo__fill { position: absolute; inset: 0; }
.top-row .live-badge { margin-left: auto; }

/* Закрытое голосование: ссылка на итоги заменяется подписью. */
.closed-note { margin: 0; color: #98a49b; font-size: 13.5px; font-weight: 600; text-align: center; }
.success-icon--muted { background: #46564b; }
.success-icon svg { display: block; }

@media (hover:hover) {
  .button--primary:hover, .reason-chips button.is-selected:hover { background: #008f41; }
  .button--secondary:hover, .category-card:hover, .remaining-categories button:hover, .reason-chips button:hover { background: #f7f9f5; }
}

/*
 * Десктоп: сайт остаётся мобильным, поэтому вёрстка живёт в рамке телефона. Рамка — 402x715,
 * это 9:16, и масштабируется целиком под высоту окна: на большом мониторе интерфейс растёт
 * вместе с рамкой, а не висит мелкой колонкой посреди экрана. Коэффициент считает
 * fitVoteMenu() в index.html — CSS не умеет делить длину на длину без свежих браузеров.
 *
 * Почему 9:16, а не 9:19.5 как у современных телефонов: высота окна фиксирована, поэтому чем
 * выше пропорция, тем уже рамка и тем мельче в ней всё при том же экране. 9:16 — самая
 * широкая из телефонных пропорций, и на десктопе она читается лучше всего. Вёрстка в неё
 * укладывается: экраны рассчитаны на 402x715, а те, где содержимое длиннее рамки — сетка
 * разделов, список позиций, рейтинг, — прокручиваются внутри себя, шапка и кнопки стоят.
 *
 * Масштаб не зажат сверху единицей: именно из-за этого рамка раньше не пользовалась высотой.
 * Снизу тоже не зажат — на низком окне лучше уменьшить, чем обрезать.
 *
 * Ниже 600px рамки нет: там обычный адаптив во весь экран.
 */
@media (min-width:600px) {
  app-venue { display: flex !important; width: 100%; height: 100dvh; min-height: 0 !important; align-items: center; justify-content: center; overflow: hidden; }
  .screen { width: 402px; height: 715px; min-height: 715px; flex: none; box-shadow: 0 24px 70px -32px rgba(23,33,27,.38); transform: scale(var(--vm-desktop-scale,1)); transform-origin: center; }
}

@media (max-width:359px) {
  .screen { padding-right: 16px; padding-left: 16px; }
  .category-grid { gap: 9px; }
  .category-card__caption { padding-right: 9px; padding-left: 9px; }
  .rating-header, .rating-panel { padding-right: 16px; padding-left: 16px; }
  .stars { gap: 6px; }
}

@media (max-height:680px) and (max-width:599px) {
  .screen { min-height: 0; overflow-y: auto; }
  .intro-copy { margin-top: 20px; }
  .intro-copy p { margin-top: 10px; }
  .section-heading { margin-top: 18px; }
  .simple-list div { min-height: 42px; }
  .category-grid { margin-top: 16px; }
  .category-card__visual { height: 68px; }
  .dish-photo__caption small { display: none; }
  .stars button { height: 54px; }
}
