/* ============================================================
   CatGroup — премиальная кото-тема
   Типографика: Playfair Display (заголовки) + Manrope (текст)
   Палитра: тёплый графит, мёд/золото, сливочный текст
   ============================================================ */
@font-face {
    font-family: 'Manrope';
    src: url('/fonts/Manrope.ttf') format('truetype');
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    src: url('/fonts/PlayfairDisplay.ttf') format('truetype');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #0f0d0a;
    --bg2: #151210;
    --panel: rgba(255, 248, 234, .035);
    --panel2: rgba(255, 248, 234, .055);
    --gold: #e9b160;
    --gold-soft: #f6d9a0;
    --gold-deep: #c98f3d;
    --rose: #e0907c;
    --green: #9ed6a0;
    --red: #e2705f;
    --text: #f4efe6;
    --muted: #a89e8e;
    --line: rgba(233, 177, 96, .16);
    --line-soft: rgba(255, 248, 234, .07);
    --radius: 18px;
    --radius-lg: 24px;
    --shadow: 0 24px 60px rgba(0, 0, 0, .45);
    --shadow-gold: 0 18px 50px rgba(233, 177, 96, .14);
    --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --sans: 'Manrope', 'Segoe UI', system-ui, sans-serif;
    --mono: 'Consolas', 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(1100px 620px at 82% -12%, rgba(233, 177, 96, .09), transparent 62%),
        radial-gradient(900px 520px at 6% 108%, rgba(224, 144, 124, .06), transparent 60%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: rgba(233, 177, 96, .35); color: #fff; }

::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: #0c0a08; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3a3227, #57482f);
    border-radius: 8px;
    border: 2px solid #0c0a08;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #57482f, #8a6b3c); }

/* ---------- фон-анимация ---------- */
.bg-anim {
    position: fixed; inset: 0; z-index: -1;
    background:
        radial-gradient(1400px 700px at 50% -20%, rgba(233, 177, 96, .05), transparent 60%);
}
#bg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 22px; }

/* ---------- топбар ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    background: rgba(15, 13, 10, .82);
    border-bottom: 1px solid var(--line-soft);
}
.topbar-inner { display: flex; align-items: center; gap: 28px; height: 68px; }

.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.logo-mark {
    width: 40px; height: 40px; border-radius: 13px;
    background: linear-gradient(135deg, #f2cd8d, #c98f3d);
    display: grid; place-items: center;
    font-size: 22px;
    box-shadow: 0 6px 18px rgba(233, 177, 96, .35), inset 0 1px 0 rgba(255,255,255,.45);
}
.logo-text {
    font-family: var(--serif);
    font-weight: 700; font-size: 21px; letter-spacing: .4px;
}
.logo-text span { color: var(--gold); }

.nav { display: flex; gap: 4px; flex: 1; }
.nav-link {
    padding: 9px 16px; border-radius: 999px;
    color: var(--muted); text-decoration: none;
    font-weight: 600; font-size: 14px;
    transition: .2s;
    border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); background: var(--panel2); }
.nav-link.active {
    color: var(--gold-soft);
    background: rgba(233, 177, 96, .09);
    border-color: rgba(233, 177, 96, .28);
}

.topbar-user { display: flex; gap: 10px; align-items: center; }

/* ---------- кнопки ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 22px; border-radius: 999px;
    font-weight: 700; font-size: 14px; text-decoration: none;
    border: 1px solid transparent; cursor: pointer;
    transition: .22s cubic-bezier(.2, .7, .3, 1);
    font-family: inherit;
    line-height: 1;
}
.btn-ghost {
    background: transparent; color: var(--text);
    border-color: rgba(255, 248, 234, .18);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-soft); background: rgba(233, 177, 96, .06); }
.btn-neon {
    background: linear-gradient(135deg, #f2cd8d, #d99a4e 60%, #c98f3d);
    color: #2a1d0c;
    box-shadow: 0 10px 28px rgba(233, 177, 96, .28), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-neon:hover {
    box-shadow: 0 14px 36px rgba(233, 177, 96, .42), inset 0 1px 0 rgba(255,255,255,.5);
    transform: translateY(-2px);
}
.btn-big { padding: 15px 32px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: wait; transform: none; }

.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: inline-grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 14px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}
.avatar-big { width: 96px; height: 96px; font-size: 40px; }

.main { min-height: calc(100vh - 68px); padding-bottom: 80px; }

/* ---------- hero ---------- */
.hero {
    position: relative;
    padding: 76px 0 40px;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 48px;
    align-items: center;
}
.hero-glow {
    position: absolute; right: -80px; top: -40px;
    width: 560px; height: 480px;
    background: radial-gradient(closest-side, rgba(233, 177, 96, .16), rgba(224, 144, 124, .07), transparent);
    filter: blur(40px);
    pointer-events: none;
}
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 18px; border-radius: 999px;
    font-size: 12px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase;
    color: var(--gold-soft); border: 1px solid rgba(233, 177, 96, .3);
    background: rgba(233, 177, 96, .07);
    margin-bottom: 26px;
}
.hero-badge::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--gold); box-shadow: 0 0 10px var(--gold);
}
.hero-title {
    font-family: var(--serif);
    font-size: clamp(40px, 6.2vw, 72px);
    font-weight: 800;
    line-height: 1.06;
    letter-spacing: -.5px;
}
.grad {
    background: linear-gradient(100deg, #f6d9a0, #e9b160 45%, #e0907c);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.hero-sub {
    margin: 24px 0 34px; max-width: 540px;
    color: var(--muted); font-size: 17px; line-height: 1.7;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats {
    display: flex; gap: 44px; flex-wrap: wrap;
    margin-top: 52px;
}
.stat { display: flex; flex-direction: column; }
.stat b {
    font-family: var(--serif);
    font-size: 36px; font-weight: 700; color: var(--gold-soft);
    line-height: 1.1;
}
.stat span {
    color: var(--muted); font-size: 12px; letter-spacing: 1.8px;
    text-transform: uppercase; margin-top: 4px;
}

/* кот в hero */
.hero-media { position: relative; }
.hero-media-frame {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(233, 177, 96, .25);
    box-shadow: var(--shadow), var(--shadow-gold);
    aspect-ratio: 4 / 4.4;
    transform: rotate(1.2deg);
    transition: transform .4s cubic-bezier(.2, .7, .3, 1);
}
.hero-media:hover .hero-media-frame { transform: rotate(0deg) scale(1.01); }
.hero-media-frame img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.hero-media-frame::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(200deg, transparent 55%, rgba(15, 13, 10, .55));
}
.hero-media-chip {
    position: absolute; left: -18px; bottom: 30px; z-index: 2;
    display: flex; align-items: center; gap: 10px;
    background: rgba(21, 18, 16, .92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(233, 177, 96, .3);
    border-radius: 14px;
    padding: 11px 16px;
    box-shadow: var(--shadow);
}
.hero-media-chip b { font-size: 14px; display: block; }
.hero-media-chip span { font-size: 12px; color: var(--muted); }
.hero-media-chip .chip-dot {
    width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
    background: linear-gradient(135deg, #f2cd8d, #c98f3d);
    display: grid; place-items: center; font-size: 18px;
}

/* ---------- секции ---------- */
.section { margin-top: 92px; }
.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 28px; gap: 18px;
}
.section-title {
    font-family: var(--serif);
    font-size: 30px; font-weight: 700; letter-spacing: .2px;
    display: flex; align-items: center; gap: 14px;
}
.section-title .grad { font-size: 26px; opacity: .9; }
.section-more {
    color: var(--gold); text-decoration: none; font-size: 14px; font-weight: 600;
    border-bottom: 1px solid transparent; padding-bottom: 2px;
    white-space: nowrap;
}
.section-more:hover { color: var(--gold-soft); border-color: var(--gold); }

/* ---------- карточки ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 20px; }
.cards-3d { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
    position: relative;
    background: var(--panel2);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none; color: var(--text);
    transition: .28s cubic-bezier(.2, .7, .3, 1);
    backdrop-filter: blur(8px);
}
.card:hover {
    transform: translateY(-6px);
    border-color: rgba(233, 177, 96, .4);
    box-shadow: var(--shadow-gold);
}
.card-visual {
    height: 130px; position: relative;
    display: grid; place-items: center;
    background: var(--bg2);
    overflow: hidden;
}
.card-visual::before {
    content: ''; position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(180deg, rgba(15,13,10,.25), rgba(15,13,10,.78));
}
.card-visual-3d { height: 216px; }
.card-tag {
    position: absolute; top: 12px; left: 12px; z-index: 2;
    padding: 5px 12px; border-radius: 999px;
    background: rgba(233, 177, 96, .92); color: #2a1d0c;
    font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
}
.card-num {
    position: relative; z-index: 2;
    font-family: var(--serif); font-size: 52px; font-weight: 800;
    color: rgba(255, 248, 234, .28);
    text-shadow: 0 2px 20px rgba(0,0,0,.6);
}
.card-play {
    position: absolute; inset: 0; z-index: 3; display: grid; place-items: center;
    font-size: 40px; color: var(--gold-soft);
    opacity: 0; transition: .25s;
    text-shadow: 0 4px 24px rgba(0,0,0,.8);
}
.card:hover .card-play { opacity: 1; }

.card-body { padding: 16px 18px 20px; }
.card-body h3 { font-size: 16px; margin-bottom: 6px; font-weight: 700; }
.card-body p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.best {
    display: inline-block; margin-top: 10px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .5px; color: var(--gold-soft);
    border: 1px solid rgba(233, 177, 96, .35); padding: 4px 11px; border-radius: 999px;
    background: rgba(233, 177, 96, .07);
}

/* ---------- случайный котик ---------- */
.random-cat {
    display: grid; grid-template-columns: 1fr 1.1fr; gap: 0;
    background: var(--panel2);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}
.random-cat-media {
    position: relative; min-height: 380px;
    background: var(--bg2);
}
.random-cat-media img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; transition: opacity .35s;
}
.random-cat-media img.swap { opacity: 0; }
.random-cat-media::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 55%, rgba(15,13,10,.65));
}
.random-cat-body {
    padding: 48px 46px;
    display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
}
.random-cat-body h2 {
    font-family: var(--serif); font-size: 34px; font-weight: 700; line-height: 1.15;
    margin-bottom: 16px;
}
.random-cat-body p { color: var(--muted); line-height: 1.7; margin-bottom: 28px; max-width: 400px; }

