/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
    color: #222;
    font-size: 1em;
    line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
    background: #b3d4fc;
    text-shadow: none;
}

::selection {
    background: #b3d4fc;
    text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #ccc;
    margin: 1em 0;
    padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
    vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
    resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* Flexbox containers */
.container-xflex {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Header parts */
.header-left {
    cursor: pointer;
}

.header-center {
    flex-grow: 1;
    text-align: center;
    cursor: pointer;
}

.header-right {
    cursor: pointer;
}

/* Modal styles */
.confirm-dialog-container,
.popup-container {
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    z-index: 1000;
}

.confirm-dialog-container {
    position: fixed;
    height: 100%;
    align-items: center;
}

.popup-container {
    position: absolute;
    min-height: 100%;
    align-items: flex-start;
    box-sizing: border-box;
    padding: 16px;
}

/* Unlike ordinary page popups, a touch context menu is centered in the visible viewport. */
.popup-container.context-menu-popup {
    position: fixed;
    min-height: 100dvh;
    align-items: center;
}

.popup-container.context-menu-popup-positioned {
    display: block;
    padding: 0;
}

.context-menu-popup .popup-content {
    width: min(320px, calc(100% - 32px));
}

.confirm-dialog-box,
.popup-content {
    background-color: white;
    padding: 64px 20px 20px;
    border-radius: 5px;
    box-sizing: border-box;
    position: relative;
    text-align: center;
}

.confirm-dialog-box {
    width: min(400px, calc(100% - 32px));
    max-height: calc(100dvh - 32px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 20px 20px;
}

.confirm-dialog-box > p {
    min-height: 36px;
    margin: 0 44px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-content {
    width: min(400px, 100%);
}

.popup-content > .container-a {
    width: 100%;
    height: auto;
    overflow: visible;
    padding: 0;
    box-shadow: none;
}

.popup-content .blog-as-messages,
.popup-content .button,
.popup-content .inputField {
    box-sizing: border-box;
    max-width: 100%;
}

.popup-content .blog-as-messages {
    min-width: 0;
    width: 100%;
    overflow-wrap: anywhere;
}

.popup-content .inputField {
    width: calc(100% - 20px);
}

.confirm-dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 0;
}

.confirm-dialog-buttons button {
    flex: 1;
    max-width: 150px;
    min-height: 48px;
    padding: 10px 18px;
    border: 1px solid #c9ccd3;
    border-radius: 8px;
    background: #f4f5f7;
    font-size: 17px;
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
    display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
    border: 0;
    clip: rect(0, 0, 0, 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
    /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
    clip: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    position: static;
    white-space: inherit;
    width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
    visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
    content: "";
    display: table;
}

.clearfix::after {
    clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
    /* Style adjustments for viewports that meet the condition */
}

@media print,
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 1.25dppx),
(min-resolution: 120dpi) {
    /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
    *,
    *::before,
    *::after {
        background: #fff !important;
        color: #000 !important;
        /* Black prints faster */
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }

    abbr[title]::after {
        content: " (" attr(title) ")";
    }

    /*
     * Don't show links that are fragment identifiers,
     * or use the `javascript:` pseudo protocol
     */
    a[href^="#"]::after,
    a[href^="javascript:"]::after {
        content: "";
    }

    pre {
        white-space: pre-wrap !important;
    }

    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }

    tr,
    img {
        page-break-inside: avoid;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }
}

/** {*/
/*    outline: 1px solid red; !* Временная рамка для диагностики *!*/
/*  }*/

html, body {
    height: 100dvh; /* Устанавливаем высоту для html и body на 100% */
    max-width: 100vw;
    margin: 0; /* Убираем отступы */
    padding: 0; /* Убираем поля */
    box-sizing: border-box; /* Обеспечиваем учет padding и border в размерах элемента */
}

/* Фон для всей страницы */
body {
    font-family: Arial, sans-serif;
    /* min-height: 100dvh; /* Используем dynamic viewport height вместо vh */
    display: flex; /* Flexbox для центрирования */
    justify-content: center; /* Центрируем по горизонтали */
    align-items: center; /* Центрируем по вертикали */
    background: linear-gradient(135deg, #efe2ff 0%, #e9e3ff 50%, #ddf2ff 100%);
}

.page-container {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;

    display: flex; /* Flexbox для центрирования */
    justify-content: center; /* Центрируем по горизонтали */
}

.page-shell {
    position: relative;
    width: min(400px, 100%);
    height: 100%;
}

.page-shell > .container-a,
.page-shell > .container-a1a {
    width: 100%;
}

.page-shell.with-navigation > .container-a {
    padding-top: 60px;
}

.page-shell.with-navigation > .studio-page-workspace {
    margin-top: 60px;
    height: calc(100% - 60px);
    padding-top: 10px;
    overscroll-behavior-y: contain;
}

.page-shell:has(.studio-text-block-editing) > .studio-page-workspace {
    position: fixed;
    inset: 0;
    z-index: 3;
    width: min(400px, 100%);
    max-width: 400px;
    height: auto;
    margin: 0 auto;
}

.page-shell:has(.studio-text-block-editing) > .navigation-button,
.page-shell:has(.studio-text-block-editing) #studio-page-title {
    visibility: hidden;
}

/* Keep chat layout inside the keyboard's visual viewport instead of relying on native focus panning. */
.page-shell > .chat-workspace {
    position: fixed;
    inset: 0;
    z-index: 1;
    width: min(400px, 100%);
    max-width: 400px;
    height: auto;
    margin: 0 auto;
}

/* The header is not a scrollport; letting iOS pan from it moves the document behind the fixed Chat. */
#chat_header {
    touch-action: none;
}

.infinite-scroll-host {
    position: relative;
}

#chat_infScroll {
    overscroll-behavior-y: contain;
}

