/* ═══ Страница «Игры»: хаб /games и конструктор /games/<id> ══════════════
   Всё с префиксом .gm-. Акцент (переливающаяся заливка) — только у главной
   кнопки экрана: «Создать» в хабе, «Отправить» в конструкторе, «Доработать»
   в окне игры. Остальное — нейтральное стекло; выбор — лёгкая подсветка
   кромки. Цветные обложки — это содержимое (как картинки), а не интерфейс.
   ═══════════════════════════════════════════════════════════════════════ */

@property --gm-p { syntax: '<number>'; inherits: true; initial-value: 0; }

/* ── Мелкие общие детали ───────────────────────────────────────────────── */
.gm-spin {
    display: inline-block;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.16);
    border-top-color: rgba(255, 255, 255, 0.85);
    animation: spin 0.8s linear infinite;
}

/* ═══ Хаб ═════════════════════════════════════════════════════════════════ */
.gm-hub { position: relative; }

.gm-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(28px, 5.5vh, 72px) 0 clamp(24px, 4vh, 44px);
}
.gm-hero-art {
    position: absolute;
    inset: 0;
    z-index: -1;
    display: flex;
    justify-content: center;
    pointer-events: none;
}
.gm-hero-world {
    width: min(1320px, 130vw);
    max-width: none;
    height: auto;
    margin-top: -6%;
    opacity: 0.46;
    -webkit-mask: radial-gradient(52% 50% at 50% 50%, #000 30%, rgba(0, 0, 0, 0.5) 62%, transparent 100%);
    mask: radial-gradient(52% 50% at 50% 50%, #000 30%, rgba(0, 0, 0, 0.5) 62%, transparent 100%);
    animation: gm-drift 18s var(--ease-in-out) infinite alternate;
    will-change: transform;
}
@keyframes gm-drift {
    from { transform: translate3d(0, -8px, 0) scale(1.02); }
    to   { transform: translate3d(0, 12px, 0) scale(1.07); }
}
/* Тёмная подложка под текстом: остров сзади не спорит с заголовком. */
.gm-hero-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.gm-hero-inner::before {
    content: '';
    position: absolute;
    inset: -10% 5% 18%;
    z-index: -1;
    /* 0.72: новый кадр hero светлее прежнего — подзаголовок и плашка держат AA (было 4.1:1). */
    background: radial-gradient(55% 60% at 50% 45%, rgba(0, 0, 0, 0.72), transparent 72%);
    pointer-events: none;
}
.gm-eyebrow {
    /* Дымчатое стекло без backdrop-filter: блик поверх тёмной подложки */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 30px;
    padding: 0 14px 0 10px;
    border-radius: var(--r-pill);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)), rgba(10, 10, 16, 0.45);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 8px 24px -12px rgba(0, 0, 0, 0.9);
    color: var(--text-2);
}
.gm-eyebrow svg { width: 15px; height: 15px; color: var(--text); }
.gm-title {
    margin-top: 18px;
    font-size: clamp(30px, 4.9vw, 66px);
    text-shadow: 0 6px 40px rgba(0, 0, 0, 0.55);
}
/* Слоган — подзаголовком под описательным h1, тем же размером: визуально
   прежний двухстрочный заголовок, а h1 говорит, что делает страница (§2.5). */
.gm-slogan {
    margin-top: 0;
    font-size: clamp(30px, 4.9vw, 66px);
}
/* Перелив — два прохода и стоп: background-position перерисовывает строку. */
.gm-slogan .text-aurora { display: inline-block; padding-bottom: 0.06em; animation: aurora-flow 14s linear 2; }
.gm-lead {
    max-width: 640px;
    margin-top: 18px;
    font-size: clamp(15px, 1.35vw, 18px);
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8);
}

/* Строка «опишите игру»: стекло, тонкая кромка, мягкое кольцо свечения
   (спокойно дышит; при фокусе разгорается). */
.gm-comp-wrap {
    position: relative;
    width: min(900px, 100%);
    margin-top: clamp(24px, 4vh, 40px);
    text-align: left;
}
.gm-comp-box { position: relative; }
.gm-comp-box::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 32px;
    /* Ореол — цветными размытыми тенями (рисуются один раз), а не conic + filter: blur:
       его дыхание прозрачностью пересчитывало размытие каждый кадр. */
    box-shadow: 0 -4px 26px -2px #a79fd0, 10px 0 26px -2px #92c4c6, 0 6px 26px -2px #b9c7a4, -10px 0 26px -2px #cfaabd;
    opacity: 0.2;
    pointer-events: none;
    transition: opacity var(--dur-3) ease;
    animation: gm-breathe 7s ease-in-out infinite alternate;
}
.gm-comp-box:focus-within::before { opacity: 0.46; animation: none; }
@keyframes gm-breathe { from { opacity: 0.14; } to { opacity: 0.26; } }