/* ---------- чат-секция ---------- */
.section-chat-cta { margin-top: 96px; }
.chat-cta {
    display: grid; grid-template-columns: 1fr 1fr; gap: 34px;
    background: var(--panel2); border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg); padding: 40px;
    backdrop-filter: blur(10px);
}
.chat-cta h2 { font-family: var(--serif); font-size: 30px; margin-bottom: 14px; }
.chat-cta p { color: var(--muted); margin-bottom: 24px; line-height: 1.7; }
.chat-cta-demo {
    background: rgba(15, 13, 10, .7); border: 1px solid var(--line-soft);
    border-radius: var(--radius); padding: 20px; min-height: 140px;
    display: flex; flex-direction: column; justify-content: flex-end;
}

/* ---------- сообщения ---------- */
.msg { display: flex; gap: 12px; margin-bottom: 14px; max-width: 86%; }
.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-ava {
    width: 36px; height: 36px; border-radius: 12px; flex: 0 0 auto;
    display: grid; place-items: center;
    font-weight: 800; font-size: 16px;
}
.msg-ava.bot {
    background: linear-gradient(135deg, #f2cd8d, #c98f3d); color: #2a1d0c;
    box-shadow: 0 4px 14px rgba(233, 177, 96, .3);
}
.msg-ava.user { background: rgba(224, 144, 124, .25); color: var(--rose); border: 1px solid rgba(224,144,124,.35); }
.msg-body {
    background: var(--panel); border: 1px solid var(--line-soft);
    border-radius: 16px; padding: 12px 16px;
    font-size: 14px; line-height: 1.65;
    white-space: pre-wrap; word-break: break-word;
}
.msg-user .msg-body { background: rgba(233, 177, 96, .08); border-color: rgba(233, 177, 96, .25); }
.msg-body b { color: var(--gold-soft); }
.msg-body.cursor::after {
    content: '▌'; color: var(--gold);
    animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- страницы ---------- */
.page-head { padding: 52px 0 30px; text-align: center; }
.page-title {
    font-family: var(--serif);
    font-size: clamp(32px, 5vw, 52px); font-weight: 800; letter-spacing: .2px;
}
.page-sub { color: var(--muted); margin-top: 14px; font-size: 15px; }

.alert {
    padding: 14px 18px; border-radius: 14px; margin-bottom: 18px;
    font-size: 14px; border: 1px solid var(--line-soft);
    background: var(--panel);
}
.alert-err { border-color: rgba(226, 112, 95, .5); color: #eda396; background: rgba(226, 112, 95, .07); }
.alert-ok  { border-color: rgba(158, 214, 160, .45); color: var(--green); background: rgba(158, 214, 160, .06); }
.muted { color: var(--muted); }

/* ---------- формы ---------- */
.auth-box {
    max-width: 470px; margin: 0 auto;
    background: var(--panel2); border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg); padding: 34px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
    width: 100%; padding: 13px 16px;
    background: rgba(15, 13, 10, .7); color: var(--text);
    border: 1px solid var(--line-soft); border-radius: 12px;
    font-size: 15px; outline: none; transition: .2s;
    font-family: inherit;
}
.field input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(233, 177, 96, .14);
}
.captcha-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; }
.captcha-img { border-radius: 12px; border: 1px solid var(--line-soft); background: var(--bg2); }
.auth-alt { margin-top: 20px; text-align: center; color: var(--muted); font-size: 14px; }
.auth-alt a { color: var(--gold); }

