/* ============================================================ MisBlocks ===
   Тема сайта в стиле интерфейса клиента и редактора Godot:
   тёмная нейтральная палитра, шрифт Open Sans (шрифт проекта Godot),
   строгие прямые формы, минимум декора.
   ========================================================================= */

/* ------------------------------------------------------------- шрифты --- */
/* Open Sans — дефолтный шрифт проекта Godot 4 (Open Sans SemiBold).
   Файлы лежат локально, без обращения к Google Fonts. */
@font-face {
    font-family: "Open Sans";
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url("fonts/OpenSans-cyrillic.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: "Open Sans";
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url("fonts/OpenSans-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
        U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
        U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------- тема --- */
:root {
    /* Тёмная тема по умолчанию — как в клиенте. */
    --bg-color: #0e0e10;
    --container-bg: #151517;
    --surface-2: #1b1b1e;
    --surface-3: #232327;
    --text-color: #d7d7db;
    --text-dim: #8d8d96;
    --border-color: #26262b;
    --border-strong: #35353c;

    --accent: #57b884;
    --accent-hover: #6ecb98;
    --accent-soft: rgba(87, 184, 132, 0.14);
    --accent-contrast: #06120c;

    --primary-color: var(--accent);
    --primary-dark: var(--accent-hover);
    --hover-bg: #202024;

    --danger: #d3574f;
    --ok: #57b884;

    /* Спокойные градиенты: подсветка сверху и мягкое затемнение внизу. */
    --page-bg:
        radial-gradient(1100px 520px at 50% -12%, rgba(87, 184, 132, 0.07), transparent 70%),
        linear-gradient(180deg, #111114 0%, #0c0c0e 100%);
    --panel-bg:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 140px),
        var(--container-bg);
    /* Лёгкий блик сверху кнопки. Не меняется при hover — иначе заливка
       переключается рывком и выглядит как мерцание. */
    --btn-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 70%);

    --radius: 4px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.28);
    --font: "Open Sans", "Noto Sans", "Segoe UI", system-ui, sans-serif;
}

html {
    background: #0e0e10;
    color-scheme: dark;
}

.theme-light {
    --bg-color: #eceef1;
    --container-bg: #ffffff;
    --surface-2: #f5f6f8;
    --surface-3: #e9ebef;
    --text-color: #1b1c1f;
    --text-dim: #61646c;
    --border-color: #d8dbe1;
    --border-strong: #c2c6ce;
    --hover-bg: #eef0f3;
    --accent-soft: rgba(63, 145, 100, 0.10);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.08);
    --page-bg:
        radial-gradient(1100px 520px at 50% -12%, rgba(63, 145, 100, 0.07), transparent 70%),
        linear-gradient(180deg, #f3f5f7 0%, #e9ebef 100%);
    --panel-bg:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 140px),
        var(--container-bg);
}