.studio-page-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.studio-page-content-editable:not(:has(.studio-text-block-editing)) {
    box-sizing: border-box;
    padding-bottom: 72px;
}

.studio-text-add-button[hidden],
.studio-text-return-button[hidden] {
    display: none;
}

.studio-text-return-layer {
    position: fixed;
    inset: 0;
    z-index: 4;
    width: min(400px, 100%);
    max-width: 400px;
    height: auto;
    margin: 0 auto;
    pointer-events: none;
}

.button.studio-text-return-button {
    pointer-events: auto;
    font-size: 28px;
}

.studio-text-block {
    position: relative;
    min-width: 0;
    overflow-wrap: anywhere;
}

.studio-text-surface {
    border-radius: 12px;
    border: 2px solid transparent;
    padding: 10px;
    background: rgba(255, 255, 255, 0.82);
}

.studio-text-block-editing .studio-text-surface {
    background: #e2f2ff;
    border-color: #659bba;
}

.studio-text-value {
    white-space: pre-wrap;
    min-height: 1.4em;
}

.studio-text-block textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 1.45em;
    padding: 0;
    border: 0;
    outline: none; /* The rounded editing surface is the focus indicator. */
    background: transparent;
    font: inherit;
    line-height: 1.45;
    resize: none;
    overflow: clip;
    touch-action: pan-y; /* A drag over the editor scrolls the Page, not the native textarea. */
}

.studio-text-controls {
    z-index: 2;
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.studio-text-actions,
.studio-text-moves {
    display: flex;
    gap: 8px;
}

.studio-text-actions { margin-left: auto; }

.studio-text-controls-offscreen {
    visibility: hidden;
    pointer-events: none;
}

.studio-text-moves[hidden] { display: none; }

.studio-text-actions button,
.studio-text-moves button {
    border: 1px solid #7293ad;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #f6edff, #d2ecfc);
    color: #1d4057;
    font-size: 1.4rem;
    cursor: pointer;
}

.studio-text-error { color: #a31515; }

.page-shell.with-navigation > .container-a1a .container-xflex {
    min-height: 60px;
}

.header-left-spacer,
.header-right {
    width: 48px;
    text-align: center;
}

.folder-list-header {
    justify-content: flex-start;
    box-sizing: border-box;
    padding-left: 60px;
}

.folder-list-header .folder-title-button {
    flex-grow: 0;
    max-width: calc(100% - 10px);
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}

#studio-folder-title:not(.folder-title-button) {
    cursor: default;
}

.page-layer {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    grid-template-rows: 60px minmax(0, 1fr);
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #efe2ff 0%, #e9e3ff 50%, #ddf2ff 100%);
}

.page-layer-header {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    padding-left: 60px;
}

.page-layer-header h1 {
    overflow: hidden;
    margin: 0;
    padding: 0 10px;
    font-size: 1rem;
    font-weight: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-layer-content {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.page-layer-content > .container-a {
    width: 100%;
    height: auto;
    min-height: 100%;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
}

.container-h {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

#studio-folder-settings-name-row,
#studio-folder-settings-edit-row,
#studio-page-settings-name-row,
#studio-page-settings-edit-row {
    width: 100%;
}

#studio-folder-settings-name-row > .blog-as-messages,
#studio-page-settings-name-row > .blog-as-messages {
    flex: 1;
    min-width: 0;
}

#studio-folder-settings-edit-row > div:first-child,
#studio-page-settings-edit-row > div:first-child {
    flex: 1;
    min-width: 0;
}

#studio-folder-settings-edit-row .inputField,
#studio-page-settings-edit-row .inputField {
    box-sizing: border-box;
    width: 100%;
    margin-right: 0;
    margin-left: 0;
}

