:root {
    --bg: #0c0a12;          /* почти чёрный с лёгким фиолетом */
    --app: #12101a;         /* основной фон */
    --card: #1a1724;        /* карточки мягче */
    --border: #2a2438;      /* спокойная граница */

    --accent: #7c6aa6;      /* приглушённый сиреневый */
    --accent-hover: #9a87c9;

    --danger: #ff6b81;
    --success: #50ffc8;
    --warning: rgba(183, 15, 48, 0.35);
    --info: rgba(73, 209, 62, 0.35);
    --description: rgb(29, 78, 103);

    --text: #eae6f5;        /* мягкий светлый */
    --text-muted: #9b94b8;  /* спокойный серо-фиолетовый */

    --input: #14121c;
    --button: #2a2438;

    --button-unselected: #343434;
    --button-accent: #6e5fa3;
    --button-warning: #8a2b2b;
    --button-ok: #137535;

    --rating-zero: #140f17;
    --rating-plus: #45502d;
    --rating-minus: #773720;

    --block-content: #201c2d;

    --tag: rgba(124, 106, 166, 0.15);
    --tag-border: rgba(124, 106, 166, 0.35);

    --tag-active: rgba(124, 106, 166, 0.25);
    --tag-active-border: #9a87c9;

    --link: #ffc067;
    --link-hover: #6fff36;
}

