*{box-sizing:border-box}body{margin:0;background:#0d1117;color:#e6edf3;font:16px system-ui;min-height:100dvh}#login{width:min(420px,92vw);margin:12vh auto;padding:24px;background:#161b22;border:1px solid #30363d;border-radius:16px}h1{margin-top:0}input,textarea{width:100%;padding:12px;border-radius:10px;border:1px solid #30363d;background:#0d1117;color:inherit;font:inherit;margin:8px 0}button{border:1px solid #51418b;background:#6750a4;color:white;padding:10px 14px;border-radius:10px;font:inherit;cursor:pointer}button:disabled{opacity:.5}main{height:100dvh;display:flex;flex-direction:column;max-width:1000px;margin:auto;padding:12px;gap:10px}header{display:flex;gap:8px;align-items:center;flex-wrap:wrap}header strong{font-size:1.2rem;margin-right:auto}#feed{flex:1;overflow:auto;background:#161b22;border:1px solid #30363d;border-radius:14px;padding:12px}.m{padding:12px;margin:8px 0;background:#21262d;border-radius:12px;overflow-wrap:anywhere}.m pre{white-space:pre-wrap}.k{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}footer{display:flex;gap:8px;align-items:flex-end}footer textarea{flex:1;resize:vertical;max-height:35vh}
/* Выпадающий список команд запуска /start1../start10 */
footer select{padding:10px 6px;border-radius:10px;border:1px solid #30363d;background:#0d1117;color:inherit;font:inherit;cursor:pointer;min-width:96px}#toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:#30363d;padding:10px 16px;border-radius:20px;opacity:0;pointer-events:none}#toast.on{opacity:1}#err{color:#ff7b72}
/* Раскладка кнопок как в Telegram */
.k {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 6px;
}

.k-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
}

.k-row > button,
.k-row > a {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Стили кнопок, переданные непосредственно из Telegram-бота */
.k-row > button.success,
.k-row > a.success {
    background: #238636;
    border-color: #2ea043;
    color: #fff;
}

.k-row > button.danger,
.k-row > a.danger {
    background: #da3633;
    border-color: #f85149;
    color: #fff;
}

.k-row > button.primary,
.k-row > a.primary {
    background: #2f81f7;
    border-color: #388bfd;
    color: #fff;
}

.k-row > button:active {
    filter: brightness(.85);
}


/* Превью изображений */
.pv {
    margin-top: 8px;
}

.pvbox {
    width: 100%;
    max-height: 380px;
    min-height: 100px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: #0d1117;
    cursor: zoom-in;
}

.pvbox.open {
    max-height: none;
    cursor: zoom-out;
}

.pvbox img {
    display: block;
    max-width: 100%;
    max-height: 360px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform .2s;
}

.pvbox.open img {
    max-height: 75vh;
}

.pvbar {
    display: flex;
    gap: 7px;
    align-items: center;
    margin-top: 7px;
}

.pvbar button {
    min-width: 42px;
    padding: 5px 12px;
    font-size: 19px;
    line-height: 1.2;
}

.pvbar a {
    margin-left: auto;
    color: #8bafff;
    font-size: 13px;
    text-decoration: none;
}


/* Полноэкранный просмотр фото */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3vh 3vw;
    background: rgba(0, 0, 0, .94);
    cursor: zoom-out;
}

.lightbox-img {
    display: block;
    max-width: 94vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 12px;
    right: 18px;
    z-index: 1;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #30363d;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
}

.auto-link {
    color: #8bafff;
    text-decoration: underline;
    overflow-wrap: anywhere;
}

.phone-copy {
    cursor: pointer;
    border-bottom: 1px dashed #8bafff;
    user-select: all;
}

.phone-copy::after {
    content: ' ⧉';
    color: #8bafff;
    font-size: .85em;
}


/* Полноэкранный просмотр фото через HTML dialog */
dialog.photo-dialog {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    background: rgba(0, 0, 0, .96) !important;
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
}

dialog.photo-dialog[open] {
    display: flex !important;
}

dialog.photo-dialog::backdrop {
    background: rgba(0, 0, 0, .96);
}

.photo-dialog-img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 96vw !important;
    max-height: 92vh !important;
    object-fit: contain;
}

.photo-dialog-close {
    position: absolute !important;
    top: 12px !important;
    right: 14px !important;
    z-index: 2;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    background: #30363d;
    color: white;
    font-size: 34px;
    line-height: 1;
}


/* Полноэкранное увеличение фото */
dialog.photo-dialog {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    background: rgba(0, 0, 0, .97) !important;
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
}

dialog.photo-dialog[open] {
    display: flex !important;
}

dialog.photo-dialog::backdrop {
    background: rgba(0, 0, 0, .97);
}

.photo-dialog-img {
    display: block;
    width: 96vw !important;
    height: 92vh !important;
    height: 92dvh !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    user-select: none;
}

.photo-dialog-close {
    position: absolute !important;
    top: max(12px, env(safe-area-inset-top)) !important;
    right: max(14px, env(safe-area-inset-right)) !important;
    z-index: 2;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid #777;
    border-radius: 50%;
    background: #30363d;
    color: white;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
}

/* Анимация нажатия кнопок */
button,
.k-row > a {
    transition:
        transform .12s ease,
        filter .12s ease,
        opacity .12s ease,
        box-shadow .12s ease;
    -webkit-tap-highlight-color: transparent;
}

button:active,
.k-row > a:active {
    transform: scale(.96);
    filter: brightness(.78);
}

button:focus-visible,
.k-row > a:focus-visible {
    outline: 2px solid #8bafff;
    outline-offset: 2px;
}

.k-row > button.is-loading {
    opacity: .65;
    filter: brightness(.8);
    transform: scale(.97);
    cursor: wait;
}

button:disabled {
    cursor: wait;
}

/* Масштабирование фотографии в полноэкранном просмотре */
dialog.photo-dialog {
    overscroll-behavior: contain;
}
dialog.photo-dialog .photo-dialog-img {
    transform-origin: center center !important;
    transition: none !important;
    touch-action: none !important;
    user-select: none;
    -webkit-user-drag: none;
}

/* Кнопки поворота в полноэкранном просмотре */
.photo-dialog-tools {
    position: fixed;
    z-index: 5;
    left: 50%;
    bottom: max(22px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
}

.photo-dialog-tools button {
    width: 52px;
    height: 52px;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 50%;
    background: rgba(35,35,35,.85);
    color: white;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-dialog-tools button:active {
    background: rgba(100,100,100,.95);
}