/* ---------- лидерборд ---------- */
.lb-table {
    border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden;
    background: var(--panel);
}
.lb-head, .lb-row {
    display: grid;
    grid-template-columns: 50px 1fr 1.6fr 130px;
    gap: 10px; align-items: center;
    padding: 13px 20px;
}
.lb-head {
    font-size: 11.5px; font-weight: 700; letter-spacing: 1.5px;
    color: var(--muted); text-transform: uppercase;
    background: rgba(255, 248, 234, .03);
    border-bottom: 1px solid var(--line-soft);
}
.lb-row { border-bottom: 1px solid rgba(255, 248, 234, .05); font-size: 14px; }
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: rgba(233, 177, 96, .04); }
.lb-row.me { background: rgba(233, 177, 96, .08); }
.lb-place { font-family: var(--serif); font-size: 17px; color: var(--gold); font-weight: 700; }
.lb-player { display: flex; align-items: center; gap: 10px; }
.lb-game { color: var(--muted); }
.lb-score { font-weight: 800; color: var(--gold-soft); text-align: right; }

.leader-mini {
    border: 1px solid var(--line-soft); border-radius: var(--radius);
    overflow: hidden; background: var(--panel);
}
.lrow {
    display: grid; grid-template-columns: 44px 44px 1fr 100px;
    align-items: center; gap: 12px; padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 248, 234, .05); font-size: 14px;
}
.lrow:last-child { border-bottom: none; }
.lplace { font-family: var(--serif); font-size: 16px; color: var(--gold); font-weight: 700; }
.lavatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center; color: #fff;
    font-weight: 800; font-size: 13px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}