.gm-composer {
    /* Без backdrop-filter: под строкой плывёт фон — размытие считалось каждый кадр */
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 14px 14px 22px;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.02) 55%),
        rgba(10, 10, 15, 0.88);
    box-shadow: var(--sh-3);
}
.gm-composer::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: var(--edge);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: background var(--dur-2) ease;
}
.gm-composer:focus-within::before {
    background: linear-gradient(135deg, rgba(204, 197, 231, 0.85), rgba(191, 222, 223, 0.45) 50%, rgba(209, 219, 192, 0.6));
}
.gm-composer.is-shake { animation: gm-shake 0.42s var(--ease-out); }
@keyframes gm-shake {
    20% { transform: translateX(-7px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(2px); }
}
.gm-input {
    width: 100%;
    min-height: 60px;
    max-height: 220px;
    padding: 2px 8px 0 0;
    border: 0;
    outline: none;
    resize: none;
    background: transparent;
    color: var(--text);
    font-size: clamp(16px, 1.35vw, 18px);
    line-height: 1.5;
}
.gm-input::placeholder { color: var(--text-3); }
.gm-input:focus-visible { outline: none; }

.gm-comp-foot { display: flex; align-items: center; gap: 12px; min-width: 0; }
.gm-examples {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 0;
    -webkit-mask: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
    mask: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
}
.gm-examples::-webkit-scrollbar { display: none; }
.gm-ex {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 13px 0 11px;
    border: 0;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
    color: var(--text-2);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    white-space: nowrap;
    transition: background var(--dur-2) ease, color var(--dur-2) ease, box-shadow var(--dur-2) ease, transform var(--dur-1) var(--ease-out);
}
.gm-ex svg { width: 14px; height: 14px; color: var(--text-3); transition: color var(--dur-2) ease; }
.gm-ex:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
.gm-ex:hover svg { color: var(--text-2); }
.gm-ex:active { transform: scale(0.97); }

.gm-comp-end { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.gm-send { min-width: 150px; }
.gm-send .price svg, .gm-send .price { font-variant-numeric: tabular-nums; }
/* Кредиты кончились: главная кнопка становится нейтральной, а не тусклым
   акцентом, и рядом сказано почему. */
.gm-send.is-locked, .gm-bsend:disabled {
    color: var(--text-3);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.gm-send.is-locked::after, .gm-bsend:disabled::after { display: none; }
.gm-send.is-locked .price { border-left-color: rgba(255, 255, 255, 0.12); }

.gm-comp-under {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    min-height: 20px;
    margin-top: 12px;
    font-size: var(--fs-xs);
    color: var(--text-4);
}
.gm-lock-note { display: inline-flex; align-items: center; gap: 6px; color: var(--warn); }
.gm-lock-note svg { width: 14px; height: 14px; }

/* Фишка игровых кредитов: кольцо-остаток (нейтральное) и число. */
.gm-credits {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px 0 7px;
    border: 0;
    border-radius: var(--r-pill);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    box-shadow: inset 0 0 0 1px var(--line-2);
    color: var(--text);
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    transition: background var(--dur-2) ease, box-shadow var(--dur-2) ease;
}
.gm-credits:hover { background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05)); box-shadow: inset 0 0 0 1px var(--line-3); }
.gm-cr-ring {
    position: relative;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
}
.gm-cr-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(rgba(255, 255, 255, 0.88) calc(var(--p) * 1%), rgba(255, 255, 255, 0.12) 0);
    -webkit-mask: radial-gradient(circle, transparent 12px, #000 12.5px);
    mask: radial-gradient(circle, transparent 12px, #000 12.5px);
}
.gm-cr-ring svg { width: 15px; height: 15px; color: var(--text-2); }
.gm-cr-of { color: var(--text-3); font-weight: var(--fw-medium); }
.gm-credits.is-empty .gm-cr-val { color: var(--warn); }
.gm-credits.is-compact { height: 36px; padding: 0 11px 0 4px; font-size: var(--fs-sm); gap: 6px; }
.gm-credits.is-compact .gm-cr-ring { width: 28px; height: 28px; }
.gm-credits.is-compact .gm-cr-ring::before {
    -webkit-mask: radial-gradient(circle, transparent 11px, #000 11.5px);
    mask: radial-gradient(circle, transparent 11px, #000 11.5px);
}

/* Поповер кредитов */
.popover.gm-cp-pop { width: 330px; padding: 18px; }
.gm-cp { display: flex; flex-direction: column; gap: 12px; }
.gm-cp-head { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--fs-sm); font-weight: var(--fw-semibold); letter-spacing: 0.06em; text-transform: uppercase; }
.gm-cp-head svg { width: 16px; height: 16px; }
.gm-cp-big { display: flex; align-items: baseline; gap: 8px; }
.gm-cp-big b { font-family: var(--font-display); font-size: 34px; line-height: 1; letter-spacing: -0.02em; }
.gm-cp-big .faint { font-size: var(--fs-md); }
.gm-cp-reset { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-2); }
.gm-cp-reset svg { width: 15px; height: 15px; color: var(--text-3); }
.gm-cp-cost { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.5; }

/* ── Библиотека: вкладки и сетки ───────────────────────────────────────── */
.gm-lib { padding-top: 8px; padding-bottom: 24px; }
.gm-tabs { margin-bottom: 22px; }
.gm-tabs > button { display: inline-flex; align-items: center; gap: 8px; }
.gm-tabs > button svg { width: 17px; height: 17px; }
.gm-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: var(--fw-semibold);
    font-variant-numeric: tabular-nums;
}
.gm-panel { min-height: 280px; }

.gm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
    gap: 24px 16px;
}

/* ── Карточка игры ─────────────────────────────────────────────────────── */
.gm-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 11px;
    min-width: 0;
    animation: gm-rise 560ms var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 42ms);
}
@keyframes gm-rise { from { opacity: 0; transform: translate3d(0, 16px, 0); } }

.gm-poster {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    border-radius: 22px;
    container-type: inline-size;
    /* Сама картинка — встроенная SVG (components/game-cover.js); это фон до неё. */
    background: #15151c;
    box-shadow: var(--sh-2);
    transform: translateZ(0);
    transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3) var(--ease-out);
}
/* Затемнение снизу — название читается на любой обложке. */
.gm-poster::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    z-index: 1;
    height: 58%;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.5) 45%, rgba(0, 0, 0, 0.78));
    pointer-events: none;
    transition: opacity var(--dur-3) ease;
}
/* Обложка — матовая аппликация в жемчужной гамме: плоские формы, без
   свечений и неона (владелец 26.09). Рисуется один раз, не анимируется. */