#studio-folder-settings-edit-button,
#studio-folder-settings-rename-confirm-button,
#studio-folder-settings-rename-cancel-button,
#studio-page-settings-edit-button,
#studio-page-settings-rename-confirm-button,
#studio-page-settings-rename-cancel-button {
    flex: 0 0 44px;
    width: 44px;
    text-align: center;
}

#studio-folder-settings-rename-error,
#studio-page-settings-rename-error {
    min-width: 0;
    background: transparent;
    color: #a31515;
}

#studio-folder-settings-delete-button,
#studio-page-settings-delete-button {
    margin-top: auto;
    border-color: rgba(170, 25, 25, 0.42);
    color: #a31515;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    cursor: pointer;
}

.checkbox input {
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: #526fc7;
}

.page-shell.page-layer-open > :not(.page-layer) {
    pointer-events: none;
    user-select: none;
}

.paper-1 {
    background-image: url('../img/pattern3.png'); /* URL изображения для узора */
    background-repeat: repeat; /* Повторение узора */
    background-size: 150px 150px; /* Размер узора, можно настроить */
    background-color: rgba(255, 255, 255, 0.9); /* Полупрозрачный белый фон для контейнера */
}

.paper-2 {
    /*background-image: url('../img/pattern3.png'); !* URL изображения для узора *!*/
    /*background-repeat: repeat; !* Повторение узора *!*/
    /*background-size: 150px 150px; !* Размер узора, можно настроить *!*/
    background-color: transparent;
}