.lscore { text-align: right; font-weight: 800; color: var(--gold-soft); }

/* ---------- фичи ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.feature {
    background: var(--panel); border: 1px solid var(--line-soft);
    border-radius: var(--radius); padding: 26px;
    transition: .25s;
}
.feature:hover { border-color: rgba(233, 177, 96, .35); transform: translateY(-3px); }
.feature h3 { margin-bottom: 10px; font-size: 16px; }
.feature p { color: var(--muted); font-size: 13.5px; line-height: 1.6; }

/* ---------- игровая страница ---------- */
.game-stage { margin: 10px auto 20px; }
.game-frame-wrap {
    position: relative;
    border: 1px solid var(--line-soft); border-radius: var(--radius-lg); overflow: hidden;
    background: #000;
    box-shadow: var(--shadow);
}
.game-frame { width: 100%; height: 620px; border: none; display: block; background: #05050c; }
.game-bar { display: flex; align-items: center; gap: 30px; flex-wrap: wrap; padding: 18px 6px; }
.game-bar-item { display: flex; flex-direction: column; }
.bar-label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; }
.bar-value { font-size: 19px; font-weight: 800; color: var(--gold-soft); font-family: var(--serif); }
.game-bar .btn { margin-left: auto; }

/* ---------- профиль ---------- */
.profile-grid { display: grid; grid-template-columns: 310px 1fr; gap: 28px; align-items: start; }
.profile-card {
    text-align: center;
    background: var(--panel2); border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg); padding: 34px 26px;
    backdrop-filter: blur(10px);
}
.profile-card h2 { margin: 16px 0 4px; font-family: var(--serif); }
.profile-stats { display: flex; justify-content: center; gap: 26px; margin: 24px 0; }
.profile-scores { padding-top: 6px; }
.profile-scores .lb-row { grid-template-columns: 50px 1fr 130px; }

/* ---------- чат-страница ---------- */
.chat-wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; }
.chat-box {
    height: 520px; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg); padding: 22px;
    display: flex; flex-direction: column;
    backdrop-filter: blur(8px);
}
.chat-form { display: flex; gap: 10px; margin-top: 16px; }
.chat-form input {
    flex: 1; padding: 14px 18px;
    background: rgba(15, 13, 10, .7); color: var(--text);
    border: 1px solid var(--line-soft); border-radius: 999px;
    font-size: 15px; outline: none;
    font-family: inherit;
    transition: .2s;
}
.chat-form input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(233, 177, 96, .14);
}
.chat-note { text-align: center; margin-top: 14px; font-size: 12px; }

