@font-face {
    font-family: "Inglobal BI";
    src: url("shrift/inglobalbi.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Inglobal Ton";
    src: url("shrift/inglobali_ton.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Стандартный стол: бархатный velur */
    --table-bg: url("assets/decks/velur.jpg");
    /* Рубашка по умолчанию – PNG */
    --card-back-bg: url("assets/backs/default/card-back.png");
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "San Francisco", sans-serif;
    background-color: #020617;
    background-image: var(--table-bg);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #e5e7eb;
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

button,
input,
select,
textarea {
    font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "San Francisco", sans-serif;
    background: rgba(255, 255, 255, 0.01) !important;
    transition:
        opacity 0.45s ease,
        background-color 0.45s ease,
        box-shadow 0.45s ease,
        border-color 0.45s ease;
}

button {
    font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "San Francisco", sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6,
.top-bar {
    font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "San Francisco", sans-serif;
}

#app {
    position: relative;
    padding: calc(80px + env(safe-area-inset-top, 0px)) 12px 24px;
    box-sizing: border-box;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    transition: opacity 0.45s ease, transform 0.45s ease, filter 0.45s ease;
}

body:not(.app-ready) #app {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
    filter: blur(4px);
    pointer-events: none;
}

body.app-ready #app {
    opacity: 1;
    transform: none;
    filter: none;
    pointer-events: auto;
}

body:not(.app-ready) button,
body:not(.app-ready) input,
body:not(.app-ready) select,
body:not(.app-ready) textarea {
    opacity: 0;
    background: transparent !important;
    box-shadow: none !important;
    border-color: transparent !important;
    transition: none;
}

body.app-ready button,
body.app-ready input,
body.app-ready select,
body.app-ready textarea {
    opacity: 1;
}

.top-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 8px 10px;
    border-radius: 16px;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    position: relative;
    overflow: hidden;
}

.top-bar::before {
    display: none;
}

.top-bar h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 0;
    text-shadow:
        -0.5px -0.5px 0 #000,
        0.5px -0.5px 0 #000,
        -0.5px 0.5px 0 #000,
        0.5px 0.5px 0 #000;
}

.logo-icon {
    font-size: 1.2em;
}

.logo-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    display: inline-block;
}

/* Полноэкранный режим стола в духе мобильной версии */
body.game-mode {
    background-image: var(--table-bg);
    background-color: #254463;
    color: #f9fafb;
}

body.game-mode #app {
    padding: 0;
}

body.game-mode .top-bar,
body.game-mode .main-menu {
    display: none;
}

body.game-mode main {
    padding-bottom: 0;
    height: 100vh;
    display: flex;
}

body.game-mode #game.view {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

body.game-mode #game::before {
    /* большое сердечко слева, как в референсе */
    content: "♥";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 32px;
    color: #f97373;
    opacity: 0.9;
    pointer-events: none;
}

body.game-mode #game .status {
    position: absolute;
    top: 10px;
    left: 12px;
    right: 12px;
    font-size: 12px;
    opacity: 0.9;
}

body.game-mode #game .players {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

body.game-mode #game .player {
    position: absolute;
    background: rgba(15, 23, 42, 0.75);
    border-radius: 16px;
    padding: 8px;
    min-width: 72px;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.profile-rank-container {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.rank-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #a5b4fc;
    color: #a5b4fc;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

.rank-tooltip {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    width: 240px;
    padding: 12px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 100;
    pointer-events: auto;
}

.rank-tooltip.hidden {
    display: none;
}

.rank-tooltip::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 10px;
    width: 10px;
    height: 10px;
    background: #1e293b;
    border-left: 1px solid #475569;
    border-top: 1px solid #475569;
    transform: rotate(45deg);
}

#rank-tooltip-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #e2e8f0;
    white-space: pre-wrap;
}

/* Top Position (Standard) */
body.game-mode #game .player.pos-top {
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
}

/* Left Position (Vertical) */
body.game-mode #game .player.pos-left {
    top: 40%;
    left: 8px;
    transform: translateY(-50%);
    flex-direction: column;
    align-items: center;
    background: rgba(15, 23, 42, 0.75);
    padding: 8px 6px;
    border-radius: 12px;
    gap: 6px;
    min-width: 60px;
}

/* Right Position (Vertical) */
body.game-mode #game .player.pos-right {
    top: 40%;
    right: 8px;
    transform: translateY(-50%);
    flex-direction: column;
    align-items: center;
    background: rgba(15, 23, 42, 0.75);
    padding: 8px 6px;
    border-radius: 12px;
    gap: 6px;
    min-width: 60px;
}