html.theme-light { background: #eceef1; color-scheme: light; }

/* Цветовые акценты из настроек. */
.theme-green { --accent: #57b884; --accent-hover: #6ecb98; --accent-soft: rgba(87, 184, 132, 0.14); --accent-contrast: #06120c; }
.theme-raspberry { --accent: #d0567f; --accent-hover: #e06a90; --accent-soft: rgba(208, 86, 127, 0.14); --accent-contrast: #1a0a10; }
.theme-chocolate { --accent: #b5793f; --accent-hover: #c98c4f; --accent-soft: rgba(181, 121, 63, 0.15); --accent-contrast: #160f08; }

/* --------------------------------------------------------------- база --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background-color: var(--bg-color);
    background-image: var(--page-bg);
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-color);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0 0 0.6em 0;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text-color);
}

h1 {
    font-size: 26px;
    padding-bottom: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
h2 { font-size: 19px; margin-top: 28px; }
h3 { font-size: 15px; margin-top: 22px; color: var(--text-color); }
h4 { font-size: 14px; }

p { margin: 0 0 12px 0; }
small { font-size: 12.5px; color: var(--text-dim); }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

hr {
    height: 0;
    margin: 22px 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

::selection { background: var(--accent-soft); color: var(--text-color); }

/* Тонкие скроллбары в духе редактора. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg-color); }

/* ------------------------------------------------------------- хедер --- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 0 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 100%),
        color-mix(in srgb, var(--bg-color) 96%, transparent);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    transition: transform 0.25s ease-in-out;
    transform: translateY(0);
}

.header.hidden { transform: translateY(-100%); }

.header-inner {
    max-width: 1120px;
    height: 60px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-logo { display: flex; align-items: center; gap: 10px; }
.header-logo img { height: 30px; width: auto; display: block; }

.header-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-nav > a,
.header-nav .user-name-btn {
    padding: 7px 11px;
    border-radius: var(--radius);
    color: var(--text-dim);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.header-nav > a:hover {
    background: var(--hover-bg);
    color: var(--text-color);
    text-decoration: none;
}

#admin-nav-link { color: var(--danger) !important; }

.header-nav .btn-signup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    margin-top: 0;
    height: 32px;
    min-height: 32px;
    padding: 0 13px;
    line-height: 1;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent) !important;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    vertical-align: middle;
}
.header-nav .btn-signup:hover {
    background: var(--accent);
    color: var(--accent-contrast) !important;
    text-decoration: none;
}

/* Кнопка меню: только на узких экранах (см. адаптивность). */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    padding: 0 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    height: 1.5px;
    background: var(--text-color);
    border-radius: 1px;
    transition: transform 0.18s ease, opacity 0.18s ease;
}
.header.nav-open .nav-toggle span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.header.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.header.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ---------------------------------------------------- меню пользователя --- */
.user-profile-container { position: relative; margin-left: 8px; }

.user-name-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-color) !important;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}
.user-name-btn:hover { background: var(--surface-3); }

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 190px;
    z-index: 1001;
    padding: 6px;
    background: var(--container-bg);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.dropdown-menu a {
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--text-color);
    font-size: 13.5px;
    font-weight: 400;
    text-decoration: none;
}
.dropdown-menu a:hover { background: var(--hover-bg); color: var(--text-color); text-decoration: none; }

.dropdown-divider { height: 1px; margin: 6px 4px; background: var(--border-color); }

/* ----------------------------------------------------------- кнопки --- */
.btn,
.btn-signup,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 16px;
    margin-top: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: var(--text-color);
    background-color: var(--surface-2);
    background-image: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.btn:hover,
button.btn:hover {
    background-color: var(--surface-3);
    border-color: var(--accent);
    color: var(--text-color);
    text-decoration: none;
}

.btn:active { background-color: var(--border-color); }

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.btn:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Основное действие — акцентная заливка. */
.btn-primary,
.vote-btn.is-active {
    background-color: var(--accent);
    background-image: var(--btn-sheen);
    border-color: var(--accent);
    color: var(--accent-contrast);
}
.btn-primary:hover,
.vote-btn.is-active:hover {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-contrast);
}
.btn-primary:active,
.vote-btn.is-active:active {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* ---------------------------------------------------------- контейнер --- */
.container {
    max-width: 960px;
    margin: 88px auto 48px auto;
    padding: 32px 36px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

/* ------------------------------------------------------------ формы --- */
.form-group { margin-bottom: 16px; }

.form-group label,
label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
textarea,
select,
.field {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    margin: 0;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-color);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

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

select { padding-right: 32px; cursor: pointer; }

input::placeholder,
textarea::placeholder { color: var(--text-dim); opacity: 0.8; }

input:focus,
textarea:focus,
select:focus,
.field:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-3);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

select.field {
    padding: 0 10px;
    line-height: normal;
}

.field { height: 40px; line-height: 38px; padding: 0 12px; }
.btn.field-btn { height: 40px; min-height: 40px; margin: 0; line-height: 1; }

.form-group input { width: 100%; }

/* Файловые поля: нативная кнопка браузера ломает тёмную тему. */
input[type="file"] {
    height: auto;
    padding: 7px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
}
input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 12px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: 3px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
input[type="file"]::file-selector-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Цветовые плашки персонажа. */
.color-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
}
.color-btn:hover { transform: scale(1.08); border-color: var(--accent); }