/* ---------- медиа ---------- */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 26px;
}
.media-item {
    position: relative;
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line-soft);
    aspect-ratio: 12 / 8;
}
.media-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .4s cubic-bezier(.2, .7, .3, 1), filter .3s;
}
.media-item:hover img { transform: scale(1.06); }
.media-item::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(10, 8, 6, .45));
    transition: opacity .3s;
}
.media-item:hover::after { opacity: .4; }
.video-box {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow);
}
.video { width: 100%; max-height: 560px; display: block; }

/* ---------- футер ---------- */
.footer {
    border-top: 1px solid var(--line-soft);
    background: rgba(12, 10, 8, .9);
    padding: 34px 0; margin-top: 80px;
}
.footer-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; flex-wrap: wrap;
}
.footer-brand {
    display: flex; align-items: center; gap: 12px; font-size: 15px;
    font-family: var(--serif);
}
.footer-brand b { color: var(--gold); }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: var(--gold); }
.footer-meta { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }

/* ---------- бургер-меню (телефон) ---------- */
.nav-burger {
    display: none;
    width: 44px; height: 44px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: var(--panel2);
    cursor: pointer;
    flex-direction: column;
    align-items: center; justify-content: center;
    gap: 5px;
    margin-left: auto;
    flex: 0 0 auto;
}
.nav-burger span {
    display: block; width: 20px; height: 2px;
    border-radius: 2px;
    background: var(--gold-soft);
    transition: .25s;
}
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
    .hero { grid-template-columns: 1fr; padding-top: 56px; }
    .hero-media { max-width: 480px; }
    .random-cat { grid-template-columns: 1fr; }
    .random-cat-media { min-height: 300px; }
    .random-cat-media::after {
        background: linear-gradient(180deg, transparent 55%, rgba(15,13,10,.65));
    }
}
@media (max-width: 820px) {
    .chat-cta, .profile-grid { grid-template-columns: 1fr; }

    /* навигация — выпадающее меню под шапкой */
    .nav-burger { display: inline-flex; }
    .nav {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        flex-direction: column;
        gap: 4px;
        padding: 12px 22px 16px;
        background: rgba(15, 13, 10, .97);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--line);
        box-shadow: 0 24px 40px rgba(0, 0, 0, .5);
    }
    .nav.open { display: flex; }
    .nav-link { padding: 13px 16px; font-size: 15px; }
    .topbar-inner { position: relative; gap: 12px; height: 60px; }
    .topbar-user { gap: 8px; margin-left: auto; }
    .topbar-user .btn { padding: 10px 14px; font-size: 13px; }
    .logo-text { font-size: 19px; }
    .logo-mark { width: 36px; height: 36px; font-size: 19px; }

    .game-frame { height: 480px; }
    .lb-head, .lb-row { grid-template-columns: 40px 1fr 110px; }
    .lb-head span:nth-child(3), .lb-row .lb-game { display: none; }
    .hero-stats { gap: 28px; }
    .section { margin-top: 64px; }
    .chat-cta { padding: 26px; }
    .random-cat-body { padding: 30px 24px; }
}

/* ---------- телефон: мелкие экраны ---------- */
@media (max-width: 640px) {
    .wrap { padding: 0 14px; }
    .main { padding-bottom: 40px; }
    .hide-sm { display: none !important; }
    .hero { padding-top: 32px; gap: 28px; }
    .hero-badge { margin-bottom: 16px; letter-spacing: 1.5px; font-size: 11px; }
    .hero-title { font-size: clamp(32px, 9.5vw, 44px); }
    .hero-sub { font-size: 15px; }
    .hero-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
    .hero-actions .btn { width: 100%; }
    .hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .hero-stats .stat { padding: 12px 14px; }
    .hero-stats .stat b { font-size: 22px; }
    .section { margin-top: 48px; }
    .section-title { font-size: 24px; }
    .section-head { flex-direction: column; align-items: flex-start; gap: 6px; }
    .cards { grid-template-columns: 1fr !important; }
    .media-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .feature-grid { grid-template-columns: 1fr; }
    .game-frame { height: 62vh; min-height: 340px; }
    .game-bar { flex-direction: column; align-items: stretch; gap: 12px; }
    .game-bar .btn { width: 100%; }
    .footer { padding: 24px 0; margin-top: 48px; }
    .footer-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
    .footer-links { gap: 14px; }
    .footer-meta { flex-direction: column; gap: 6px; }
    .page-title { font-size: 26px; }
    .page-sub { font-size: 14px; }
    /* безопасные зоны iPhone (чёлка/жест-бар) */
    .topbar { padding-top: env(safe-area-inset-top); }
    .chat-form { padding-bottom: env(safe-area-inset-bottom); }
}