/* Adjust inner layout for vertical players */
body.game-mode #game .player.pos-left .player-main,
body.game-mode #game .player.pos-right .player-main {
    flex-direction: column;
    gap: 4px;
    text-align: center;
    width: 100%;
}

/* Remove rotation */
body.game-mode #game .player.pos-left .player-main,
body.game-mode #game .player.pos-right .player-main {
    transform: none;
}

/* Cards layout for side players */
body.game-mode #game .player.pos-left .player-backs,
body.game-mode #game .player.pos-right .player-backs {
    margin-top: 2px;
    display: flex;
    flex-direction: row;
    /* Cards horizontally */
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
    max-width: 60px;
}

/* Reset background for side players wrapper since we moved it to the main container */
body.game-mode #game .player.pos-left .player-backs,
body.game-mode #game .player.pos-right .player-backs {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/* Smaller text for side players */
body.game-mode #game .player.pos-left .player-name,
body.game-mode #game .player.pos-right .player-name {
    font-size: 11px;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Smaller avatar for side players */
body.game-mode #game .player.pos-left .player-avatar,
body.game-mode #game .player.pos-right .player-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

body.game-mode #game .player.me {
    border: 2px solid #22c55e;
    background: rgba(22, 163, 74, 0.35);
}

.turn-hints {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.turn-hint {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #f9fafb;
    opacity: 0;
    transition: opacity 0.15s ease-out;
}

.turn-hint.visible {
    opacity: 1;
}

.turn-hint-arrow {
    font-size: 26px;
}

.turn-hint-label {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    background: rgba(15, 23, 42, 0.85);
}

.turn-hint--attack {
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: column-reverse;
}

.turn-hint--attack .turn-hint-arrow {
    color: #f97373;
}

.turn-hint--defend {
    bottom: 120px;
    right: 24px;
    flex-direction: row;
}

.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--table-bg, #020617);
    background-size: cover;
    background-position: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    color: #fff;
}

.loading-logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.loading-title {
    font-size: 24px;
    font-weight: 800;
    text-shadow:
        -0.5px -0.5px 0 #000,
        0.5px -0.5px 0 #000,
        -0.5px 0.5px 0 #000,
        0.5px 0.5px 0 #000;
}

.loading-spinner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px dashed rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
    animation: loading-spin 1.2s linear infinite;
}

.loading-text {
    font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "San Francisco", sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

@keyframes loading-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.turn-hint--defend .turn-hint-arrow {
    transform: rotate(-40deg);
    color: #a5b4fc;
}

button {
    padding: 10px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(24, 36, 58, 0.015);
    background-image:
        linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.008)),
        radial-gradient(circle at 15% 0, rgba(255, 255, 255, 0.018), transparent 45%);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 8px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

button::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

button:active {
    transform: scale(0.96);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.main-menu {
    position: fixed;
    left: 50%;
    bottom: 2px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    gap: 0;
    margin: 0;
    padding: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
    width: calc(100% - 90px);
    max-width: 320px;
    z-index: 1100;
    position: fixed;
    overflow: hidden;
    border-radius: 28px;
}

#nav-active-indicator {
    position: absolute;
    height: 56px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 6px 12px rgba(0, 0, 0, 0.35);
    top: 2px;
    left: 0;
    width: 0;
    transition: transform 0.25s ease, width 0.25s ease, opacity 0.25s ease;
    opacity: 0.85;
    pointer-events: none;
    z-index: 0;
}

.main-menu button {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    border-radius: 22px;
    font-size: 10px;
    padding: 4px 2px;
    position: relative;
    overflow: hidden;
    border: none !important;
    background: transparent !important;
    background-image: none !important;
    background-color: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    min-width: 0;
    box-shadow: none !important;
    text-shadow: none;
    isolation: isolate;
    transition: color 0.2s ease, filter 0.2s ease, transform 0.2s ease;
    color: rgba(229, 231, 235, 0.65);
    z-index: 1;
}

.main-menu button:focus-visible {
    outline: none;
    box-shadow: none;
}

.main-menu button:not([disabled]) {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.main-menu button.active {
    color: #fff;
    transform: none;
}

.main-menu button::before {
    display: none !important;
}

.main-menu button.active::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 8px 18px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.12);
    z-index: 0;
    pointer-events: none;
}

