:root {
    --bg: #f5f7fb;
    --bg-accent: #eef3ff;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-strong: #ffffff;
    --line: #d9e2ef;
    --line-strong: #c7d3e3;
    --text: #17324d;
    --muted: #66788f;
    --primary: #2f6fed;
    --primary-soft: #eaf1ff;
    --success: #2d9d78;
    --success-soft: #e9f7f2;
    --warning: #c78a23;
    --warning-soft: #fff5e4;
    --danger: #d95c4f;
    --danger-soft: #fff0ee;
    --shadow: 0 16px 40px rgba(28, 58, 92, 0.08);
    --shadow-soft: 0 8px 24px rgba(28, 58, 92, 0.05);
    --radius: 22px;
    --panel-bg: rgba(255, 255, 255, 0.88);
    --nav-bg: rgba(255, 255, 255, 0.92);
    --panel-border: rgba(217, 226, 239, 0.95);
    --body-radial: radial-gradient(circle at top left, rgba(47, 111, 237, 0.08), transparent 24%);
    --body-radial-secondary: linear-gradient(180deg, #f8fafc 0%, #f2f6fb 100%);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    color: var(--text);
    font-family: 'Manrope', sans-serif;
    background:
        var(--body-radial),
        var(--body-radial-secondary);
}

h1, h2, h3, h4, h5, .navbar-brand strong {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.03em;
    color: #10263c;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    padding-bottom: 2rem;
}

.glass-nav,
.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.state-card {
    max-width: 760px;
    margin: 0 auto;
    border-radius: 30px;
}

.state-code {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.8rem, 7vw, 4.6rem);
    font-weight: 800;
    line-height: 1;
    color: var(--primary);
    letter-spacing: -0.05em;
}

.state-note {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: var(--muted);
}

.glass-nav {
    background: var(--nav-bg);
}

body[data-theme="theme-2"] {
    --bg: #fff6ef;
    --bg-accent: #fff0e6;
    --surface: #ffffff;
    --surface-soft: #fff9f4;
    --surface-strong: #ffffff;
    --line: #f1d8d1;
    --line-strong: #e9c3b8;
    --text: #3f2a39;
    --muted: #7a6272;
    --primary: #ff6b6b;
    --primary-soft: #ffe7e7;
    --success: #2cb7a0;
    --success-soft: #e7faf6;
    --warning: #ffb347;
    --warning-soft: #fff3de;
    --danger: #ef476f;
    --danger-soft: #ffe7ee;
    --shadow: 0 18px 40px rgba(239, 71, 111, 0.12);
    --shadow-soft: 0 10px 26px rgba(255, 107, 107, 0.08);
    --panel-bg: rgba(255, 255, 255, 0.9);
    --nav-bg: rgba(255, 247, 240, 0.92);
    --panel-border: rgba(241, 216, 209, 0.96);
    --body-radial: radial-gradient(circle at top left, rgba(255, 107, 107, 0.16), transparent 26%);
    --body-radial-secondary:
        radial-gradient(circle at top right, rgba(255, 179, 71, 0.14), transparent 22%),
        linear-gradient(180deg, #fffaf5 0%, #fff0e8 100%);
}

body[data-theme="theme-2"] h1,
body[data-theme="theme-2"] h2,
body[data-theme="theme-2"] h3,
body[data-theme="theme-2"] h4,
body[data-theme="theme-2"] h5,
body[data-theme="theme-2"] .navbar-brand strong {
    color: #442742;
}

body[data-theme="theme-2"] .btn-primary {
    border-color: #ff7d66;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8d5c 100%);
    box-shadow: 0 14px 26px rgba(255, 107, 107, 0.22);
}

body[data-theme="theme-2"] .btn-primary:hover {
    background: linear-gradient(135deg, #f45f78 0%, #ff7d66 100%);
    border-color: #f45f78;
}

body[data-theme="theme-2"] .hero-card::after {
    background: rgba(255, 107, 107, 0.08);
}

body[data-theme="theme-2"] .invite-hero-card,
body[data-theme="theme-2"] .invite-banner {
    background: linear-gradient(180deg, #fff9f3 0%, #ffece3 100%);
    border-color: #ffd4c7;
}

body[data-theme="theme-2"] .avatar-more-trigger {
    background: linear-gradient(135deg, #ffe2a8 0%, #ffd06b 100%);
    color: #8d4d00;
}

.navbar-dark .navbar-nav .nav-link,
.navbar-dark .navbar-brand,
.navbar-dark .navbar-toggler {
    color: var(--text);
}

.navbar-dark .navbar-nav .nav-link.active,
.navbar-dark .navbar-nav .nav-link:hover {
    color: var(--primary);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
}

.brand-logo {
    display: block;
    width: 7rem;
    line-height: 0;
}

.brand-logo img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    padding: 0;
}

.brand-mark small,
.text-secondary,
.muted-note,
.player-row span,
.leaderboard-row span,
.word-row span,
.admin-row span {
    color: var(--muted) !important;
}

.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
}

.hero-wrap {
    padding-top: 1.5rem;
}

.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.auth-screen-grid {
    min-height: calc(100vh - 6rem);
}

.auth-logo-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
}

.auth-screen-logo {
    width: min(100%, 360px);
    height: auto;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 22px 40px rgba(47, 111, 237, 0.12));
}

.hero-card {
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: "";
    position: absolute;
    right: -90px;
    top: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: rgba(47, 111, 237, 0.07);
}

.invite-hero-card,
.invite-banner {
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: linear-gradient(180deg, #f6f9ff 0%, #eef4ff 100%);
    border: 1px solid #d8e5ff;
}

.invite-banner {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.desktop-invite-cta {
    align-self: flex-start;
}

.desktop-link-btn {
    min-width: 46px;
}

.invite-modal-content .modal-body {
    padding-top: 1rem;
}

.invite-modal-toolbar {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 1rem;
}

.invite-online-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(136, 159, 194, 0.22);
    background: rgba(245, 248, 255, 0.92);
    white-space: nowrap;
}

.invite-user-list {
    display: grid;
    gap: 0.85rem;
}

.invite-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.05rem;
    border-radius: 18px;
    border: 1px solid rgba(136, 159, 194, 0.2);
    background: rgba(252, 253, 255, 0.96);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    cursor: pointer;
}

