/* ============================================================
   style.css — базовые стили + login + общие компоненты.
   На каждой странице — собственная секция, разделена /* === */
   ============================================================ */

/* ---------- Reset + переменные ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
    --blue: #1A6FD4;
    --blue-light: #E8F1FB;
    --blue-mid: #4A90E2;
    --yellow: #F5C518;
    --yellow-dark: #C49A0A;
    --black: #111;
    --dark: #1C1C1E;
    --dark2: #2C2C2E;
    --dark3: #3A3A3C;
    --gray: #8E8E93;
    --gray2: #AEAEB2;
    --gray3: #C7C7CC;
    --gray4: #D1D1D6;
    --gray5: #E5E5EA;
    --gray6: #F2F2F7;
    --white: #fff;
    --bg: #F2F2F7;
    --green: #34C759;
    --red: #FF3B30;
    --orange: #FF9500;
    --purple: #AF52DE;

    --card-bg: #fff;
    --card-border: rgba(0, 0, 0, 0.08);

    --text: #111;
    --text2: #3C3C43;
    --text3: #8E8E93;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 20px;

    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);

    /* Алиас для основного акцентного цвета. В проекте исторически
       используется --blue, но многие места (включая мои новые компоненты —
       merge button, print button, баннер заказа, форма комментария фото)
       используют --accent. Один алиас разом чинит их все. */
    --accent: var(--blue);
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
html {
    background: var(--bg);
    overflow-x: hidden;        /* страховка от горизонтального скролла на странице */
}
html.login-screen, html.login-screen body {
    background: var(--dark);
    max-width: 100vw;
    overflow-x: hidden;
}
body { display: flex; flex-direction: column; min-height: 100vh; }

/* Полное обнуление боковых отступов на основных контейнерах -
   с !important чтобы перебить любые возможные правила. Контент
   занимает всю ширину экрана впритык к краю.
   ИСКЛЮЧЕНИЕ: .section-header убран из этого списка - у него отдельное
   правило ниже с небольшим отступом слева (чтобы заголовки секций
   "СЕЙЧАС В ЦЕНТРЕ" / "ВЫШЕДШИЕ" / "СТАТИСТИКА ПО ДНЯМ" не лепились
   впритык к краю). */
html, body, #app-content {
    padding-left: 1px !important;
    padding-right: 1px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.timers-list, .location-list, .location-header,
.stats-row, .room-log-wrap,
.player-section, .reg-section, .nav-bar {
    padding-left: 1px !important;
    padding-right: 1px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Заголовки секций имеют небольшой отступ слева (4px) - чтобы текст
   не примыкал ровно к краю экрана. Карточки таймеров - на 0, заголовок -
   на 4px вглубь. !important чтобы не перетёрлось ничем сверху. */
.section-header {
    padding-left: 4px !important;
}

input, button, select, textarea { font: inherit; color: inherit; outline: none; }
a { color: var(--blue); text-decoration: none; }

/* SVG-иконки управляются через color/font-size в родителе */
.icon { width: 1em; height: 1em; vertical-align: -0.15em; flex-shrink: 0; }
button .icon, a .icon { pointer-events: none; }

/* =========================================================================
 * !!! ВНИМАНИЕ — НЕ ТРОГАТЬ position: fixed у .page-head и .bottom-bar !!!
 * =========================================================================
 *
 *   Шапка (.page-head) и нижняя панель (.bottom-bar) ОБЯЗАТЕЛЬНО fixed,
 *   а НЕ sticky/relative/absolute.
 *
 *   На iOS Safari + Android Chrome `position: sticky` ломается когда у
 *   <body>/<html> установлен overflow-x: hidden (а у нас он есть для защиты
 *   от горизонтального скролла). Шапка/подвал начинают ДЁРГАТЬСЯ при скролле
 *   — едут вверх/вниз вместе с контентом.
 *
 *   Если когда-то нужно будет менять position здесь — обязательно
 *   ПРОВЕРЯТЬ НА РЕАЛЬНОМ МОБИЛЬНИКЕ iOS. На десктопе всё выглядит ок,
 *   но на телефонах ломается.
 *
 *   transform: translateZ(0) — принудительный compositor layer,
 *   устраняет дрейф при показе/скрытии iOS address bar. Тоже НЕ убирать.
 * ========================================================================= */
/* ---------- Lock-friendly шапка (nav-bar) ---------- */
/* Шапка страницы: первая строка — кнопки (◀ Назад слева, опц. справа),
   вторая строка — заголовок по центру. Жёстко приклеена к верху. */
.page-head {
    background: var(--bg);
    position: fixed;        /* !!! НЕ МЕНЯТЬ — см. блок ВНИМАНИЕ выше !!! */
    inset: 0 0 auto 0;      /* top:0; right:0; bottom:auto; left:0 - явная фиксация ко всем 4 краям */
    top: 0; left: 0; right: 0;   /* дубль для совместимости со старыми браузерами без inset */
    z-index: 50;            /* как было — ниже modal-backdrop (100) чтобы модалы перекрывали шапку */
    padding-top: env(safe-area-inset-top, 0);
    padding-left: 0; padding-right: 0; padding-bottom: 0;
    /* Принудительный composite layer — устраняет дрейф при показе/скрытии iOS address bar */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
    will-change: transform;
    /* isolation: isolate создаёт новый stacking context у самой шапки,
       не затрагивая родителей. Это страховка чтобы случайный transform/filter
       у соседних элементов не вытолкнул шапку из её слоя. */
    isolation: isolate;
}
.head-spacer {
    height: calc(var(--head-h, 80px) + env(safe-area-inset-top, 0px));
    flex-shrink: 0;
}
/* Spacer — занимает место под fixed page-head, чтобы контент не оказался под шапкой.
   PHP layout_start вставляет <div class="head-spacer"> сразу после <body>. */
/* (head-spacer определён выше — учитывает safe-area-inset-top) */
.nav-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 0 0;
    background: transparent;
}
/* Заголовок страницы — крупно, по центру, в одну строку с многоточием */
.nav-title {
    display: block;
    text-align: center;
    font-size: 24px; font-weight: 700;
    color: var(--text);
    padding: 0 6px 6px;
    margin-top: 0;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
html.login-screen .nav-title { color: #fff; }

.nav-btn {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: 0; cursor: pointer;
    color: var(--blue); font-size: 17px;
    padding: 6px; min-width: 44px;
    text-decoration: none;
}
.nav-btn .icon { font-size: 22px; }
.nav-btn.right { justify-content: flex-end; }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--blue); color: #fff;
    border: 0; border-radius: var(--radius);
    padding: 14px 18px; font-size: 16px; font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; }
.btn-secondary { background: var(--gray5); color: var(--text); }
.btn-ghost { background: transparent; color: var(--blue); }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }

/* ---------- Текстовые поля ---------- */
.field {
    display: block; width: 100%;
    background: var(--white);
    border: 1px solid var(--gray5);
    border-radius: var(--radius-sm);
    padding: 14px 14px;
    font-size: 16px;
    color: var(--text);
}
.field:focus { border-color: var(--blue); }
.field::placeholder { color: var(--gray2); }
.label {
    display: block;
    font-size: 13px; color: var(--text3);
    margin: 0 0 4px 4px;
}