.main-menu button > * {
    position: relative;
    z-index: 1;
}

.main-menu button:active {
    transform: scale(0.99);
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
}

.nav-btn-icon {
    display: inline-flex;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    background: none;
    padding: 0;
}

.main-menu button.active .nav-btn-icon {
    background: none;
    opacity: 1;
}

.nav-btn-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    opacity: 0.65;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.nav-btn-label {
    font-size: 13px;
    font-weight: 700;
    color: rgba(229, 231, 235, 0.65);
    white-space: nowrap;
}

.main-menu button.active .nav-btn-label {
    color: #fff;
}

.main-menu button.active .nav-btn-icon img {
    opacity: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.main-menu .admin-only {
    display: none;
}

main {
    padding: 0 0 16px;
    flex: 1;
}

.view.hidden {
    display: none;
}

.view {
    margin-bottom: 16px;
    opacity: 1;
}

.view-enter {
    animation: viewFadeIn 0.24s ease forwards;
}

.view-leave {
    animation: viewFadeOut 0.2s ease forwards;
}

.view-enter-left {
    animation: viewSlideInLeft 0.25s ease forwards;
}

.view-enter-right {
    animation: viewSlideInRight 0.25s ease forwards;
}

.view-leave-left {
    animation: viewSlideOutLeft 0.2s ease forwards;
}

.view-leave-right {
    animation: viewSlideOutRight 0.2s ease forwards;
}

@keyframes viewFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

@keyframes viewFadeOut {
    from {
        opacity: 1;
        transform: none;
        filter: none;
    }
    to {
        opacity: 0;
        transform: translateY(6px);
        filter: blur(6px);
    }
}

@keyframes viewSlideInLeft {
    from {
        opacity: 0;
        transform: translateX(-12px);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

@keyframes viewSlideInRight {
    from {
        opacity: 0;
        transform: translateX(12px);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

@keyframes viewSlideOutLeft {
    from {
        opacity: 1;
        transform: none;
        filter: none;
    }
    to {
        opacity: 0;
        transform: translateX(-12px);
        filter: blur(6px);
    }
}

@keyframes viewSlideOutRight {
    from {
        opacity: 1;
        transform: none;
        filter: none;
    }
    to {
        opacity: 0;
        transform: translateX(12px);
        filter: blur(6px);
    }
}

/* Игровое меню визуально тянется почти до нижних кнопок */
#lobby.view {
    margin-bottom: 4px;
}

.settings-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-group select {
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #e5e7eb;
}

.settings-hint {
    font-size: 12px;
    color: #9ca3af;
}

.coin-packs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.coin-pack {
    flex: 1 1 30%;
    font-size: 13px;
    padding-inline: 8px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.profile-avatar {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    background: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.profile-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(135deg, #4f46e5, #22c55e);
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.profile-rank {
    margin: 0;
    font-size: 13px;
    color: #a5b4fc;
}

.profile-xp {
    margin: 0;
    font-size: 13px;
    color: #e5e7eb;
}

.profile-coins {
    margin: 0;
    font-size: 13px;
    color: #facc15;
}

.xp-toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.95);
    color: #022c22;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.lobby-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 4px 0;
}

#lobby>h2 {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin: 4px 0 8px;
}

#lobby {
    padding: 0 8px 8px;
}

.lobby-panel {
    background: rgba(2, 6, 23, 0.015);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    border-radius: 16px;
    padding: 0 8px 12px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.lobby-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 12px;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
}

.lobby-card {
    padding: 10px 16px;
    background: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.lobby-card:last-child {
    border-bottom: none;
}

.lobby-card-main {
    display: flex;
    flex-direction: column;
}

.lobby-card-title {
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: 0.04em;
}

.lobby-card-meta {
    font-size: 12px;
    color: #9ca3af;
}

.lobby-card-join button {
    padding-inline: 10px;
    font-size: 13px;
    border-radius: 999px;
}

.lobby-search-container {
    margin-bottom: 8px;
}

.lobby-search-container input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(2, 6, 23, 0.015);
    color: #e5e7eb;
    font-size: 14px;
    box-sizing: border-box;
}

.lobby-search-container input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

.lobby-filters {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.filter-group select {
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(2, 6, 23, 0.015);
    color: #e5e7eb;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.lobby-create-button {
    display: block;
    width: min(240px, 72%);
    margin: 12px auto 36px;
    padding: 13px 16px;
    border-radius: 22px;
    font-size: 15px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow:
        0 10px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
}

.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    width: 100%;
    max-width: 360px;
    margin: 0 16px;
    padding: 16px 16px 12px;
    border-radius: 16px;
    background: rgba(2, 6, 23, 0.015);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-content input[type="tel"],
.modal-content input[type="text"] {
    width: 100%;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(2, 6, 23, 0.015);
    color: #e5e7eb;
}

.status {
    margin-bottom: 12px;
    font-size: 14px;
    color: #a5b4fc;
}

.players {
    margin-bottom: 12px;
    font-size: 13px;
}

#room .players {
    margin-top: 8px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.06);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

#room .actions {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#room .actions button {
    width: min(240px, 90%);
    margin: 0;
    border-radius: 22px;
}

.player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-radius: 0;
    background: transparent;
    border: none;
    margin: 0;
}

.player.me {
    background: transparent;
}

.btn-ready {
    background: rgba(59, 130, 246, 0.15);
    color: #dbeafe;
    border: 1px solid rgba(59, 130, 246, 0.45);
    border-radius: 18px;
    transition: all 0.2s ease;
}

.btn-ready.active {
    background: rgba(34, 197, 94, 0.2);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.7);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.35);
}