.invite-user-row:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(54, 77, 114, 0.08);
    border-color: rgba(74, 112, 224, 0.22);
}

.invite-user-row.is-selected {
    border-color: rgba(47, 111, 237, 0.34);
    box-shadow: 0 16px 30px rgba(47, 111, 237, 0.12);
}

.invite-user-row.is-disabled {
    opacity: 0.68;
    cursor: not-allowed;
}

.invite-user-main {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.invite-user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.invite-user-text strong,
.invite-user-text span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invite-user-text span {
    color: var(--muted);
    font-size: 0.92rem;
}

.invite-user-side {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.invite-status-pill {
    text-transform: none;
}

.invite-status-online,
.invite-status-lobby {
    color: #1f7a5a;
    background: rgba(52, 199, 116, 0.14);
}

.invite-status-in_game {
    color: #7b51e0;
    background: rgba(123, 81, 224, 0.14);
}

.invite-status-offline {
    color: #7a869e;
    background: rgba(122, 134, 158, 0.16);
}

.invite-room-badge {
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(47, 111, 237, 0.08);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
}

.invite-empty-state,
.invite-footer-note {
    color: var(--muted);
}

@media (max-width: 767.98px) {
    .invite-modal-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .invite-user-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .invite-user-side {
        width: 100%;
        justify-content: flex-start;
    }
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.9rem;
    color: var(--primary);
    font-size: 0.76rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 700;
}

.mini-stat,
.metric-pill,
.task-card,
.list-card,
.notification-tile,
.stat-box,
.achievement-card,
.admin-row,
.timeline-item,
.word-row {
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.mini-stat {
    min-width: 165px;
    border-radius: 18px;
    padding: 0.95rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.mini-stat strong {
    font-size: 0.98rem;
}

.auth-stack,
.panel-stretch,
.room-card,
.profile-card {
    border-radius: var(--radius);
}

.auth-tabs .nav-link {
    border-radius: 999px;
    color: var(--muted);
    border: 1px solid transparent;
    background: transparent;
}

.auth-tabs .nav-link.active {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #d9e7ff;
}

.stack-form {
    display: grid;
    gap: 1rem;
}

.premium-input {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: var(--text);
    padding: 0.85rem 1rem;
}

.premium-input:focus {
    background: #fff;
    border-color: #a8c2ff;
    box-shadow: 0 0 0 0.25rem rgba(47, 111, 237, 0.12);
    color: var(--text);
}

.premium-input::placeholder {
    color: #8a9bb1;
}

.btn {
    border-radius: 999px;
    font-weight: 700;
    padding-top: 0.72rem;
    padding-bottom: 0.72rem;
}

.btn-primary {
    border: 1px solid #2f6fed;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 24px rgba(47, 111, 237, 0.16);
}

.btn-primary:hover {
    background: #245fd3;
    border-color: #245fd3;
}

.btn-soft {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}

.btn-outline-light {
    color: var(--text);
    border-color: var(--line-strong);
    background: #fff;
}

.btn-outline-light:hover {
    background: var(--surface-soft);
    color: var(--text);
    border-color: var(--line-strong);
}

.info-card {
    height: 100%;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.create-room-panel {
    border-radius: 30px;
}

.create-room-head {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    align-items: flex-start;
}

.create-room-title {
    margin: 0;
    font-size: clamp(2rem, 3.4vw, 2.8rem);
    line-height: 1.02;
}

.create-room-subtitle {
    max-width: 680px;
    color: var(--muted);
    font-size: 1rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-weight: 700;
    box-shadow: var(--shadow-soft);
}

.back-link:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.form-section-card {
    padding: 1.4rem;
    border-radius: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.form-section-head {
    margin-bottom: 1.15rem;
}

.form-section-head h2 {
    margin: 0 0 0.25rem;
    font-size: 1.12rem;
    font-weight: 800;
}

.form-section-head p {
    margin: 0;
    color: var(--muted);
}

.form-label-strong {
    font-weight: 800;
    color: #10263c;
    margin-bottom: 0.55rem;
}

.info-card i {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-title h1,
.panel-title h2 {
    margin: 0;
    font-size: 1.06rem;
}

.task-card,
.list-card,
.notification-tile,
.timeline-item,
.admin-row,
.word-row {
    border-radius: 18px;
    padding: 1rem;
    margin-bottom: 0.9rem;
}

.task-card,
.notification-tile,
.admin-row,
.leaderboard-row,
.word-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.list-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-tile i {
    color: var(--primary);
    font-size: 1.05rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    font-weight: 700;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
}

.status-playing {
    color: var(--success);
    background: var(--success-soft);
    border-color: #d4eee5;
}

.status-waiting {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: #f2dfb8;
}

.status-finished {
    color: var(--muted);
}

.lobby-hero {
    border-radius: 30px;
    overflow: hidden;
}

.hero-quick-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

.lobby-hero-actions {
    display: grid;
    gap: 0.9rem;
}

.dual-game-hero-grid {
    align-items: stretch;
}

.triple-game-hero-grid {
    align-items: stretch;
}

.dual-game-hero-card {
    height: 100%;
    padding: 1.4rem;
    border-radius: 28px;
    border: 1px solid rgba(212, 221, 233, 0.92);
    background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(248,250,255,0.96));
    box-shadow: 0 24px 46px rgba(23, 50, 77, 0.08);
    display: grid;
    gap: 1.2rem;
}

.dual-game-hero-rozdraw {
    background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(244, 248, 255, 0.96) 100%);
    border-color: rgba(193, 214, 247, 0.95);
}

.dual-game-hero-rozlie {
    background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(246, 251, 248, 0.96) 100%);
    border-color: rgba(190, 229, 206, 0.95);
}

.dual-game-hero-rozvamp {
    background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(255, 246, 248, 0.96) 100%);
    border-color: rgba(244, 204, 214, 0.95);
}

.dual-game-hero-head {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dual-game-hero-head h3 {
    margin: 0 0 0.2rem;
    font-size: 1.28rem;
}

.dual-game-hero-head p {
    margin: 0;
    color: var(--muted);
}

.dual-game-hero-logo {
    width: 6.25rem;
    height: 6.25rem;
    object-fit: contain;
    display: block;
}

.lobby-hero-logo-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
}

.lobby-hero-logo {
    width: min(100%, 260px);
    height: auto;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 16px 30px rgba(47, 111, 237, 0.12));
}

.join-code-box {
    padding: 1rem;
    border-radius: 20px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.lobby-join-box {
    max-width: 560px;
    margin: 0 auto;
}

.join-code-inline {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
}

.room-card-premium {
    position: relative;
    overflow: hidden;
}

.game-selector-grid {
    align-items: stretch;
}

.game-card-premium {
    height: 100%;
    border-radius: 28px;
    border: 1px solid rgba(212, 221, 233, 0.92);
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,255,0.95));
    box-shadow: 0 24px 46px rgba(23, 50, 77, 0.08);
    padding: 1.35rem;
    display: grid;
    gap: 1rem;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.game-card-premium:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 28px 58px rgba(23, 50, 77, 0.12);
}

.game-card-premium h3 {
    margin: 0;
    font-size: 1.18rem;
}

.game-card-premium p {
    margin: 0;
    color: var(--muted);
    max-width: 42ch;
}

.game-card-icon {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: #f4f7ff;
    border: 1px solid rgba(206, 219, 243, 0.9);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
}

.game-card-icon img {
    max-width: 3.3rem;
    max-height: 3.3rem;
}

.game-card-icon-alt {
    background: linear-gradient(135deg, #eef4ff 0%, #f8f3ff 100%);
    color: #2f6fed;
    font-size: 1.6rem;
}

.room-card-premium::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #2f6fed, #89aefc);
}

.room-card-game-rozdraw {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(244, 248, 255, 0.96) 100%);
    border-color: rgba(193, 214, 247, 0.95);
    box-shadow: 0 24px 46px rgba(47, 111, 237, 0.09);
}

