:root {
    --pg-bg: #f7f8fa;
    --pg-border: #e6e8ec;
    --pg-text: #18181b;
    --pg-muted: #71717a;
    --pg-accent-x: #2563eb;
    --pg-accent-o: #e11d48;
    --pg-win-bg: #ecfdf5;
    --pg-win-border: #10b981;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--pg-bg);
    color: var(--pg-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.border {
    border-color: var(--pg-border) !important;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background-color: #18181b;
    color: #ffffff;
    font-size: 1.05rem;
}

.code-input {
    letter-spacing: 0.12em;
}

/* Карточки игр и открытых комнат */
.game-card,
.lobby-item {
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.game-card:hover,
.lobby-item:hover {
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.game-icon-box {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background-color: #f4f4f5;
    color: #18181b;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-tile {
    background-color: #fafafa;
    border: 1px solid var(--pg-border);
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
}

/* Список участников */
.member-row {
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    background-color: #fafafa;
    border: 1px solid transparent;
}

.member-row.is-me {
    background-color: #f4f4f5;
    border-color: var(--pg-border);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background-color: #10b981;
}

.status-dot.offline {
    background-color: #d4d4d8;
}

/* Чат */
.chat-card {
    height: 430px;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    scroll-behavior: smooth;
}

.chat-msg-user {
    max-width: 88%;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    background-color: #f4f4f5;
    font-size: 0.875rem;
    line-height: 1.4;
    align-self: flex-start;
    word-break: break-word;
}

.chat-msg-user.is-mine {
    background-color: #18181b;
    color: #ffffff;
    align-self: flex-end;
}

.chat-msg-meta {
    font-size: 0.72rem;
    color: var(--pg-muted);
    margin-bottom: 0.15rem;
}

.chat-msg-user.is-mine .chat-msg-meta {
    color: #a1a1aa;
}

.chat-msg-system {
    align-self: center;
    text-align: center;
    font-size: 0.76rem;
    color: var(--pg-muted);
    background-color: #fafafa;
    border: 1px solid var(--pg-border);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
}

/* Выбор аватара */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.4rem;
}

@media (max-width: 480px) {
    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.avatar-option {
    border: 1px solid var(--pg-border);
    background: #ffffff;
    border-radius: 10px;
    height: 42px;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.12s ease;
}

.avatar-option:hover {
    background-color: #f4f4f5;
}

.avatar-option.active {
    border-color: #18181b;
    background-color: #f4f4f5;
    box-shadow: 0 0 0 1px #18181b;
}

/* Поле игры Крестики-нолики */
.ttt-wrapper {
    max-width: 360px;
    margin: 0 auto;
}

.ttt-versus {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.ttt-player-pill {
    padding: 0.6rem 0.75rem;
    border-radius: 12px;
    border: 1px solid var(--pg-border);
    background-color: #fafafa;
    text-align: center;
    transition: all 0.15s ease;
}

.ttt-player-pill.active-turn {
    background-color: #ffffff;
    border-color: #18181b;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    aspect-ratio: 1 / 1;
}

.ttt-cell {
    border: 1px solid var(--pg-border);
    border-radius: 16px;
    background-color: #fafafa;
    font-size: 2.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}

.ttt-cell:hover:not(:disabled) {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.ttt-cell:active:not(:disabled) {
    transform: scale(0.97);
}

.ttt-cell:disabled {
    cursor: default;
}

.ttt-cell.symbol-x {
    color: var(--pg-accent-x);
    background-color: #ffffff;
}

.ttt-cell.symbol-o {
    color: var(--pg-accent-o);
    background-color: #ffffff;
}

.ttt-cell.last-move {
    border-color: #94a3b8;
}

.ttt-cell.win-cell {
    background-color: var(--pg-win-bg);
    border-color: var(--pg-win-border);
}

/* =========================================================
   Карточная игра «Подкидной Дурак»
   ========================================================= */
.durak-seats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 0.6rem;
}

.durak-seat {
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--pg-border);
    background-color: #fafafa;
}

.durak-seat.active-seat {
    background-color: #ffffff;
    border-color: #94a3b8;
}

.durak-seat.me-seat {
    background-color: #f4f4f5;
}

.durak-table-felt {
    min-height: 195px;
    background-color: #f8fafc;
}

.durak-pairs-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.1rem;
    padding: 0.4rem 0;
}

.durak-pair {
    position: relative;
    width: 82px;
    height: 118px;
}

.durak-pair.selectable-pair {
    cursor: pointer;
}

.durak-pair.selected-target .table-attack-card {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.durak-card {
    width: 72px;
    height: 102px;
    border-radius: 10px;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
    padding: 0.35rem 0.45rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    user-select: none;
}

.table-attack-card {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.table-defense-card {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 2;
    transform: rotate(5deg);
}

.durak-suit-red {
    color: #e11d48;
}

.durak-suit-black {
    color: #18181b;
}

.durak-card-corner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.05;
    font-weight: 700;
    font-size: 0.95rem;
}

.durak-card-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    opacity: 0.9;
    pointer-events: none;
}

.durak-trump-star {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 0.72rem;
    color: #eab308;
}

.durak-hand-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.durak-hand-btn {
    background: none;
    border: none;
    padding: 0;
    transition: transform 0.14s ease, opacity 0.14s ease;
}

.durak-hand-btn.is-playable {
    cursor: pointer;
}

.durak-hand-btn.is-playable:hover {
    transform: translateY(-6px);
}

.durak-hand-btn.is-playable .durak-card {
    border-color: #18181b;
}

.durak-hand-btn.is-dimmed {
    opacity: 0.55;
    cursor: default;
}

/* =========================================================
   Игра «Угадай рисунок»
   ========================================================= */
.dg-canvas-wrap {
    width: 100%;
    aspect-ratio: 8 / 5;
    position: relative;
}

.dg-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: default;
}

.dg-canvas.dg-canvas-drawable {
    cursor: crosshair;
}

.dg-color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px #cbd5e1;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.dg-color-swatch.active {
    transform: scale(1.18);
    box-shadow: 0 0 0 2px #18181b;
}

.dg-guesses-feed {
    height: 150px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background-color: #ffffff;
    border: 1px solid var(--pg-border);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
}

/* =========================================================
   Медиа-викторины: «Угадай логотип», «Угадай песню», «Угадай кадр»
   ========================================================= */
.mq-image-stage {
    min-height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mq-image-el {
    max-width: 100%;
    border-radius: 14px;
    object-fit: contain;
}

.mq-logo-frame {
    max-height: 220px;
}

.mq-movie-frame {
    width: 100%;
    max-height: 340px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.mq-vinyl-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background-color: #18181b;
    color: #ffffff;
    font-size: 2.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mq-vinyl-icon.spinning {
    animation: mqSpin 3.5s linear infinite;
}

@keyframes mqSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mq-choice-btn {
    border-radius: 12px;
    transition: transform 0.1s ease, border-color 0.15s ease;
}

.mq-choice-btn:hover:not(:disabled) {
    border-color: #18181b !important;
    background-color: #f8fafc !important;
}