* {
    position: relative;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

a, .link {
    color: var(--link);
    cursor: pointer;
    transition-duration: 200ms;
}

a:hover, .link:hover {
    color: var(--link-hover);
}

h1 {
    font-size: 20px;
    text-align: center;
    padding: 10px;
}

h2 {
    margin: 10px;
    text-align: center;
    font-size: 18px;
}

h3 {
    margin: 7px;
    text-align: center;
    font-size: 17px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    overflow: hidden;
}

.center {
    text-align: center;
}

.right {
    text-align: right;
}

.one-block {
    height: 100%; /* высота экрана */
    display: flex;
    flex-direction: column;
    align-items: center;      /* по горизонтали */
    justify-content: center;  /* по вертикали */
    padding: 40px;            /* вместо margin */
}

.hint {
    text-align: center;
    padding: 8px 22px;
    border-radius: 6px;
    background: var(--button);
    margin: 8px 0;
    font-weight: bold;
}

.hint.warning {
    background: var(--warning);
}

.hint.info {
    background: var(--info);
}

.hint.description {
    background: var(--description);
}

.hint.inline {
    display: inline-block;
}

.reacts {
    margin-top: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.reacts span {
    background: var(--button);
    border-radius: 20px;
    gap: 5px;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 6px 10px;
    text-align: center;
    transition-duration: 200ms;
    display: none;
}

.reacts span.visible {
    display: flex;
}

.reacts span.active {
    background: var(--button-accent);
}


.game-links {
    display: flex;
    flex-wrap: wrap; /* Разрешаем перенос кнопок на новую строку */
    gap: 10px; /* Промежуток между кнопками */
    justify-content: center; /* Центрируем кнопки по горизонтали */
}

.game-links button {
    background-color: var(--button);
    border-radius: 20px;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    font-weight: bold;
}

.game-links button:hover {
    background-color: var(--button-accent); /* Цвет при наведении */
}


.app {
    background: var(--app);
    max-width: 800px;
    margin: auto;
}

.screen {
    padding: 8px;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.screen.active {
    animation: dialogFade 0.15s ease-out;
}

.screen .scroll {
    flex: 1;
    overflow: auto;
    padding: 10px;
}

.cards-box {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

.card {
    background: var(--card);
    border-radius: 14px;
    padding: 16px;
    margin: 6px;
    min-width: 120px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-header {
    margin-bottom: 14px;
}

.card-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.list-item {
    text-align: left;
    padding: 14px 12px;
    border-radius: 10px;
    background: var(--button);
    color: var(--text);
    font-size: 15px;
    border: 1px solid transparent;
    transition: background 0.15s ease, border 0.15s ease;
}

.list-item:not(:last-child) {
    margin-bottom: 10px;
}

.list-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.item-title {
    font-weight: 600;
    color: var(--text);
    flex: 1;
    font-size: 15px;
}

.item-meta {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    font-weight: bold;
    margin: 5px;
    display: inline-block;
    background: var(--tag);
    border: 1px solid var(--tag-border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 12px; /* pill */
    font-size: 14px;
    transition: background 0.15s ease, color 0.15s ease, border 0.15s ease;
    cursor: pointer;
}

.tag.active {
    background: var(--tag-active);
    border: 1px solid var(--tag-active-border);
}

.stat-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
}

.stat-value-small {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.stat-delta {
    font-size: 16px;
    padding: 4px 22px;
    border-radius: 15px;
    background: var(--button);
}

.stat-delta.positive {
    display: inline-block;
    color: var(--success);
    border: 1px solid rgba(76, 195, 138, 0.3);
}

.stat-delta.negative {
    color: var(--danger);
    border: 1px solid rgba(255, 92, 122, 0.3);
}

.max-width {
    max-width: 90% !important;
}

.max-height {
    max-height: 90% !important;
}

.max-size {
    max-width: 90% !important;
    max-height: 90% !important;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.form-group label {
    padding: 5px 0 5px 20px;
}

.form-group .print-value {
    font-size: 16px;
    font-weight: bold;
    padding: 5px 0 5px 25px;
}

input, textarea, select {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--input);
    color: var(--text);
    font-size: 16px;
    margin-bottom: 16px;
}

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

.under {
    margin-top: 10px;
    text-align: center;
}

button {
    padding: 14px 22px;
    border-radius: 10px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 12px;
    background: var(--button);
    color: var(--text);
    margin-left: 4px;
}

button.accent {
    background: var(--button-accent);
}

button.unselected {
    background: var(--button-unselected);
}

button.warning {
    background: var(--button-warning);
}

button.ok {
    background: var(--button-ok);
}

button.small {
    padding: 8px 14px;
}

button.close {
    padding: 4px 8px;
    margin: 0;
    font-size: 16px;
}

.panel {
    margin: 0;
    background: var(--block-content);
    border-radius: 14px;
    padding: 8px 16px;
    display: none;
}

.panel.active {
    display: flex;
}

header {
    display: flex;
}

.header {
    display: flex;
}

.header .menu {
    flex: 1;
}

.header .menu button {
    background: var(--border);
}

.header .menu button.accent {
    background: var(--button-accent);
}

.flex {
    display: flex;
}

.flex-vertical {
    display: flex;
    flex-direction: column;
}

.flex-fill {
    flex: 1;
}

.flex-center {
    justify-content: center;
    align-items: center;
}

.big-padding {
    padding: 20px 40px;
}

.left {
    text-align: left;
}


/* BLOCKS */

.block {
    background: var(--card);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: dialogFade 0.15s ease-out;
}

.block-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0 8px;
}

.block-header-title {
    padding-left: 15px;
}

.block-logo {

}

.block-logo-small img {
    width: 90px;
    height: 90px;
    border-radius: 15px;
    margin-right: 10px;
    object-fit: cover;
}

.block-logo img {
    width: 100%;
    max-height: 300px;
    border-radius: 15px;
    margin: 10px 0;
    object-fit: cover;
}

.block-content {
    margin: 8px 0;
    background: var(--block-content);
    border-radius: 14px;
    padding: 8px 16px;
}

.block-content-trans {
    border-radius: 14px;
    padding: 8px;
}

.block-tags {
    flex: 1;
    display: flex;
    align-items: center;
}

.block-tags .tag {
    padding: 4px 8px;
    font-size: 13px;
}

.clickable {
    cursor: pointer;
    opacity: 0.95;
}

.clickable:hover {
    opacity: 1;
}

.images-carousel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 4px 10px 4px;

    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.images-carousel img {
    max-height: 480px;
    max-width: 100%;
    width: auto;
    flex: 0 0 auto;

    border-radius: 14px;
    object-fit: cover;

    background: var(--card);
    border: 1px solid var(--border);

    cursor: pointer;
}

.images-carousel img:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}


.images-grid {
    display: grid;
    gap: 10px;
    padding: 6px 4px 10px 4px;

    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.images-grid img {
    width: 100%;
    aspect-ratio: 16 / 9; /* можно убрать если не надо */
    object-fit: cover;

    border-radius: 14px;
    background: var(--card);
    border: 1px solid var(--border);

    cursor: pointer;
    transition: 0.15s;
}

.images-grid img:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.message {
    display: flex;
    flex-direction: row;
    border: 1px solid var(--border);
}

.message-left-block {
    padding-right: 10px;
    cursor: pointer;
}

.rating {
    text-align: center;
    font-size: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--rating-zero);
    border: 1px solid var(--border);
    margin: 8px 0;
    font-weight: bold;
    user-select: none;
    transition-duration: 200ms;
}

.rating .value {
    font-size: 16px;
    font-weight: bold;
}

.rating.positive {
    background: var(--rating-plus);
}

.rating.negative {
    background: var(--rating-minus);
}

.message-left-block:hover .rating {
    background: var(--tag);
    color: var(--link);
}

.message-avatar {

}

.message .reacts {
    justify-content: end;
}

.message .reacts span {

}

.message .reacts span.active {

}

.message.highlight {
    animation: msgHighlight 1.5s ease;
}

@keyframes msgHighlight {
    0% {
        background: var(--accent-hover);
    }

    100% {
        background: var(--card);
    }
}

.avatar-big {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 1px solid var(--border);
    object-fit: cover;
}

.avatar-container-big {
    padding: 10px;
}

.avatar-container-big .avatar {
    width: 150px;
    height: 150px;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid var(--border);
    object-fit: cover;
    background: var(--tag-active);
}

.profile-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--tag);
    border: 1px solid var(--border);
    border-radius: 15px;
    margin-bottom: 10px;
}

.profile-stat b {
    font-size: 18px;
}



/* ALERT */

#alert-container {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    padding: 16px;
}

/* Active state */
#alert-container.active {
    display: flex;
}

