:root {
    --bg0: #07060d;
    --bg1: #12101c;
    --glass: rgba(255, 255, 255, 0.06);
    --stroke: rgba(255, 255, 255, 0.12);
    --text: #f4f2ff;
    --muted: #9d96b8;
    --accent: #8b5cf6;
    --accent2: #22d3ee;
    --ok: #34d399;
    --err: #fb7185;
    --radius: 18px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font);
    background: radial-gradient(1200px 800px at 10% -10%, rgba(139, 92, 246, 0.35), transparent),
        radial-gradient(900px 600px at 100% 0%, rgba(34, 211, 238, 0.2), transparent), var(--bg0);
    color: var(--text);
}

body {
    padding-bottom: 96px;
}

.noise {
    pointer-events: none;
    position: fixed;
    inset: 0;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    z-index: 0;
}

.app-shell {
    position: relative;
    z-index: 1;
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 16px 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.logo {
    font-weight: 700;
    letter-spacing: -0.03em;
    font-size: 1.35rem;
    background: linear-gradient(120deg, #fff, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.pill {
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--stroke);
    background: var(--glass);
    color: var(--muted);
}

.card {
    border-radius: var(--radius);
    border: 1px solid var(--stroke);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(14px);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.card h2 {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 600;
}

label {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    margin: 10px 0 6px;
}

.field-block {
    margin-top: 4px;
}

.field-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 14px 0 8px;
}

.field-block:first-of-type .field-label {
    margin-top: 2px;
}

.field-block--file .field-label {
    margin-bottom: 10px;
}

.mode-select-shell {
    position: relative;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.28));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mode-select-shell:focus-within {
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mode-select-shell::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    width: 8px;
    height: 8px;
    margin-top: -5px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    pointer-events: none;
    opacity: 0.85;
}