.container-a1a {
    max-width: 400px;
    width: 100%;
    height: 100%;

    display: grid;
    grid-template-rows: auto 1fr auto auto auto;

    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.container-1a {
    max-width: 400px;
    width: 100%;
    height: 100%;

    display: grid;
    grid-template-rows: 1fr auto auto auto;

    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.container-a {
    width: 400px;
    height: 100%;
    overflow-y: auto;

    display: flex;
    flex-direction: column; /* Располагаем элементы вертикально */

    padding: 10px;
    /*box-sizing: content-box; !* Считаем padding в размер элемента *!*/
    box-sizing: border-box; /* Обеспечиваем учет padding и border в размерах элемента */
    border-radius: 10px; /* Закругленные углы */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Легкая тень для контейнера */
}

/* Контейнер с сообщениями */
.container-yflex {
    width: 100%;
    min-height: 0; /* Минимальная высота 0, чтобы работать с flex-grow */
    overflow-y: auto;
    /* Скрываем скроллбар в разных браузерах */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */

    padding: 10px;
    box-sizing: border-box; /* Обеспечиваем учет padding и border в размерах элемента */

    /* Virtualized container needs to be flex */
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Скрываем скроллбар для WebKit браузеров (Chrome, Safari) */
.container-yflex::-webkit-scrollbar {
    display: none;
}

/* Notification badge */
.notification-badge {
    position: absolute;
    top: 7px;
    right: 7px;
    background-color: green;
    color: white;
    border-radius: 10px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    padding: 0 5px;
    min-width: 8px; /* Минимальная ширина для случаев с одной цифрой */
    box-sizing: border-box;
    text-align: center;
}

.button-with-notification {
    position: relative;
}

/* Virtualization components */

.infinite-scroll-underlay {
    height: 100000px;
    position: relative;
    min-height: 100000px;
    overflow-anchor: none; /* Prevent Desktop Chrome from autocorrecting scroll position */
}

.infinite-scroll-messages-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 2px;
    position: absolute;
    left: 0;
}

#studio-folder-list_infContainer:has(> #LAST_LIST_MARKER) {
    padding-bottom: 64px;
    box-sizing: border-box;
}

.button.floating-list-action {
    position: absolute;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 3;
    width: 54px;
    height: 54px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    line-height: 1;
    text-align: center;
    color: #25332d;
    border-color: rgba(91, 69, 145, 0.42);
    background: linear-gradient(135deg, #d7a9ff 0%, #b8baff 48%, #84d6ff 100%);
    box-shadow: 0 8px 22px rgba(75, 72, 145, 0.28);
}

/* The Studio add action expands left while its close button stays where the original + was. */
#studio-create-menu.floating-action-menu {
    position: fixed;
    min-height: 100dvh;
    padding: 0;
    background: transparent;
}

#studio-create-menu .popup-content {
    position: absolute;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    width: 166px;
    height: 54px;
    padding: 4px 58px 4px 4px;
    overflow: hidden;
    border: 1px solid rgba(91, 69, 145, 0.42);
    border-radius: 27px;
    background: linear-gradient(135deg, #d7a9ff 0%, #b8baff 48%, #84d6ff 100%);
    box-shadow: 0 8px 22px rgba(75, 72, 145, 0.28);
    animation: studio-create-menu-expand 150ms ease-out;
}

#studio-create-menu .popup-content > .container-h {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 98px;
    height: 46px;
}

#studio-create-menu .popup-content > .navigation-button {
    top: -1px;
    right: -1px;
    left: auto;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

#studio-create-folder-choice-button,
#studio-create-page-choice-button {
    flex: 0 0 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    text-align: center;
}

#studio-create-folder-choice-button::before,
#studio-create-page-choice-button::before {
    font-size: 25px;
    line-height: 1;
}

#studio-create-folder-choice-button::before {
    content: "📁";
}

#studio-create-page-choice-button::before {
    content: "📄";
}

@keyframes studio-create-menu-expand {
    from { width: 54px; }
    to { width: 166px; }
}

@media (prefers-reduced-motion: reduce) {
    #studio-create-menu .popup-content {
        animation: none;
    }
}

#studio-create-folder-error,
#studio-create-page-error {
    color: #a52222;
    min-height: 1.2em;
}

#studio-create-folder-error:empty,
#studio-create-page-error:empty {
    min-height: 0;
}

#studio-folder-list_infContainer > .button[id^="studio-folder-"]::before,
#studio-folder-list_infContainer > .button[id^="studio-page-"]::before {
    display: inline-block;
    margin-right: 8px;
    font-size: 1.35em;
    line-height: 1;
    vertical-align: -0.08em;
}

#studio-folder-list_infContainer > .button[id^="studio-folder-"]::before {
    content: "📁";
}

#studio-folder-list_infContainer > .button[id^="studio-page-"]::before {
    content: "📄";
}

#studio-page-title {
    position: absolute;
    top: 10px;
    left: 60px;
    z-index: 2;
    box-sizing: border-box;
    width: auto;
    max-width: calc(100% - 70px);
    height: 40px;
    margin: 0;
    padding: 8px 10px;
    overflow: hidden;
    border-color: transparent;
    background: transparent;
    font-size: 1.15rem;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scroll visualizer components */
.dbg-scroll-container {
    position: relative;
}

.dbg-scroll-loaded {
    position: absolute;
    left: 0;
    width: 10px;
    background-color: rgba(0, 0, 0, 0.1);
}

.dbg-scroll-window {
    position: absolute;
    left: 0;
    width: 10px;
    background-color: rgba(0, 100, 255, 0.5);
}

.dbg-scroll-message-marker {
    position: absolute;
    width: 3px;
    background-color: rgba(0, 155, 155, 0.7);
}

.dbg-scroll-message-marker.system {
    left: 4px;
}