.gm-pp { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.gm-pp > .game-cover { display: block; width: 100%; height: 100%; }

.gm-poster-ic {
    /* Без backdrop-filter (26.09, лаги): подложка плотнее */
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.52);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    color: #fff;
    transition: opacity var(--dur-3) ease;
}
.gm-poster-ic svg { width: 17px; height: 17px; }
.gm-poster-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 10px 0 8px;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.55);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 11.5px;
    font-weight: var(--fw-semibold);
    transition: opacity var(--dur-3) ease;
}
.gm-poster-tag svg { width: 13px; height: 13px; }
.gm-poster:has(.gm-live.is-on) .gm-poster-tag { opacity: 0; }
.gm-poster-title {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    z-index: 3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: var(--font-display);
    font-weight: var(--fw-bold);
    font-size: clamp(14px, 8.4cqw, 22px);
    line-height: 1.1;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    text-wrap: balance;
    overflow-wrap: anywhere;
    color: #fff;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
    transition: opacity var(--dur-3) ease, transform var(--dur-3) var(--ease-out);
}
.gm-poster-play {
    position: absolute;
    left: 50%;
    top: 44%;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07)), rgba(10, 10, 16, 0.5);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.26), 0 14px 34px -10px rgba(0, 0, 0, 0.8);
    color: #fff;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.86);
    transition: opacity var(--dur-2) ease, transform var(--dur-3) var(--ease-spring);
    pointer-events: none;
}
.gm-poster-play svg { width: 22px; height: 22px; margin-left: 3px; }

/* Живая игра при наведении: кадр 390×607 ужат под высоту обложки. */
.gm-live {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    background: #000;
    opacity: 0;
    transition: opacity 360ms var(--ease-out);
    pointer-events: none;
}
.gm-live.is-on { opacity: 1; }
.gm-live iframe {
    position: absolute;
    top: 0;
    left: 50%;
    width: 390px;
    max-width: none;
    height: 607px;
    border: 0;
    transform: translateX(-50%) scale(var(--k, 0.5));
    transform-origin: 50% 0;
    pointer-events: none;
}
.gm-poster:has(.gm-live.is-on)::after,
.gm-poster:has(.gm-live.is-on) .gm-poster-title,
.gm-poster:has(.gm-live.is-on) .gm-poster-ic,
.gm-poster:has(.gm-live.is-on) .gm-poster-play { opacity: 0; }

.gm-card:hover .gm-poster, .gm-card:focus-within .gm-poster {
    transform: translateY(-4px);
    box-shadow: var(--sh-3);
}
.gm-card:hover .gm-poster::before, .gm-card:focus-within .gm-poster::before { background: var(--edge-hover); }
.gm-card:hover .gm-poster-play, .gm-card:focus-within .gm-poster-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.gm-card:hover .gm-poster-title { transform: translateY(-2px); }

.gm-card-hit {
    position: absolute;
    inset: 0;
    z-index: 5;
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: transparent;
    cursor: pointer;
}
.gm-card-hit:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }

.gm-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    padding: 0 4px;
    color: var(--text-3);
    font-size: var(--fs-sm);
    min-width: 0;
}
.gm-meta-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-stats { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.gm-stat { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.gm-card-meta > .gm-stat { margin-left: auto; }
.gm-stat svg { width: 13px; height: 13px; }
.gm-stat.is-on svg { color: #dba3b1; }
.gm-author { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.gm-author-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-weight: var(--fw-medium); }
.gm-av {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, #2c2c38, #15151c);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    color: var(--text-2);
    font-size: 11px;
    font-weight: var(--fw-bold);
}
.gm-av > img { width: 100%; height: 100%; object-fit: cover; }
.gm-av-lg { width: 42px; height: 42px; font-size: 16px; }

/* Заготовки и «собирается» */
.gm-card.is-skel { animation: none; }
.gm-card.is-skel .gm-poster { background: rgba(255, 255, 255, 0.045); box-shadow: none; }
.gm-skel-line { height: 14px; width: 62%; border-radius: 7px; margin-left: 4px; }
.gm-card.is-building .gm-poster-build {
    display: grid;
    place-items: center;
    background:
        radial-gradient(70% 55% at 50% 40%, rgba(167, 159, 208, 0.22), transparent 70%),
        linear-gradient(180deg, #0c0c14, #050507);
}
.gm-card.is-building .gm-poster-title { font-size: clamp(13px, 6.4cqw, 16px); color: var(--text-2); text-transform: none; font-family: var(--font-ui); font-weight: var(--fw-medium); }
.gm-card.is-building .gm-card-meta { color: var(--text-2); }

.gm-pixels { display: grid; grid-template-columns: repeat(5, 12px); gap: 6px; }
.gm-card .gm-pixels { grid-template-columns: repeat(4, 12px); margin-bottom: 30%; }
.gm-pixels i {
    width: 12px;
    height: 12px;
    border-radius: 3.5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0.1;
    animation: gm-pix 1.8s ease-in-out infinite;
    animation-delay: var(--d, 0ms);
    transition: background var(--dur-3) ease, box-shadow var(--dur-3) ease;
}
.gm-pixels i.is-lit {
    opacity: 1;
    animation: none;
    background: linear-gradient(135deg, #ffffff, #dcdfef);
    box-shadow: 0 0 12px rgba(226, 222, 242, 0.12);
}
@keyframes gm-pix { 0%, 100% { opacity: 0.1; } 50% { opacity: 0.42; } }

/* Пустые состояния и ошибки */
.gm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 48px;
    text-align: center;
    animation: gm-rise 560ms var(--ease-out) both;
}
.gm-empty-art {
    width: min(460px, 92%);
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 26px;
    -webkit-mask: radial-gradient(64% 70% at 50% 46%, #000 42%, transparent 100%);
    mask: radial-gradient(64% 70% at 50% 46%, #000 42%, transparent 100%);
    margin-bottom: 2px;
}
.gm-empty .muted { max-width: 460px; }
.gm-empty .btn { margin-top: 8px; }
.gm-empty.is-error { padding-top: 48px; }
.gm-empty.is-error > svg { width: 32px; height: 32px; color: var(--danger); }

.gm-more { position: relative; display: flex; justify-content: center; padding: 30px 0 4px; }
.gm-sentinel { position: absolute; left: 50%; bottom: 0; width: 1px; height: 1px; }

/* ═══ Рамка устройства и слои игры (конструктор и окно игры) ════════════ */
.gm-device {
    position: relative;
    height: 92%;
    height: min(calc(100cqh - 36px), calc((100cqw - 36px) * 14 / 9), 880px);
    aspect-ratio: 9 / 14;
    max-width: 100%;
    padding: 9px;
    border-radius: 38px;
    background: linear-gradient(160deg, #1d1d27, #0b0b10 55%, #101017);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        inset 0 0 0 1px rgba(255, 255, 255, 0.07),
        0 50px 110px -40px rgba(0, 0, 0, 0.95),
        0 0 90px -30px rgba(226, 222, 242, 0.113);
}
/* Блик по кромке рамки. */
.gm-device::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.04) 35%, rgba(255, 255, 255, 0.02) 65%, rgba(191, 222, 223, 0.22));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.gm-screen {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 29px;
    background: #000;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.gm-screen iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
    opacity: 0;
    transition: opacity 320ms var(--ease-out), filter 320ms var(--ease-out);
}
[data-stage="ready"] .gm-screen iframe,
.gm-screen[data-stage="ready"] iframe,
[data-stage="testing"] .gm-screen iframe { opacity: 1; }

.gm-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    color: var(--text-2);
    font-size: var(--fs-sm);
    animation: gm-fade 320ms var(--ease-out);
}
.gm-layer b { color: var(--text); font-size: var(--fs-base); font-weight: var(--fw-semibold); }
@keyframes gm-fade { from { opacity: 0; } }
[data-stage="empty"] .gm-l-empty,
[data-stage="loading"] .gm-l-load,
[data-stage="building"] .gm-l-build,
[data-stage="testing"] .gm-l-test,
[data-stage="error"] .gm-l-err,
[data-stage="missing"] .gm-l-missing { display: flex; }

.gm-l-empty, .gm-l-missing { justify-content: flex-end; padding-bottom: 38px; background: #030305; }
.gm-l-missing img { filter: grayscale(0.85) brightness(0.6); }
.gm-l-empty img, .gm-l-missing img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
    -webkit-mask: linear-gradient(180deg, #000 45%, transparent 88%);
    mask: linear-gradient(180deg, #000 45%, transparent 88%);
    z-index: -1;
}
.gm-l-empty b, .gm-l-missing b { font-family: var(--font-display); font-size: clamp(15px, 1.5vw, 19px); text-transform: uppercase; letter-spacing: -0.01em; }
.gm-l-empty span, .gm-l-missing span { max-width: 260px; color: var(--text-3); }
.gm-l-load { background: #000; }
.gm-l-build {
    gap: 14px;
    background:
        radial-gradient(70% 45% at 50% 42%, rgba(167, 159, 208, 0.2), transparent 70%),
        radial-gradient(60% 40% at 55% 70%, rgba(146, 196, 198, 0.08), transparent 70%),
        #050508;
}
.gm-l-build { overflow: hidden; isolation: isolate; }
/* Тёмное «окно» под пикселями и подписью: строки кода не спорят с текстом. */
.gm-l-build::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(42% 24% at 50% 52%, rgba(5, 5, 8, 0.92), rgba(5, 5, 8, 0.6) 55%, transparent 100%);
    pointer-events: none;
}
.gm-l-build .gm-pixels { margin-bottom: 10px; }
.gm-build-sub { max-width: 90%; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.5; }
/* Сияние за экраном сборки: медленно вращающийся конический градиент под размытием. */
.gm-build-aura {
    position: absolute;
    inset: -35%;
    z-index: -3;
    /* Пятна по кругу вместо conic + blur(40px): вращающийся размытый слой
       пересчитывал размытие каждый кадр; мягкость — спадом градиента. */
    background:
        radial-gradient(30% 30% at 80% 50%, rgba(167, 159, 208, 0.34), rgba(167, 159, 208, 0.12) 50%, transparent),
        radial-gradient(28% 28% at 60% 78%, rgba(146, 196, 198, 0.22), rgba(146, 196, 198, 0.08) 50%, transparent),
        radial-gradient(26% 26% at 27% 69%, rgba(185, 199, 164, 0.12), transparent);
    opacity: 0.75;
    animation: gm-aura 9s linear infinite;
}
@keyframes gm-aura { to { transform: rotate(360deg); } }
/* «Код» пишется: полоски-строки плывут вверх, края растворяются. */
.gm-build-code {
    position: absolute;
    inset: 7% 12% 7% 12%;
    z-index: -2;
    overflow: hidden;
    opacity: 0.55;
    -webkit-mask: linear-gradient(180deg, transparent, #000 22%, #000 70%, transparent);
    mask: linear-gradient(180deg, transparent, #000 22%, #000 70%, transparent);
}
.gm-build-code > div { display: flex; flex-direction: column; gap: 11px; padding-bottom: 11px; animation: gm-code 14s linear infinite; }
.gm-build-code i {
    display: block;
    height: 5px;
    width: var(--w);
    margin-left: var(--x);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.075);
}
.gm-build-code i[style*="--c:1"] { background: rgba(201, 193, 230, 0.22); }
.gm-build-code i[style*="--c:2"] { background: rgba(191, 222, 223, 0.16); }
@keyframes gm-code { to { transform: translateY(-100%); } }
.gm-l-build[data-phase="think"] .gm-build-code { opacity: 0.22; }
.gm-l-build[data-phase="think"] .gm-build-code > div { animation-duration: 26s; }
/* Полоса хода сборки под заголовком. */
.gm-build-bar {
    position: relative;
    width: min(180px, 60%);
    height: 4px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.08);
}
.gm-build-bar i {
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--p, 0.06) * 100%);
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.55), #fff);
    box-shadow: 0 0 12px rgba(226, 222, 242, 0.12);
    transition: width 700ms var(--ease-out);
}
.gm-build-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: translateX(-100%);
    animation: gm-bar-sheen 1.6s ease-in-out infinite;
}
@keyframes gm-bar-sheen { to { transform: translateX(100%); } }
/* Правка уже готовой игры: игра видна под дымкой. */
.gm-view.has-game[data-stage="building"] .gm-screen iframe { opacity: 0.38; filter: blur(7px) saturate(0.6); }
.gm-view.has-game[data-stage="building"] .gm-l-build { background: rgba(4, 4, 8, 0.55); }
.gm-l-test { background: rgba(0, 0, 0, 0.5); }
.gm-l-err { background: #050507; }
.gm-l-err > svg { width: 30px; height: 30px; color: var(--danger); }

.gm-exitmax { display: none; position: absolute; top: 14px; right: 14px; z-index: 6; }
.gm-stage.is-max .gm-exitmax, .gm-stage.is-fs .gm-exitmax, .gm-stage:fullscreen .gm-exitmax,
.gm-pm-stage.is-max .gm-exitmax, .gm-pm-stage:fullscreen .gm-exitmax { display: inline-flex; }

/* Полноэкранный режим (настоящий и запасной для iPhone). */
.gm-stage:fullscreen, .gm-pm-stage:fullscreen { background: #000; padding: 12px; }
.gm-stage:-webkit-full-screen, .gm-pm-stage:-webkit-full-screen { background: #000; padding: 12px; width: 100%; height: 100%; }
.gm-stage.is-max, .gm-pm-stage.is-max {
    position: fixed !important;
    inset: 0;
    z-index: calc(var(--z-modal) + 10);
    width: 100vw;
    height: 100dvh;
    padding: max(12px, env(safe-area-inset-top)) 8px max(12px, env(safe-area-inset-bottom));
    background: #000;
    border-radius: 0 !important;
}

/* ═══ Окно игры сообщества ════════════════════════════════════════════════ */
.modal.gm-pm-modal { overflow: hidden; }
.gm-pm { display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.gm-pm-stage {
    position: relative;
    display: grid;
    place-items: center;
    height: min(82dvh, 780px);
    padding: 20px;
    container-type: size;
    border-radius: var(--r-2xl) 0 0 var(--r-2xl);
    background:
        radial-gradient(38% 46% at 50% 50%, rgba(167, 159, 208, 0.26), transparent 72%),
        radial-gradient(30% 34% at 62% 72%, rgba(146, 196, 198, 0.1), transparent 70%),
        radial-gradient(30% 30% at 36% 26%, rgba(203, 165, 184, 0.07), transparent 70%),
        #040406;
}
.gm-pm-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    max-height: min(82dvh, 780px);
    overflow: auto;
    padding: 64px 24px 24px;
}
.gm-pm-author { display: flex; align-items: center; gap: 12px; min-width: 0; }
.gm-pm-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.gm-pm-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-semibold); }
.gm-pm-who .faint { font-size: var(--fs-sm); }
.gm-pm-title {
    font-family: var(--font-display);
    font-size: clamp(20px, 2vw, 26px);
    font-weight: var(--fw-bold);
    line-height: 1.12;
    letter-spacing: -0.015em;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}
.gm-pm-desc { color: var(--text-2); font-size: var(--fs-md); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.gm-pm-desc.is-clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.gm-pm-more {
    align-self: flex-start;
    margin-top: -8px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255, 255, 255, 0.3);
}
.gm-pm-of { display: inline-flex; align-items: center; gap: 7px; color: var(--text-3); font-size: var(--fs-sm); }
.gm-pm-of svg { width: 14px; height: 14px; }
.gm-pm-stats { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; color: var(--text-2); font-size: var(--fs-md); }
.gm-pm-stat { display: inline-flex; align-items: center; gap: 6px; }
.gm-pm-stat svg { width: 16px; height: 16px; color: var(--text-3); }
.gm-like {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 44px;
    padding: 0 16px 0 14px;
    border: 0;
    border-radius: var(--r-pill);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.035));
    box-shadow: inset 0 0 0 1px var(--line-2);
    color: var(--text);
    font-weight: var(--fw-semibold);
    transition: background var(--dur-2) ease, box-shadow var(--dur-2) ease, transform var(--dur-1) var(--ease-out);
}
.gm-like svg { width: 18px; height: 18px; transition: color var(--dur-2) ease; }
.gm-like:hover { background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05)); }
.gm-like:active { transform: scale(0.96); }
.gm-like[aria-pressed="true"] { box-shadow: inset 0 0 0 1px rgba(219, 163, 177, 0.35); }
.gm-like[aria-pressed="true"] svg { color: #dba3b1; }
.gm-like.is-pop svg { animation: gm-pop 460ms var(--ease-spring); }
@keyframes gm-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.gm-pm-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.gm-pm-remix { flex: 1 1 auto; }
.gm-pm-note { display: flex; align-items: flex-start; gap: 7px; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.5; }
.gm-pm-note svg { width: 14px; height: 14px; margin-top: 3px; flex: 0 0 auto; }
.gm-pm-del { align-self: flex-start; margin-top: auto; color: var(--text-3); }
.gm-pm-del:hover:not(:disabled) { color: var(--danger); }

/* ═══ Конструктор ═════════════════════════════════════════════════════════ */
.gm-builder {
    --chat-w: 420px;
    display: grid;
    grid-template-columns: var(--chat-w) 14px minmax(0, 1fr);
    height: calc(100dvh - var(--nav-h) - var(--tabs-h));
    min-height: 520px;
    padding: 12px var(--gutter) 16px;
}
.gm-builder.is-dragging { cursor: col-resize; user-select: none; }
.gm-builder.is-dragging iframe { pointer-events: none; }
.gm-bswitch { display: none; }

.gm-chat, .gm-view {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-radius: var(--r-2xl);
    animation: gm-rise 520ms var(--ease-out) both;
}
.gm-view { animation-delay: 70ms; }
.gm-chat { overflow: hidden; }
.gm-chat-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 60px;
    padding: 10px 10px 10px 8px;
    border-bottom: 1px solid var(--line);
}
.gm-chat-id { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.gm-chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-semibold); font-size: var(--fs-base); }
.gm-chat-sub { color: var(--text-3); font-size: var(--fs-xs); }