.room-card-game-rozdraw::before {
    background: linear-gradient(90deg, #5d8dff, #b8cdfd);
}

.room-card-game-rozlie {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246, 251, 248, 0.96) 100%);
    border-color: rgba(190, 229, 206, 0.95);
    box-shadow: 0 24px 46px rgba(72, 161, 111, 0.08);
}

.room-card-game-rozlie::before {
    background: linear-gradient(90deg, #55b887, #b8ead1);
}

.room-card-game-rozvamp {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255, 246, 248, 0.96) 100%);
    border-color: rgba(244, 204, 214, 0.95);
    box-shadow: 0 24px 46px rgba(203, 92, 122, 0.1);
}

.room-card-game-rozvamp::before {
    background: linear-gradient(90deg, #d96a88, #f4c0cf);
}

.room-card-top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.room-game-brand {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.85rem;
}

.room-game-logo {
    width: 6.25rem;
    height: 6.25rem;
    object-fit: contain;
    display: block;
}

.room-seat-badge {
    min-width: 82px;
    padding: 0.75rem 0.9rem;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--line);
    text-align: center;
}

.room-seat-badge strong {
    display: block;
    font-size: 1rem;
}

.room-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1rem;
}

.room-pill-row span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.88rem;
}

.room-card-note {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: linear-gradient(180deg, #f9fbff 0%, #f3f7fd 100%);
    border: 1px solid #e1eaf7;
}

.lobby-activity-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.activity-card {
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.activity-card strong {
    display: block;
    margin-bottom: 0.4rem;
}

.activity-card span {
    color: var(--muted);
    font-size: 0.93rem;
}

.room-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.choice-chip input {
    display: none;
}

.choice-chip span,
.switch-tile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
}

.choice-chip input:checked + span {
    border-color: #a8c2ff;
    background: var(--primary-soft);
}

.switch-tile input {
    accent-color: var(--primary);
}

.avatar-choice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.avatar-choice img,
.avatar-quick-btn img,
.avatar-selected-preview img,
.avatar-modal-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 16px;
    background: #fff;
}

.avatar-quick-btn,
.avatar-more-trigger,
.avatar-modal-item {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    transition: 0.18s ease;
    overflow: hidden;
}

.avatar-quick-btn,
.avatar-more-trigger {
    width: 72px;
    height: 72px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.avatar-quick-btn.active,
.avatar-modal-item.active {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(47, 111, 237, 0.18);
}

.avatar-more-trigger {
    color: var(--primary);
    font-size: 1.15rem;
    background: var(--primary-soft);
}

.avatar-selected-preview {
    margin-top: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
    padding: 0.75rem 0.9rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    overflow: hidden;
}

.avatar-selected-preview span {
    color: var(--muted);
    font-weight: 600;
}

.avatar-modal-content {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.avatar-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 0.85rem;
}

.avatar-modal-item {
    width: 100%;
    min-height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem;
}

.avatar-modal-img {
    opacity: 0;
    transition: opacity 0.18s ease;
}

.avatar-modal-img[data-loaded="1"] {
    opacity: 1;
}

.admin-room-row {
    align-items: center;
}

.theme-switcher-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.theme-option-card {
    position: relative;
    display: grid;
    gap: 0.9rem;
    padding: 1.1rem;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, var(--surface-soft) 100%);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    transition: 0.18s ease;
}

.theme-option-card:hover,
.theme-option-card.active {
    border-color: #a8c2ff;
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(47, 111, 237, 0.12);
}