.player-main {
    display: flex;
    align-items: center;
    gap: 6px;
}

.player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-avatar.turn-timer,
.self-avatar.turn-timer {
    position: relative;
}

.player-avatar.turn-timer::after,
.self-avatar.turn-timer::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        rgba(74, 222, 128, 0.9) calc(var(--turn-progress, 0) * 100%),
        rgba(34, 197, 94, 0.08) calc(var(--turn-progress, 0) * 100%)
    );
    mask: radial-gradient(circle at center, transparent 62%, #000 63%);
    box-shadow:
        0 0 12px rgba(74, 222, 128, 0.65),
        0 0 0 1px rgba(15, 23, 42, 0.6);
    pointer-events: none;
}

.player-name {
    font-weight: 500;
}

.player-cards {
    font-size: 12px;
    color: #9ca3af;
}

.player-backs {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}


.card-back {
    width: 20px;
    height: 28px;
    border-radius: 4px;
    background-image: var(--card-back-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.table {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid #1f2937;
    background-color: #1f2937;
    background-image: var(--table-bg);
    background-size: cover;
    background-position: center;
    position: relative;
    z-index: 2;
}

.deck-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 8px;
}

.deck-stack {
    position: relative;
    /* Горизонтальная стопка колоды */
    width: 94px;
    height: 72px;
}

.deck-pile-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 64px;
    height: 94px;
    border-radius: 8px;
    /* Используем ту же рубашку, что и для карт игроков */
    background-color: #020617;
    background-image: var(--card-back-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Лежащая горизонтально колода */
    transform: rotate(-90deg);
    transform-origin: center center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    /* Стопка колоды лежит сверху */
    z-index: 2;
}

.deck-trump-card {
    position: absolute;
    /* Вертикальная козырная карта, выглядывает снизу из-под стопки */
    bottom: -40px;
    left: 26px;
    transform: rotate(-4deg);
    z-index: 1;
}

.deck-trump-suit {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.85);
    color: #fecaca;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.deck-count {
    font-size: 12px;
    font-weight: 600;
    color: #e5e7eb;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    padding-left: 2px;
}

/* В полноэкранном режиме колода всегда в левом верхнем углу стола */
body.game-mode #game .deck-area {
    position: absolute;
    top: 12px;
    left: 12px;
    margin-bottom: 0;
    z-index: 5;
}

.table-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 72px;
    position: relative;
    z-index: 3;
}

.table-pair {
    position: relative;
    width: 64px;
    height: 112px;
}

.table-pair .card {
    position: absolute;
    left: 0;
    top: 0;
}

.table-pair .table-card-attack {
    z-index: 1;
}

.table-pair .table-card-defense {
    top: 14px;
    left: 10px;
    z-index: 2;
}

.table-drop-zone {
    display: none;
}

.table-drop-zone.drop-over {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.table-card-attack.drag-over {
    outline: none;
}

.actions {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
}

.actions button {
    flex: 1;
}

.hand-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.card {
    width: 64px;
    height: 94px;
    border-radius: 8px;
    background-color: #f9fafb;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.7);
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

.card--selected {
    transform: translateY(-8px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.8);
}

/* Компоновка стола и руки в полноэкранном режиме */
body.game-mode #game .table {
    position: relative;
    flex: 1;
    margin: 0;
    border-radius: 0;
    border: none;
    padding: 0;
    background-color: #254463;
    background-image: var(--table-bg);
}

body.game-mode #game .table h2 {
    display: none;
}