.mode-select {
    display: block;
    width: 100%;
    margin: 0;
    padding: 14px 42px 14px 16px;
    border: none;
    border-radius: 16px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.35;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.mode-select option,
.mode-select optgroup {
    background: #1a1628;
    color: var(--text);
}

.mode-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.file-dropzone {
    position: relative;
    display: block;
    margin: 0;
    min-height: 132px;
    border-radius: 18px;
    border: 2px dashed rgba(255, 255, 255, 0.18);
    background: linear-gradient(160deg, rgba(139, 92, 246, 0.08), rgba(34, 211, 238, 0.04));
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.file-dropzone:hover:not(.file-dropzone--inactive):not(.file-dropzone--locked) {
    border-color: rgba(139, 92, 246, 0.45);
    background: linear-gradient(160deg, rgba(139, 92, 246, 0.12), rgba(34, 211, 238, 0.07));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.file-dropzone--drag {
    border-color: rgba(34, 211, 238, 0.65);
    border-style: solid;
    background: linear-gradient(160deg, rgba(139, 92, 246, 0.18), rgba(34, 211, 238, 0.1));
    transform: scale(1.01);
}

.file-dropzone--inactive,
.file-dropzone--locked {
    cursor: not-allowed;
    opacity: 0.52;
    border-style: dashed;
}

/* input скрыт — выбор файла только через label[for] (иначе клик по превью открывал бы диалог) */
.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.file-dropzone-stack {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.file-dropzone-hit-empty {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    border-radius: inherit;
    margin: 0;
}

.file-dropzone.has-files .file-dropzone-hit-empty {
    display: none !important;
}

.file-thumb-strip {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-content: flex-start;
    padding: 12px 10px 6px;
    min-height: 0;
}

.file-thumb-item {
    position: relative;
    flex: 0 0 auto;
    width: calc(50% - 5px);
    max-width: 148px;
    aspect-ratio: 1;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.file-thumb-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-thumb-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: rgba(10, 8, 18, 0.82);
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.file-thumb-remove:active {
    transform: scale(0.94);
}

.file-dropzone-addbar {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    margin: 4px 10px 10px;
    padding: 10px 12px;
    text-align: center;
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.22);
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
}

.file-dropzone-addbar-text {
    pointer-events: none;
}

.file-dropzone--full .file-dropzone-addbar {
    display: none !important;
}

.file-dropzone--inactive .file-dropzone-hit-empty,
.file-dropzone--inactive .file-dropzone-addbar,
.file-dropzone--locked .file-dropzone-hit-empty,
.file-dropzone--locked .file-dropzone-addbar {
    cursor: not-allowed;
    pointer-events: none;
}

.file-dropzone--full:not(.file-dropzone--inactive):not(.file-dropzone--locked) {
    cursor: default;
}

.file-dropzone-icon {
    font-size: 1.75rem;
    line-height: 1;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.file-dropzone-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.file-dropzone-hint {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--muted);
    max-width: 260px;
}

select,
textarea,
input[type="text"] {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

.music-card {
    margin-bottom: 0;
}

.music-title {
    margin: 0 0 6px !important;
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em;
}

.music-lead {
    margin: 0 0 14px;
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 500;
}

.music-textarea {
    min-height: 140px;
    border-width: 2px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.music-textarea:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.75);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.2);
}

.music-hint {
    margin-top: 14px;
    font-size: 0.78rem;
    line-height: 1.45;
}

.music-hint code {
    font-size: 0.85em;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--stroke);
}

.btn-music {
    margin-top: 16px;
    background: linear-gradient(115deg, #7c3aed 0%, #6366f1 45%, #0891b2 100%);
    box-shadow: 0 14px 36px rgba(99, 102, 241, 0.4);
}

.bottom-nav-inner--3 {
    max-width: 520px;
}

.bottom-nav-inner--3 .nav-btn {
    font-size: 0.78rem;
    padding: 10px 6px;
}

.bottom-nav-inner--5 {
    max-width: 520px;
    gap: 4px;
    padding: 6px;
}

.bottom-nav-inner--5 .nav-btn {
    font-size: 0.68rem;
    padding: 9px 4px;
    line-height: 1.15;
}

.bottom-nav-inner--dock {
    max-width: 520px;
    gap: 6px;
    padding: 8px 6px;
    align-items: flex-end;
}

.bottom-nav-inner--dock .nav-btn:not(.nav-btn--compose) {
    font-size: 0.7rem;
    padding: 10px 4px;
    line-height: 1.15;
    flex: 1;
    min-width: 0;
}

.nav-btn--compose {
    flex: 0 0 auto !important;
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 0 !important;
    margin-top: -14px;
    border-radius: 50%;
    font-size: 1.55rem !important;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(140deg, #a78bfa, #6366f1 45%, #22d3ee);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45);
}

.nav-btn--compose.active {
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.45), 0 12px 32px rgba(99, 102, 241, 0.5);
}

.studio-top {
    margin-bottom: 10px;
}

.studio-switcher {
    display: flex;
    gap: 8px;
    padding: 4px;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.2);
}

.studio-chip {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--muted);
    background: transparent;
}

.studio-chip.active {
    color: #fff;
    background: linear-gradient(120deg, rgba(139, 92, 246, 0.4), rgba(34, 211, 238, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.studio-swipe-hint {
    font-size: 0.76rem;
    margin: 8px 4px 0;
    text-align: center;
}

.studio-swipe-host {
    touch-action: pan-y;
}

.studio-pane {
    animation: studioPaneIn 0.22s ease;
}

@keyframes studioPaneIn {
    from {
        opacity: 0.88;
        transform: translateX(6px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.compose-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.compose-pick-cell {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 2px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.25);
}

.compose-pick-cell--selected {
    border-color: rgba(167, 139, 250, 0.95);
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.35);
}

.compose-pick-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.compose-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 14px;
}

.compose-preview-img {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.3);
}

.compose-clear-photo {
    margin-top: 0 !important;
    width: 100%;
}

.post-from-studio-actions {
    margin-top: 14px;
}

.post-from-studio-actions .btn {
    width: 100%;
}

.feed-sub {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 18px 0 10px;
    color: var(--text);
}

.post-gallery-pick {
    width: 100%;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feed-card {
    position: relative;
    border-radius: 14px;
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.22);
    padding: 12px 14px;
    text-align: left;
}

.feed-card-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.feed-card-menu {
    position: relative;
    flex-shrink: 0;
}

.feed-card-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--stroke);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    font-size: 1.15rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
}

.feed-card-menu-btn:active {
    transform: scale(0.96);
}

.feed-card-menu-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 8;
    min-width: 188px;
    padding: 6px 0;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    background: linear-gradient(165deg, rgba(30, 26, 44, 0.98), rgba(14, 12, 22, 0.99));
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.feed-card-menu-item {
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
}

.feed-card-menu-item:hover,
.feed-card-menu-item:focus-visible {
    background: rgba(255, 255, 255, 0.06);
}

.feed-card-menu-item--danger {
    color: var(--err);
}

.feed-card-menu-empty {
    margin: 0;
    padding: 10px 16px;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.35;
}

.feed-card-meta {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0;
    padding-top: 2px;
}

.feed-card-meta b {
    color: var(--text);
    font-weight: 600;
}

.feed-card-caption {
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.feed-card-img {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 10px;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.35);
}

.feed-card-img + .feed-card-caption {
    margin-top: 12px;
}

.feed-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 14px;
}