/* Подсказки под файловыми полями и сообщение формы публикации. */
.form-hint {
    margin: 6px 0 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-dim);
}
.form-hint-ok { color: var(--ok); }
.form-hint-error { color: var(--danger); }

.form-message { margin: 14px 0 0 0; min-height: 1em; font-size: 13px; font-weight: 600; }
.form-message-ok { color: var(--ok); }
.form-message-error { color: var(--danger); }

#game-form.is-uploading { cursor: progress; }
#game-form.is-uploading input,
#game-form.is-uploading textarea,
#game-form.is-uploading select { opacity: 0.65; }

/* ------------------------------------------------------------ модалка --- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    padding: 24px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 8vh auto;
    padding: 26px 28px;
    background: var(--panel-bg);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 14px;
    color: var(--text-dim);
    font-size: 24px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease;
}
.close-btn:hover { color: var(--text-color); }

.login-link { margin-top: 16px; text-align: center; font-size: 13.5px; color: var(--text-dim); }
.login-link a { font-weight: 600; }

/* Основное действие в модалке (вход/регистрация). */
.modal-content button[type="submit"] {
    width: 100%;
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast);
}
.modal-content button[type="submit"]:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-contrast);
}

/* ------------------------------------------------------------- сетки --- */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.game-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.game-tile:hover {
    border-color: var(--accent);
    background: var(--surface-3);
    text-decoration: none;
    color: var(--text-color);
}

.game-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 132px;
    color: var(--text-dim);
    font-size: 12px;
    background:
        linear-gradient(135deg, var(--surface-3) 0%, var(--surface-2) 100%);
    border-bottom: 1px solid var(--border-color);
}

.game-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.game-info { padding: 12px 14px 14px; }
.game-title { font-size: 14.5px; font-weight: 600; padding: 0 0 4px; }
.game-desc {
    font-size: 13px;
    color: var(--text-dim);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-tile.has-menu { position: relative; }
.game-tile.has-menu > .kebab-btn { position: absolute; top: 8px; right: 8px; }

/* --------------------------------------------------------- MisCreate --- */
/* MisCreate is its own brand: the logo sits at the top without a frame and
   the page accent follows the logo colour instead of the site green. */
.miscreate-page {
    --accent: #7b86d9;
    --accent-hover: #949cf0;
    --accent-soft: rgba(123, 134, 217, 0.16);
    --accent-contrast: #0b0d20;
    --primary-color: var(--accent);
    --primary-dark: var(--accent-hover);
    --page-bg:
        radial-gradient(1100px 520px at 50% -12%, rgba(123, 134, 217, 0.10), transparent 70%),
        linear-gradient(180deg, #111114 0%, #0c0c0e 100%);
}

.miscreate-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    margin: 4px 0 24px;
}

.miscreate-logo {
    width: 112px;
    height: 112px;
    object-fit: contain;
    flex: 0 0 auto;
    background: none;
    border: 0;
    padding: 0;
    border-radius: 0;
    filter: drop-shadow(0 6px 18px rgba(123, 134, 217, 0.35));
}

.miscreate-hero h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: 0.4px;
}

.miscreate-hero .miscreate-lead {
    margin: 0 auto;
}

.miscreate-lead {
    margin: 6px 0 0;
    color: var(--text-dim);
    max-width: 760px;
}

.miscreate-lead code,
.asset-code,
.asset-result code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    background: var(--surface-3);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 6px;
    color: var(--accent);
}

.miscreate-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 18px 20px;
    margin: 0 0 16px;
}

.miscreate-panel h2 {
    margin: 0 0 10px;
    font-size: 16px;
}

.asset-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.asset-form-row .form-group { margin-bottom: 10px; }

.asset-result {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 6px;
}