body.game-mode #game #deck-area {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: top 0.3s ease, transform 0.3s ease;
}

body.game-mode.more-than-2-players #game #deck-area {
    top: 80px;
    transform: none;
}

body.game-mode #game #table-cards {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    min-height: 96px;
}

body.game-mode #game .hand {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 70px;
    /* Lowered significantly */
    /* Moved up to make room for avatar and button */
    padding: 0 16px 8px;
    z-index: 5;
}

body.game-mode #game .hand h2 {
    display: none;
}

body.game-mode #game .hand-cards {
    justify-content: center;
    gap: 0;
}

body.game-mode #game .hand-cards .card {
    margin-left: -32px;
}

body.game-mode #game .hand-cards .card:first-child {
    margin-left: 0;
}

/* Нижняя панель действий */
#game .game-actions {
    position: absolute;
    left: 16px;
    /* Bottom left */
    right: auto;
    transform: none;
    bottom: 16px;
    /* Lowered slightly */
    width: auto;
    max-width: 140px;
    /* Decreased width */
    padding: 0;
    background: transparent;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    pointer-events: auto;
}

/* Self Profile (Avatar) */
.self-profile {
    position: absolute;
    bottom: 10px;
    /* Moved up slightly to increase gap from buttons */
    /* Between hand and button */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 10;
    pointer-events: none;
}

.self-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: #1e293b;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: border-color 0.3s, box-shadow 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.self-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.self-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.self-profile.attacker .self-avatar {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

.self-name {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 8px;
    border-radius: 10px;
}

.self-role-text {
    display: none;
    /* Hide text role, rely on visual cue */
}

.turn-expiring .self-name,
.turn-expiring .player-name {
    animation: pulse-status 0.9s ease-in-out infinite;
}

@keyframes pulse-status {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(34, 197, 94, 0));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.8));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(34, 197, 94, 0));
    }
}

body.turn-expiring-me .game-actions button,
body.turn-expiring-me #btn-surrender {
    animation: pulse-status 0.9s ease-in-out infinite;
}

/* Action Buttons */
.action-btn {
    /* background: #1f3b59; - Removed to use global/table-bg */
    background-image: var(--table-bg);
    background-size: cover;
    background-position: center;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 8px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    width: 100%;
    z-index: 101;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), transparent);
    pointer-events: none;
}

.action-btn:active {
    transform: scale(0.96);
}

.action-btn:disabled {
    background: #0f172a;
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    border-color: transparent;
}

/* Specific colors removed to match menu style */

#btn-surrender {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s, background 0.2s;
}

#btn-surrender:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

#btn-surrender:active {
    transform: scale(0.95);
}