.feed-sort-chip {
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.22);
    color: var(--muted);
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.feed-sort-chip.active {
    color: #fff;
    border-color: rgba(167, 139, 250, 0.45);
    background: linear-gradient(120deg, rgba(139, 92, 246, 0.35), rgba(34, 211, 238, 0.12));
}

.feed-reactions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.feed-react-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.28);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 12px;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.feed-react-btn--active {
    border-color: rgba(167, 139, 250, 0.85);
    background: rgba(139, 92, 246, 0.22);
}

.feed-react-emoji {
    font-size: 1rem;
    line-height: 1;
}

.feed-react-n {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 0.78rem;
}

.feed-react-btn--active .feed-react-n {
    color: var(--text);
}

.feed-meta-views {
    display: block;
    font-size: 0.76rem;
    width: 100%;
    margin-top: 6px;
}

.feed-open-comments {
    width: 100%;
    margin-top: 10px !important;
}

.feed-scroll-sentinel {
    height: 1px;
    margin-top: 12px;
}

.feed-loading-hint {
    text-align: center;
    margin-top: 8px;
}

.comments-modal {
    position: fixed;
    inset: 0;
    z-index: 99;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom)) 16px;
    box-sizing: border-box;
}

.comments-modal.hidden {
    display: none !important;
}

.comments-modal-scrim {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, 0.72);
    cursor: pointer;
}