.gm-feed {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 16px 12px;
    overscroll-behavior: contain;
}
.gm-feed > * { animation: gm-rise 360ms var(--ease-out) both; flex: 0 0 auto; }
.gm-feed {
    -webkit-mask: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 6px), transparent);
    mask: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 6px), transparent);
}

.gm-msg { display: flex; gap: 10px; max-width: 100%; }
.gm-msg.is-user { justify-content: flex-end; }
.gm-msg.is-user .gm-bubble {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 18px 18px 6px 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.065));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.5;
}
.gm-msg.is-ai { align-items: flex-start; }
.gm-ai-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.gm-ai-mark .brand-mark { width: 20px; height: 20px; filter: none; }
.gm-msg.is-ai .gm-bubble { min-width: 0; padding-top: 4px; color: var(--text); line-height: 1.55; overflow-wrap: anywhere; }
.gm-md p + p, .gm-md p + ul, .gm-md ul + p { margin-top: 8px; }
.gm-md ul { margin: 6px 0 0; padding-left: 18px; }
.gm-md li + li { margin-top: 3px; }
.gm-md code {
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    font-family: var(--font-mono);
    font-size: 0.88em;
}
.gm-md pre {
    margin: 8px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.45);
    box-shadow: inset 0 0 0 1px var(--line);
    overflow: auto;
    font-size: 12.5px;
}
.gm-md pre code { padding: 0; background: none; }