.theme-option-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-option-top {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.theme-option-top strong {
    font-size: 1rem;
}

.theme-option-top small {
    color: var(--muted);
    font-size: 0.88rem;
}

.theme-option-preview {
    display: flex;
    gap: 0.55rem;
}

.theme-swatch {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow-soft);
}

.theme-option-note {
    color: var(--muted);
    line-height: 1.55;
}

.theme-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}

body[data-theme="theme-2"] .theme-option-card:hover,
body[data-theme="theme-2"] .theme-option-card.active {
    border-color: #ffb9a3;
    box-shadow: 0 16px 30px rgba(255, 107, 107, 0.14);
}

.room-topbar {
    border-radius: 24px;
}

.room-topline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.mobile-room-tabs {
    display: flex;
    gap: 0.75rem;
}

.mobile-tab {
    flex: 1 1 0;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    padding: 0.8rem 1rem;
    font-weight: 700;
}

.mobile-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.topbar-main {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.topbar-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.metric-pill {
    padding: 0.7rem 1rem;
    border-radius: 999px;
    color: var(--text);
}

.panel-stretch {
    height: 100%;
}

.room-side-card {
    background: rgba(255, 255, 255, 0.94);
}

.game-finish-panel {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.game-finish-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 27, 43, 0.55);
    backdrop-filter: blur(8px);
}

.game-finish-dialog {
    position: relative;
    width: min(100%, 760px);
    max-height: min(88vh, 920px);
    overflow: auto;
    border-radius: 30px;
    border: 1px solid rgba(217, 226, 239, 0.95);
    box-shadow: 0 28px 80px rgba(16, 38, 60, 0.24);
}

.finish-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -18px;
    width: 10px;
    height: 18px;
    border-radius: 999px;
    opacity: 0.9;
    animation: confetti-fall 4.8s linear infinite;
}

.confetti-piece:nth-child(3n) {
    width: 8px;
    height: 14px;
}

.confetti-piece:nth-child(4n) {
    border-radius: 4px;
}