/* ---------- очень маленькие экраны ---------- */
@media (max-width: 380px) {
    .logo-text { display: none; }
    .topbar-user .btn-neon { padding: 10px 12px; font-size: 12px; }
}

/* ---------- две видео-карточки ---------- */
.video-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:22px;margin-top:22px}
.video-card{margin:0;background:rgba(255,255,255,.03);border:1px solid rgba(233,177,96,.16);border-radius:20px;overflow:hidden}
.video-card figcaption{padding:14px 18px;font-size:15px;color:var(--muted);text-align:center}
.video-card .video{width:100%;height:auto;display:block;background:#000;border-radius:0}
@media(max-width:640px){.video-grid{grid-template-columns:1fr}}

/* ============================================================
   ЧАТ v2: большое окно, код-блоки, микрофон, вложения, лимиты
   ============================================================ */
.chat-wrap { max-width: 1060px; }
.chat-topline {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; gap: 12px;
}
.chat-counter { font-size: 13px; color: var(--muted); }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 999px; }
.chat-box {
    height: min(72vh, 760px);
    min-height: 380px;
    padding: 26px;
}
.chat-input-row { display: flex; gap: 10px; margin-top: 16px; align-items: stretch; }
.chat-form input {
    flex: 1; padding: 15px 20px; font-size: 16px;
    background: rgba(15, 13, 10, .7); color: var(--text);
    border: 1px solid var(--line-soft); border-radius: 999px;
    outline: none; font-family: inherit; transition: .2s;
    min-width: 0;
}
.chat-form input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(233, 177, 96, .14);
}
.chat-icon-btn {
    flex: 0 0 auto; width: 50px; border-radius: 999px;
    background: rgba(255,255,255,.04); color: var(--text);
    border: 1px solid var(--line-soft); font-size: 19px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: .2s;
}
.chat-icon-btn:hover { border-color: var(--gold); background: rgba(233,177,96,.08); }
.chat-icon-btn.active {
    background: #e0907c; border-color: #e0907c; color: #fff;
    animation: mic-pulse 1.4s infinite;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(224,144,124,.45); }
    50% { box-shadow: 0 0 0 8px rgba(224,144,124,0); }
}
.chat-form .btn-neon { flex: 0 0 auto; width: 50px; padding: 0; border-radius: 999px; font-size: 18px; }

