/* Editor and pack detail share the catalogue and configure design tokens. */
#tileEditorOverlay {
    --editor-gap: 24px;
    --editor-inset: 16px;
    z-index: 140;
    align-items: flex-end;
    padding: var(--cfg-sheet-inset) !important;
    height: calc(100dvh - var(--ui-keyboard, 0px));
    background: rgba(0, 0, 0, .3) !important;
}

#tileEditorSheet {
    width: 100%;
    max-width: var(--cfg-max);
    max-height: calc(100% - max(24px, var(--tier-top, 0px)));
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    border: 0 !important;
    border-radius: var(--cfg-sheet-radius) !important;
    background: var(--cfg-sheet-bg) !important;
    box-shadow: 0 -18px 48px -24px rgba(0, 0, 0, .7) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    color: var(--ui-text);
    transition: transform .3s var(--cfg-sheet-ease);
}

#tileEditorSheet .oem-sheet-handle {
    width: 36px;
    height: 5px;
    margin: 10px auto 2px;
    background: var(--cfg-grab);
}

#tileEditorSheet .oem-sheet-header {
    padding: 4px 12px 12px;
    gap: 4px;
    background: var(--cfg-sheet-bg);
}

#tileEditorTitle {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.02em;
}

.editor-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

#tileEditorSheet .editor-top { flex: none; z-index: 5; }
#tileEditorSheet .oem-sheet-header {
    grid-template-columns: 1fr 1fr;
    background: none;
    padding-bottom: 10px;
}
#tileEditorSheet .oem-sheet-header-side--end { grid-column: 2; }
#tileEditorSheet.is-scrolled .cfg-top-blur { display: block; }
#tileEditorSheet .editor-top::before { bottom: -26px; }
#tileEditorSheet .editor-top .cfg-top-blur { height: calc(100% + 36px); }
#tileEditorSheet .cfg-card { margin: 0; }
#tileEditorSheet .cfg-section-head { padding-left: 6px; padding-right: 6px; }

#tileEditorSheet .oem-sheet-text-btn {
    min-height: 44px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--ui-hint);
    font-size: 14px;
    font-weight: 500;
    transition: background-color .18s ease, transform .18s ease;
}

#tileEditorSheet #tileEditorClose {
    background: var(--cfg-thumb);
    color: var(--cfg-accent);
    font-weight: 600;
}

#tileEditorSheet .oem-sheet-text-btn:active { transform: scale(.96); }

#cartSheet:focus,
#tileEditorSheet:focus { outline: none; }

#cartSheet .cfg-seg-button.is-active { color: var(--cfg-accent); }
#cartSheet .cfg-row--tap:focus-visible,
#cartSheet .cfg-seg-button:focus-visible {
    outline: 2px solid var(--cfg-accent);
    outline-offset: -3px;
}

#tileEditorSheet .oem-sheet-body {
    min-height: 0;
    padding: 0 var(--cfg-x-end) max(24px, var(--cfg-bottom)) var(--cfg-x);
    scroll-padding: 16px;
}

#tileEditorSheet .oem-sheet-section {
    margin: 0 0 var(--editor-gap) !important;
    padding: 0 !important;
}

#tileEditorSheet .oem-sheet-preview-section { padding: 4px 0 0 !important; }

#tileEditorPreview {
    width: min(52vw, 216px);
    height: auto;
    aspect-ratio: 1;
    border: 0 !important;
    border-radius: var(--cfg-radius) !important;
    background: var(--cfg-card) !important;
    box-shadow: none !important;
}

#tileEditorSheet .ui-card {
    margin: 0 !important;
    padding: 0;
    border: 0 !important;
    border-radius: var(--cfg-radius) !important;
    overflow: hidden;
    background: var(--cfg-card) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#tileEditorSheet .ui-row {
    min-height: var(--cfg-row-h);
    padding: 13px var(--cfg-row-pad) !important;
    gap: 12px;
    border: 0 !important;
    background: none;
    box-shadow: none !important;
}

#tileEditorSheet .ui-row::after { display: none !important; }

#tileEditorSheet .ui-row-title,
#tileEditorSheet .oem-input-label {
    color: var(--ui-text);
    font-size: 16px;
    font-weight: 400;
    line-height: 22px;
    text-transform: none;
    letter-spacing: -.01em;
}

#tileEditorSheet .oem-sheet-section > .ui-row {
    min-height: 0;
    padding: 0 6px 10px !important;
}

#tileEditorSheet .oem-sheet-section > .ui-row .ui-row-title {
    color: var(--ui-section-header, var(--ui-hint));
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .01em;
}

#tileEditorSheet .ui-row-subtitle,
#tileEditorSheet .ui-section-footer {
    color: var(--ui-hint);
    font-size: 13px;
    font-weight: 400;
    line-height: 18px;
}

#tileEditorSheet .ui-section-footer { margin: 8px 6px 0; padding: 0; }
#tileTextIcon, #tileUploadIcon { display: none !important; }
#tileEditorSheet .oem-input-value { flex: 1; min-width: 0; width: auto !important; }
#tileEditorSheet #tileTextInput {
    width: 100% !important;
    min-height: 28px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    text-align: right !important;
    color: var(--ui-text) !important;
    font-size: 17px;
    font-weight: 400;
}

#tileEditorSheet #tileTextInput::placeholder { color: var(--ui-hint); }
#tileEditorSheet #tileFontSegment {
    height: 44px;
    margin: 0 12px 14px;
    padding: 3px;
    border: 0;
    border-radius: 999px;
    background: var(--cfg-track);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#tileFontSegment::before {
    inset: 3px auto 3px 3px;
    width: calc(50% - 3px);
    border-radius: 999px !important;
    background: var(--cfg-thumb);
    box-shadow: var(--cfg-thumb-shadow);
}