.dbg-scroll-message-marker.my-message {
    left: 7px;
}

.dbg-scroll-message-marker.other-message {
    left: 0;
}

/* Chat control buttons */
.dbg-chat-control-button {
    position: fixed;
    padding: 5px 10px;
    background-color: lightcoral;
    border: 1px solid darkred;
    color: white;
    cursor: pointer;
    z-index: 2000;
}

/* Debug scroll container */
.dbg-scroll-container {
    position: absolute;
    right: 5px;
    top: 0;
    width: 15px;
    height: 100%;
    margin-left: 5px;
    z-index: 100;
    overflow: hidden;
}

.message {
    padding: 5px; /* Внутренний отступ */
    margin: 0 0; /* Отступ между сообщениями */
    border: 1px solid #ddd; /* Легкая рамка */
    max-width: 70%; /* Максимальная ширина сообщения */
    word-wrap: break-word; /* Перенос слов */

    border-radius: 10px; /* Один угол оставляем без закругления */
    border-bottom-left-radius: 0; /* Один угол оставляем без закругления */
    background-color: #cce5ffaa; /* Цвет фона по умолчанию */

    align-self: flex-start; /* Прижимаем (ЭТОТ) элемент (только когда внутри флекса)*/
    justify-self: start; /* Прижимаем элемент (если это чайлд грида!) */
    text-align: left; /* Выравниваем текст внутри сообщений по левому краю */
}

.i-am-author {
    /*.message:nth-child(odd) {*/
    align-self: flex-end; /* Прижимаем (ЭТОТ) элемент к левому краю (только когда внутри флекса)*/
    justify-self: end; /* Прижимаем элемент к правому краю ячейки (если это чайлд грида!) */
    text-align: right; /* Выравниваем текст внутри сообщений по левому краю */

    background-color: #aadde5aa; /* Цвет фона по умолчанию */
    border-radius: 10px; /* Закругленные углы */
    border-bottom-right-radius: 0; /* Один угол оставляем без закругления */

}

.system-author {
    /*.message:nth-child(odd) {*/
    align-self: center;
    text-align: center;

    /*background-color: #aaaaaa33; !* Цвет фона по умолчанию *!*/
    border-radius: 10px; /* Закругленные углы */
    /*border-bottom-right-radius: 0; !* Один угол оставляем без закругления *!*/
    background-color: transparent; /* Цвет фона по умолчанию */
    border: none; /* Легкая рамка */
}


.blog-as-messages {
    padding: 5px; /* Внутренний отступ */
    margin: 5px 0; /* Отступ между сообщениями */
    /*border: 1px solid #ddd; !* Легкая рамка *!*/
    min-width: 90%; /* Максимальная ширина сообщения */


    border-radius: 10px; /* Закругленные углы */
    /*border-bottom-right-radius: 0; !* Один угол оставляем без закругления *!*/
    background-color: #f5f5f5; /* Цвет фона по умолчанию */


    align-self: flex-start; /* Прижимаем (ЭТОТ) элемент (только когда внутри флекса?)*/
    justify-self: start; /* Прижимаем элемент (если это чайлд грида!) */
    text-align: justify; /* Выравниваем текст внутри сообщений по левому краю */
    word-wrap: break-word; /* Перенос слов */

    hyphens: auto; /* Добавляет автоматические переносы */
    line-height: 1.5; /* Увеличивает межстрочный интервал */
}

.blog-as-messages-right {
    align-self: flex-end; /* Прижимаем (ЭТОТ) элемент к левому краю (только когда внутри флекса?)*/
    border-bottom-right-radius: 10px; /* Один угол оставляем без закругления */
    border-bottom-left-radius: 0; /* Один угол оставляем без закругления */
}

.info {
    padding: 5px; /* Внутренний отступ */
    margin: 5px 0; /* Отступ между сообщениями */
    background-color: #cce5ffaa; /* Цвет фона по умолчанию */
    text-align: center; /* Выравниваем текст внутри сообщений по левому краю */
}