/* превью вложенной картинки */
.chat-attach-preview[hidden] { display: none; }
.chat-attach-preview {
    display: flex; align-items: center; gap: 12px;
    margin-top: 14px; padding: 10px 14px;
    background: rgba(233,177,96,.07); border: 1px solid rgba(233,177,96,.25);
    border-radius: 14px; width: fit-content;
}
.chat-attach-preview img {
    width: 72px; height: 54px; object-fit: cover; border-radius: 8px; display: block;
}
.chat-attach-preview button {
    background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer;
}
.chat-attach-preview button:hover { color: #e0907c; }

/* картинка в сообщении юзера */
.msg-img {
    display: block; max-width: 260px; border-radius: 12px;
    margin-bottom: 10px; border: 1px solid var(--line-soft);
}

/* ---------- код-блоки ---------- */
.code-block {
    margin: 10px 0; border-radius: 12px; overflow: hidden;
    border: 1px solid rgba(233,177,96,.22);
    background: #14110c;
    max-width: 100%;
}
.code-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 7px 14px; background: rgba(233,177,96,.09);
    font-size: 12px; color: var(--muted);
}
.code-lang { text-transform: uppercase; letter-spacing: .08em; }
.code-copy {
    background: none; border: 1px solid rgba(233,177,96,.35); color: var(--gold-soft, #f6d9a0);
    border-radius: 8px; padding: 3px 10px; font-size: 11.5px; cursor: pointer;
    font-family: inherit; transition: .15s;
}
.code-copy:hover { background: rgba(233,177,96,.15); }
.code-block pre {
    margin: 0; padding: 14px 16px; overflow-x: auto;
    max-width: 100%; box-sizing: border-box;
}
.code-block code, .inline-code {
    font-family: 'Consolas', 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13.5px; line-height: 1.55; color: #f0dfc0;
    white-space: pre;
}
.inline-code {
    background: rgba(233,177,96,.12); border-radius: 6px;
    padding: 1.5px 7px; white-space: normal; font-size: .92em; color: var(--gold-soft, #f6d9a0);
}
.msg-body { overflow-wrap: anywhere; }

/* служебные пометки */
.tool-note { color: var(--gold); font-size: .93em; opacity: .9; }

/* Пока идёт инструмент, текста ответа в пузыре ещё нет. Мягкое мерцание
   показывает, что работа не остановилась. Если человек отключил анимации
   в системе, оставляем ровный текст. */
.tool-note { display: inline-block; animation: tool-pulse 1.6s ease-in-out infinite; }
@keyframes tool-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .tool-note { animation: none; opacity: .9; }
}
.limit-note { color: #e0907c; }

/* ---------- мобильная адаптация ---------- */
@media (max-width: 640px) {
    .chat-wrap { max-width: 100%; }
    .chat-box {
        height: 58vh;
        height: 58dvh;
        min-height: 320px;
        padding: 16px; border-radius: 16px;
    }
    .chat-input-row { gap: 8px; margin-top: 12px; }
    .chat-form input { padding: 13px 16px; font-size: 16px; }
    .chat-icon-btn, .chat-form .btn-neon { width: 46px; }
    .msg { gap: 10px; }
    .msg-ava { width: 30px; height: 30px; font-size: 15px; }
    .msg-body { font-size: 14.5px; }
    .msg-img { max-width: 200px; }
    .code-block pre { padding: 10px 12px; }
    .code-block code { font-size: 12.5px; }
    .chat-attach-preview img { width: 60px; height: 45px; }
    .page-title { font-size: 30px; }
    .chat-note { font-size: 11.5px; }
}
@media (max-width: 480px) {
    .chat-box { height: 55vh; padding: 12px; }
    .chat-icon-btn, .chat-form .btn-neon { width: 42px; font-size: 16px; }
    .chat-form input { padding: 12px 14px; }
}

/* ============================================================
   ИНТЕРФЕЙС v2 — правки поверх базовой темы
   Идёт последним блоком, поэтому переопределяет правила выше.
   ============================================================ */

/* ---------- ссылка «к содержимому» для клавиатуры ---------- */
.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 200;
    background: var(--gold); color: #2a1d0c;
    padding: 11px 20px; border-radius: 0 0 12px 0;
    font-weight: 700; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* ---------- знак вместо эмодзи ---------- */
.logo-mark { line-height: 0; }
.logo-mark svg, .chip-dot svg { display: block; }

/* ---------- обложки игр ---------- */
/* Вместо случайного фото кота — рисунок по геометрии самой игры. */
.card-visual .visual-cover {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform .45s cubic-bezier(.2, .7, .3, 1);
}
.card:hover .visual-cover { transform: scale(1.04); }

/* Плёнка сверху была рассчитана на яркие фотографии и почти полностью
   гасила обложки — они и так нарисованы в тёмной палитре.
   Оставляем лёгкое затемнение только у нижнего края. */
.card-visual::before {
    background: linear-gradient(180deg, rgba(15, 13, 10, 0) 42%, rgba(15, 13, 10, .45));
}

/* Номер игры был 52px по центру и перекрывал рисунок обложки.
   Теперь это небольшая метка в углу. */
.card-num {
    position: absolute; top: 10px; left: 13px; z-index: 2;
    font-size: 15px; font-weight: 700; letter-spacing: .6px;
    color: var(--gold-soft); opacity: .8;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
}

/* Кнопка запуска: был символ ▶ шрифтом (в разных браузерах разный),
   стал круг с вектором. */
.card-play {
    position: absolute; inset: auto 12px 12px auto; z-index: 3;
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(233, 177, 96, .95); color: #2a1d0c;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .45);
    opacity: 0; transform: translateY(6px) scale(.9);
    transition: opacity .25s, transform .25s;
}
.card:hover .card-play,
.card:focus-visible .card-play { opacity: 1; transform: translateY(0) scale(1); }
.card-play svg { display: block; margin-left: 1px; }

/* ---------- заголовки секций ---------- */
/* Было «// Заголовок» — приём из редактора кода, к порталу о котах
   отношения не имеет. Заменено на тонкую золотую засечку. */
.section-title::before {
    content: ''; flex: 0 0 auto;
    width: 22px; height: 2px; border-radius: 2px;
    background: linear-gradient(90deg, var(--gold), rgba(233, 177, 96, 0));
}
.hub-group { margin-top: 56px; }
.hub-group > .section-title { margin-bottom: 24px; }
.page-sub a {
    color: var(--gold); text-decoration: none;
    border-bottom: 1px solid rgba(233, 177, 96, .45);
}
.page-sub a:hover { color: var(--gold-soft); }

/* ---------- блоки «о портале» ---------- */
/* Заголовки начинались с эмодзи (🐱 🐾 🧠 🎮 🔒 🏆). Эмодзи рисуются
   системным шрифтом и на каждой ОС выглядят иначе; вместо них — та же
   засечка, что у заголовков секций. */
.feature h3::before {
    content: ''; display: block;
    width: 26px; height: 2px; margin-bottom: 14px; border-radius: 2px;
    background: linear-gradient(90deg, var(--gold-deep), rgba(201, 143, 61, 0));
}
.feature h3 { font-size: 15.5px; line-height: 1.35; }

/* ---------- фотографии ---------- */
/* Ячейка была 12/8 (3:2), а снимки 800x600 (4:3) — сетка подрезала
   картинкам верх и низ. Теперь пропорции совпадают. */
.media-item { aspect-ratio: 4 / 3; }
.media-item img { display: block; }

/* ---------- видео ---------- */
/* Клипы сняты на телефон: 720x1280, вертикальные. Правило
   .video-card .video{width:100%;height:auto} растягивало их на всю
   ширину карточки, и в колонке шириной 600px видео становилось
   высотой больше тысячи пикселей — оно занимало весь экран.
   Теперь кадр вписан в сцену, а пустоту по бокам закрывает размытый
   постер этого же клипа. */
.video-stage {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background-color: #0b0908;
    background-size: cover;
    background-position: center;
}
.video-stage::before {
    content: ''; position: absolute; inset: -10%;
    background: inherit;
    background-size: cover;
    background-position: center;
    filter: blur(30px) saturate(.6) brightness(.4);
}
.video-card .video {
    /* absolute к сцене: её размер определён, проценты разрешаются.
       object-fit:contain вписывает кадр целиком, ничего не обрезая.
       Фон прозрачный — по бокам видно размытый постер из ::before. */
    position: absolute; inset: 0; z-index: 1;
    width: 100%; height: 100%;
    /* .video выше ставит max-height:560px — оно резало бокс на сцене
       высотой 706px, и снизу оставалась пустая полоса. Снимаем. */
    max-width: none; max-height: none;
    object-fit: contain;
    display: block; background: transparent; border-radius: 0;
}
.video-card figcaption {
    padding: 15px 18px; font-size: 14px;
    color: var(--muted); text-align: center;
    border-top: 1px solid var(--line-soft);
}
@media (max-width: 640px) {
    /* на телефоне карточка во всю ширину — можно отдать кадру больше места */
    .video-stage { aspect-ratio: 3 / 4; }
}

/* ---------- подвал ---------- */
.footer-brand { align-items: center; }
.footer-brand > span { display: flex; flex-direction: column; line-height: 1.4; }
.footer-brand b { color: var(--text); font-size: 16px; font-weight: 700; }
.footer-brand > span > span {
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 12px; color: var(--muted); letter-spacing: .2px;
}

/* ---------- демо-чат на главной ---------- */
.chat-cta-demo { min-height: 168px; gap: 0; }

/* ---------- форма чата ---------- */
/* .chat-form стоит display:flex в строку, а внутри неё три блока:
   превью вложения, строка ввода и скрытый input[type=file]. Строка
   ввода становилась обычным flex-элементом и сжималась по содержимому —
   поле «Спросите…» получалось узким, а справа оставалась пустота.
   Колонка возвращает блокам полную ширину. */
.chat-form { flex-direction: column; gap: 0; margin-top: 0; }
.chat-input-row { width: 100%; }

/* Ссылка под формой рисовалась стандартным синим подчёркиванием:
   правила для ссылок внутри .chat-note в теме не было. */
.chat-note a {
    color: var(--gold); text-decoration: none;
    border-bottom: 1px solid rgba(233, 177, 96, .4);
}
.chat-note a:hover { color: var(--gold-soft); border-bottom-color: var(--gold-soft); }

/* Разделитель «·» стоял в разметке жёстко, а строка состояния слева от
   него почти всегда пустая — на странице висела одинокая точка.
   Теперь точку добавляет сама строка состояния, и только когда в ней
   что-то есть. */
#chat-state:not(:empty)::after { content: ' · '; }