/* ---------- Лоадер (Promise-обёртка над AJAX) ---------- */
.loader-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.18);
    display: none;
    align-items: center; justify-content: center;
    z-index: 1000;
}
.loader-backdrop.show { display: flex; }
.loader-spinner {
    width: 44px; height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast (короткие уведомления) ---------- */
.toast {
    position: fixed; left: 50%; bottom: 20px;
    transform: translateX(-50%);
    background: var(--dark);
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    z-index: 1001;
    box-shadow: var(--shadow);
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    width: 80vw;
    max-width: 80vw;
    box-sizing: border-box;
    text-align: center;
    white-space: pre-line;
}
/* На страницах с fixed bottom-bar — поднимаем toast выше неё */
body[data-has-bar="1"] .toast {
    bottom: calc(var(--bar-h, 60px) + 12px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast.err { background: var(--red); }
.toast.ok  { background: var(--green); }

/* ============================================================
   ЭКРАН ВХОДА / РЕГИСТРАЦИИ (login.php)
   ============================================================ */

body.login-screen {
    background: var(--dark);
    color: #fff;
    justify-content: stretch;
}
body.login-screen .nav-bar { background: transparent; padding-left: 0; }
body.login-screen .nav-btn { color: var(--blue-mid); padding-left: 4px; }

/* Экран-обёртка занимает весь viewport */
.login-screen .page {
    flex: 1;
    display: flex; flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    background: var(--dark);
    overflow-x: hidden;
}
.login-screen .page.hidden { display: none; }
html.login-screen .page-head { background: transparent; }
html.login-screen .nav-bar { background: transparent; }

/* Все формы внутри login-screen — ровно по ширине родителя, никаких выпираний.
   У <input>/<select> в некоторых браузерах есть собственный min-width — отключаем. */
.login-screen .login-form,
.login-screen .reg-form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.login-screen .field,
.login-screen input,
.login-screen select,
.login-screen textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.login-logo-area {
    flex: 0 0 auto;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px;
    padding: 32px 16px 0;
}
.login-logo {
    width: 220px; height: 104px;
    background: var(--dark2);
    border-radius: 20px;
    position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 8px;
}
.logo-text-the {
    position: absolute; top: 12px; left: 64px;
    font-size: 14px; font-weight: 800; font-style: italic;
    color: #fff; letter-spacing: 1px;
}
.logo-text-mardj {
    font-size: 38px; font-weight: 900; font-style: italic;
    color: var(--yellow);
    font-family: 'Arial Black', sans-serif;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    margin-top: -4px;     /* чуть подвинули "Мардж" вверх, освобождая место под ROOMS */
}
.logo-text-rooms {
    position: absolute; bottom: 6px; right: 18px;
    font-size: 14px; font-weight: 800;
    color: #fff;
    background: var(--blue-mid);
    padding: 2px 10px;
    border-radius: 8px;
}
.login-subtitle {
    font-size: 14px;
    color: var(--gray2);
    text-align: center;
    margin-top: 4px;
}

.login-form {
    padding: 40px 3px 20px;
    display: flex; flex-direction: column;
    gap: 8px;
}
.login-form .label    { color: var(--gray2); margin-left: 4px; }
.login-form .field    {
    background: var(--dark2);
    border-color: var(--dark3);
    color: #fff;
    padding: 16px 14px;
}
.login-form .field:focus { border-color: var(--blue-mid); }
.login-form .field::placeholder { color: var(--gray); }

.login-actions { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }

.login-footer {
    margin-top: 8px;
    text-align: center;
    font-size: 14px;
    color: var(--gray2);
}
.login-footer a { color: var(--blue-mid); }

/* Регистрация (та же стилистика, но nav-bar обратно вверху + чек-листы залов) */
.reg-form {
    padding: 12px 3px 20px;
    display: flex; flex-direction: column;
    gap: 12px;
}
.reg-form h2 {
    color: #fff; font-size: 20px; font-weight: 700;
    margin: 0 4px 4px;
}
.reg-form .field-hint {
    font-size: 12px; color: var(--gray);
    margin: -8px 0 0 4px;
}

.rooms-checklist {
    background: var(--dark2);
    border: 1px solid var(--dark3);
    border-radius: var(--radius-sm);
    max-height: 35vh; overflow-y: auto;
    padding: 4px 0;
}
.rooms-checklist .check-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    user-select: none;
    color: #fff;
    border-top: 1px solid var(--dark3);
    font-size: 15px;
}
.rooms-checklist .check-row:first-child { border-top: 0; }
.rooms-checklist .check-row input[type="checkbox"] {
    width: 26px; height: 26px;
    accent-color: var(--blue-mid);
    flex-shrink: 0;
    cursor: pointer;
}
.rooms-checklist .room-city { color: var(--gray); font-size: 12px; }

/* ============================================================
   ЭКРАН "ЛОКАЦИИ"  (index.php — список залов оператора)
   ============================================================ */

.location-header {
    padding: 4px 0 6px;
}
.location-greeting {
    font-size: 22px; font-weight: 700;
    color: var(--text);
    padding-left: 4px;
}
.location-sub {
    font-size: 14px; color: var(--text3);
    margin-top: 2px;
    padding-left: 4px;
}

.location-list {
    padding: 0 0 100px;
    display: flex; flex-direction: column;
    gap: 6px;
}

.location-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 12px 12px 12px 14px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.05s, background 0.1s;
    text-decoration: none;
    color: inherit;
    user-select: none;
}
.location-card:active { transform: scale(0.99); background: #f7f7f9; }
.location-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.location-icon {
    flex-shrink: 0;
    position: relative;
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--blue-light);
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.location-icon img {
    width: 100%; height: 100%;
    object-fit: contain;            /* картинка целиком, без обрезки */
}
.location-icon-fallback {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 700;
    color: var(--blue);
}

.location-info { flex: 1; min-width: 0; }
.location-name {
    font-size: 16px; font-weight: 600;
    color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.location-address {
    font-size: 13px; color: var(--text3);
    margin: 2px 0 2px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}
.location-phone {
    font-size: 13px;
    color: var(--text3);
    text-decoration: none;
    margin: 0 0 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.location-stats {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.loc-badge {
    background: var(--gray6);
    color: var(--text2);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    display: inline-flex; align-items: center; gap: 4px;
}
.loc-badge.green {
    background: #E7F8EC;
    color: #1A8E3A;
}
.loc-badge.blue {
    background: var(--blue-light);
    color: var(--blue);
}
.loc-badge .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}
.location-chevron {
    color: var(--gray3);
    font-size: 18px;
    flex-shrink: 0;
}

.location-empty {
    margin: 40px 20px;
    text-align: center;
    color: var(--text3);
    font-size: 14px;
}

/* ============================================================
   ЭКРАН "ЗАЛ"  (location.php — таймеры конкретного зала)
   ============================================================ */

body.room-page {
    padding-bottom: 88px;       /* место для fixed bottom-bar */
}

/* Пилюли статистики под шапкой */
.stats-row {
    display: flex;
    gap: 8px;
    padding: 3px 0 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.stats-row::-webkit-scrollbar { display: none; }
.stat-pill {
    flex-shrink: 0;
    background: var(--white);
    border-radius: var(--radius-pill);
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text2);
    display: inline-flex; align-items: center; gap: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    white-space: nowrap;
}
.stat-pill .stat-val { font-weight: 700; color: var(--text); }
.stat-pill .stat-sub { color: var(--text3); font-size: 12px; }
.stat-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.stat-dot-green { background: var(--green); }
.stat-icon {
    display: inline-flex; align-items: center;
}
.stat-icon .icon { font-size: 15px; }
.stat-icon-blue   { color: var(--blue); }
.stat-icon-orange { color: var(--orange); }
.stat-icon-red    { color: var(--red); }

/* Заголовок секции "СЕЙЧАС В ЦЕНТРЕ" / "ВЫШЕДШИЕ" */
.section-header {
    padding: 3px 0 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
/* "ВЫШЕДШИЕ" — отделяем от секции активных:
   • большой отступ сверху (в 3 раза больше базового)
   • тонкий разделитель */
.section-header.finished {
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid var(--gray4);
    position: relative;
}
.section-header.finished::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -6px;
    transform: translateX(-50%);
    width: 36px; height: 5px;
    background: var(--gray4);
    border-radius: 3px;
}

/* Список таймеров */
.timers-list {
    display: flex; flex-direction: column;
    gap: 8px;
    padding: 2px 0 6px;
}
.timers-empty {
    padding: 24px;
    text-align: center;
    color: var(--text3);
    font-size: 14px;
}

/* Карточка одного таймера (одна регистрация — может быть несколько гостей внутри) */
.timer-card {
    position: relative;
    display: block;
    background: var(--white);
    border-radius: var(--radius);
    padding: 5px 6px 6px 9px;
    /* min-height чтобы вмещать абсолютно-позиционированный .timer-end-wrap
       (число + "с XX:XX" под ним) даже на коротких карточках без бейджа,
       например на безлимитных где timer-end = "***". Без этого блок справа
       визуально торчит за нижний край карточки. */
    min-height: 56px;
    box-sizing: border-box;
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
    border-left: 4px solid var(--green);       /* активный — зелёная полоска */
    transition: transform 0.05s, background 0.1s;
}
.timer-card:active { transform: scale(0.99); }
.timer-card.warning  { border-left-color: var(--orange); }
.timer-card.expired  { border-left-color: var(--red); }
.timer-card.on-pause { border-left-color: var(--orange); }
.timer-card.has-tg   { background: #F6EBFE; }
.timer-card.finished {
    border-left-color: var(--gray3);
    opacity: 0.82;
}
.timer-card.finished .timer-end {
    background: var(--gray6);
    color: var(--text3);
}
/* Пилюля "Вышел" на finished-карточке - фон темнее окружающего серого фона,
   чтобы пилюля выделялась как пилюля, а не сливалась со светлым серым фоном. */
.timer-card.finished .timer-badge {
    background: var(--gray4);   /* было gray6 - стало темнее (D1D1D6 vs F2F2F7) */
    color: var(--text2);
}

.timer-line {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 6px;
}
.timer-line + .timer-line { margin-top: 1px; }
/* Если в строке остался только meta/start без бейджа справа — строка сожмётся под текст */

.timer-names-wrap {
    display: flex; align-items: center; gap: 6px;
    min-width: 0; flex: 1;
}
.timer-children-count {
    flex-shrink: 0;
    background: var(--orange);
    color: #fff;
    border-radius: 50%;
    width: 20px; height: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.timer-names {
    font-size: 16px; font-weight: 600;
    color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
}

.timer-end {
    flex-shrink: 0;
    font-size: 22px; font-weight: 700;
    color: var(--blue);
    background: var(--blue-light);
    padding: 3px 10px;
    border-radius: 8px;
    letter-spacing: 0.5px;
    line-height: 1.1;
}
.timer-end.warning {
    color: var(--orange);
    background: #FFF1DE;
}
.timer-end.expired {
    color: var(--red);
    background: #FFE9E7;
}
.timer-end.paused {
    color: var(--green);
    background: #E8F8EC;          /* зелёный = на паузе (раньше серый) */
}

.timer-meta {
    color: var(--text3);
    font-size: 13px;
    /* Полное имя клиента не обрезается: длинный текст переносится на новую строку */
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0; flex: 1;
}
.timer-start {
    flex-shrink: 0;
    color: var(--text3);
    font-size: 13px;
    align-self: flex-start;     /* "с 10:18" остаётся в верхней строке если meta переносится */
}

.timer-badge {
    font-size: 12px;
    color: var(--text2);
    background: var(--gray6);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    display: inline-block;
}
.timer-badge:empty { display: none; }
.timer-badge.warning {
    color: var(--orange);
    background: #FFF1DE;
}
.timer-badge.expired {
    color: var(--red);
    background: #FFE9E7;
}

/* Скидка и промо — отдельной строкой под именем клиента, слева */
.timer-extra-line {
    font-size: 12px;
    color: var(--text3);
    margin-top: 2px;
    word-break: break-word;
}

/* Нижняя панель с кнопкой действия — приклеена к самому низу страницы. */
.bottom-bar {
    position: fixed;        /* !!! НЕ МЕНЯТЬ — см. блок ВНИМАНИЕ у .page-head !!! */
    inset: auto 0 0 0;      /* top:auto; right:0; bottom:0; left:0 - явная фиксация к низу */
    left: 0; right: 0; bottom: 0;   /* дубль для совместимости со старыми браузерами без inset */
    box-sizing: border-box;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);   /* iOS home-indicator */
    z-index: 40;            /* как было — ниже modal-backdrop (100) */
    /* Принудительный composite layer - удерживает панель в её собственном
       слое и предотвращает "дрейф" при скролле / показе iOS address bar.
       Аналог того что в .page-head. Без этих свойств bottom-bar на iOS
       Safari начинает дёргаться вместе с контентом. */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
    will-change: transform;
    isolation: isolate;     /* страховка от случайных transform у соседей */
}
.bottom-bar > .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    border-radius: 0;
    padding: 16px;
    font-weight: 600;
    font-size: 16px;
    box-sizing: border-box;
    border: 0;
    text-align: center;
}
body[data-has-bar="1"]  { padding-bottom: var(--bar-h, 60px); }
.btn-add-timer {
    background: var(--blue);
    color: #fff;
}

/* Таблица статистики rooms_log */
.room-log-wrap {
    margin: 0 0 6px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.room-log {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.room-log th, .room-log td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray6);
}
.room-log th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    background: var(--gray6);
}
.room-log tbody tr:last-child td { border-bottom: 0; }
.room-log td:nth-child(2),
.room-log th:nth-child(2) { text-align: right; padding-right: 18px; }

.room-log-actions {
    display: flex; gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--gray6);
    justify-content: center;
}
.btn-room-log-more, .btn-room-log-collapse {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: var(--radius-sm);
}

/* ============================================================
   ЭКРАН РЕГИСТРАЦИИ (register.php)
   ============================================================ */

body.register-page { padding-bottom: 24px; }

.reg-section {
    padding: 2px 0 12px;
}

.reg-block {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 12px;
    overflow: hidden;        /* предохранитель от вылезающих полей */
}
.reg-block-title {
    font-size: 13px; font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
}

.reg-section .label { color: var(--text2); margin-bottom: 6px; margin-top: 10px; }
.reg-section .label:first-child { margin-top: 0; }
.reg-section .field {
    box-sizing: border-box;
    width: 100%;
    display: block;
}

select.field {
    appearance: none; -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--gray2) 50%),
        linear-gradient(135deg, var(--gray2) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px;
    background-repeat: no-repeat;
    padding-right: 36px;
}

.reg-step-actions {
    display: flex; gap: 8px;
    margin-top: 12px;
}
.reg-step-actions .btn { flex: 1; }

.reg-hint {
    margin-top: 12px;
    color: var(--text3);
    font-size: 14px;
    text-align: center;
}
.reg-hint.err { color: var(--red); }
.reg-hint.ok  { color: var(--green); }

/* Список гостей с галочками */
.children-list {
    display: flex; flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.child-row {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    column-gap: 8px;
    row-gap: 6px;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 5px 5px 5px 5px;
    cursor: pointer;
    user-select: none;
    align-items: start;
}
.child-row .child-checkbox { grid-column: 1; align-self: start; margin-top: 4px; }
/* child-info span'ит обе строки (grid-row: 1 / 3) — так вторая строка под merge
   НЕ добавляет лишней высоты к карточке: высота берётся из контента child-info,
   а merge просто становится поверх "своей" второй строки. Карточка расширится
   только если контент короче суммы (карандаш + row-gap + merge ≈ 68px). */
.child-row .child-info     { grid-column: 2; grid-row: 1 / 3; min-width: 0; }
/* Карандаш редактирования и кнопка "Объединить" — в крайней правой колонке,
   друг под другом (карандаш сверху, merge ниже). Прижаты к правому краю. */
.child-row > .child-edit-btn  { grid-column: 3; grid-row: 1; align-self: start; justify-self: end; }
.child-row > .child-merge-btn { grid-column: 3; grid-row: 2; align-self: start; justify-self: end; }
.child-row.selected {
    background: #EAF3FE;
    border-color: var(--blue);
}
.child-checkbox {
    flex-shrink: 0;
    position: relative;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--gray3);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--white);
}
.child-row.selected .child-checkbox {
    background: var(--blue);
    border-color: var(--blue);
}
.child-row.selected .child-checkbox::after {
    content: ''; width: 8px; height: 4px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}