.asset-result-label {
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

.asset-result code {
    font-size: 15px;
    font-weight: 600;
    padding: 5px 10px;
}

.asset-result .btn { margin-top: 0; }

.quota-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.quota-card {
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 14px;
}

.quota-head {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-dim);
}

.quota-head span:last-child { color: var(--text-color); font-variant-numeric: tabular-nums; }

.quota-bar {
    height: 6px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}

.quota-bar > span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
    border-radius: inherit;
    transition: width 0.25s ease;
}

.quota-bar.is-full > span { background: var(--danger); }

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.asset-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    min-width: 0;
}

.asset-preview {
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface-3);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 22px;
}

.asset-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

.asset-body { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; }

.asset-name {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-meta { font-size: 12px; color: var(--text-dim); }

.asset-code {
    align-self: flex-start;
    cursor: pointer;
    font-size: 12.5px;
    padding: 3px 8px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-code:hover { border-color: var(--accent); background: var(--accent-soft); }

.asset-actions { display: flex; gap: 8px; margin-top: 4px; }

.asset-actions .btn {
    margin-top: 0;
    min-height: 30px;
    padding: 0 12px;
    font-size: 12.5px;
}

.btn-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}

.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.games-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 16px 0 8px;
}

.games-toolbar .field { flex: 1 1 260px; max-width: 420px; }
.games-toolbar .btn { margin-top: 0; }

.game-status {
    display: inline-block;
    font-size: 11.5px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    color: var(--text-dim);
}

.game-status.status-approved { color: var(--ok); border-color: var(--ok); background: rgba(87, 184, 132, 0.1); }
.game-status.status-rejected { color: var(--danger); border-color: var(--danger); background: rgba(211, 87, 79, 0.1); }

@media (max-width: 640px) {
    .miscreate-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
    .miscreate-panel { padding: 16px 14px; }
}

/* ------------------------------------------------------ меню «три точки» --- */
.ctx-menu {
    position: fixed;
    z-index: 3000;
    min-width: 200px;
    max-width: 320px;
    padding: 6px;
    background: var(--container-bg);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.ctx-menu button {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-color);
    font-family: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
}
.ctx-menu button:hover { background: var(--hover-bg); color: var(--text-color); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button.danger:hover { background: var(--danger); color: #fff; }

.kebab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    background: color-mix(in srgb, var(--container-bg) 80%, transparent);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-color);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}
.kebab-btn:hover,
.kebab-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------- пагинация --- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
}

.pagination button {
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text-color);
    font-family: inherit;
    font-size: 13.5px;
    cursor: pointer;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination .pagination-dots { padding: 0 4px; color: var(--text-dim); }
.pagination .pagination-info { margin-left: auto; font-size: 12px; color: var(--text-dim); }

/* ---------------------------------------------------------- клан --- */
.clan-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.clan-head-text { min-width: 0; }
.clan-head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.clan-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    padding: 0;
    background: var(--accent);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: #fff;
    font-family: inherit;
    font-size: 20px;
    font-weight: 700;
    cursor: default;
}
.clan-icon:hover:not(:disabled) { filter: brightness(1.08); }
.clan-icon:disabled { opacity: 1; }

.clan-icon-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0 0 0; }
.clan-title { margin: 0; padding: 0; border: none; font-size: 24px; }
.clan-meta { margin: 2px 0 0 0; font-size: 12.5px; color: var(--text-dim); }
.clan-description { margin: 8px 0 0 0; font-size: 14px; }
.clan-action-message { margin: 0 0 6px 0; font-weight: 600; }

.clan-report-link {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--danger);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.clan-report-link:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.clan-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 18px 0 0 0;
    border-bottom: 1px solid var(--border-color);
}