/* Заметки: приветствие, копия, кредиты, ошибки. */
.gm-note {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--text-2);
    font-size: var(--fs-md);
    line-height: 1.55;
}
.gm-note-ic {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: var(--text);
}
.gm-note-ic svg { width: 17px; height: 17px; }
.gm-note-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.gm-note-body b { color: var(--text); }
.gm-note-ex { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.gm-note-ex .gm-ex { height: 32px; padding: 0 11px 0 9px; gap: 5px; font-size: 13px; }
.gm-note-ex .gm-ex svg { width: 13px; height: 13px; }
.gm-note.is-bad .gm-note-ic { color: var(--danger); }
.gm-note.is-calm .gm-note-ic { color: var(--text-2); }

/* Ход сборки */
.gm-work {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 14px 14px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 0 0 1px var(--line), 0 12px 30px -18px rgba(0, 0, 0, 0.9);
}
.gm-work[data-state="run"] { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 1px rgba(201, 193, 230, 0.2), 0 16px 40px -22px rgba(226, 222, 242, 0.113); }
.gm-work-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gm-work-ic { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 auto; color: var(--text-2); }
.gm-work-ic svg { width: 18px; height: 18px; }
.gm-work[data-state="done"] .gm-work-ic { color: var(--success); }
.gm-work[data-state="error"] .gm-work-ic { color: var(--danger); }
.gm-work-stage { flex: 1 1 auto; min-width: 0; font-weight: var(--fw-semibold); color: var(--text); }
.gm-work[data-state="run"] .gm-work-stage {
    background: linear-gradient(90deg, var(--text) 0%, var(--text) 26%, rgba(255, 255, 255, 0.5) 50%, var(--text) 74%, var(--text) 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gm-sheen 2.4s linear infinite;
}
@keyframes gm-sheen { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.gm-work-time { color: var(--text-3); font-size: var(--fs-xs); flex: 0 0 auto; }

.gm-plan { list-style: none; display: flex; flex-direction: column; gap: 7px; padding-left: 2px; }
.gm-plan li { display: flex; align-items: flex-start; gap: 10px; color: var(--text-3); font-size: var(--fs-sm); line-height: 1.45; transition: color var(--dur-3) ease; }
.gm-plan li[data-s="active"] { color: var(--text); }
.gm-plan li[data-s="done"] { color: var(--text-2); }
.gm-step {
    position: relative;
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex: 0 0 auto;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.2);
    transition: background var(--dur-3) ease, box-shadow var(--dur-3) ease;
}
.gm-step svg { width: 11px; height: 11px; stroke-width: 2.6; }
.gm-plan li[data-s="done"] .gm-step { background: rgba(255, 255, 255, 0.88); box-shadow: none; color: #07070b; animation: gm-pop 380ms var(--ease-spring); }
.gm-plan li[data-s="active"] .gm-step { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.14); }
.gm-plan li[data-s="active"] .gm-step::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.9);
    border-right-color: rgba(255, 255, 255, 0.35);
    animation: spin 0.9s linear infinite;
}

.gm-files { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.gm-files li {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 0 12px 0 10px;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.28);
    box-shadow: inset 0 0 0 1px var(--line);
    font-size: var(--fs-sm);
}
.gm-file-ic { display: grid; place-items: center; color: var(--text-3); }
.gm-file-ic svg { width: 15px; height: 15px; }
.gm-file-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 12.5px; color: var(--text); }
.gm-file-size { color: var(--text-3); font-size: var(--fs-xs); }
.gm-file-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(201, 193, 230, 0.85), rgba(191, 222, 223, 0.85), transparent);
    background-size: 50% 100%;
    background-repeat: no-repeat;
    opacity: 0;
}
.gm-files li[data-s="write"] { background: rgba(255, 255, 255, 0.045); }
.gm-files li[data-s="write"] .gm-file-bar { opacity: 1; animation: gm-scan 1.3s ease-in-out infinite; }
.gm-files li[data-s="write"]::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.06) 45%, transparent 70%);
    transform: translateX(-100%);
    animation: shimmer 1.7s ease-in-out infinite;
    pointer-events: none;
}
.gm-files li[data-s="done"] .gm-file-ic { color: var(--success); }
@keyframes gm-scan { from { background-position: -60% 0; } to { background-position: 160% 0; } }