.child-photo {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--gray6);
    display: flex; align-items: center; justify-content: center;
    color: var(--gray2);
    font-size: 20px;
}
.child-photo img { width: 100%; height: 100%; object-fit: cover; }
.child-info { flex: 1; min-width: 0; }
.child-name-line {
    font-size: 15px; font-weight: 600;
    color: var(--text);
    word-break: break-word;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.child-name-line .child-name-text { flex-shrink: 1; }
.child-name-line .child-meta-gender {
    color: var(--text3);
    font-weight: 400;
    font-size: 13px;
    /* Компенсирует gap: 6px у flex-родителя — запятая+возраст прижимаются к имени
       (без визуального большого пробела перед запятой). */
    margin-left: -6px;
}
.child-name-line .gender-ico { margin-left: 0; }
.child-name-line .child-edit-btn { margin-left: auto; }    /* карандаш всегда справа */
.child-name-line .alien-badge { margin-left: 0; }          /* бейдж прижат к возрасту (без отступа сверху) */
.child-dob {
    font-size: 13px; color: var(--text3);
    margin-top: 2px;
}
.child-dob.dob-today, .child-dob.dob-soon, .child-dob.dob-recent {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    color: #fff;
    font-weight: 600;
    animation: dob-rainbow 3s linear infinite;
}
@keyframes dob-rainbow {
    0%    { background: #FF3B30; }   /* red */
    16.6% { background: #FF9500; }   /* orange */
    33.3% { background: #FFCC00; }   /* yellow */
    50%   { background: #34C759; }   /* green */
    66.6% { background: #007AFF; }   /* blue */
    83.3% { background: #AF52DE; }   /* purple */
    100%  { background: #FF3B30; }   /* red */
}

.child-last {
    font-size: 12px; color: var(--text3);
    margin-top: 2px;
}
.child-last .bunny-badge {
    display: inline-block;
    background: #FDE2EE;
    color: #C71469;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}
.child-last .bunny-badge.first {
    background: #E8F1FB;
    color: var(--blue);
}

.btn-add-child {
    margin-top: 4px;
    background: var(--bg);
    border: 1px dashed var(--gray3);
    color: var(--text2);
}
.btn-add-child:disabled { opacity: 0.55; }

.reg-submit-wrap {
    margin-top: 20px;
}

/* Экран успеха */
.reg-success {
    padding: 40px 24px;
    text-align: center;
    max-width: 480px;
    margin: 0 auto;
}
.reg-success-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
}
.reg-success-icon .icon { font-size: 44px; }
.reg-success-title {
    font-size: 22px; font-weight: 700;
    margin-bottom: 12px;
}
.reg-success-names {
    font-size: 16px;
    color: var(--text2);
    margin-bottom: 4px;
}
.reg-success-duration {
    font-size: 14px;
    color: var(--text3);
    margin-bottom: 28px;
}

/* ============================================================
   ЭКРАН "ИГРОК"  (player.php)
   ============================================================ */

body.player-page { padding-bottom: 100px; }

.player-section {
    padding: 2px 0 6px;
}

.player-info {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 4px;
    text-align: center;
}
.player-format {
    font-size: 13px;
    color: var(--text3);
    margin-bottom: 4px;
}
.player-times {
    display: flex; align-items: center; justify-content: center;
    gap: 12px;
    font-size: 30px; font-weight: 700;
    color: var(--blue);
    line-height: 1.1;
}
.player-time-block {
    background: var(--blue-light);
    padding: 4px 14px;
    border-radius: 12px;
}
.player-time-sep { color: var(--text3); font-weight: 400; }

.player-phone-meta {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text2);
}
.player-extras {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text3);
}

.player-children {
    display: flex; flex-direction: column;
    gap: 8px;
}
.player-child {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding-left: 4px;     /* место для полоски слева */
    overflow: hidden;
}
.player-child-strip {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--green);
}
.player-child.expired   .player-child-strip { background: var(--red); }
.player-child.finished  .player-child-strip { background: var(--gray3); }
.player-child.finished  { opacity: 0.82; }
.player-child {
    /* min-height не нужен - .player-child-main теперь flex-раскладка, и блок
       сам растягивается по большему из info/action столбцов. */
}
.player-child.has-three-actions,
.player-child.has-two-actions {
    /* Классы оставлены для обратной совместимости (вешаются из PHP по числу
       кнопок), но min-height не применяется - см. комментарий выше. */
}

.player-child-body {
    padding: 6px 7px;
}
.player-child-name {
    font-size: 16px; font-weight: 600;
    color: var(--text);
    word-break: break-word;
}
.player-child-name .player-child-name-text {
    /* inline */
}
.player-child-name .player-child-primeta {
    color: var(--text3);
    font-weight: 400;
    font-size: 14px;
    margin-left: 4px;
}
.player-child-name .player-child-gender {
    color: var(--text3);
    font-weight: 400;
    font-size: 13px;
    margin-left: 4px;
}
.player-child-dob {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text3);
}
.player-child-dob.dob-today,
.player-child-dob.dob-soon,
.player-child-dob.dob-recent {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    color: #fff;
    font-weight: 600;
    animation: dob-rainbow 3s linear infinite;
}
.player-child-actions {
    margin-top: 10px;
}
.player-child-actions .btn {
    padding: 8px 14px;
    font-size: 14px;
}
.btn-close-one {
    background: var(--gray6);
    color: var(--red);
}
.player-child-finished-label {
    display: inline-block;
    color: var(--text3);
    font-size: 13px;
    background: var(--gray6);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
}

.player-close-all-count {
    background: rgba(255,255,255,0.25);
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    margin-left: 4px;
}

/* ============================================================
   МОДАЛЬНОЕ ОКНО — попап редактирования гостя / нового человека
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    padding: 8px;
    box-sizing: border-box;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.modal-title {
    font-size: 18px; font-weight: 700;
    margin-bottom: 6px;
    text-align: center;
}
.modal .label {
    color: var(--text2);
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
}
.modal .label:first-child { margin-top: 0; }
.modal .field {
    width: 100%; box-sizing: border-box;
    margin-top: 2px;
    padding: 8px 12px;
}
.modal-photo {
    width: 96px; height: 96px;
    margin: 0 auto 4px;
    border-radius: 16px;
    background: var(--gray6);
    display: flex; align-items: center; justify-content: center;
    color: var(--gray2); font-size: 36px;
    overflow: hidden;
    border: 2px dashed transparent;
}
.modal-photo.has-photo { border-color: transparent; }
.modal-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Кнопки под фото: камера / галерея / удалить */
.modal-photo-actions {
    display: flex; flex-wrap: wrap; gap: 6px;
    justify-content: center;
    margin: 0 0 6px;
}
.modal-photo-actions .btn-photo {
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
}
.modal-photo-hint {
    text-align: center;
    color: var(--text3);
    font-size: 11px;
    margin-bottom: 4px;
}
.modal-gender {
    display: flex; gap: 8px;
    margin-top: 2px;
}
.modal-gender label {
    flex: 1;
    padding: 5px 8px;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    user-select: none;
    font-size: 15px;
}
.modal-gender input[type="radio"] { display: none; }
.modal-gender input[type="radio"]:checked + label,
.modal-gender label.selected {
    background: #EAF3FE;
    border-color: var(--blue);
    color: var(--blue);
    font-weight: 600;
}
.modal-actions {
    display: flex; gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.modal-actions .btn { flex: 1; min-width: 100px; }
.modal-actions .btn-danger { flex: 0 0 100%; order: 99; }   /* "Удалить" — отдельной строкой внизу */

/* Кнопка редактирования в child-row — пилюля */
/* Старое правило .child-edit-btn (текстовая кнопка) убрано —
   теперь SVG-карандаш, стиль в секции "КАРАНДАШ ИЗМЕНИТЬ" ниже */

/* ============================================================
   СПИСОК "Кто пришёл" — radio + inline-edit имени
   ============================================================ */
.members-list {
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.member-row {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 8px;
    row-gap: 2px;
    padding: 10px 12px;
    border-top: 1px solid var(--gray5);
    cursor: pointer;
    user-select: none;
    align-items: center;
}
.member-row:first-child { border-top: 0; }
.member-row.selected { background: #EAF3FE; }
.member-row .member-radio { grid-row: 1 / span 2; grid-column: 1; align-self: center; }
.member-row .member-info  { grid-row: 1; grid-column: 2 / 4; }
.member-row .member-phone-line {
    grid-row: 2; grid-column: 2;
    font-size: 12px; color: var(--text3);
    white-space: nowrap;
}
.member-row .member-edit-btn { grid-row: 2; grid-column: 3; align-self: center; }
.member-radio {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border: 2px solid var(--gray3);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}
.member-row.selected .member-radio {
    border-color: var(--blue);
}
.member-row.selected .member-radio::after {
    content: '';
    width: 11px; height: 11px;
    background: var(--blue);
    border-radius: 50%;
}
.member-info {
    flex: 1; min-width: 0;
}
.member-name { font-weight: 600; color: var(--text); }
.member-phone {
    font-size: 12px; color: var(--text3);
}
.member-edit-btn {
    flex-shrink: 0;
    background: none; border: 0; cursor: pointer;
    color: var(--blue); font-size: 14px;
    padding: 6px 10px;
}
.member-edit-form {
    grid-column: 2 / -1;     /* занимает все колонки кроме radio */
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.member-edit-form .field {
    margin: 0;
    padding: 8px 10px;
}
.member-edit-form-actions {
    display: flex;
    gap: 6px;
}
.member-edit-form-actions .btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 14px;
    min-width: 0;
}

/* ============================================================
   PLAYER: блок кнопок действий (Пауза / Продление / Позвонить / Telegram)
   ============================================================ */
.player-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 14px;
}
.player-actions-row {
    display: flex;
    gap: 6px;
}
.player-actions-row:empty { display: none; }
.player-action-btn {
    flex: 1 1 0;
    min-width: 0;
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 6px 8px;
    min-height: 36px;
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
    border: 0; cursor: pointer;
    text-decoration: none; color: var(--text);
    font-size: 14px; font-weight: 500;
    line-height: 1.2;
    box-sizing: border-box;
}
.player-action-btn .icon {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 18px; height: 18px;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}
.player-action-btn .icon svg {
    width: 100%;
    height: 100%;
    display: block;
}
.player-action-btn:active { transform: scale(0.98); }
.player-action-btn.act-pause   .icon { color: var(--orange); }
.player-action-btn.act-resume  .icon { color: var(--green); }
.player-action-btn.act-extend  .icon { color: var(--blue); font-weight: 700; }
.player-action-btn.act-call    { background: var(--green); color: #fff; }
.player-action-btn.act-tg      { background: #229ED9; color: #fff; }
.player-action-btn.act-call .icon,
.player-action-btn.act-tg   .icon { color: #fff; }

/* Опции продления — сетка кнопок */
.extend-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.extend-option-btn {
    padding: 14px 8px;
    font-weight: 600;
    font-size: 16px;
}

/* ============================================================
   PLAYER: player-child — флексовая раскладка с кнопками справа.
   Контент (info) и блок кнопок (action) лежат в одном flex-потоке -
   блок-контейнер растягивается по большему из них. Никаких min-height
   и абсолютного позиционирования action - кнопки никогда не подрезаются
   overflow:hidden, даже когда контент слева короткий.
   ============================================================ */
.player-child-main {
    display: flex;
    align-items: flex-start;   /* кнопки прижаты к верху */
    gap: 8px;
    width: 100%;
}
.player-child-info {
    min-width: 0;
    flex: 1 1 auto;
}
.player-child-action {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;                  /* отступ между иконками: edit / exit / pause */
    padding-top: 4px;          /* лёгкий воздух сверху, чтобы кнопки не липли к верху */
}
.player-child-action .btn,
.player-child-action .btn-close-one,
.player-child-action .btn-edit-child {
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    min-width: 0;
}
/* Старое правило: padding-right у info было резервом под абсолютную кнопку.
   В flex-раскладке резерв не нужен - кнопки занимают своё место. */
.player-child .player-child-name .child-edit-btn {
    /* Карандаш переехал в .player-child-action (см. выше).
       Это правило оставлено пустым на случай обратной совместимости. */
    margin-left: 0;
}
.player-child-action .btn-edit-child {
    background: var(--blue-light);
    color: var(--blue);
}
.player-child-visit {
    font-size: 12px;
    color: var(--text3);
    margin-top: 4px;
}
.player-child-visit .bunny-badge {
    display: inline-block;
    background: #FDE2EE; color: #C71469;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}
.player-child-visit .bunny-badge.first {
    background: #E8F1FB; color: var(--blue);
}

/* ============================================================
   QR-СКАНЕР — полноэкранный модал с камерой
   ============================================================ */
.qr-scanner {
    position: fixed; inset: 0;
    background: #000;
    z-index: 200;
    overflow: hidden;
}
.qr-scanner[hidden] { display: none; }
.qr-video {
    width: 100%; height: 100%;
    object-fit: cover;
    background: #000;
}
.qr-overlay {
    position: absolute; inset: 0;
    pointer-events: none;
    display: flex; align-items: center; justify-content: center;
}
.qr-frame {
    width: 70vmin; height: 70vmin;
    max-width: 320px; max-height: 320px;
    border: 3px solid rgba(255,255,255,0.92);
    border-radius: 16px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.55);
    position: relative;
}
.qr-frame::before, .qr-frame::after {
    content: ''; position: absolute;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, #4A90E2, transparent);
    animation: qr-scan 2.2s linear infinite;
}
.qr-frame::before { top: 0; }
.qr-frame::after  { bottom: 0; animation-delay: 1.1s; }
@keyframes qr-scan {
    0%   { transform: translateY(0); opacity: 0.9; }
    100% { transform: translateY(calc(70vmin - 2px)); opacity: 0.3; }
}
.qr-status {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 12px; right: 12px;
    text-align: center;
    color: #fff;
    background: rgba(0,0,0,0.55);
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
    backdrop-filter: blur(4px);
}
.qr-cancel {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    left: 50%; transform: translateX(-50%);
    padding: 14px 32px;
    background: var(--white);
    color: var(--text);
    border: 0;
    border-radius: 28px;
    font-weight: 600; font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Пилюля посещения "Зайка/Впервые в зале" — отдельной строкой под ДР */
.child-pill-row, .player-child-pill-row {
    margin-top: 4px;
}
.child-pill-row .bunny-badge,
.player-child-pill-row .bunny-badge {
    display: inline-block;
    background: #FDE2EE; color: #C71469;
    padding: 1px 10px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 12px;
}
.child-pill-row .bunny-badge.first,
.player-child-pill-row .bunny-badge.first {
    background: #E8F1FB; color: var(--blue);
}

/* Примечание для текущего визита — отдельной строкой под именем */
.child-primeta, .player-child-primeta-line {
    font-size: 13px;
    color: var(--text);
    font-style: italic;
    margin-top: 4px;
    /* Плашка с жёлтым фоном — такой же дизайн как в списке таймеров (location.php).
       Фон только за текстом (width: fit-content), длинный текст переносится. */
    display: block;
    width: fit-content;
    max-width: 100%;
    padding: 4px 8px;
    background: rgba(255, 215, 0, 0.12);
    border-radius: var(--radius-sm);
    word-break: break-word;
}

/* ============================================================
   ПРЕВЬЮ ФОТО В ПОПАПЕ РЕБЁНКА — с плюсиком внизу-справа
   ============================================================ */
.modal-photo-preview {
    position: relative;
    width: 88px; height: 88px;
    margin: 0 auto 6px;
    border-radius: 18px;
    background-color: var(--gray6);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0; padding: 0;
    cursor: pointer;
}
/* Иконка камеры — заглушка, центрируется через flex родителя */
.modal-photo-icon {
    width: 50%;
    height: 50%;
    color: #B0B0B5;
    display: block;
    flex-shrink: 0;
}
.modal-photo-preview.has-photo .modal-photo-icon { display: none; }
.modal-photo-preview.has-photo { overflow: hidden; }
.modal-photo-preview img:not([hidden]) {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}
.modal-photo-preview img[hidden] { display: none !important; }

/* Плюсик чуть торчит из правого нижнего угла */
.modal-photo-plus {
    position: absolute;
    right: -3px; bottom: -3px;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px var(--white, #fff);
    line-height: 1;
    z-index: 2;
}
.modal-photo-plus svg {
    width: 12px; height: 12px; display: block;
}
#child-modal-photo-letter { display: none; }
.modal-photo-preview img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

/* ============================================================
   ПОПАП ГАЛЕРЕИ ФОТО — список с lazy-load
   ============================================================ */
.modal.modal-gallery {
    max-height: 92vh;
    display: flex; flex-direction: column;
}
.photo-gallery-add {
    display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
    margin-bottom: 8px;
}
.photo-gallery-pending {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 8px;
    margin-bottom: 10px;
    display: flex; flex-direction: column; gap: 8px;
}
.photo-gallery-pending[hidden] { display: none !important; }
.photo-gallery-pending-img {
    align-self: center;
    max-width: 140px; max-height: 140px;
    border-radius: 8px;
    object-fit: contain;
}
.photo-gallery-pending-actions {
    display: flex; gap: 6px;
}
.photo-gallery-pending-actions .btn { flex: 1; }

.photo-gallery-list {
    display: flex; flex-direction: column; gap: 8px;
    overflow-y: auto;
    flex: 1; min-height: 0;
    /* ТЗ: padding 4px сверху/по бокам — чтобы box-shadow (синяя обводка)
       у главного фото не обрезалась границей контейнера. */
    padding: 4px 4px 0;
}
    margin: 0 -4px;          /* чуть шире чем родитель */
    padding: 0 4px;
}
.photo-gallery-empty {
    text-align: center;
    color: var(--text3);
    padding: 24px 8px;
    font-size: 13px;
}
.photo-gallery-load-more {
    text-align: center;
    color: var(--blue);
    cursor: pointer;
    padding: 8px;
    font-size: 13px;
    font-weight: 500;
}
.photo-card {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 8px;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--gray6);
    border-radius: var(--radius-sm);
    padding: 6px;
}
.photo-card-img {
    width: 72px; height: 72px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.photo-card-body {
    min-width: 0;
}
.photo-card-comment {
    font-size: 13px;
    color: var(--text);
    word-break: break-word;
    line-height: 1.3;
}
.photo-card-date {
    font-size: 11px;
    color: var(--text3);
    margin-top: 2px;
}
.photo-card-actions {
    display: flex; flex-direction: column; gap: 4px;
}
.btn-photo-icon {
    background: var(--gray6);
    border: 0; border-radius: 6px;
    width: 32px; height: 32px;
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.btn-photo-icon.btn-danger-ghost {
    color: var(--red);
    background: #FFE9E7;
}

/* Иконка камеры перед именем гостя — открывает галерею фото гостя */
.player-child-photo-icon {
    background: var(--blue-light);
    color: var(--blue);
    border: 0;
    width: 24px; height: 24px;
    border-radius: 50%;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    margin-right: 4px;
    vertical-align: -3px;
    line-height: 1;
    padding: 0;
}

/* Кнопка "Фото клиента" в плеере — цвет нейтральный */
.player-action-btn.act-photos {
    background: var(--gray6);
    color: var(--text);
}
.player-action-btn.act-photos .icon { color: var(--text2); }

/* ============================================================
   ПОПАП ГАЛЕРЕИ: кнопки в одну строку, компактнее
   ============================================================ */
.photo-gallery-add {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    margin-bottom: 8px;
}
.photo-gallery-add .btn-photo {
    flex: 1;
    padding: 5px 8px;        /* было 6×10 → 1.3× меньше */
    font-size: 13px;
    min-height: 0;
}

/* Превью pending фото: img по центру; кнопки внизу */
.photo-gallery-pending-actions .btn { flex: 1; }

/* ============================================================
   LIGHTBOX — большое фото на весь экран
   ============================================================ */
.photo-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    cursor: zoom-out;
}
.photo-lightbox[hidden] { display: none; }
.photo-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}
.photo-lightbox-close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top, 12px));
    right: 12px;
    width: 40px; height: 40px;
    min-width: 40px; min-height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 0;
    padding: 0;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* ============================================================
   БАННЕР QR над формой регистрации
   ============================================================ */
.reg-qr-banner {
    margin: 4px 3px 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--gray6);
    border-left: 4px solid var(--gray2);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.reg-qr-banner[hidden] { display: none !important; }
.reg-qr-banner--paid {
    background: #E6F8EC;
    border-left-color: var(--green);
}
.reg-qr-banner--warn {
    background: #FFE9E7;
    border-left-color: var(--red);
}
.reg-qr-banner-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.btn-link {
    align-self: flex-start;
    background: transparent;
    border: 0;
    color: var(--blue);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 2px 0;
    text-decoration: underline;
}

/* ============================================================
   БЛОКИРОВКИ ГОСТЕЙ ПРИ ПЛАТНОМ QR
   ============================================================ */
.child-row.qr-locked {
    /* В QR — нельзя снять. Выглядит обычно (выбран), но клик-toast блокирует. */
    cursor: not-allowed;
}
.child-row.qr-locked .child-checkbox::before {
    content: '🔒';
    font-size: 10px;
    position: absolute;
    top: -8px; right: -8px;
    background: var(--green);
    color: #fff;
    border-radius: 50%;
    width: 16px; height: 16px;
    display: flex; align-items: center; justify-content: center;
}
.child-row.qr-disabled {
    /* Не в QR — нельзя выбрать. Серый, нельзя кликнуть. */
    opacity: 0.45;
    cursor: not-allowed;
}
.child-row.qr-disabled .child-checkbox {
    border-color: var(--gray3);
}

/* Disabled select / input / button в форме регистрации — серый фон */
#reg-duration:disabled,
#reg-promo:disabled,
#reg-discount:disabled,
#reg-format:disabled,
.field:disabled,
select.field:disabled {
    background: var(--gray6);
    color: var(--text2);
    cursor: not-allowed;
    opacity: 1;
}
#btn-add-child:disabled,
#btn-add-member:disabled {
    background: var(--gray6);
    color: var(--text3);
    cursor: not-allowed;
    opacity: 0.7;
}

/* «Клиент не найден» — блок с предложением создать */
.reg-not-found {
    margin-top: 8px;
    padding: 12px;
    background: #FFF4E1;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--orange);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}
.reg-not-found-text {
    font-size: 14px;
    color: var(--text);
}
.reg-not-found .btn {
    padding: 8px 18px;
    font-size: 14px;
}

/* ============================================================
   БАННЕР «НЕТ СВЯЗИ» — поверх всего, вверху страницы
   ============================================================ */
.network-banner {
    position: fixed;
    top: env(safe-area-inset-top, 0);
    left: 0; right: 0;
    background: var(--red);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    text-align: center;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transform: translateY(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.network-banner.show {
    transform: translateY(0);
}
.network-banner-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: pulse-dot 1s infinite;
    flex-shrink: 0;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.3; }
}

/* ============================================================
   КАРТОЧКА НОМЕРОВ КЛИЕНТА (пункт 3 ТЗ)
   ============================================================ */
.phones-card {
    position: relative;
    background: var(--gray6);
    border-radius: var(--radius);
    padding: 12px 12px 32px 12px;   /* нижний паддинг под карандаш */
    min-height: 48px;
}
.phones-card.no-phone-mode {
    padding: 6px 12px;              /* в 2 раза меньше высоты */
    min-height: 0;
}
.phones-empty {
    color: var(--text2);
    font-size: 13px;
    text-align: center;
    padding: 6px 0;
}
.phones-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.phone-pill {
    background: var(--white);
    border: 1.5px solid var(--gray3);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
}
.phone-pill:hover { background: var(--gray5); }
.phone-pill.selected {
    background: #E6F8EC;
    border-color: var(--green);
    color: var(--green);
}

/* Карандаш в правом нижнем углу карточки номеров */
.phones-edit-btn {
    position: absolute;
    right: 8px;
    bottom: 6px;
    background: transparent;
    border: 0;
    color: var(--blue);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.phones-edit-btn .icon { width: 18px; height: 18px; }
.phones-edit-btn:hover { background: var(--gray5); }

/* === Режим редактирования === */
.phones-edit-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.phone-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.phone-edit-row .field {
    flex: 1;
    margin: 0;
}
.phone-del-btn {
    flex-shrink: 0;
    background: transparent;
    border: 0;
    color: var(--red);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.phone-del-btn:hover { background: rgba(255, 59, 48, 0.1); }
.phone-del-btn .icon { width: 18px; height: 18px; }

.phones-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.phones-edit-actions .btn { flex: 1; }

/* === Форма "+ Добавить номер" === */
.add-phone-form {
    background: var(--gray6);
    border-radius: var(--radius);
    padding: 12px;
}
.add-phone-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.add-phone-actions .btn { flex: 1; }
.add-phone-result {
    margin-top: 10px;
}
.add-phone-warn {
    padding: 10px;
    background: #FFF4E1;
    border-left: 3px solid var(--orange);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
}

/* ============================================================
   ИКОНКА ПОЛА (мужской/женский) + ПОПАП ВЫБОРА (пункт 11)
   ============================================================ */
.gender-ico {
    background: transparent;
    border: 0;
    cursor: pointer;
    width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    padding: 2px;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.gender-ico:hover { background: var(--gray5); }
.gender-ico .icon { width: 22px; height: 22px; }
.gender-ico.gender-m  .icon { color: #2D8CF0; }
.gender-ico.gender-f  .icon { color: #E83E8C; }
.gender-ico.gender-unknown .icon { color: var(--gray3); }

/* Некликабельная иконка пола (в карточке таймера в списке зала и в карточке гостя).
   Размеры точно такие же как у .gender-ico — для визуального соответствия между
   страницами регистрации/локации (запрос пользователя). */
.gender-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    width: 26px; height: 26px;
}
.gender-inline .icon       { width: 22px; height: 22px; }
.gender-inline.gender-m .icon { color: #2D8CF0; }
.gender-inline.gender-f .icon { color: #E83E8C; }

.gender-popover {
    background: var(--white);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    border-radius: var(--radius);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
}
.gender-opt {
    background: transparent;
    border: 0;
    padding: 8px 12px;
    text-align: left;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; gap: 8px;
}
.gender-opt:hover { background: var(--gray6); }
.gender-opt .icon { width: 20px; height: 20px; }
.gender-opt:nth-child(1) .icon { color: #2D8CF0; }
.gender-opt:nth-child(2) .icon { color: #E83E8C; }

/* ============================================================
   КАРАНДАШ "ИЗМЕНИТЬ" в строке имени гостя (пункт 14)
   ============================================================ */
.child-edit-btn,
.player-child-name .child-edit-btn {
    margin-left: auto;
    background: transparent;
    border: 0;
    color: var(--blue);
    cursor: pointer;
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}
.child-edit-btn:hover { background: var(--gray5); }
.child-edit-btn .icon { width: 18px; height: 18px; }
/* В player.php — кнопка справа от блока имени */
.player-child-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
/* Компенсация gap для возраста — запятая прижимается к имени без пробела (как в register) */
.player-child-name .player-child-gender { margin-left: -6px; color: var(--text3); font-weight: 400; font-size: 13px; }

/* ============================================================
   ВВОД ДАТЫ РОЖДЕНИЯ — три поля + календарь + очистить (пункт 12)
   ============================================================ */
.dob-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.dob-input {
    text-align: center;
    margin: 0;
    padding: 10px 4px;
    min-width: 0;
}
.dob-day, .dob-month { flex: 0 0 50px; }
.dob-year           { flex: 0 0 70px; }
.dob-icon-btn {
    background: transparent;
    border: 1.5px solid var(--gray3);
    color: var(--text);
    cursor: pointer;
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
.dob-icon-btn:hover { background: var(--gray5); }
.dob-icon-clear { margin-left: 4px; }

/* ============================================================
   DATE PICKER — три прокручиваемые колонки (пункт 12)
   ============================================================ */
.modal-datepicker {
    max-width: 360px;
}
.dp-cols {
    display: flex;
    gap: 8px;
    height: 260px;
    margin: 12px 0;
}
.dp-col {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--gray3);
    border-radius: var(--radius-sm);
    background: var(--gray6);
    scroll-snap-type: y mandatory;
    padding: 100px 0;       /* паддинг чтобы можно было докрутить крайние до центра */
}
.dp-item {
    padding: 10px 8px;
    text-align: center;
    font-size: 16px;
    color: var(--text2);
    cursor: pointer;
    scroll-snap-align: center;
}
.dp-item.selected {
    background: var(--blue);
    color: #fff;
    border-radius: var(--radius-sm);
    margin: 0 6px;
    font-weight: 600;
}

/* ============================================================
   ALIEN CHILD ("пришёл вместе") — бэдж + чекбокс в попапе (пункт 13)
   ============================================================ */
.alien-badge {
    background: var(--orange);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    /* Чуть больше высоты (3px вместо 2px по вертикали) — текст не примыкает
       вплотную к границе пилюли, визуально по центру (ТЗ Bug 2). */
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    /* Точное вертикальное центрирование */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    vertical-align: middle;
}
.child-row.is-alien {
    border-left: 3px solid var(--orange);
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 4px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
    width: 18px; height: 18px;
}

/* ============================================================
   ATTACH PHONE PREVIEW (пункт 6)
   ============================================================ */
.attach-preview {
    background: var(--white);
    border: 1px solid var(--gray3);
    border-radius: var(--radius);
    padding: 12px;
}
.attach-section-title {
    font-size: 12px;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}
.attach-phones-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.attach-children-list {
    margin-bottom: 12px;
}
.attach-child {
    padding: 8px;
    border-bottom: 1px solid var(--gray5);
}
.attach-child:last-child { border-bottom: 0; }
.attach-child-name { font-weight: 600; font-size: 14px; color: var(--text); }
.attach-child-meta { font-size: 13px; color: var(--text2); margin-top: 2px; }
.attach-child-visit { font-size: 12px; color: var(--text3); margin-top: 2px; }
.attach-no-children { color: var(--text3); font-style: italic; padding: 6px 0; }
.attach-warn {
    background: #FFF4E1;
    border-left: 3px solid var(--orange);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    margin-bottom: 10px;
}
.attach-actions {
    display: flex;
    gap: 8px;
}
.attach-actions .btn { flex: 1; }

/* === Кнопка "Удалить" в карточке вышедшего таймера на player.php === */
.player-child-finished-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.btn-timer-del {
    background: transparent;
    border: 1.5px solid var(--red);
    color: var(--red);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-timer-del:hover { background: rgba(255, 59, 48, 0.08); }
.btn-timer-del:active { background: rgba(255, 59, 48, 0.16); }
.btn-timer-del .icon { width: 14px; height: 14px; }

/* Опция "Не указывать" в попапе выбора пола (мусульманские клиенты и т.п.) */
.gender-popover .gender-opt-none {
    color: var(--text2);
    border-top: 1px solid var(--gray5);
    margin-top: 2px;
    padding-top: 10px;
}

/* CSS-страховка: атрибут [hidden] всегда скрывает (на случай если style.display
   сброшен другим правилом). Распространяется только на child-modal-alien-row. */
#child-modal-alien-row[hidden] { display: none !important; }

/* =====================================================
   ТЗ Bug 3: Большая аватарка гостя в шапке player.php
   для одиночного таймера. 100×100 кружок.
   ===================================================== */
.player-info { position: relative; }
.player-child-avatar {
    background: var(--gray5);
    border: 0;
    cursor: pointer;
    width: 100px; height: 100px;
    border-radius: 50%;
    overflow: hidden;
    display: block;
    margin: 0 auto 12px;
    box-shadow: var(--shadow);
    padding: 0;
}
.player-child-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* =====================================================
   ТЗ Bug 4: Доп. номера гостя на player.php — небольшие
   нейтральные кнопки tel: под основной зелёной "Позвонить".
   ===================================================== */
.player-extra-phones {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.player-extra-phone {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gray5);
    color: var(--text);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    border: 0;
}
.player-extra-phone:hover  { background: var(--gray4); }
.player-extra-phone:active { background: var(--gray3); }
.player-extra-phone .icon  { width: 14px; height: 14px; color: var(--text2); }

/* =====================================================
   ТЗ Bug 5: Дополнительная инфо в карточке одиночного
   таймера в списке зала (возраст · пол, пилюли, примечание).
   ===================================================== */
.timer-single-meta {
    font-size: 13px;
    color: var(--text2);
    margin-top: 4px;
}
.timer-single-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.timer-single-primeta {
    font-size: 13px;
    color: var(--text);
    margin-top: 4px;
    /* width: fit-content — фон только за текстом, ширина адаптивная по содержимому.
       max-width — не залезать под абсолютно-позиционированный блок времени справа. */
    display: block;
    width: fit-content;
    max-width: calc(100% - 90px);
    font-style: italic;
    padding: 4px 8px;
    background: rgba(255, 215, 0, 0.12);
    border-radius: var(--radius-sm);
    /* Перенос длинного текста (например, если оператор написал длинное примечание) */
    word-break: break-word;
}
.dob-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.dob-pill.dob-today { background: #FFD700; color: #422; }
.dob-pill.dob-soon  { background: #FFE680; color: #553; }

/* =====================================================
   ТЗ Bug 2: галочка "Пришёл вместе" в попапе ребёнка для
   сохранённых в БД на register-page — клик переводит в alien
   (handler onAlienCheckboxChange + endpoint child_to_alien).
   ===================================================== */

/* =====================================================
   ТЗ Bug 5: Группа таймеров — раскрытие inline
   ===================================================== */
.timer-card-group {
    /* Контейнер всей группы — наследует timer-card стили, но не ссылка */
    cursor: default;
    padding: 4px;                /* компактные отступы по краям карточки группы */
}
.timer-group-head {
    cursor: pointer;
    user-select: none;
}
.timer-group-chevron {
    color: var(--text3);
    transition: transform 0.2s ease;
    font-size: 14px;
    margin-left: auto;
}
.timer-card-group.expanded .timer-group-chevron {
    transform: rotate(180deg);
}
.timer-group-children {
    display: none;
    margin-top: 3px;
    /* Полоса смещена влево: 1px слева до полосы, 3px справа до child. */
    margin-left: 1px;
    padding-left: 3px;
    border-left: 2px solid var(--gray4);
}
.timer-card-group.expanded .timer-group-children {
    display: block;
}
.timer-card.timer-card-child {
    padding: 4px;             /* такие же отступы как у card-group */
    margin-bottom: 4px;       /* было 6px — уменьшено в 1.5 раза (ТЗ Bug 7) */
    background: var(--gray6);
    border-radius: var(--radius-sm);
    text-decoration: none;
    display: block;
    color: inherit;
    box-shadow: none;
    /* Дочерняя карточка ВСЕГДА показывает зелёную полоску по умолчанию,
       но если родительская группа expired/warning/finished/on-pause — наследует
       соответствующий цвет (см. правила ниже). */
}
/* ТЗ: дочерние записи наследуют цвет статуса от родительской группы.
   Например если группа expired → красная полоска и у дочерних тоже. */
.timer-card-group.expired  .timer-card.timer-card-child { border-left-color: var(--red); }
.timer-card-group.warning  .timer-card.timer-card-child { border-left-color: var(--orange); }
.timer-card-group.on-pause .timer-card.timer-card-child { border-left-color: var(--orange); }
.timer-card-group.finished .timer-card.timer-card-child { border-left-color: var(--gray3); }
.timer-card.timer-card-child:last-child { margin-bottom: 0; }
.timer-card.timer-card-child:active { background: var(--gray5); }
.timer-card.timer-card-child.finished {
    opacity: 0.7;
    background: var(--gray5);
}

/* =====================================================
   АНИМАЦИИ для пилюль "Зайка" и "ДР" (восстановление со старой версии)
   ===================================================== */

/* Базовый стиль Зайки — розовая пилюля как в регистрации (скриншот: #FDE2EE / #C71469).
   Используется везде: в списке таймеров, в карточке гостя, в регистрации. */
.bunny-badge {
    display: inline-block;
    background: #FDE2EE;
    color: #C71469;
    padding: 2px 12px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 12px;
    animation: bunny-pulse 3s ease-in-out infinite;
}
.bunny-badge.first {
    background: #E8F1FB;
    color: var(--blue);
    animation: bunny-first-pulse 2.5s ease-in-out infinite;
}
@keyframes bunny-pulse {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0   rgba(199, 20, 105, 0.25); }
    50%      { transform: scale(1.03); box-shadow: 0 0 0 5px rgba(199, 20, 105, 0); }
}
@keyframes bunny-first-pulse {
    0%, 100% { box-shadow: 0 0 0 0   rgba(45, 140, 240, 0.3); }
    50%      { box-shadow: 0 0 0 5px rgba(45, 140, 240, 0); }
}

/* ДР — мигание (как в старой версии — yellow/pink/violet) — для ±3 дней от ДР */
.dob-pill.dob-today,
.dob-pill.dob-soon,
.dob-pill.dob-recent {
    animation: dob-blink 1.2s ease-in-out infinite;
}
@keyframes dob-blink {
    0%   { background: #FFD700; color: #422; }
    33%  { background: #FFB6C1; color: #422; }
    66%  { background: #DDA0DD; color: #fff; }
    100% { background: #FFD700; color: #422; }
}

/* =====================================================
   Скриншот 2 layout: имя жирное + возраст не жирный + иконка пола;
   время окончания и "с XX:XX" — независимый блок в правом верхнем углу
   (НЕ влияет на высоту первой строки имени, не сдвигает примечание/пилюли).
   ===================================================== */
.timer-name-strong { font-weight: 600; color: var(--text); }
/* Стиль возраста в карточке таймера — точно такой же как в player.php
   (.player-child-gender): серый, не жирный, 13px. */
.timer-name-age    { font-weight: 400; color: var(--text3); font-size: 13px; }

/* ВАЖНО: position: absolute — чтобы блок времени НЕ занимал место в потоке.
   Иначе высокая правая колонка (10:11 + с 08:11) "растягивает" строку с именем
   и сдвигает примечание вниз. */
/* Блок времени окончания + время начала ПОД ним по центру.
   Сделано через text-align: center (а не flex), потому что flex с column-direction
   на iOS Safari иногда выравнивает дочерние по краю несмотря на align-items: center.
   text-align гарантированно работает с inline/block содержимым. */
.timer-end-wrap {
    /* Единая схема для всех типов карточек (group / single / child):
       в обычном flow, прижато к правому краю flex-row через margin-left:auto. */
    text-align: center;
    pointer-events: none;
    z-index: 1;
    flex-shrink: 0;
    min-width: 0;
    margin-left: auto;
}
.timer-end-wrap .timer-end {
    display: block;
    line-height: 1;
    margin: 0;
    text-align: center;
}
.timer-end-wrap .timer-start {
    display: block;
    font-size: 12px;
    color: var(--text3);
    margin: 2px 0 0;
    text-align: center;
}

/* Резерв padding-right:70 больше не нужен - timer-end-wrap всегда в обычном
   flow (см. правило выше), он сам занимает место в flex-row и не накладывается
   на имя. Правило удалено. */

.timer-pill-line { margin-top: 4px; }
.timer-pill-line .bunny-badge,
.timer-pill-line .child-dob { display: inline-block; }

/* =====================================================
   Лайтбокс увеличения фото — клик по аватару гостя в player.php.
   85% ширины окна, описание внизу, повторный клик закрывает.
   ===================================================== */
.photo-lightbox {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    padding: 16px;
}
.photo-lightbox-inner {
    width: 85vw;
    max-width: 85vw;
    max-height: 90vh;
    display: flex; flex-direction: column;
    align-items: center;
}
.photo-lightbox img {
    width: 100%; max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius);
    background: var(--gray5);
}
.photo-lightbox-caption {
    color: #fff;
    margin-top: 12px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

/* ТЗ Bug 1: пилюля "вход с оплаченным QR" в шапке player.php — фиолетовый фон
   как у tg-связанных гостей (.timer-card.has-tg использует #F6EBFE). */
.player-qr-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: #F6EBFE;
    color: #7A3FB8;
    font-size: 12px;
    font-weight: 600;
}

/* ТЗ Bug 2: индивидуальная "Гость вышел" — иконка двери, без текста.
   Тот же визуальный стиль что у текстовой кнопки (фон/паддинг), но иконка вместо текста. */
.player-child-exit-icon {
    background: var(--red-light, #FEEAEA);
    color: var(--red, #FF3B30);
    border: 0;
    cursor: pointer;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.player-child-exit-icon:hover  { background: var(--red, #FF3B30); color: #fff; }
.player-child-exit-icon:active { opacity: 0.85; }
.player-child-exit-icon .icon  { width: 20px; height: 20px; }

/* ТЗ Bug 4 (новая логика): для вышедших — "вышел" обычной строкой в потоке
   (внутри .player-child-info последней строкой), а кнопка "Удалить" — отдельно
   absolute в правом нижнем углу карточки. */
.player-child-finished-label {
    color: var(--text2);
    font-size: 13px;
    font-style: italic;
    margin-top: 4px;
}
.player-child-del-floating {
    position: absolute;
    right: 12px;
    bottom: 10px;
    z-index: 2;
}
.btn-timer-del-icon {
    background: transparent;
    border: 1px solid var(--red, #FF3B30);
    color: var(--red, #FF3B30);
    cursor: pointer;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0;
}
.btn-timer-del-icon:hover  { background: var(--red, #FF3B30); color: #fff; }
.btn-timer-del-icon .icon  { width: 18px; height: 18px; }

/* ============================================================
   Ссылка "Инструкция" под "Регистрация" на странице логина
   ============================================================ */
.login-footer { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.login-instruction-link {
    color: var(--text2);
    font-size: 14px;
    text-decoration: none;
    border-bottom: 1px dashed var(--gray3);
    padding-bottom: 1px;
}
.login-instruction-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ============================================================
   Попап "Инструкция" — дизайн в стиле проекта
   ============================================================ */
.modal-instruction {
    max-width: 720px;
    width: calc(100% - 32px);
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    /* Перебиваем базовый .modal { padding: 10px } — у этого попапа padding
       свой, на каждой внутренней секции (.modal-head, .instruction-body). */
    padding: 0;
}
.modal-instruction .modal-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-instruction .modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}
.modal-instruction .modal-close {
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--text3);
    padding: 4px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.modal-instruction .modal-close:hover { background: var(--gray5); color: var(--text); }
.modal-instruction .modal-close .icon { width: 22px; height: 22px; }

.instruction-body {
    padding: 18px 22px 24px;
    overflow-y: auto;
    flex: 1 1 auto;
    -webkit-overflow-scrolling: touch;
    /* небольшой плавный градиент сверху для подсказки о прокручиваемости */
}

/* Секции инструкции */
.instr-section + .instr-section { margin-top: 22px; }
.instr-h {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent);
}
.instr-alert .instr-h {
    color: #B85C00;
    border-bottom-color: #F4A03A;
}
.instr-alert {
    background: rgba(255, 215, 0, 0.06);
    border-radius: var(--radius);
    padding: 14px 16px;
    border-left: 3px solid #F4A03A;
}

/* Список шагов */
.instr-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: instr;
}
.instr-list > li {
    position: relative;
    padding: 10px 0 10px 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    border-bottom: 1px dashed var(--gray5);
}
.instr-list > li:last-child { border-bottom: 0; }
.instr-step {
    /* "Шаг N." — обычный жирный текст синего цвета (как в оригинальном
       документе пользователя), не пилюля. */
    color: var(--accent);
    font-weight: 700;
    margin-right: 6px;
    white-space: nowrap;
}
.instr-alert .instr-step { color: #B85C00; }

/* Вложенный список (a, b, c) */
.instr-sub {
    margin: 6px 0 0 0;
    padding-left: 20px;
    list-style: disc;
    color: var(--text2);
}
.instr-sub > li { padding: 3px 0; }

/* Подсветка кода/url, цитат и пути */
.instr-code {
    display: inline-block;
    background: var(--gray5);
    color: var(--text);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    padding: 2px 7px;
    border-radius: 5px;
    word-break: break-all;
}
.instr-quote {
    display: inline;
    color: var(--accent);
    font-style: italic;
    font-weight: 500;
}
.instr-path {
    display: inline-block;
    background: rgba(45, 140, 240, 0.08);
    color: #1B5BAA;
    padding: 1px 7px;
    border-radius: 5px;
    font-weight: 500;
    font-size: 13px;
}

@media (max-width: 480px) {
    .modal-instruction { width: calc(100% - 12px); }
    .instruction-body  { padding: 14px 16px 18px; }
    .instr-h           { font-size: 14px; }
    .instr-list > li   { font-size: 13px; }
}

/* ============================================================
   ТЗ: Кнопка "Объединить" в строке гостя.
   Позиционируется через grid правилом .child-row > .child-merge-btn
   (третья колонка, вторая строка — под карандашом редактирования).
   Видна только когда выбрано ровно 2 гостя чекбоксами.
   ============================================================ */
.child-merge-btn {
    background: rgba(45, 140, 240, 0.10);
    border: 1px solid rgba(45, 140, 240, 0.35);
    color: var(--accent);
    cursor: pointer;
    width: 32px; height: 32px;
    border-radius: 8px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.child-merge-btn:hover  {
    /* ТЗ: при hover иконка ОСТАЁТСЯ синей (а не становится белой на синем фоне,
       где её было не видно). Фон чуть темнее, обводка ярче — кнопка визуально
       откликается, но иконка читается. */
    background: rgba(45, 140, 240, 0.18);
    border-color: var(--accent);
    color: var(--accent);
}
.child-merge-btn:active { opacity: 0.85; }
.child-merge-btn .icon  { width: 20px; height: 20px; }

/* ============================================================
   Попап "Объединить двух гостей"
   ============================================================ */
.modal-merge {
    max-width: 520px;
    width: calc(100% - 32px);
    padding: 0;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 60px);
}
.modal-merge .modal-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-merge .modal-title { font-size: 17px; font-weight: 700; text-align: left; }
.modal-merge .modal-close {
    background: transparent; border: 0; cursor: pointer;
    color: var(--text3); padding: 4px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
}
.modal-merge .modal-close:hover { background: var(--gray5); color: var(--text); }
.modal-merge .modal-close .icon { width: 22px; height: 22px; }
.modal-merge .modal-body { padding: 16px 18px; overflow-y: auto; }

.merge-hint {
    background: rgba(255, 215, 0, 0.10);
    border-left: 3px solid #F4A03A;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}
.merge-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--gray5);
}
.merge-row:last-of-type { border-bottom: 0; }
.merge-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 6px;
}
.merge-row-auto .merge-value {
    color: var(--text);
    font-size: 14px;
}
.merge-auto-hint {
    color: var(--text3);
    font-size: 12px;
    font-style: italic;
    margin-left: 6px;
}
.merge-row-choice .merge-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--gray4);
    border-radius: 8px;
    margin-top: 6px;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}
.merge-row-choice .merge-radio:has(input:checked) {
    border-color: var(--accent);
    background: rgba(45, 140, 240, 0.05);
}
.merge-row-choice .merge-radio input { margin: 0; }
.merge-row-choice .merge-radio span  { font-size: 14px; color: var(--text); }

.merge-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--gray5);
}

/* ============================================================
   ТЗ Фича #5: баннер "Найден(ы) предоплаченный(е) заказ(ы)" в register.php
   Появляется когда у найденного клиента есть оплаченные неиспользованные
   заказы в pay (оплата через бот/киоск без QR-сканирования, или несколько
   оплат с разных номеров на одного клиента).

   Структура (плоская — без "коробки в коробке"):
     • .reg-pending-order-title  — заголовок-надпись (без фона)
     • .reg-pending-order-hint   — подсказка
     • .reg-pending-order-card   — самостоятельная карточка заказа
        - .is-current-room       — заказ для текущего зала (зелёная)
        - .is-other-room         — заказ для другого зала (серая, кнопка
                                   приглушена, qr_resolve вернёт wrong_room)
   ============================================================ */
.reg-pending-order-banner {
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.reg-pending-order-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #1B5E20;
    font-size: 14px;
    padding: 0 2px;
}
.reg-pending-order-title .icon { width: 18px; height: 18px; }
.reg-pending-order-hint {
    color: var(--text2);
    font-size: 12px;
    line-height: 1.4;
    padding: 0 2px;
    margin-bottom: 4px;
}

/* Карточка заказа — самостоятельный элемент с обрамлением */
.reg-pending-order-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: #fff;
    border: 1px solid var(--gray5);
}
.reg-pending-order-card.is-current-room {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.10), rgba(76, 175, 80, 0.04));
    border-color: rgba(76, 175, 80, 0.45);
}
.reg-pending-order-card.is-other-room {
    background: var(--gray6);
    border-color: var(--gray4);
}
.reg-pending-order-card-info { flex: 1 1 auto; min-width: 0; }
.reg-pending-order-card-room {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.reg-pending-order-card.is-current-room .reg-pending-order-card-room { color: #1B5E20; }
.reg-pending-order-card.is-other-room   .reg-pending-order-card-room { color: var(--text2); }
.reg-pending-order-card-details {
    color: var(--text2);
    font-size: 13px;
    margin-top: 2px;
}
.reg-pending-order-card-names {
    color: var(--text);
    font-size: 13px;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reg-pending-order-card-paid {
    color: var(--text3);
    font-size: 11px;
    margin-top: 2px;
}

/* Кнопка "Применить" */
.reg-pending-order-apply {
    flex-shrink: 0;
    background: #4CAF50;
    color: #fff;
    padding: 8px 16px;
    font-size: 14px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.reg-pending-order-apply:hover  { background: #43A047; }
.reg-pending-order-apply:active { background: #388E3C; }
.reg-pending-order-apply:disabled { opacity: 0.6; cursor: not-allowed; }

/* Кнопка на карточке другого зала — приглушена. Оператор всё ещё может
   её нажать (если клиент уверен), но qr_resolve вернёт wrong_room. */
.reg-pending-order-card.is-other-room .reg-pending-order-apply {
    background: var(--gray2);
}
.reg-pending-order-card.is-other-room .reg-pending-order-apply:hover  { background: var(--gray); }
.reg-pending-order-card.is-other-room .reg-pending-order-apply:active { background: var(--text3); }

@media (max-width: 480px) {
    .reg-pending-order-card { flex-direction: column; align-items: stretch; gap: 8px; }
    .reg-pending-order-apply { width: 100%; }
}

/* ============================================================
   ТЗ Фича #2: галерея фото — звезда "главное" и кнопка кропа
   ============================================================ */
.photo-card-main { box-shadow: 0 0 0 2px var(--accent), 0 2px 4px rgba(0,0,0,0.08); }
.btn-photo-star {
    color: var(--text3);
    font-size: 20px;
}
.btn-photo-star.is-main { color: #FFB300; }
.btn-photo-star:hover { color: #FFB300; }
.btn-photo-crop {
    /* Чёрная иконка — как у обычных кнопок (карандаш ✏, корзина 🗑).
       Раньше `--accent` была undefined и color наследовался от body (чёрный);
       после фикса --accent кнопка стала синей. Возвращаем явный цвет. */
    color: var(--text);
    font-size: 16px;
}

/* ============================================================
   ТЗ Фича #2: редактор кропа аватарки
   ============================================================ */
.modal-crop {
    max-width: 380px;
    width: calc(100% - 32px);
    padding: 0;
    display: flex;
    flex-direction: column;
}
.modal-crop .modal-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray5);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-crop .modal-title { font-size: 16px; font-weight: 700; text-align: left; }
.modal-crop .modal-close {
    background: transparent; border: 0; cursor: pointer;
    color: var(--text3); padding: 4px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
}
.modal-crop .modal-close:hover { background: var(--gray5); color: var(--text); }
.modal-crop .modal-close .icon { width: 22px; height: 22px; }

.crop-body { padding: 12px 16px 16px; }
.crop-hint {
    font-size: 12px;
    color: var(--text3);
    text-align: center;
    margin-bottom: 12px;
}
.crop-stage {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    overflow: hidden;
    background: #000;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage #crop-img {
    position: absolute;
    max-width: none;        /* отменяем потенциальное ограничение от родителя */
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;   /* drag ловит стейдж */
}
.crop-stage .crop-mask {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* Круглое окно: всё внутри круга прозрачно, снаружи — затемнение */
    background: radial-gradient(circle 150px at center,
                                transparent 149px, rgba(0,0,0,0.55) 150px);
    /* Тонкая белая обводка круга поверх */
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
    border-radius: 0;
}
.crop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

/* ============================================================
   ТЗ Фича #3: кнопка печати рядом с аватаркой в шапке player.php
   ============================================================ */
.player-avatar-wrap {
    position: relative;
    display: inline-block;
}
.player-print-avatar-btn {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    /* Стиль 1:1 с .modal-photo-print-btn: серый фон + тёмная иконка в покое,
       синий фон + белая иконка при hover. */
    background: var(--gray5);
    color: var(--text2);
    border: 1px solid var(--gray4);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 0;
    transition: background 0.12s, color 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.player-print-avatar-btn .icon { width: 20px; height: 20px; }
.player-print-avatar-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 3px 10px rgba(45, 140, 240, 0.45);
}
.player-print-avatar-btn:active {
    transform: scale(0.95);
    background: #1B5BAA;
}

/* ============================================================
   ТЗ Bug 1: inline-форма редактирования комментария к фото —
   разворачивается под названием фото (вместо страшного browser prompt).
   ============================================================ */
.photo-comment-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    padding: 8px;
    background: var(--gray6);
    border-radius: 6px;
}
.photo-comment-input {
    border: 1px solid var(--gray4);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    color: var(--text);
}
.photo-comment-input:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(45, 140, 240, 0.15);
}
.photo-comment-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}
.photo-comment-actions .btn { padding: 5px 12px; font-size: 13px; }

/* ============================================================
   ТЗ Фича #3: кнопка печати в попапе редактирования гостя (child-modal)
   слева от аватарки. Стиль яркий и видимый — синий фон, белая иконка,
   тёмно-синий при hover.
   ============================================================ */
.modal-photo-wrap {
    /* Блочный wrapper с центрированием — иначе аватарка съезжает влево из-за
       того что внутри стало inline-block. Сохраняет центрирование как было
       у .modal-photo-preview { margin: 0 auto } раньше. */
    position: relative;
    width: 88px;
    margin: 0 auto 6px;
}
.modal-photo-wrap .modal-photo-preview {
    /* margin теперь у wrapper'а, превью просто заполняет его */
    margin: 0;
}
.modal-photo-print-btn {
    position: absolute;
    /* Слева от аватарки, по центру вертикально */
    left: -48px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    /* Неактивное состояние — серый фон, тёмная иконка (тоже видно, но
       без агрессивного синего). При hover/active — становится синей. */
    background: var(--gray5);
    color: var(--text2);
    border: 1px solid var(--gray4);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    z-index: 2;
    transition: background 0.12s, color 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.modal-photo-print-btn .icon { width: 22px; height: 22px; }
.modal-photo-print-btn[hidden] { display: none !important; }   /* HTML-атрибут hidden побеждает display:inline-flex */
.modal-photo-print-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 3px 10px rgba(45, 140, 240, 0.45);
}
.modal-photo-print-btn:active {
    transform: translateY(-50%) scale(0.95);
    background: #1B5BAA;
}

/* ============================================================
   ТЗ Фича #3: кнопка печати в галерее (в списке кнопок фото).
   ============================================================ */
.btn-photo-print {
    color: var(--accent);
}
.btn-photo-print .icon { width: 18px; height: 18px; }
.btn-photo-print:hover { color: var(--accent); background: var(--gray5); }

/* ============================================================
   ТЗ: логотип на странице входа — картинка the_marge_rooms.png
   вместо текстового THE/Мардж/Rooms. Сохраняем те же размеры
   и центрирование что и у текстового варианта.
   ============================================================ */
.login-logo-image {
    background: transparent;
    border-radius: 0;
    padding: 0;
}
.login-logo-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ============================================================
   ТЗ Биометрия: passwordless экран (большая кнопка "Вход")
   ============================================================ */
.login-form-bio {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
}
.login-bio-greeting {
    color: var(--text2);
    font-size: 14px;
    margin-top: 4px;
}
.btn-bio-big {
    /* Крупная кнопка для одного жеста */
    font-size: 18px;
    padding: 16px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-bio-big .icon { width: 26px; height: 26px; }

/* Экран "Включить вход без пароля" */
.bio-prompt-text {
    text-align: center;
    margin-bottom: 16px;
}
.bio-prompt-text h2 {
    font-size: 22px;
    margin: 0 0 8px;
    color: var(--text);
}
.bio-prompt-text p {
    font-size: 15px;
    color: var(--text2);
    margin: 0;
    line-height: 1.4;
}

/* ============================================================
   ТЗ Биометрия: баннер установки PWA внизу экрана
   ============================================================ */
.pwa-install-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #2156b9;
    color: #fff;
    padding: 20px;
    z-index: 9999;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    box-sizing: border-box;
}
.pwa-install-banner[hidden] { display: none; }
.pwa-install-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}
.pwa-install-hint {
    font-size: 15px;
    line-height: 1.5;
}
.pwa-install-btn,
.pwa-install-copy {
    background: #fff;
    color: #2156b9;
    border: 0;
    border-radius: 6px;
    padding: 14px 20px;
    font-size: 17px;
    font-weight: 700;
    margin-top: 12px;
    cursor: pointer;
    display: block;
    width: 100%;
    box-sizing: border-box;
}
.pwa-install-btn[hidden],
.pwa-install-copy[hidden] { display: none; }
.pwa-install-btn:hover { background: #f0f4ff; }

/* ============================================================
   ТЗ: единое управление видимостью пяти экранов login.php.
   Все пять page по умолчанию СКРЫТЫ. inline-script в login.php ставит
   на <html> один из классов и тем самым показывает нужный экран:
     .show-login-form    → видна форма логин/пароль
     .show-bio-only      → виден passwordless (большая кнопка Вход)
     .show-bio-prompt    → виден экран "Включить вход без пароля"
     .show-tablet-login  → видна форма входа по 6-значному коду (?tablet=1)
     .require-standalone → ФОРМЫ ВХОДА скрыты (login, bio, tablet), виден
                           блок #page-rs-stub с логотипом и ссылками
                           Инструкция / Регистрация. Это блокировка входа
                           из обычной вкладки браузера (не из PWA). При
                           этом #page-register НЕ принудительно скрыт —
                           регистрация работает и в браузере, оператор
                           создаёт аккаунт, потом ставит ярлык и заходит.
                           Когда оператор открыл форму регистрации в
                           require-standalone, на <html> ставится класс
                           .register-open — он скрывает stub и pwa-banner,
                           чтобы UI не загромождался.
   Никакого initial-flash. Чтобы быть устойчиво — !important перебивает
   старые правила .page.hidden (которые остались для совместимости).
   ============================================================ */
.login-screen #page-login,
.login-screen #page-bio-only,
.login-screen #page-bio-prompt,
.login-screen #page-tablet-login,
.login-screen #page-rs-stub {
    display: none !important;
}
html.show-login-form   .login-screen #page-login,
html.show-bio-only     .login-screen #page-bio-only,
html.show-bio-prompt   .login-screen #page-bio-prompt,
html.show-tablet-login .login-screen #page-tablet-login {
    display: flex !important;
    flex-direction: column;
}

/* В режиме планшета прячем «Регистрация»/«Инструкция» — там это не нужно
   (один общий планшет, регистрация и установка PWA производятся не с него). */
html.show-tablet-login .login-screen #page-register,
html.show-tablet-login .pwa-install-banner {
    display: none !important;
}

/* require-standalone: блокировка ФОРМ ВХОДА из обычной вкладки браузера.
   Регистрация (#page-register) намеренно НЕ в списке — управляется через
   .hidden как обычно; по умолчанию hidden, при клике "Регистрация" в stub
   JS уберёт .hidden и форма станет видна. */
html.require-standalone .login-screen #page-login,
html.require-standalone .login-screen #page-bio-only,
html.require-standalone .login-screen #page-bio-prompt,
html.require-standalone .login-screen #page-tablet-login {
    display: none !important;
}

/* В require-standalone виден stub-блок (логотип + ссылки) и pwa-баннер. */
html.require-standalone .login-screen #page-rs-stub {
    display: flex !important;
    flex-direction: column;
}
html.require-standalone .pwa-install-banner {
    display: block !important;
}

/* Когда форма регистрации открыта (в require-standalone оператор кликнул
   "Регистрация") — скрываем stub и баннер. Иначе сверху лого, посреди
   форма, снизу баннер — слишком много. Класс .register-open ставит и
   снимает JS (openRegister/openLogin). */
html.register-open .login-screen #page-rs-stub,
html.register-open .pwa-install-banner {
    display: none !important;
}

/* Ссылки "Инструкция · Регистрация" в stub-блоке: центрируем под лого,
   разделитель — точка. login-footer и так задаёт нужный отступ сверху;
   .rs-stub-links — для возможного будущего тюнинга, сейчас без своих
   стилей (наследует от .login-footer). */
.rs-stub-sep {
    opacity: 0.5;
    margin: 0 4px;
}

/* Крупное поле ввода 6-значного кода: укрупнённый шрифт + межбуквенный
   интервал = ощущение «полосок под цифры». Центрируем содержимое.
   Шрифт моноширинный, чтобы все цифры были одной ширины (без скачков
   при наборе). */
.tablet-pass-field {
    font-size: 32px;
    letter-spacing: 12px;
    text-align: center;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    padding-left: 16px;
    padding-right: 4px;            /* визуальная компенсация letter-spacing справа */
    font-variant-numeric: tabular-nums;
}
.tablet-pass-field::placeholder {
    letter-spacing: 10px;
    color: var(--gray, #c5c5c7);
}

/* ===================================================================
   ИНДИВИДУАЛЬНЫЕ ТАЙМЕРЫ В РАЗВЁРНУТОМ СПИСКЕ ГРУППЫ
   =================================================================== */

/* Индивидуальный таймер справа от имени гостя — компактный, наследует
   .timer-end (цвет/фон через .paused / .expired). Чуть меньше группового. */
.timer-end.timer-end-individual {
    font-size: 16px;
    padding: 2px 7px;
}

/* Мелкая красная подпись под главным таймером группы:
   "выход группы HH:MM" — показывается когда у группы расхождение
   во времени окончания между гостями. */
.group-end-hint {
    color: var(--red);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    display: block;
    margin: 2px 0;
}

/* Пилюли состояния в строке гостя (слева внизу под именем).
   "время вышло" / "пауза". */
.pill-state {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    padding: 2px 7px;
    border-radius: 6px;
    text-transform: lowercase;
    letter-spacing: 0.2px;
}
.pill-state.pill-expired {
    color: var(--red);
    background: #FFE9E7;
}
.pill-state.pill-paused {
    color: var(--green);
    background: #E8F8EC;          /* светло-зелёный фон под цвет паузы */
}

/* ===================================================================
   КНОПКА ИНДИВИДУАЛЬНОЙ ПАУЗЫ В player.php (внутри .player-child-action,
   третьей иконкой под "вышел"). Только иконка, без текста, малый отступ.
   Раскладку .player-child-action не дублируем - определена выше (строка ~1461).
   =================================================================== */
.player-child-pause-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--gray4);
    border-radius: 8px;
    background: var(--gray7);
    color: var(--text2);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s;
}
.player-child-pause-icon:hover {
    background: var(--gray6);
}
.player-child-pause-icon.act-resume {
    /* Гость на паузе - кнопка возобновления зелёная (как групповая act-resume). */
    color: var(--green);
    border-color: var(--green);
    background: #E8F8EC;
}

/* ===================================================================
   .timer-card-group.has-group-end - расширение карточки под подпись
   "выход группы HH:MM" чтобы не перекрывала "с HH:MM".
   =================================================================== */
/* НОВАЯ структура шапки timer-card-group: 2 колонки.
   Левая (.timer-group-head-left): имя сверху, под ним бейдж + chevron.
   Правая (.timer-end-wrap): таймер-блок (19:47 / выход группы / с 17:49).
   timer-end-wrap в обычном flow - карточка растягивается под содержимое
   автоматически, без min-height хаков и без absolute трюков. */
.timer-card-group .timer-group-head {
    display: flex;
    align-items: flex-start;     /* обе колонки прижаты к верху */
    gap: 6px;
    padding: 0;                  /* отступы берутся от .timer-card */
}

/* Одиночный таймер: та же 2-колонная структура что и у group, для единообразия.
   Левая колонка - имя, примечания/пилюли, бейдж. Правая - timer-end-wrap. */
.timer-single-head {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.timer-single-head-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;     /* чтобы пилюли/бейдж не растягивались на всю ширину */
    gap: 4px;
}
/* timer-names-wrap должен оставаться на всю ширину (имя может быть длинным) */
.timer-single-head-left .timer-names-wrap {
    align-self: stretch;
}
/* singleExtras внутри left-col имеют свои margin - сбросим лишние,
   чтобы gap у column работал предсказуемо. */
.timer-single-head-left .timer-single-primeta,
.timer-single-head-left .timer-pill-line {
    margin-top: 0;
}
/* Пилюли внутри single-head-left должны быть только по content-width.
   Из-за того что .timer-pill-line - block div, в flex column он растягивается
   на всю ширину - надо явно ограничить. */
.timer-single-head-left .timer-pill-line,
.timer-single-head-left .timer-badge,
.timer-single-head-left .timer-single-primeta {
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100%;
}
.timer-card-group .timer-group-head-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.timer-card-group .timer-group-head-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
/* .timer-card-group .timer-end-wrap - наследует от общего правила .timer-end-wrap */