.clan-tab {
    margin: 0 0 -1px 0;
    padding: 9px 14px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.clan-tab:hover { color: var(--text-color); }
.clan-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.clan-panel { display: none; padding-top: 16px; }
.clan-panel.active { display: block; }

.clan-members { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0 0; }
.clan-form,
.clan-report-form { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin-top: 12px; }
.clan-note { margin: 6px 0 0 0; font-size: 12.5px; color: var(--text-dim); }

.clan-news-item {
    margin-bottom: 10px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}
.clan-news-meta { margin-bottom: 4px; font-size: 11.5px; color: var(--text-dim); }

#clan-chat {
    max-height: 280px;
    overflow-y: auto;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.clan-chat-message { padding: 6px 0; border-bottom: 1px solid var(--border-color); }
.clan-chat-message:last-child { border-bottom: 0; }
.clan-chat-meta { font-size: 11.5px; color: var(--text-dim); }
.clan-chat-meta a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* ------------------------------------------------------- персонаж --- */
.char-icon {
    display: block;
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.char-icon canvas { display: block; width: 100%; height: 100%; }

/* ---------------------------------------------------- участники --- */
.member-chip {
    display: inline-block;
    padding: 6px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-color);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
}
.member-chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ------------------------------------------------------------ футер --- */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    justify-content: center;
    max-width: 960px;
    margin: 0 auto 40px auto;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
    font-size: 12.5px;
    color: var(--text-dim);
}
.site-footer a { color: var(--text-dim); font-weight: 600; text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: none; }
.site-footer .footer-sep { padding: 0 4px; color: var(--border-strong); }
.site-footer .footer-copy { margin-left: 10px; color: var(--text-dim); font-weight: 400; }