.gm-work-sum { color: var(--text-2); font-size: var(--fs-sm); }
.gm-work-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    color: var(--text-2);
    font-size: var(--fs-sm);
}
.gm-work-check svg { width: 16px; height: 16px; flex: 0 0 auto; }
.gm-work-check[data-s="ok"] svg { color: var(--success); }
.gm-work-check[data-s="fix"] svg, .gm-work-check[data-s="warn"] svg { color: var(--warn); }
.gm-work-check[data-s="warn"] { align-items: flex-start; }
.gm-work-err { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.5; }
.gm-work[data-state="error"] { box-shadow: inset 0 0 0 1px rgba(255, 92, 108, 0.22); }
.gm-work[data-state="credits"] .gm-work-ic { color: var(--text-2); }

/* Отложенное сообщение */
.gm-queue {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px 8px 12px;
    border-radius: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    color: var(--text-2);
    font-size: var(--fs-sm);
}
.gm-queue-ic { color: var(--text-3); display: grid; }
.gm-queue-ic svg { width: 16px; height: 16px; }
.gm-queue-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gm-queue-label { color: var(--text-3); font-size: var(--fs-xs); }
.gm-queue-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.gm-hist-skel { display: flex; flex-direction: column; gap: 12px; }
.gm-hist-skel .skeleton { height: 44px; border-radius: 16px; }
.gm-hist-skel .skeleton.is-me { align-self: flex-end; }

/* Строка ввода конструктора */
.gm-bcomp { padding: 10px 12px 12px; background: linear-gradient(180deg, transparent, rgba(6, 6, 10, 0.6) 40%); }
.gm-bcomp-box {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 8px 8px 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.045);
    box-shadow: inset 0 0 0 1px var(--line-2);
    transition: box-shadow var(--dur-2) ease, background var(--dur-2) ease;
}
.gm-bcomp-box:focus-within {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(201, 193, 230, 0.5), 0 0 0 4px rgba(167, 159, 208, 0.12), 0 10px 40px -16px rgba(226, 222, 242, 0.12);
}
.gm-bcomp textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 24px;
    max-height: 180px;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    outline: none;
    resize: none;
    background: transparent;
    color: var(--text);
    font-size: var(--fs-base);
    line-height: 1.5;
}
.gm-bcomp textarea::placeholder { color: var(--text-3); }
.gm-bcomp textarea:focus-visible { outline: none; }
.gm-bsend { --h: 40px; flex: 0 0 auto; }
.gm-bcomp-note { margin-top: 8px; padding: 0 6px; color: var(--text-4); font-size: var(--fs-xs); text-align: center; font-variant-numeric: tabular-nums; }
.gm-bcomp-note.is-locked { color: var(--warn); }
.gm-bcomp.is-busy .gm-bsend { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 20px -10px rgba(226, 222, 242, 0.12); }

/* Разделитель панелей */
.gm-split { position: relative; cursor: col-resize; touch-action: none; }
.gm-split::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 46px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.14);
    transform: translate(-50%, -50%);
    transition: height var(--dur-3) var(--ease-out), background var(--dur-2) ease;
}
.gm-split:hover::before, .gm-split:focus-visible::before, .gm-builder.is-dragging .gm-split::before { height: 88px; background: rgba(255, 255, 255, 0.4); }
.gm-split:focus-visible { outline: none; }

/* Панель игры */
.gm-view { overflow: hidden; }
.gm-view-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    padding: 10px 10px 10px 18px;
    border-bottom: 1px solid var(--line);
}
.gm-view-status { flex: 1 1 auto; min-width: 0; overflow: hidden; display: flex; align-items: center; gap: 9px; font-size: var(--fs-md); color: var(--text-2); }
.gm-view-state { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: rgba(255, 255, 255, 0.3); transition: background var(--dur-3) ease, box-shadow var(--dur-3) ease; }
.gm-view[data-stage="ready"] .gm-dot { background: var(--success); box-shadow: 0 0 10px rgba(62, 224, 143, 0.7); }
.gm-view[data-stage="building"] .gm-dot, .gm-view[data-stage="testing"] .gm-dot, .gm-view[data-stage="loading"] .gm-dot {
    background: #e3e5f2;
    box-shadow: 0 0 10px rgba(226, 222, 242, 0.12);
    animation: gm-blink 1.2s ease-in-out infinite;
}
.gm-view[data-stage="error"] .gm-dot { background: var(--danger); box-shadow: 0 0 10px rgba(255, 92, 108, 0.6); }
@keyframes gm-blink { 50% { opacity: 0.35; } }
.gm-pubchip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 9px 0 7px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
    color: var(--text-2);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    white-space: nowrap;
}
.gm-pubchip svg { width: 13px; height: 13px; }
.gm-view-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.gm-view-actions .btn-icon.btn-sm { --h: 38px; }
.gm-vsep { width: 1px; height: 22px; margin: 0 6px; background: var(--line-2); }
.gm-del:hover:not(:disabled) { color: var(--danger); background: var(--danger-bg); }
.gm-publish { position: relative; }
.gm-publish.is-stale::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e3e5f2;
    box-shadow: 0 0 8px rgba(226, 222, 242, 0.12);
}

.gm-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    container-type: size;
    background:
        radial-gradient(42% 52% at 50% 50%, rgba(167, 159, 208, 0.16), transparent 72%),
        radial-gradient(34% 36% at 58% 68%, rgba(146, 196, 198, 0.07), transparent 72%);
}
/* Отражение «на полу» под устройством. */
.gm-stage::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 3%;
    width: min(60cqw, 420px);
    height: 38px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(167, 159, 208, 0.24), rgba(167, 159, 208, 0.1) 50%, transparent);
    pointer-events: none;
    z-index: 0;
}
.gm-stage > .gm-device { z-index: 1; }