.button {
    padding: 5px; /* Внутренний отступ */
    margin: 5px 0; /* Отступ между сообщениями */
    align-self: center;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(105, 94, 135, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    width: 50%; /* Максимальная ширина сообщения */
    word-wrap: break-word; /* Перенос слов */
    text-align: left;
    cursor: pointer; /* Показываем, что элемент кликабельный */
    transition: all 0.2s ease; /* Плавный переход для всех анимируемых свойств */
}

.navigation-button {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(105, 94, 135, 0.24);
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.74);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #25332d;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
}

.navigation-button:hover,
.navigation-button:focus {
    background-color: rgba(255, 255, 255, 0.9);
    outline: 2px solid #1976d2;
    outline-offset: 1px;
}

.navigation-button:active {
    background-color: rgba(255, 255, 255, 0.98);
    transform: scale(0.96);
}

/* Стиль для кнопки в фокусе */
.button:focus {
    outline: 2px solid #1976d2; /* Синяя обводка вместо стандартной */
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.3); /* Дополнительное свечение */
    background-color: rgba(255, 255, 255, 0.9);
}

/* Стиль при наведении */
.button:hover {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: #aaa; /* Более темная граница */
}

/* Стиль при нажатии */
.button:active {
    background-color: rgba(255, 255, 255, 0.98);
    transform: scale(0.98); /* Легкое уменьшение для эффекта нажатия */
}

.button.disabled {
    background-color: rgba(255, 255, 255, 0.48);
    color: #999; /* Более светлый текст */
    cursor: not-allowed; /* Курсор, показывающий, что действие недоступно */
    opacity: 0.7; /* Немного прозрачный */
    border: 1px solid #ccc; /* Более светлая рамка */
}

.button.has-context-menu {
    -webkit-touch-callout: none;
    user-select: none;
}

/*
 * Chrome on iOS may retarget the still-active long press to the newly inserted popup or page background.
 * This temporary class blocks its native callout and accidental text selection only until the finger is released.
 */
body.context-menu-gesture-active,
body.context-menu-gesture-active * {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

#sky5-brand {
    grid-column: 1 / -1;
    width: auto;
    align-self: center;
    margin: 22px 0 28px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #25332d;
    font-family: Georgia, serif;
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
    text-align: center;
    text-decoration: underline;
}

.page-shell.home-page > .container-a {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 24px 28px;
    padding: 10px 28px 32px;
    border-radius: 0;
    box-shadow: none;
}

.home-action {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: #25332d;
    text-align: center;
}

.home-action-icon {
    width: 82px;
    height: 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
    color: white;
    font-family: Georgia, serif;
    font-size: 46px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 9px 20px rgba(63, 54, 91, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.38);
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.home-action-label {
    max-width: 100%;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#login-button .home-action-icon,
#account-button .home-action-icon {
    background: linear-gradient(145deg, #73d9ca, #269f91);
}

#studio-button .home-action-icon {
    background: linear-gradient(145deg, #ffad83, #ed6375);
}

#search-all-button .home-action-icon {
    background: linear-gradient(145deg, #82c5ff, #4e78dd);
}

#saved-button .home-action-icon {
    background: linear-gradient(145deg, #ffe07a, #eea32c);
}

#scan-button .home-action-icon {
    background: linear-gradient(145deg, #9f99f6, #6961ce);
}

.home-action:hover,
.home-action:focus,
.home-action:active {
    border: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
}

.home-action:hover .home-action-icon,
.home-action:focus .home-action-icon {
    box-shadow: 0 9px 20px rgba(63, 54, 91, 0.2), 0 0 0 3px rgba(25, 118, 210, 0.32);
}

.home-action:active {
    transform: none;
}

.home-action:active .home-action-icon {
    transform: scale(0.94);
}

/* Контейнер для панели ввода */
.input-panel {
    width: 100%; /* Ширина панели ввода */
    grid-row: 3; /* Размещаем в строке 3 сетки */
}

.inputField {
    /*width: 80%; !* Заполняем всю ширину контейнера *!*/
    /*height: 100px; !* Фиксированная высота *!*/
    /*resize: none; !* Отключаем возможность изменения размера *!*/
    padding: 10px; /* Внутренний отступ */
    margin: 10px 10px; /* Отступ сверху и снизу */
    border: 1px solid #ddd; /* Легкая рамка */
    border-radius: 10px; /* Закругленные углы */
    font-family: Arial, sans-serif; /* Шрифт */
    /* should be 16px+, because else mobile browsers can zoom in */
    font-size: 16px; /* Размер шрифта */
    background-color: #f9f9f9; /* Фоновый цвет */
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); /* Тень внутри поля */
}

#custom-context-menu div {
    padding: 8px 12px;
    cursor: pointer;
}