/* ----------------------------------------------------- страница игры --- */
.game-hero { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.game-hero-cover {
    flex: 0 0 320px;
    max-width: 100%;
    overflow: hidden;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.game-hero-cover img { display: block; width: 100%; height: 210px; object-fit: cover; }
.game-hero-info { flex: 1; min-width: 260px; }
.game-hero-info h1 { margin-top: 0; }
.page-message { margin: 0 0 12px 0; min-height: 1em; color: var(--danger); font-weight: 600; }
.game-meta { margin: 0 0 10px 0; font-size: 12.5px; color: var(--text-dim); }
.game-description { white-space: pre-wrap; line-height: 1.65; }
.game-page { max-width: 1000px; }
.game-hero { display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: 28px; }
.game-hero-cover {
    aspect-ratio: 16 / 10;
    border-radius: 10px;
}
.game-hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.game-hero-info h1 { margin: 0 0 6px 0; font-size: 32px; line-height: 1.2; }

/* Карточка действий: Play!, рейтинг и подсказка живут вместе. */
.game-play-card {
    margin-top: 18px;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.game-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0; }
.game-play,
button.game-play {
    flex: 1 1 220px;
    width: 100%;
    min-height: 52px;
    margin-top: 0;
    padding: 0 22px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.2px;
    border-radius: var(--radius);
    background-color: var(--accent);
    background-image: var(--btn-sheen);
    border: 1px solid var(--accent);
    color: #ffffff;
    box-shadow: none;
    text-decoration: none;
}
.game-play:hover,
button.game-play:hover {
    background-color: var(--accent-hover);
    background-image: var(--btn-sheen);
    border-color: var(--accent-hover);
    color: #ffffff;
    box-shadow: none;
}
.game-play:active,
button.game-play:active {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}
.game-report-btn { margin-top: 0; }
.game-hint { max-width: 560px; margin: 10px 0 0 0; font-size: 12.5px; color: var(--text-dim); }
.play-setup {
    margin-top: 12px;
    padding: 10px 12px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-dim);
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: 6px;
}
.play-setup code { color: var(--text-color); }

/* Секции страницы игры: один ритм отступов и заголовков. */
.game-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.section-head h2 { margin: 0; font-size: 19px; }
.section-meta { font-size: 12px; color: var(--text-dim); font-weight: 600; }

/* Галерея скриншотов: альбомная сцена, стрелки и миниатюры. */
.game-gallery {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.gallery-stage {
    flex: 1;
    min-width: 0;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    touch-action: pan-y;
}
#gallery-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.gallery-arrow {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
    color: var(--text-color);
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    cursor: pointer;
}
.gallery-arrow:hover { border-color: var(--accent); color: var(--accent); }
.gallery-arrow:disabled { opacity: 0.35; cursor: default; }
.gallery-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.gallery-thumb {
    width: 96px;
    aspect-ratio: 16 / 9;
    padding: 0;
    overflow: hidden;
    background: #000;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.65;
}
.gallery-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb:hover { opacity: 1; }
.gallery-thumb.is-active { border-color: var(--accent); opacity: 1; }

/* Комментарии. */
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.comment-form textarea { width: 100%; resize: vertical; min-height: 78px; }
.comment-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.comment-actions .btn { margin-top: 0; }
.comments-list { display: flex; flex-direction: column; gap: 10px; }
.comment {
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.comment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 12.5px;
    color: var(--text-dim);
}
.comment-author { color: var(--text-color); font-weight: 700; }
.comment-text { margin: 0; white-space: pre-wrap; line-height: 1.55; }
.comment-delete {
    padding: 2px 4px;
    background: none;
    border: 0;
    color: var(--danger);
    font: inherit;
    cursor: pointer;
}
.comment-delete:hover { text-decoration: underline; }
.comments-empty { margin: 0; font-size: 13px; color: var(--text-dim); }
@media (max-width: 860px) {
    .game-hero { grid-template-columns: 1fr; gap: 20px; }
    .game-hero-cover { max-width: 100%; }
}
@media (max-width: 560px) {
    .game-play,
    button.game-play { min-height: 46px; font-size: 18px; }
    .gallery-arrow { flex-basis: 30px; width: 30px; height: 30px; font-size: 20px; }
    .gallery-thumb { width: 72px; }
}
.game-hint { max-width: 520px; margin: 0; font-size: 12.5px; color: var(--text-dim); }

.game-rating { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 14px 0 4px 0; }
.vote-btn { min-width: 88px; }
.game-score { font-size: 12.5px; color: var(--text-dim); }
.game-score.is-positive { color: var(--ok); font-weight: 600; }
.game-score.is-negative { color: var(--danger); font-weight: 600; }
.game-report-btn { background: transparent; border-color: var(--danger); color: var(--danger); }
.game-report-btn:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.game-report-form {
    margin-top: 14px;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}
.game-report-form label { margin-bottom: 6px; }
.game-report-form textarea { width: 100%; }
.game-rating-line { margin-top: 4px; font-size: 11.5px; color: var(--text-dim); }

/* ----------------------------------------- лендинг (hero / features) --- */
.home-hero {
    padding: 8px 0 26px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 26px;
}

.home-hero h1 {
    margin: 6px 0 12px 0;
    padding: 0;
    border: 0;
    font-size: clamp(26px, 4vw, 36px);
    line-height: 1.18;
    letter-spacing: -0.02em;
}

.home-lead {
    max-width: 640px;
    margin: 0 0 18px 0;
    color: var(--text-dim);
    font-size: 15.5px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-actions .btn { margin-top: 0; }

.hero {
    padding: 56px 36px;
    margin: 88px auto 24px auto;
    max-width: 960px;
    background:
        radial-gradient(1200px 300px at 10% -10%, var(--accent-soft), transparent 60%),
        var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.hero h1 { font-size: 32px; border: 0; padding: 0; margin-bottom: 12px; }
.hero p { max-width: 620px; color: var(--text-dim); font-size: 16px; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 0 0 10px 0;
}
.feature {
    padding: 18px 18px 16px;
    background-color: var(--surface-2);
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0) 90px);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.feature:hover { border-color: var(--border-strong); background-color: var(--surface-3); }
.feature h2 { margin: 0 0 6px 0; font-size: 14.5px; }
.feature p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--text-dim); }


/* --------------------------------------------------------- downloads --- */
.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin: 0 0 26px 0;
}

.download-card {
    padding: 20px;
    background-color: var(--surface-2);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0) 90px);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.download-card h2 { margin-top: 0; }
.download-desc { margin: 0 0 14px 0; color: var(--text-dim); font-size: 13.5px; }

.download-rows { display: flex; flex-direction: column; gap: 8px; }