#tileFontSegment .oem-tile-segment-btn { font-size: 14px; color: var(--ui-hint) !important; opacity: 1 !important; }
#tileFontSegment[data-active="montserrat"] [data-font="montserrat"],
#tileFontSegment[data-active="seymour"] [data-font="seymour"] { color: var(--ui-text) !important; }

#tilePositionPad {
    width: calc(100% - 36px);
    max-width: none;
    height: 152px;
    aspect-ratio: auto;
    margin: 0 18px 12px;
    border: 0;
    border-radius: 18px;
    background: var(--cfg-track);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#tilePositionDot { background: var(--cfg-accent); box-shadow: none; }
#tileEditorSheet .oem-slider-row { min-height: 48px; padding: 4px 18px; }
#tileEditorSheet .oem-slider { min-width: 0; min-height: 44px; accent-color: var(--cfg-accent); }
#tileEditorSheet .oem-position-card { padding-bottom: 10px; }
#tileEditorSheet .oem-color-swatch { border-radius: 50%; box-shadow: 0 0 0 1px var(--cfg-separator); }
#tileGradientToggle { background: var(--cfg-thumb); box-shadow: none; }
#tileGradientToggle[aria-checked="true"] { background: var(--cfg-cta); }
#tileGradientToggle::after { content: ""; position: absolute; inset: -8px 0; }

/* Detail actions use the same slate accent and page gutters as the app. */
#packsScreen:not(.tier-packs-list) {
    --cfg-x: 0px;
    --cfg-x-end: 0px;
    --cfg-text-x: 6px;
}

#packsScreen:not(.tier-packs-list) #packsScreenTitle {
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: clamp(24px, 7.5vw, 30px) !important;
    line-height: 1.16 !important;
}

#packDetailSection {
    margin: 18px 0 26px;
    border-radius: var(--cfg-radius);
    background: var(--cfg-card);
    overflow: hidden;
}
.pack-detail-heading { padding: 20px 18px 18px; }
#packDetailName { margin: 0; color: var(--ui-text); font-size: 21px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
#packDetailMeta { margin: 6px 0 0; font-size: 13px; color: var(--ui-hint); line-height: 18px; }
#packsScreen:not(.tier-packs-list) .oem-titlebar { display: flex !important; align-items: center; gap: 12px; }
#packsScreen:not(.tier-packs-list) #packsScreenTitle { font-size: 26px !important; line-height: 32px !important; }
#packsScreen:not(.tier-packs-list) #createTab {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    display: grid !important;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 10px;
    border: 0;
    border-radius: 50%;
    background: var(--cfg-card);
    color: var(--cfg-accent);
    place-items: center;
}
#packsScreen:not(.tier-packs-list) #packsScreenTitle { flex: 1; min-width: 0; }
#packsScreen:not(.tier-packs-list) #packsBackLabel,
#packsScreen:not(.tier-packs-list) .oem-titlebar-balance { display: none; }
#packsScreen:not(.tier-packs-list) #createTab svg { width: 20px; height: 20px; }
#openPackButton {
    position: relative;
    min-height: 52px;
    width: 100%;
    margin: 0;
    padding: 15px 18px;
    justify-content: flex-start;
    gap: 12px;
    border-radius: 0;
    background: transparent;
    color: var(--cfg-accent);
    box-shadow: none;
    font-size: 17px;
    line-height: 24px;
    font-weight: 400;
}
#openPackButton::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: 1px; transform: scaleY(.5); background: var(--cfg-separator); }
#openPackButton .cfg-tg-plane { filter: grayscale(1) brightness(0) invert(1); opacity: .7; width: 20px; height: 20px; background-size: 20px !important; }
html[data-theme="light"] #openPackButton .cfg-tg-plane { filter: none; opacity: 1; }
.pack-action-chevron { width: 17px; height: 17px; margin-left: auto; color: var(--ui-hint); }
#stickersSection .cfg-section-head { justify-content: space-between; }
#deletePackSection { margin-top: 24px; }
/* Подпись по центру: это одно опасное действие, а не строка списка, и
   прижатая влево она читалась продолжением «Открыть в ТГ» над ней. */
#deletePackButton { background: var(--cfg-card); border-radius: var(--cfg-radius); justify-content: center; padding: 0 18px; font-size: 17px; font-weight: 400; }
.cfg-item-art.has-live-preview > img { visibility: hidden; }

#tileEditorSheet :is(button, input, [role="slider"]):focus-visible,
#packsScreen :is(button, a):focus-visible {
    outline: 2px solid var(--cfg-accent);
    outline-offset: -3px;
}

@media (hover: hover) {
    #tileEditorSheet .oem-sheet-text-btn:hover,
    #tileEditorSheet #tileLogoButton:hover { background: var(--cfg-press); }
    #openPackButton:hover { background: var(--cfg-press); }
    #deletePackButton:hover { background: var(--cfg-press); }
}

@media (prefers-reduced-motion: reduce) {
    #tileEditorOverlay, #tileEditorSheet, #tileEditorSheet *,
    #openPackButton, #deletePackButton { transition: none !important; }
}


/* ==========================================================================
   Превью прокручивается вместе с содержимым

   Правка аудита 2026-09-20 прилепила превью к верху листа и сжимала его при
   прокрутке, чтобы ползунки было видно вместе с картинкой. На деле плитка
   ездила за пальцем и меняла размер на ходу — отменено по просьбе владельца
   21.09.2026: превью стоит там, где нарисовано, и уезжает вверх как обычная
   часть листа. Класс is-scrolled остаётся: он нужен шапке (.cfg-top-blur).
   ========================================================================== */
#tileEditorSheet #tileEditorPreview {
    margin-inline: auto;
}