.confetti-piece-1 { left: 6%; background: #f0b429; animation-delay: 0s; }
.confetti-piece-2 { left: 14%; background: #2f6fed; animation-delay: 0.4s; }
.confetti-piece-3 { left: 22%; background: #d95c4f; animation-delay: 1.1s; }
.confetti-piece-4 { left: 30%; background: #2d9d78; animation-delay: 0.9s; }
.confetti-piece-5 { left: 38%; background: #7c5cff; animation-delay: 1.8s; }
.confetti-piece-6 { left: 46%; background: #f0b429; animation-delay: 0.7s; }
.confetti-piece-7 { left: 54%; background: #2f6fed; animation-delay: 1.5s; }
.confetti-piece-8 { left: 62%; background: #d95c4f; animation-delay: 0.2s; }
.confetti-piece-9 { left: 70%; background: #2d9d78; animation-delay: 1.3s; }
.confetti-piece-10 { left: 78%; background: #7c5cff; animation-delay: 0.6s; }
.confetti-piece-11 { left: 86%; background: #f0b429; animation-delay: 1.9s; }
.confetti-piece-12 { left: 93%; background: #2f6fed; animation-delay: 0.1s; }

@keyframes confetti-fall {
    0% {
        transform: translate3d(0, -4%, 0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.95;
    }
    100% {
        transform: translate3d(28px, 115vh, 0) rotate(520deg);
        opacity: 0;
    }
}

.finish-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.finish-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.finish-title {
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1;
}

.finish-subtitle {
    color: var(--muted);
    font-size: 1rem;
}

.finish-leaderboard {
    display: grid;
    gap: 0.9rem;
}

.finish-rank-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.finish-rank-row.is-winner {
    border-color: #f0d58c;
    background: linear-gradient(180deg, #fff9ea 0%, #fff3cf 100%);
    box-shadow: 0 16px 34px rgba(199, 138, 35, 0.16);
}

.finish-rank-row.rank-2 {
    border-color: #d7dde7;
    background: linear-gradient(180deg, #fbfcfe 0%, #eef2f7 100%);
}

.finish-rank-row.rank-3 {
    border-color: #e6c6ac;
    background: linear-gradient(180deg, #fff8f3 0%, #f8e6da 100%);
}

.finish-rank-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.finish-rank-index {
    min-width: 58px;
    color: var(--muted);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.finish-rank-row.is-winner .finish-rank-index {
    color: #9b6b00;
}

.finish-rank-row.rank-2 .finish-rank-index {
    color: #617186;
}

.finish-rank-row.rank-3 .finish-rank-index {
    color: #99684b;
}

.finish-rank-index .fa-crown {
    color: #d4a021;
}

.finish-rank-score {
    font-weight: 800;
    font-size: 1.02rem;
}

.player-list {
    display: grid;
    gap: 0.8rem;
    max-height: 56vh;
    overflow: auto;
}

.player-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    border-radius: 18px;
    padding: 0.85rem 0.9rem;
    background: var(--surface-soft);
    border: 1px solid transparent;
}

.player-row.is-host {
    border-color: #cfe0ff;
    background: #f5f9ff;
}

.player-row.is-offline {
    opacity: 0.6;
}

.player-id {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.avatar-pill,
.avatar-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
}

.avatar-pill {
    width: 2.5rem;
    height: 2.5rem;
}

.profile-avatar-trigger {
    position: relative;
    display: inline-flex;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.profile-avatar-trigger:hover .profile-avatar-display,
.profile-avatar-trigger:focus-visible .profile-avatar-display {
    border-color: #a8c2ff;
    box-shadow: 0 16px 34px rgba(47, 111, 237, 0.18);
    transform: translateY(-2px);
}

.profile-avatar-display {
    transition: 0.18s ease;
}

.profile-avatar-edit-badge {
    position: absolute;
    right: 0.1rem;
    bottom: 0.1rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    border: 3px solid #fff;
    box-shadow: var(--shadow-soft);
    font-size: 0.82rem;
}

.avatar-display {
    width: 6.4rem;
    height: 6.4rem;
}

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

.canvas-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.tool-btn,
.color-dot {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
}

.tool-btn.active,
.color-dot.active {
    border-color: #9ebeff;
    background: var(--primary-soft);
}

.color-dot {
    background: var(--swatch);
}

.size-slider {
    width: 120px;
}

.color-picker-wrap {
    width: 2.9rem;
    height: 2.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    position: relative;
}

.color-picker-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)),
        var(--palette-preview, linear-gradient(135deg, #7c5cff 0%, #2f6fed 100%));
    opacity: 0.92;
}

.color-picker-wrap i {
    pointer-events: none;
    position: absolute;
    font-size: 1rem;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

.color-picker-input {
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    opacity: 0;
    cursor: pointer;
}

.color-palette-modal .modal-dialog {
    max-width: 380px;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.7rem;
}

.palette-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 14px;
    border: 1px solid rgba(133, 151, 180, 0.22);
    background: var(--swatch);
    box-shadow: var(--shadow-soft);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.palette-swatch:hover,
.palette-swatch.active {
    transform: translateY(-1px);
    border-color: rgba(47, 111, 237, 0.34);
    box-shadow: 0 14px 24px rgba(47, 111, 237, 0.14);
}

.palette-custom-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.palette-color-input {
    width: 68px;
    height: 52px;
    border-radius: 14px;
    border: 1px solid var(--line);
    padding: 0.2rem;
    background: #fff;
    opacity: 1;
}

.palette-color-code {
    display: inline-flex;
    align-items: center;
    min-height: 52px;
    padding: 0.8rem 0.95rem;
    border-radius: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.03em;
}

.word-pick-panel {
    border-radius: 20px;
    border: 1px solid #cfe0ff;
    background: linear-gradient(180deg, #f7faff 0%, #eef4ff 100%);
    box-shadow: 0 16px 30px rgba(47, 111, 237, 0.08);
    padding: 1.2rem 1.25rem;
    margin-bottom: 1rem;
}

.word-pick-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.word-pick-kicker {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #d7e4ff;
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.word-pick-title {
    margin: 0.85rem 0 0.35rem;
    font-size: 1.35rem;
}

.word-pick-text {
    max-width: 620px;
    color: var(--muted);
}

.word-pick-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    background: rgba(47, 111, 237, 0.1);
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}

.word-pick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.word-choice-btn {
    min-width: 170px;
}

.word-choice-btn:disabled {
    opacity: 0.72;
    cursor: progress;
}

.canvas-stage {
    border-radius: 28px;
}

.canvas-stage-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.canvas-stage-tools {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.canvas-spectator-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.78rem 0.95rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.84rem;
    white-space: nowrap;
    box-shadow: var(--shadow-soft);
}

.canvas-stage-note {
    max-width: 240px;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: var(--primary-soft);
    border: 1px solid #d9e7ff;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.92rem;
}

.room-options-menu {
    min-width: 250px;
    padding: 0.55rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.room-options-menu .dropdown-item,
.room-options-menu .dropdown-item-text,
.room-options-menu .dropdown-header {
    border-radius: 12px;
}

.room-options-menu .dropdown-item {
    padding: 0.72rem 0.9rem;
}

.room-options-menu .dropdown-item:active {
    background: var(--primary-soft);
    color: var(--primary);
}

.canvas-stage-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.canvas-shell {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 24px;
    overflow: hidden;
    min-height: 520px;
}

#draw-canvas {
    width: 100%;
    height: min(74vh, 720px);
    touch-action: none;
    display: block;
    background:
        linear-gradient(rgba(223, 231, 241, 0.8) 1px, transparent 1px),
        linear-gradient(90deg, rgba(223, 231, 241, 0.8) 1px, transparent 1px),
        #ffffff;
    background-size: 24px 24px, 24px 24px, cover;
}

.canvas-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 1rem;
}

.overlay-chip {
    padding: 0.6rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.overlay-chip-primary {
    background: rgba(47, 111, 237, 0.92);
    border-color: rgba(47, 111, 237, 0.92);
    color: #fff;
}

.chat-feed {
    min-height: 300px;
    max-height: 48vh;
    overflow: auto;
    display: grid;
    gap: 0.7rem;
}

.chat-entry {
    border-radius: 18px;
    padding: 0.8rem 0.9rem;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.chat-entry strong {
    display: block;
    margin-bottom: 0.2rem;
}

.chat-entry.type-system {
    border-color: #d4eee5;
    background: var(--success-soft);
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.8rem;
    margin-top: 1rem;
}

body[data-page="room"] {
    font-size: 0.94rem;
}

body[data-page="room"] .room-page {
    font-size: 0.95em;
}

body[data-page="room"] .room-side-card,
body[data-page="room"] .canvas-stage {
    padding: 0.9rem !important;
}

body[data-page="room"] .panel-title h2,
body[data-page="room"] .canvas-stage .h4,
body[data-page="room"] .guessers-panel .panel-title h2 {
    font-size: 1rem;
}

body[data-page="room"] .panel-title span,
body[data-page="room"] #guess-status-label,
body[data-page="room"] .player-id span,
body[data-page="room"] .player-score span,
body[data-page="room"] .chat-entry span {
    font-size: 0.8rem;
}

body[data-page="room"] .metric-pill {
    padding: 0.56rem 0.82rem;
    font-size: 0.84rem;
}

body[data-page="room"] .player-list {
    gap: 0.55rem;
    max-height: 50vh;
}

body[data-page="room"] .player-row {
    padding: 0.68rem 0.78rem;
    border-radius: 15px;
}

body[data-page="room"] .avatar-pill {
    width: 2.15rem;
    height: 2.15rem;
}

body[data-page="room"] .player-id strong,
body[data-page="room"] .chat-entry strong,
body[data-page="room"] .finish-rank-left strong {
    font-size: 0.9rem;
}

body[data-page="room"] .canvas-stage-header {
    margin-bottom: 0.75rem;
}

body[data-page="room"] .canvas-stage-note,
body[data-page="room"] .word-pick-text {
    font-size: 0.84rem;
}

body[data-page="room"] .canvas-stage-meta {
    gap: 0.5rem;
    margin-bottom: 0.7rem !important;
}

body[data-page="room"] .word-pick-panel {
    padding: 0.95rem 1rem;
    margin-bottom: 0.8rem;
}

body[data-page="room"] .word-pick-title {
    font-size: 1.08rem;
    margin-top: 0.55rem;
}

body[data-page="room"] .canvas-shell {
    min-height: 440px;
}

body[data-page="room"] #draw-canvas {
    height: min(62vh, 610px);
}

body[data-page="room"] .chat-feed {
    min-height: 360px;
    max-height: 52vh;
    gap: 0.55rem;
}

body[data-page="room"] .chat-entry {
    border-radius: 15px;
    padding: 0.68rem 0.78rem;
}

body[data-page="room"] .chat-form {
    gap: 0.65rem;
    margin-top: 0.75rem;
}

.global-compact-scope {
    font-size: 1rem;
}

@media (min-width: 992px) {
    body:not([data-page="room"]) {
        font-size: 0.94rem;
    }

    body:not([data-page="room"]) .app-shell {
        padding-top: 1rem;
    }

    body:not([data-page="room"]) .glass-panel {
        border-radius: 24px;
    }

    body:not([data-page="room"]) .glass-panel.p-5,
    body:not([data-page="room"]) .glass-panel.p-lg-5 {
        padding: 1.55rem !important;
    }

    body:not([data-page="room"]) .glass-panel.p-4,
    body:not([data-page="room"]) .glass-panel.p-lg-4 {
        padding: 1.15rem !important;
    }

    body:not([data-page="room"]) .glass-panel.p-3 {
        padding: 0.95rem !important;
    }

    body:not([data-page="room"]) .panel-title {
        margin-bottom: 0.85rem;
    }

    body:not([data-page="room"]) .panel-title h1,
    body:not([data-page="room"]) .panel-title h2,
    body:not([data-page="room"]) .panel-title h3 {
        font-size: 1rem;
    }

    body:not([data-page="room"]) .panel-title span,
    body:not([data-page="room"]) .eyebrow,
    body:not([data-page="room"]) .text-secondary,
    body:not([data-page="room"]) .create-room-subtitle,
    body:not([data-page="room"]) .word-pick-text,
    body:not([data-page="room"]) .leaderboard-user-copy span,
    body:not([data-page="room"]) .leaderboard-stat-card span {
        font-size: 0.84rem;
    }

    body:not([data-page="room"]) .premium-input,
    body:not([data-page="room"]) .form-select.premium-input {
        padding: 0.74rem 0.92rem;
        font-size: 0.94rem;
        border-radius: 14px;
    }

    body:not([data-page="room"]) .btn {
        padding-top: 0.62rem;
        padding-bottom: 0.62rem;
        font-size: 0.93rem;
    }

    body:not([data-page="room"]) .btn-lg {
        padding-top: 0.78rem;
        padding-bottom: 0.78rem;
    }

    body:not([data-page="room"]) .stat-box,
    body:not([data-page="room"]) .admin-row,
    body:not([data-page="room"]) .leaderboard-row,
    body:not([data-page="room"]) .task-card,
    body:not([data-page="room"]) .list-card,
    body:not([data-page="room"]) .notification-tile,
    body:not([data-page="room"]) .timeline-item {
        border-radius: 18px;
    }

    body:not([data-page="room"]) .lobby-hero,
    body:not([data-page="room"]) .hero-card,
    body:not([data-page="room"]) .create-room-panel,
    body:not([data-page="room"]) .leaderboard-shell {
        padding: 1.35rem !important;
    }

    body:not([data-page="room"]) .lobby-hero-logo {
        max-width: 170px;
    }

    body:not([data-page="room"]) .create-room-title,
    body:not([data-page="room"]) .landing-logo-block h1,
    body:not([data-page="room"]) .leaderboard-head h1 {
        font-size: clamp(1.6rem, 2vw, 2.1rem);
    }

    body:not([data-page="room"]) .stats-grid,
    body:not([data-page="room"]) .leaderboard-stats,
    body:not([data-page="room"]) .choice-grid,
    body:not([data-page="room"]) .invite-modal-toolbar {
        gap: 0.75rem;
    }

    body:not([data-page="room"]) .form-section-card {
        padding: 1rem;
        border-radius: 20px;
    }

    body:not([data-page="room"]) .form-section-head {
        margin-bottom: 0.9rem;
    }
}

@media (min-width: 1400px) {
    body:not([data-page="room"]) {
        font-size: 0.92rem;
    }

    body:not([data-page="room"]) .glass-panel.p-4,
    body:not([data-page="room"]) .glass-panel.p-lg-4 {
        padding: 1.05rem !important;
    }

    body:not([data-page="room"]) .glass-panel.p-5,
    body:not([data-page="room"]) .glass-panel.p-lg-5 {
        padding: 1.45rem !important;
    }
}

.correct-list {
    display: grid;
    gap: 0.7rem;
}

.correct-pill {
    padding: 0.65rem 0.9rem;
    border-radius: 999px;
    background: var(--success-soft);
    border: 1px solid #d4eee5;
    color: var(--success);
    font-weight: 700;
}

.profile-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.profile-grid > div,
.stat-box {
    border-radius: 20px;
    padding: 1rem;
}

.profile-grid strong,
.stat-box strong {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.achievement-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-radius: 20px;
    padding: 1rem;
    height: 100%;
}

.achievement-card i {
    font-size: 1.3rem;
    color: var(--primary);
}

.leaderboard-table {
    display: grid;
    gap: 1rem;
}

.leaderboard-shell {
    position: relative;
    overflow: hidden;
}

.leaderboard-head {
    position: relative;
    z-index: 1;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 88px minmax(220px, 1.4fr) minmax(0, 1.8fr);
    gap: 1.15rem;
    align-items: center;
    border-radius: 28px;
    padding: 1.15rem 1.2rem;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    transition: 0.18s ease;
}

.leaderboard-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(28, 58, 92, 0.1);
}

.leaderboard-row.is-gold {
    border-color: #f0d58c;
    background: linear-gradient(180deg, #fff9ea 0%, #fff1c8 100%);
    box-shadow: 0 18px 36px rgba(199, 138, 35, 0.16);
}

.leaderboard-row.is-silver {
    border-color: #d7dde7;
    background: linear-gradient(180deg, #fbfcfe 0%, #eef2f7 100%);
}

.leaderboard-row.is-bronze {
    border-color: #e6c6ac;
    background: linear-gradient(180deg, #fff8f3 0%, #f6e5da 100%);
}

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

.leaderboard-rank-badge {
    min-width: 58px;
    height: 58px;
    padding: 0 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: var(--muted);
    font-weight: 800;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
}

.leaderboard-rank-badge.is-crown {
    min-width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffe9a7 0%, #ffd364 100%);
    border-color: #f0c253;
    color: #9b6b00;
    box-shadow: 0 12px 26px rgba(212, 160, 33, 0.24);
    font-size: 1.2rem;
}

.leaderboard-user {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.leaderboard-user-copy {
    display: grid;
    gap: 0.18rem;
}

.leaderboard-user-copy strong {
    font-size: 1.06rem;
}

.leaderboard-user-copy span {
    color: var(--muted);
}

.leaderboard-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.leaderboard-stat-card {
    min-height: 84px;
    display: grid;
    align-content: center;
    gap: 0.28rem;
    padding: 0.95rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.leaderboard-stat-card strong {
    display: block;
    font-size: 1.28rem;
    line-height: 1;
    letter-spacing: -0.03em;
}

.leaderboard-stat-card span {
    display: block;
    color: var(--muted);
    font-size: 0.92rem;
}

body[data-theme="theme-2"] .leaderboard-row {
    background: linear-gradient(180deg, #ffffff 0%, #fff8f3 100%);
}

body[data-theme="theme-2"] .leaderboard-row.is-gold {
    background: linear-gradient(180deg, #fff7d8 0%, #ffe9a8 100%);
}

body[data-theme="theme-2"] .leaderboard-row.is-silver {
    background: linear-gradient(180deg, #fffefe 0%, #f6edf1 100%);
}

body[data-theme="theme-2"] .leaderboard-row.is-bronze {
    background: linear-gradient(180deg, #fff7f1 0%, #ffe3d2 100%);
}

body[data-theme="theme-2"] .leaderboard-rank-badge.is-crown {
    background: linear-gradient(180deg, #ffe59f 0%, #ffbf69 100%);
    border-color: #ffbc57;
    color: #8b4f00;
}

body[data-theme="theme-2"] .leaderboard-stat-card {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(255, 214, 199, 0.8);
}

.word-table {
    display: grid;
    gap: 0.8rem;
}

@media (max-width: 991.98px) {
    .lobby-activity-grid {
        grid-template-columns: 1fr;
    }

    .room-grid > div {
        min-height: auto;
    }

    #draw-canvas {
        height: 56vh;
    }

    .word-pick-head,
    .canvas-stage-header {
        flex-direction: column;
    }

    .canvas-stage-tools {
        width: 100%;
        justify-content: space-between;
    }

    .finish-actions {
        width: 100%;
        justify-content: stretch;
    }

    .finish-actions .btn {
        flex: 1 1 0;
    }

    .canvas-stage-note {
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 1699.98px) and (min-width: 1200px) {
    body[data-page="room"] .glass-nav,
    body[data-page="room"] .room-topbar {
        display: none !important;
    }

    body[data-page="room"] .app-shell {
        padding-top: 1rem;
    }

    body[data-page="room"] .room-grid {
        --bs-gutter-x: 0.9rem;
        --bs-gutter-y: 0.9rem;
    }

    body[data-page="room"] .room-grid > [data-room-pane="players"] {
        width: 17% !important;
    }

    body[data-page="room"] .room-grid > [data-room-pane="canvas"] {
        width: 47% !important;
    }

    body[data-page="room"] .room-grid > [data-room-pane="chat"] {
        width: 36% !important;
    }

    body[data-page="room"] .room-side-card,
    body[data-page="room"] .canvas-stage {
        padding: 0.95rem !important;
    }

    body[data-page="room"] .panel-title h2,
    body[data-page="room"] .canvas-stage .h4 {
        font-size: 1.02rem;
    }

    body[data-page="room"] .player-list {
        gap: 0.6rem;
        max-height: 52vh;
    }

    body[data-page="room"] .player-row,
    body[data-page="room"] .chat-entry {
        padding: 0.7rem 0.78rem;
        border-radius: 16px;
    }

    body[data-page="room"] .player-id {
        gap: 0.62rem;
    }

    body[data-page="room"] .avatar-pill {
        width: 2.2rem;
        height: 2.2rem;
    }

    body[data-page="room"] .player-row strong,
    body[data-page="room"] .chat-entry strong {
        font-size: 0.94rem;
    }

    body[data-page="room"] .player-row span,
    body[data-page="room"] .chat-entry span {
        font-size: 0.84rem;
    }

    body[data-page="room"] .canvas-stage-meta {
        gap: 0.55rem;
    }

    body[data-page="room"] .metric-pill {
        padding: 0.58rem 0.82rem;
        font-size: 0.84rem;
    }

    body[data-page="room"] .canvas-shell {
        min-height: 440px;
    }

    body[data-page="room"] #draw-canvas {
        height: min(62vh, 610px);
    }

    body[data-page="room"] .chat-feed {
        min-height: 380px;
        max-height: 60vh;
        gap: 0.62rem;
    }
}

@media (max-width: 1399.98px) and (min-width: 1200px) {
    body[data-page="room"] .room-grid > [data-room-pane="players"] {
        width: 16% !important;
    }

    body[data-page="room"] .room-grid > [data-room-pane="canvas"] {
        width: 44% !important;
    }

    body[data-page="room"] .room-grid > [data-room-pane="chat"] {
        width: 40% !important;
    }

    body[data-page="room"] #draw-canvas {
        height: min(56vh, 540px);
    }

    body[data-page="room"] .chat-feed {
        min-height: 420px;
        max-height: 64vh;
    }

    body[data-page="room"] .canvas-toolbar {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 0.7rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.15rem 0.1rem 0.45rem;
        margin-inline: -0.1rem;
        scrollbar-width: thin;
        scroll-snap-type: x proximity;
    }

    body[data-page="room"] .canvas-toolbar::-webkit-scrollbar {
        height: 8px;
    }

    body[data-page="room"] .canvas-toolbar::-webkit-scrollbar-thumb {
        background: rgba(143, 162, 190, 0.42);
        border-radius: 999px;
    }

    body[data-page="room"] .toolbar-section {
        flex-wrap: nowrap;
        flex: 0 0 auto;
        padding-right: 0.15rem;
        scroll-snap-align: start;
    }

    body[data-page="room"] .tool-btn,
    body[data-page="room"] .color-dot,
    body[data-page="room"] .color-picker-wrap {
        width: 2.45rem;
        height: 2.45rem;
        border-radius: 12px;
        flex: 0 0 auto;
    }

    body[data-page="room"] .size-slider {
        width: 96px;
        flex: 0 0 96px;
    }
}

@media (max-width: 1199.98px) and (min-width: 768px) {
    body[data-page="room"] .canvas-toolbar {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 0.65rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.1rem 0 0.4rem;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }

    body[data-page="room"] .canvas-toolbar::-webkit-scrollbar {
        display: none;
    }

    body[data-page="room"] .toolbar-section {
        flex-wrap: nowrap;
        flex: 0 0 auto;
        gap: 0.45rem;
        scroll-snap-align: start;
    }

    body[data-page="room"] .tool-btn,
    body[data-page="room"] .color-dot,
    body[data-page="room"] .color-picker-wrap {
        width: 2.25rem;
        height: 2.25rem;
        border-radius: 11px;
        flex: 0 0 auto;
    }

    body[data-page="room"] .tool-btn i,
    body[data-page="room"] .color-picker-wrap i {
        font-size: 0.92rem;
    }

    body[data-page="room"] .size-slider {
        width: 88px;
        flex: 0 0 88px;
    }
}

@media (max-width: 767.98px) {
    body {
        font-size: 0.96rem;
    }

    .hero-wrap {
        padding-top: 1rem;
    }

    .auth-screen {
        min-height: auto;
        align-items: stretch;
    }

    .auth-screen-grid {
        min-height: auto;
    }

    .auth-logo-panel {
        min-height: 0;
        margin-bottom: 0.5rem;
    }

    .auth-screen-logo {
        width: min(100%, 220px);
    }

    .theme-switcher-grid {
        grid-template-columns: 1fr;
    }

    .theme-actions {
        justify-content: stretch;
    }

    .theme-actions .btn {
        width: 100%;
    }

    .avatar-choice-grid {
        gap: 0.5rem;
    }

    .avatar-quick-btn,
    .avatar-more-trigger {
        width: 56px;
        height: 56px;
        border-radius: 14px;
    }

    .avatar-quick-btn img,
    .avatar-selected-preview img,
    .avatar-modal-item img {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }

    .avatar-selected-preview {
        width: 100%;
        padding: 0.65rem 0.75rem;
        gap: 0.6rem;
        border-radius: 16px;
    }

    .avatar-selected-preview span {
        font-size: 0.92rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .avatar-modal-grid {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
        gap: 0.65rem;
    }

    .avatar-modal-item {
        min-height: 72px;
        padding: 0.55rem;
        border-radius: 14px;
    }

    .chat-form {
        grid-template-columns: 1fr;
    }

    .join-code-inline,
    .section-head,
    .canvas-stage-header {
        grid-template-columns: 1fr;
        display: grid;
    }

    .canvas-stage-tools {
        display: grid;
        grid-template-columns: 1fr;
    }

    .room-card-top {
        flex-direction: column;
    }

    .finish-panel-head {
        flex-direction: column;
    }

    .leaderboard-row {
        grid-template-columns: 1fr;
        align-items: flex-start;
        padding: 1rem;
    }

    .leaderboard-rank {
        justify-content: flex-start;
    }

    .leaderboard-stats {
        grid-template-columns: 1fr;
    }

    .topbar-main {
        align-items: flex-start;
    }

    .brand-logo {
        width: 5.4rem;
    }

    .profile-avatar-edit-badge {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.74rem;
    }

    .lobby-hero-logo {
        width: min(100%, 180px);
    }

    #draw-canvas {
        height: 48vh;
    }

    .canvas-toolbar {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 0.6rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.05rem 0 0.4rem;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }

    .canvas-toolbar::-webkit-scrollbar {
        display: none;
    }

    .toolbar-section {
        flex-wrap: nowrap;
        flex: 0 0 auto;
        gap: 0.42rem;
        scroll-snap-align: start;
    }

    .tool-btn,
    .color-dot,
    .color-picker-wrap {
        width: 2.15rem;
        height: 2.15rem;
        border-radius: 10px;
        flex: 0 0 auto;
    }

    .tool-btn i,
    .color-picker-wrap i {
        font-size: 0.86rem;
    }

    .size-slider {
        width: 82px;
        flex: 0 0 82px;
    }

    .room-pane {
        display: none;
    }

    .room-pane.mobile-pane-active {
        display: block;
    }
}