.download-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-color);
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.download-row:hover {
    border-color: var(--accent);
    background: var(--surface-3);
    color: var(--text-color);
    text-decoration: none;
}
.download-platform { font-weight: 700; font-size: 13.5px; }
.download-meta { font-size: 12px; color: var(--text-dim); }
.download-action { font-size: 12.5px; font-weight: 700; color: var(--accent); }

.download-join { margin: 0 0 24px 0; }
.download-join-form {
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: 380px;
}
.download-join-form input {
    flex: 1;
    min-width: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}
.download-join-form .btn { margin-top: 0; flex: 0 0 auto; }
.download-note { margin: 8px 0 0 0; min-height: 1em; font-size: 12.5px; color: var(--text-dim); }

.download-note-block { margin-top: 30px; }
.download-notes { margin: 0; padding-left: 20px; color: var(--text-dim); font-size: 13px; }
.download-notes li { margin-bottom: 6px; }
.download-notes code {
    padding: 1px 5px;
    background: var(--surface-3);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 12px;
    color: var(--text-color);
}

/* ----------------------------------------------------- live sessions --- */
.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin: 12px 0 26px 0;
}

.session-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    background-color: var(--surface-2);
    background-image: linear-gradient(180deg, rgba(87, 184, 132, 0.05), rgba(87, 184, 132, 0) 80px);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.session-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.session-title {
    font-size: 14.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.session-players {
    flex: 0 0 auto;
    padding: 1px 7px;
    background: var(--accent-soft);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 700;
}
.session-meta { font-size: 12px; color: var(--text-dim); }
.session-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.session-actions .btn { margin-top: 0; min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.session-copy { background: transparent; }
.session-empty { margin: 0 0 24px 0; font-size: 13px; }

@media (max-width: 760px) {
    .download-row { grid-template-columns: 1fr auto; }
    .download-meta { grid-column: 1 / -1; order: 3; }
    .download-join-form { flex-direction: column; align-items: stretch; }
    .download-join-form .btn { width: 100%; }
}

/* ------------------------------------------------------- утилиты --- */
.muted { color: var(--text-dim); }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }

/* ----------------------------------------------------- адаптивность --- */
@media (max-width: 760px) {
    /* Хедер остаётся в потоке (sticky), а ссылки прячутся в выпадающее меню:
       семь пунктов не помещаются в 390 px, горизонтальная прокрутка их прятала. */
    .header { position: sticky; padding: 0 14px; }
    .header-inner { height: 56px; min-height: 0; padding: 0; flex-wrap: nowrap; gap: 10px; }
    .header-logo { flex: 0 0 auto; }
    .header-logo img { height: 26px; }
    .nav-toggle { display: flex; margin-left: auto; }
    .header-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex: none;
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        gap: 2px;
        padding: 8px 14px 12px;
        background: var(--container-bg);
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow);
        z-index: 1001;
    }
    .header.nav-open .header-nav { display: flex; }
    .header-nav > a { padding: 10px 10px; font-size: 14px; white-space: nowrap; }
    .header-nav .btn-signup { margin-left: 0; text-align: center; }
    .user-profile-container { margin-left: 0; }
    .user-name-btn { padding: 10px; }
    .header-nav .dropdown-menu { position: static; margin-top: 4px; min-width: 0; box-shadow: none; }
    .container,
    .hero { margin-top: 20px; margin-bottom: 28px; padding: 22px 18px; border-radius: 6px; }
    h1 { font-size: 22px; }
    .games-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .game-image { height: 110px; }
    .site-footer { padding: 16px 16px 0; }
    .game-hero-cover { flex-basis: 100%; }
    .home-hero h1 { font-size: 26px; }
}

@media (max-width: 460px) {
    .header-nav > a { padding: 10px 8px; font-size: 13.5px; }
}

/* Печать — без хедера и фона. */
@media print {
    .header, .site-footer, .ctx-menu, .modal { display: none !important; }
    body { background: #fff; color: #000; }
    .container { margin: 0; border: 0; box-shadow: none; }
}