/* Alert box */

.alert-box {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border-radius: 16px;
    padding: 20px 20px 5px 20px;
    text-align: center;
    animation: alertFade 0.15s ease-out;
}

.alert-text {
    font-size: 16px;
    margin-bottom: 20px;
}

@keyframes alertFade {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}



/* MENU */

#menu-container {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.8);
}

#menu-container.active {
    display: block;
}

/* само меню */

.menu-box {
    position: absolute;
    min-width: 120px;
    max-width: 260px;
    background: var(--card);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: alertFade 0.15s ease-out;
}

/* горизонтальный блок */

.menu-row {
    display: flex;
    gap: 6px;
    padding: 4px 8px;
    overflow-y: hidden;
    overflow-x: auto;
}

.menu-row button {
    flex: 1;
}

/* вертикальные кнопки */

.menu-item {
    margin: 0;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    text-align: left;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
}

.menu-item:hover {
    background: rgba(255,255,255,0.05);
}

/* универсальные кнопки */

.menu-btn {
    padding: 8px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.05);
    cursor: pointer;
}


/* LOADER */

#loader-container {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20000; /* выше alert */
}

/* Active */
#loader-container.active {
    display: flex;
}

/* Spinner */

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: loaderSpin 0.8s linear infinite;
}

/* Animation */

@keyframes loaderSpin {
    to {
        transform: rotate(360deg);
    }
}



/* IMAGE VIEWER */

#image-viewer {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    overflow: hidden;
}

#image-viewer.active {
    display: flex;
}

/* Image */

.viewer-image {
    max-width: none;
    max-height: none;
    transform-origin: center center;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
    touch-action: none;
    opacity: 0;
    transition-duration: 200ms;
    image-rendering: -moz-crisp-edges; /* Firefox */
    image-rendering: -o-crisp-edges; /* Opera */
    image-rendering: -webkit-optimize-contrast; /* Webkit */
    image-rendering: pixelated; /* Стандарт (Chrome, Edge, Opera) */
    -ms-interpolation-mode: nearest-neighbor; /* IE */
}

.viewer-image.active {
    opacity: 1;
}

/* Close button */

.viewer-close {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
}




/* Общий стиль для message-area */
.message-area {
    background: var(--card);
    border-radius: 14px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Панель с эмодзи (горизонтальная прокрутка) */
.emoji-panel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.emoji {
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 10px;
    transition: background 0.2s ease;
    user-select: none;
}

.emoji:hover {
    background: var(--button);
}

/* Контейнер для поля ввода и кнопки */
.send-container {
    display: flex;
    align-items: flex-start; /* Выравнивание по верху */
    gap: 12px;
    width: 100%;
}

/* Поле ввода с contenteditable */
.message-input {
    flex-grow: 1; /* Поле ввода занимает всё доступное пространство */
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--input);
    color: var(--text);
    font-size: 16px;
    min-height: 50px;
    max-height: 200px;
    overflow-y: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
    resize: none;
    transition: border-color 0.2s ease;
}

/* Кнопка отправки */
.send-button {
    background: var(--button);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.send-button:hover {
    background: var(--button-accent);
}

/* Стили для прокрутки смайликов */
.emoji-panel::-webkit-scrollbar {
    height: 10px;
}

.emoji-panel::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.emoji-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.emoji-panel::-webkit-scrollbar-track {
    background: var(--bg);
}

.font-emoji {
    font-size: 40px;
}

.raw-text {
    white-space: pre-wrap;
    word-break: break-word;
}


/* DIALOG */

#dialog-container {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    padding: 16px;
}

#dialog-container.active {
    display: flex;
}

.dialog-box {
    width: 100%;
    max-width: 720px;
    background: var(--card);
    border-radius: 18px;
    padding: 6px 16px 6px 16px;
    position: relative;
    animation: dialogFade 0.15s ease-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-title {
    flex: 1;
    font-size: 18px;
    margin: 0;
    text-align: left;
    padding-left: 10px;
}

.dialog-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
}

.dialog-close:active {
    color: var(--text);
}

.dialog-content {
    flex: 1;
    font-size: 15px;
    overflow: auto;
}

@keyframes dialogFade {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}



/* =========================
   SCROLLBAR (Chrome, Edge, Safari)
========================= */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

::-webkit-scrollbar-corner {
    background: var(--bg);
}


/* =========================
   SCROLLBAR (Firefox)
========================= */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg);
}