#game .game-actions #btn-exit-game {
    width: auto;
    align-self: flex-start;
    padding: 6px 12px;
    font-size: 12px;
    min-height: 30px;
    margin-top: 4px;
    /* background: rgba(239, 68, 68, 0.8); - Removed to use table-bg */
    background-image: var(--table-bg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 4px rgba(0, 0, 0, 0.4);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
    margin-top: 8px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* Profile Customization */
.profile-customization {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.customization-tabs {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 16px;
}

.tab-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.tab-btn.active {
    background-image: var(--table-bg);
    background-size: cover;
    background-position: center;
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 4px rgba(0, 0, 0, 0.4);
}

.tab-content {
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.tab-content.active {
    display: block;
}

.result-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.result-modal.hidden {
    display: none;
}

.result-card {
    width: min(420px, 90%);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    text-align: center;
    color: #e5e7eb;
}

.result-card h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 800;
}

.result-status {
    margin: 0 0 12px;
    color: #cbd5e1;
    font-weight: 600;
}

.result-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 10px;
}

.result-metric {
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.result-label {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.result-value {
    font-size: 18px;
    font-weight: 800;
    color: #facc15;
}

.result-hint {
    font-size: 12px;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.result-close-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #e5e7eb;
    font-weight: 800;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
}
.result-close-btn.secondary {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    color: #cbd5e1;
}

.daily-card {
    background: linear-gradient(135deg, rgba(12, 14, 20, 0.78), rgba(24, 28, 38, 0.7));
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.daily-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(64px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.daily-cell {
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    text-align: center;
    color: #e5e7eb;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.daily-cell .day-label {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.daily-cell .reward-text {
    font-weight: 700;
    font-size: 14px;
}

.daily-cell .reward-image {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 4px;
}

.daily-cell.claimed {
    border-color: rgba(34, 197, 94, 0.8);
    background: rgba(34, 197, 94, 0.12);
}

.daily-cell.current {
    border-color: rgba(250, 204, 21, 0.8);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35), 0 10px 24px rgba(0, 0, 0, 0.35);
}

.daily-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.result-card.daily-card button {
    flex: 0 0 auto;
    min-width: 160px;
    width: auto;
}

@media (max-width: 420px) {
    .daily-grid {
        grid-template-columns: repeat(3, minmax(64px, 1fr));
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shop-grid {
    display: flex;
    justify-content: center;
}

.shop-carousel {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 90%;
    max-width: 300px;
    margin: 0 auto;
}

.carousel-arrow {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 56px;
    border-radius: 12px;
    font-size: 18px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
}

.shop-card {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
}

.shop-card-preview {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 14px;
    overflow: hidden;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.shop-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.shop-card-name {
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.shop-card-action {
    width: 100%;
    margin-top: 4px;
}

.shop-card-action.selected {
    background: rgba(250, 204, 21, 0.2);
    border-color: #facc15;
    color: #facc15;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.35);
}

.shop-placeholder {
    padding: 12px;
    text-align: center;
    color: #cbd5e1;
}

/* Settings Controls */
.settings-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.settings-subtitle {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 800;
    color: #e5e7eb;
}

.setting-toggle-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.setting-toggle-btn.active {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #22c55e;
}

.setting-toggle-btn:not(.active) {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

/* legacy shop buttons removed */

.admin-panel {
    margin-top: 12px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(59, 130, 246, 0.08));
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
}

.admin-panel h3 {
    margin-top: 0;
    margin-bottom: 4px;
}

.admin-panel h4 {
    margin: 8px 0 6px;
}

.admin-block {
    padding: 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 10px;
}

.admin-block input,
.admin-block select {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04) !important;
    color: #f8fafc;
}

.admin-inline {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-status {
    margin-top: 6px;
    font-size: 12px;
    color: #cbd5e1;
    min-height: 16px;
}

.admin-status.success {
    color: #4ade80;
}

.admin-status.error {
    color: #f87171;
}

/* Leaderboard */
.leaderboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.leaderboard-subtitle {
    margin: 4px 0 0;
    color: #cbd5e1;
    opacity: 0.85;
    font-size: 13px;
    font-weight: 600;
}

.leaderboard-refresh-btn {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(56, 189, 248, 0.7);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(16, 185, 129, 0.16));
    color: #e0f2fe;
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.leaderboard-refresh-btn:hover {
    border-color: rgba(56, 189, 248, 1);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.34);
}

.leaderboard-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-bottom: 8px;
}

.leaderboard-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.leaderboard-group {
    padding: 12px;
    border-radius: 16px;
    background: linear-gradient(140deg, rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.58));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.leaderboard-group-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.leaderboard-group-title {
    font-weight: 800;
    font-size: 16px;
    color: #f8fafc;
}

.leaderboard-group-desc {
    font-size: 12px;
    color: #cbd5e1;
    opacity: 0.82;
}

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

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.leaderboard-row.is-self {
    border-color: rgba(251, 191, 36, 0.7);
    box-shadow:
        0 0 0 1px rgba(251, 191, 36, 0.35),
        0 8px 18px rgba(0, 0, 0, 0.35);
    background: linear-gradient(120deg, rgba(251, 191, 36, 0.08), rgba(255, 255, 255, 0.02));
}

.leaderboard-pos {
    min-width: 42px;
    text-align: center;
    font-weight: 800;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border-radius: 10px;
    padding: 6px 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.leaderboard-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.leaderboard-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(145deg, #0ea5e9, #22d3ee);
    color: #0b132b;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.leaderboard-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.leaderboard-user-info {
    min-width: 0;
}

.leaderboard-name {
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-user-meta {
    font-size: 12px;
    color: #cbd5e1;
    opacity: 0.86;
}

.leaderboard-stats {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 96px;
}

.leaderboard-xp {
    font-weight: 700;
    color: #38bdf8;
}

.leaderboard-time {
    font-size: 12px;
    color: #9ca3af;
}

.leaderboard-placeholder {
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
}

@media (max-width: 420px) {
    .leaderboard-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .leaderboard-stats {
        align-self: flex-end;
        width: 100%;
    }
}