.comments-modal-x {
    position: absolute;
    top: calc(8px + env(safe-area-inset-top));
    right: calc(8px + env(safe-area-inset-right));
    z-index: 102;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(10, 8, 18, 0.85);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comments-modal-panel {
    position: relative;
    z-index: 101;
    width: 100%;
    max-width: 520px;
    max-height: min(78vh, 640px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 16px 18px;
    border-radius: 20px 20px 0 0;
    border: 1px solid var(--stroke);
    border-bottom: none;
    background: linear-gradient(180deg, rgba(24, 20, 36, 0.98), rgba(12, 10, 20, 0.99));
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
}

.comments-modal-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.comments-modal-list {
    flex: 1;
    min-height: 120px;
    max-height: 38vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 2px;
}

.comments-modal-row {
    font-size: 0.86rem;
    line-height: 1.4;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.comments-modal-row-meta {
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.comments-modal-row-meta b {
    color: var(--text);
}

.comments-modal-row-del {
    margin-top: 8px;
    padding: 0;
    border: none;
    background: none;
    color: var(--err);
    font: inherit;
    font-size: 0.76rem;
    cursor: pointer;
    text-decoration: underline;
}

#comments-modal-input {
    width: 100%;
    margin-top: 4px;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font: inherit;
    padding: 10px 12px;
    resize: vertical;
    min-height: 72px;
}

#comments-modal-send {
    margin-top: 4px;
}

.playlist-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.playlist-row {
    border-radius: 14px;
    border: 1px solid var(--stroke);
    background: rgba(0, 0, 0, 0.22);
    padding: 12px 14px;
}

.playlist-row-prompt {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 8px;
    line-height: 1.4;
    max-height: 3.6em;
    overflow: hidden;
}

.playlist-row-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.btn-playlist-del {
    margin-top: 0;
    width: auto;
    padding: 8px 14px;
    font-size: 0.82rem;
    background: transparent;
    border: 1px solid rgba(251, 113, 133, 0.45);
    color: var(--err);
    box-shadow: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 600;
    font: inherit;
    cursor: pointer;
    margin-top: 12px;
    width: 100%;
    background: linear-gradient(120deg, var(--accent), #6366f1);
    color: #fff;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.35);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--stroke);
    color: var(--muted);
    box-shadow: none;
}

.msg-hint {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--muted);
}

.msg {
    font-size: 0.88rem;
    margin-top: 10px;
    color: var(--muted);
}

.msg.err {
    color: var(--err);
}

.msg.ok {
    color: var(--ok);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.gallery-item {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 2px solid transparent;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.gallery-item:focus-visible {
    outline: 2px solid rgba(34, 211, 238, 0.6);
    outline-offset: 2px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.btn-gallery-save {
    flex: 0 0 auto;
    min-width: 108px;
    border: none;
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(160deg, #2563eb, #1d4ed8);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.45);
}

.btn-gallery-save:active {
    transform: scale(0.98);
}

.btn-gallery-del {
    flex: 0 0 auto;
    min-width: 108px;
    border: none;
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(160deg, #ef4444, #b91c1c);
    box-shadow: 0 10px 24px rgba(239, 68, 68, 0.35);
}

.btn-gallery-del:active {
    transform: scale(0.98);
}

.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(12px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)) 16px;
    box-sizing: border-box;
}

.gallery-modal-scrim {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, 0.78);
    cursor: pointer;
}

.gallery-modal-x {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top));
    left: calc(8px + env(safe-area-inset-left));
    z-index: 102;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(10, 8, 18, 0.75);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.gallery-modal-x:active {
    transform: scale(0.95);
}

.gallery-modal-panel {
    position: relative;
    z-index: 101;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.gallery-modal-title {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.gallery-modal-frame {
    max-width: 100%;
    max-height: min(68vh, 620px);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55);
}

.gallery-modal-img {
    display: block;
    max-width: 100%;
    max-height: min(68vh, 620px);
    width: auto;
    height: auto;
    object-fit: contain;
    vertical-align: top;
}

.gallery-modal-hint {
    margin: 0;
    font-size: 0.78rem;
    text-align: center;
    line-height: 1.4;
    max-width: 320px;
}

.gallery-modal-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 4px;
}

.gallery-modal-actions--3 {
    width: 100%;
    max-width: 420px;
    justify-content: stretch;
    gap: 8px;
}

.gallery-modal-actions--3 .btn-gallery-save,
.gallery-modal-actions--3 .btn-gallery-feed,
.gallery-modal-actions--3 .btn-gallery-del {
    flex: 1 1 0;
    min-width: 0;
    font-size: 0.72rem;
    padding: 11px 6px;
    line-height: 1.2;
}

.btn-gallery-feed {
    border: none;
    border-radius: 14px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(160deg, #8b5cf6, #6366f1);
    box-shadow: 0 10px 24px rgba(99, 102, 241, 0.42);
}

.btn-gallery-feed:active {
    transform: scale(0.98);
}

.compose-pick-modal {
    position: fixed;
    inset: 0;
    z-index: 105;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(12px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)) 16px;
    box-sizing: border-box;
}

.compose-pick-modal.hidden {
    display: none !important;
}

.compose-pick-scrim {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, 0.82);
    cursor: pointer;
}

.compose-pick-panel {
    position: relative;
    z-index: 101;
    width: 100%;
    max-width: 520px;
    max-height: min(86vh, 720px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 14px 16px;
    border-radius: 20px;
    border: 1px solid var(--stroke);
    background: linear-gradient(165deg, rgba(28, 24, 42, 0.98), rgba(10, 8, 18, 0.99));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.compose-pick-grid-wrap {
    flex: 1;
    min-height: 180px;
    max-height: min(58vh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 8px;
    margin: 0 -2px;
}

.compose-pick-modal .gallery-grid {
    margin-top: 0;
}

.gallery-modal-err {
    margin: 0;
    min-height: 1.2em;
    text-align: center;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, rgba(7, 6, 13, 0.92));
}

.bottom-nav-inner {
    display: flex;
    gap: 10px;
    padding: 8px;
    border-radius: 22px;
    border: 1px solid var(--stroke);
    background: rgba(18, 16, 28, 0.85);
    backdrop-filter: blur(16px);
    max-width: 420px;
    width: 100%;
}

.nav-btn {
    flex: 1;
    border: none;
    border-radius: 16px;
    padding: 10px 8px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--muted);
    background: transparent;
}

.nav-btn.active {
    color: #fff;
    background: linear-gradient(120deg, rgba(139, 92, 246, 0.35), rgba(34, 211, 238, 0.15));
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.hidden {
    display: none !important;
}

.login-box {
    text-align: center;
}

#tg-login {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

audio {
    width: 100%;
    margin-top: 10px;
}

.gen-card {
    position: relative;
}

.gen-cross-lock {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    border-radius: var(--radius);
    background: rgba(7, 6, 13, 0.88);
    backdrop-filter: blur(10px);
}

.gen-cross-lock-text {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text);
    max-width: 280px;
}

.gen-progress {
    text-align: center;
    padding: 28px 12px 20px;
}

.gen-progress-icon {
    font-size: 2.2rem;
    line-height: 1;
    margin-bottom: 8px;
    filter: grayscale(0.2);
}

.gen-progress-title {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 700;
}

.gen-progress-digits {
    margin: 0 0 10px;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(120deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.gen-progress-job {
    margin: 0 0 8px;
    font-size: 0.82rem;
    min-height: 1.2em;
}

.gen-progress-note {
    margin: 0;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.45;
}

.muted {
    color: var(--muted);
}