#custom-context-menu div:hover {
    background-color: #f0f0f0;
}

#custom-context-menu {
    transition: opacity 0.2s ease;
    opacity: 0;
}

#custom-context-menu.show {
    opacity: 1;
}

#test-menu-overlay {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border-radius: 12px;
  padding: 10px 24px;
  z-index: 9999;
  display: none;
  gap: 16px;
  cursor: default;
  user-select: none; /* Prevent text selection while dragging */
}

html.test-menu-enabled #test-menu-overlay {
  display: flex;
}

/* Probe-only colors expose which viewport layer owns a mobile keyboard gap. */
html.viewport-probe-active {
  background: #ffe36e;
}

.viewport-probe-active body {
  box-shadow: inset 0 0 0 4px #b000d4;
}

.viewport-probe-active .studio-page-workspace {
  box-shadow: inset 0 0 0 4px #ed174c;
}

.viewport-probe-active .studio-page-content {
  outline: 3px solid #0b9b55;
  outline-offset: -3px;
}

.viewport-probe-active .studio-text-block-editing .studio-text-surface {
  border-color: #008de5;
}

.test-menu-handle {
  cursor: move;
  padding: 0 8px;
  margin: -10px 0 -10px -24px;
  display: flex;
  align-items: center;
  font-size: 16px;
  color: #666;
  border-radius: 12px 0 0 12px;
}

.test-menu-handle:hover {
  background-color: rgba(0,0,0,0.05);
}

#test-menu-overlay button {
  font-size: 18px;
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: #1976d2;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#test-menu-overlay button:hover {
  background: #125ea6;
}

#test-menu-overlay button.active {
  background: #4caf50;
  transform: scale(1.05);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#test-menu-overlay button:disabled {
  background: #cccccc;
  cursor: not-allowed;
  opacity: 0.7;
}

.app-errors {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  width: min(420px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.server-error,
.client-error {
  box-sizing: border-box;
  padding: 16px;
  border-left: 5px solid #b42318;
  border-radius: 6px;
  background: #fff4f2;
  box-shadow: 0 8px 24px rgba(68, 18, 12, 0.2);
  color: #4a1712;
}

.server-error-text,
.client-error-original-text,
.client-error-reporting-text {
  margin-bottom: 12px;
  max-height: 180px;
  overflow: auto;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.server-error-actions,
.client-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.server-error-copy-button,
.server-error-close-button,
.client-error-copy-button,
.client-error-close-button {
  padding: 7px 12px;
  border: 1px solid #b42318;
  border-radius: 4px;
  background: #fff;
  color: #7a271a;
  cursor: pointer;
}

.client-error-status {
  margin-bottom: 8px;
  font-weight: 700;
}

.client-error-id {
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

#login-mail-unavailable {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: 10000;
  display: flex;
  width: min(520px, calc(100vw - 40px));
  box-sizing: border-box;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-left: 5px solid #9a6700;
  border-radius: 6px;
  background: #fff8c5;
  box-shadow: 0 8px 24px rgba(65, 45, 10, 0.2);
  color: #4d3500;
  transform: translateX(-50%);
}

#login-mail-unavailable button {
  padding: 7px 12px;
  border: 1px solid #9a6700;
  border-radius: 4px;
  background: #fff;
  color: #684900;
  cursor: pointer;
}

/* Test dropdown menu styles */
.test-dropdown {
  display: none;
  position: absolute;
  right: 0;
  bottom: 100%; /* Position above the menu instead of below */
  margin-bottom: 5px; /* Add margin to the bottom instead of top */
  z-index: 9999;
}

.test-dropdown.show {
  display: block;
}

.test-dropdown-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  overflow: hidden;
  min-width: 180px;
}

.test-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 16px;
  color: #333;
}

.test-item:hover {
  background: #f0f0f0;
}

.test-item.selected {
  background: #e3f2fd;
  font-weight: bold;
  color: #1976d2;
}