/* ═══ Публикация ══════════════════════════════════════════════════════════ */
.gm-pub { display: flex; flex-direction: column; gap: 16px; padding: 28px 26px 22px; }
.gm-pub-head { display: flex; gap: 14px; align-items: flex-start; padding-right: 36px; }
.gm-pub-head .muted { margin-top: 4px; font-size: var(--fs-md); line-height: 1.5; }
.gm-pub-ic {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.gm-pub-ic svg { width: 21px; height: 21px; }
.gm-pub-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gm-pub-stats > span {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--text-3);
    font-size: var(--fs-xs);
}
.gm-pub-stats svg { width: 15px; height: 15px; color: var(--text-2); }
.gm-pub-stats b { color: var(--text); font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.gm-pub .field-card .textarea { min-height: 104px; }
.gm-pub-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--r-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    box-shadow: inset 0 0 0 1px var(--line);
}
.gm-pub-row > div { flex: 1 1 auto; min-width: 0; }
.gm-pub-row b { font-weight: var(--fw-semibold); }
.gm-pub-row .faint { margin-top: 3px; font-size: var(--fs-sm); line-height: 1.45; }
.gm-pub-err { color: var(--danger); font-size: var(--fs-sm); }
.gm-pub-mod { display: flex; align-items: center; gap: 7px; font-size: var(--fs-xs); }
.gm-pub-mod svg { width: 14px; height: 14px; flex: 0 0 auto; }
.gm-pub-actions { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.gm-pub-actions .btn-primary { flex: 0 0 auto; }
.gm-spacer { flex: 1 1 auto; }
.gm-unpub { color: var(--text-3); padding: 0 12px; }
.gm-unpub:hover:not(:disabled) { color: var(--danger); background: var(--danger-bg); }

/* ═══ Планшет и телефон ═══════════════════════════════════════════════════ */
@media (max-width: 1180px) {
    .gm-builder { --chat-w: 380px; }
    .gm-pubchip { padding: 0 6px; }
    .gm-pubchip span { display: none; }
}
@media (max-width: 1100px) and (min-width: 901px) {
    .gm-view-actions .gm-vsep { display: none; }
    .gm-view-bar { padding-left: 14px; gap: 6px; }
}
@media (max-width: 900px) {
    .gm-builder {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        gap: 10px;
        padding: 10px 12px 12px;
        min-height: 480px;
    }
    .gm-bswitch { display: flex; }
    .gm-bswitch > button { position: relative; }
    .gm-bdot { position: absolute; top: 9px; right: calc(50% - 44px); width: 7px; height: 7px; border-radius: 50%; background: #e3e5f2; box-shadow: 0 0 8px rgba(226, 222, 242, 0.12); animation: gm-blink 1.2s ease-in-out infinite; }
    .gm-split { display: none; }
    .gm-builder[data-pane="chat"] .gm-view,
    .gm-builder[data-pane="game"] .gm-chat { display: none; }
    .gm-chat, .gm-view { animation: none; }
    .gm-view-bar { padding-left: 14px; }
    .gm-view-actions { gap: 2px; }
    .gm-vsep { margin: 0 3px; }
    .gm-stage { padding: 12px; }

    .gm-pm { grid-template-columns: 1fr; }
    .gm-pm-stage { height: min(54dvh, 600px); border-radius: var(--r-2xl) var(--r-2xl) 0 0; padding: 12px; }
    .gm-pm-side { max-height: none; overflow: visible; padding: 16px 18px 20px; gap: 12px; }
}
@media (max-width: 640px) {
    .gm-hero { padding-top: 28px; }
    .gm-hero-world { width: 190vw; margin-top: 4%; opacity: 0.4; }
    .gm-lead { margin-top: 12px; }
    .gm-composer { padding: 14px 12px 12px 16px; border-radius: 24px; gap: 10px; }
    .gm-comp-box::before { border-radius: 28px; }
    .gm-input { min-height: 72px; font-size: 16px; }
    .gm-comp-foot { flex-direction: column; align-items: stretch; gap: 10px; }
    .gm-examples { margin: 0 -12px 0 -16px; padding: 2px 12px 2px 16px; }
    .gm-comp-end { justify-content: space-between; }
    .gm-send { flex: 1 1 auto; min-width: 0; }
    .gm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
    .gm-poster, .gm-card-hit { border-radius: 18px; }
    .gm-poster-ic { top: 9px; left: 9px; width: 30px; height: 30px; border-radius: 10px; }
    .gm-poster-title { left: 11px; right: 11px; bottom: 11px; }
    .gm-poster-tag { top: 9px; right: 9px; height: 30px; width: 30px; padding: 0; justify-content: center; border-radius: 10px; }
    .gm-poster-tag span { display: none; }
    .gm-card-meta { font-size: var(--fs-xs); gap: 6px; padding: 0 2px; }
    .gm-stats { gap: 7px; }
    .gm-card[data-post] .gm-stat + .gm-stat { display: none; }
    .gm-tabs { margin-bottom: 16px; }

    .gm-view-status .gm-pubchip span { display: none; }
    .gm-publish { padding: 0 12px; }
    .gm-publish .gm-publish-label { display: none; }
    .gm-feed { padding: 14px 12px 10px; }
    .gm-pub { padding: 24px 18px 18px; }
    .gm-pub-actions { flex-wrap: wrap; }
    .gm-pub-actions .gm-unpub { order: 3; flex: 1 0 100%; justify-content: center; }
    .gm-pub-actions .gm-spacer { display: none; }
    .gm-pub-actions .gm-cancel { flex: 0 0 auto; }
    .gm-pub-actions .btn-primary { flex: 1 1 auto; }
}
@media (max-width: 380px) {
    .gm-view-actions [data-act="tab"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .gm-hero-world, .gm-comp-box::before, .gm-build-aura, .gm-build-code > div, .gm-build-bar::after { animation: none; }
    .gm-card, .gm-feed > *, .gm-chat, .gm-view, .gm-empty, .gm-slogan .text-aurora { animation: none; }
}
