/* ==========================================================================
   PARTY-HUB STYLESHEET
   Features:
   - Doodle / Skribbl.io Sketchbook Style (Default & Primary Theme)
   - Dark Mode Theme (User-switchable per client)
   ========================================================================== */

:root, [data-theme="doodle"] {
    --bg-page: #f4f6fa;
    --bg-grid: #e2e8f0;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #fafbff;
    
    --ink: #1e293b;
    --ink-light: #475569;
    --ink-border: 2.5px solid #1e293b;
    --shadow-doodle: 4px 4px 0px #1e293b;
    --shadow-doodle-hover: 7px 7px 0px #1e293b;
    --shadow-doodle-active: 1px 1px 0px #1e293b;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-text: #ffffff;
    
    --accent-green: #22c55e;
    --accent-yellow: #facc15;
    --accent-red: #ef4444;
    --accent-orange: #fb923c;
    --accent-purple: #a855f7;

    --font-heading: 'Patrick Hand', 'Comic Neue', cursive, sans-serif;
    --font-body: 'Comic Neue', 'Plus Jakarta Sans', system-ui, sans-serif;

    --radius-doodle: 16px 20px 18px 22px;
    --radius-pill: 999px;
}

[data-theme="dark"] {
    --bg-page: #0f1219;
    --bg-grid: #1e2538;
    --bg-surface: #181d28;
    --bg-surface-elevated: #212836;
    
    --ink: #f8fafc;
    --ink-light: #94a3b8;
    --ink-border: 2px solid rgba(255, 255, 255, 0.15);
    --shadow-doodle: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-doodle-hover: 0 14px 30px -5px rgba(0, 0, 0, 0.6);
    --shadow-doodle-active: 0 4px 10px rgba(0, 0, 0, 0.4);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-text: #ffffff;
    
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #f43f5e;
    --accent-orange: #f97316;
    --accent-purple: #c084fc;

    --font-heading: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;

    --radius-doodle: 16px;
    --radius-pill: 999px;
}

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

body {
    background-color: var(--bg-page);
    background-image: var(--body-bg-pattern, 
        linear-gradient(var(--bg-grid) 1.5px, transparent 1.5px),
        linear-gradient(90deg, var(--bg-grid) 1.5px, transparent 1.5px));
    background-size: var(--body-bg-size, 26px 26px);
    background-attachment: fixed;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.25s, color 0.25s;
}

/* ==========================================================================
   PARTY HEADER (SKRIBBL DOODLE STYLE)
   ========================================================================== */
.party-header {
    height: 76px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border-bottom: var(--ink-border);
    box-shadow: 0 4px 0px rgba(30, 41, 59, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.logo-doodle-img {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: var(--ink-border);
    box-shadow: 2px 2px 0px var(--ink);
    object-fit: cover;
    background: #fff;
    transform: rotate(-3deg);
    transition: transform 0.2s;
}

.logo:hover .logo-doodle-img {
    transform: rotate(6deg) scale(1.08);
}

.logo-text .highlight {
    color: var(--primary);
    background: none;
    -webkit-text-fill-color: initial;
}

.room-pill {
    display: inline-flex;
    align-items: center;
    background: var(--bg-surface);
    border: var(--ink-border);
    padding: 4px 6px 4px 12px;
    border-radius: var(--radius-pill);
    gap: 8px;
    box-shadow: var(--shadow-doodle);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.room-pill:hover {
    transform: translateY(-1px);
    box-shadow: 3px 3px 0px var(--ink);
}

.live-dot-badge {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
    display: inline-block;
    transition: background 0.3s, box-shadow 0.3s;
    flex-shrink: 0;
}

.live-dot-badge.disconnected {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
    animation: livePulse 1s infinite alternate;
}

@keyframes livePulse {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

.room-code-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: all;
    cursor: pointer;
}

.room-label {
    font-size: 0.8rem;
    font-family: var(--font-heading);
    color: var(--ink-light);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.room-code {
    font-weight: 900;
    letter-spacing: 0.16em;
    color: #0a0e17; /* High contrast dark text against bright yellow badge */
    background: var(--accent-yellow);
    padding: 3px 10px;
    border-radius: 7px;
    border: 1.5px solid rgba(0, 0, 0, 0.22);
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 1.1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
}

.room-code-tag:hover .room-code {
    transform: scale(1.04);
}

.room-pill-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon-btn {
    background: white;
    border: 1.5px solid #1e293b;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 4px 8px;
    border-radius: 8px;
    box-shadow: 1.5px 1.5px 0px #1e293b;
    transition: transform 0.1s, box-shadow 0.1s, background-color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 2.5px 2.5px 0px #1e293b;
}

.icon-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 0px 0px 0px #1e293b;
}

/* Theme Switcher Button */
.theme-toggle-btn {
    background: #ffffff;
    color: var(--ink);
    border: var(--ink-border);
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 2px 2px 0px var(--ink);
    transition: all 0.15s;
}

.theme-toggle-btn:hover {
    background: #f1f5f9;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--ink);
}

.theme-toggle-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 0px 0px 0px var(--ink);
}

.action-btn {
    background: var(--bg-surface);
    color: var(--ink);
    border: var(--ink-border);
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-doodle);
    transition: all 0.15s;
}

.action-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-doodle-hover);
}

.action-btn:active {
    transform: translate(2px, 2px);
    box-shadow: var(--shadow-doodle-active);
}

.action-btn.active {
    background: var(--accent-orange);
    color: white;
}

.action-btn-sm {
    background: var(--primary);
    color: white;
    border: var(--ink-border);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 2px 2px 0px var(--ink);
    transition: all 0.1s;
}

.action-btn-sm:active {
    transform: translate(1px, 1px);
    box-shadow: 0px 0px 0px var(--ink);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 14px 5px 6px;
    background: var(--bg-surface);
    border: var(--ink-border);
    border-radius: var(--radius-pill);
    box-shadow: 2px 2px 0px var(--ink);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.user-badge:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3.5px 3.5px 0px var(--ink);
}

.avatar-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.avatar-pick-item {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px solid var(--bg-grid);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    background: var(--bg-surface);
}

.avatar-pick-item:hover {
    transform: scale(1.15);
    border-color: var(--primary);
}

.avatar-pick-item.selected {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 2px 2px 0px var(--primary);
    transform: scale(1.12);
}

.avatar-small {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e0f2fe;
    border: 2px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.95rem;
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.1;
}

.user-role {
    font-size: 0.76rem;
    color: var(--ink-light);
}

.user-role.host {
    color: #b45309;
    font-weight: 700;
}

/* ==========================================================================
   MAIN LIVING ROOM
   ========================================================================== */
.living-room-container {
    max-width: 1220px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 24px 64px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background: var(--accent-yellow);
    color: #1e293b;
    border: 2px solid #1e293b;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font-heading);
    box-shadow: 1.5px 1.5px 0px #1e293b;
}

.couch-hint {
    font-size: 0.95rem;
    font-family: var(--font-heading);
    color: var(--ink-light);
}

/* ==========================================================================
   COUCH / PLAYERS ROSTER (NOTEBOOK STYLE)
   ========================================================================== */
.couch-section {
    background: var(--bg-surface);
    border: var(--ink-border);
    border-radius: var(--radius-doodle);
    padding: 20px 24px;
    box-shadow: var(--shadow-doodle);
    position: relative;
}

.player-roster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}

.player-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-surface-elevated);
    border: var(--ink-border);
    padding: 10px 14px;
    border-radius: 12px 16px 14px 18px;
    position: relative;
    box-shadow: 2px 2px 0px var(--ink);
    transition: transform 0.15s, box-shadow 0.15s;
    color: var(--ink);
    min-width: 0;
}

.player-card:hover {
    transform: translateY(-2px) rotate(0.5deg);
    box-shadow: 4px 4px 0px var(--ink);
}

.player-card.is-host {
    background: var(--bg-surface-elevated);
    border-color: var(--accent-yellow);
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.25), 2px 2px 0px var(--ink);
}

.player-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    position: relative;
    background: var(--bg-surface);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-green);
    position: absolute;
    bottom: -1px;
    right: -1px;
    border: 2px solid var(--ink);
}

.status-dot.afk {
    background: var(--accent-yellow);
}

.player-card-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.player-card-name {
    font-size: 1.05rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-card-tag {
    font-size: 0.8rem;
    font-family: var(--font-body);
    color: var(--ink-light);
    font-weight: 600;
}

.transfer-host-btn {
    margin-left: auto;
    background: #fef08a;
    color: #854d0e;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 1.5px 1.5px 0px var(--ink);
    transition: all 0.12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.transfer-host-btn:hover {
    transform: scale(1.1);
    background: #fde047;
    box-shadow: 2px 2px 0px var(--ink);
}

.transfer-host-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 0px 0px 0px var(--ink);
}

.mini-transfer-host-btn {
    margin-top: 3px;
    background: #fef08a;
    color: #854d0e;
    border: 1.5px solid var(--ink);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    font-size: 0.7rem;
    font-family: var(--font-heading);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 1px 1px 0px var(--ink);
    transition: all 0.12s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.mini-transfer-host-btn:hover {
    transform: scale(1.08);
    background: #fde047;
}

/* ==========================================================================
   VOTE BANNER
   ========================================================================== */
.vote-banner {
    background: #fef08a;
    border: var(--ink-border);
    border-radius: var(--radius-doodle);
    padding: 16px 22px;
    box-shadow: var(--shadow-doodle);
    color: #1e293b;
}

.vote-banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.vote-icon {
    font-size: 2.2rem;
}

.vote-text {
    flex-grow: 1;
}

.vote-text h3 {
    font-size: 1.25rem;
    font-family: var(--font-heading);
    font-weight: 700;
}

.vote-text p {
    font-size: 0.95rem;
    color: #475569;
}

/* ==========================================================================
   CATALOG & GAME CARDS (DOODLE SKETCHBOOK)
   ========================================================================== */
.filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-pill {
    background: var(--bg-surface);
    color: var(--ink-light);
    border: var(--ink-border);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 2px 0px var(--ink);
    transition: all 0.12s;
}

.filter-pill:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--ink);
    color: var(--ink);
}

.filter-pill.active {
    background: var(--accent-yellow);
    color: #1e293b;
    box-shadow: 3px 3px 0px #1e293b;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.game-card {
    background: var(--bg-surface);
    border: var(--ink-border);
    border-radius: var(--radius-doodle);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-doodle);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.game-card:hover {
    transform: translateY(-5px) rotate(-0.5deg);
    box-shadow: var(--shadow-doodle-hover);
}

.card-media {
    height: 180px;
    position: relative;
    overflow: hidden;
    border-bottom: var(--ink-border);
    background: #e2e8f0;
}

.card-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.game-card:hover .card-cover-img {
    transform: scale(1.05);
}

.random-bg {
    background: linear-gradient(135deg, #f472b6, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon-big {
    font-size: 4.5rem;
    filter: drop-shadow(3px 3px 0px rgba(0, 0, 0, 0.3));
    transition: transform 0.25s;
}

.game-card:hover .card-icon-big {
    transform: scale(1.15) rotate(5deg);
}

.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    border: 2px solid #1e293b;
    box-shadow: 2px 2px 0px #1e293b;
}

.card-badge.live {
    background: #86efac;
    color: #1e293b;
}

.card-badge.os {
    background: #e2e8f0;
    color: #1e293b;
}

.card-badge.new {
    background: #fde047;
    color: #1e293b;
}

.card-body {
    padding: 16px 18px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.card-title-row h3 {
    font-size: 1.35rem;
    font-family: var(--font-heading);
    font-weight: 700;
}

.game-time {
    font-size: 0.85rem;
    font-family: var(--font-heading);
    color: var(--ink-light);
    font-weight: 700;
}

.card-desc {
    font-size: 0.9rem;
    color: var(--ink-light);
    line-height: 1.4;
    margin-bottom: 14px;
    flex-grow: 1;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    background: var(--bg-surface-elevated);
    color: var(--ink);
    font-size: 0.78rem;
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 8px;
    border: 1.5px solid var(--ink);
    box-shadow: 1px 1px 0px var(--ink);
}

.tag.highlight-tag {
    background: #fef08a;
    color: #1e293b;
}

.card-actions {
    padding: 12px 18px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.play-btn {
    width: 100%;
    background: var(--accent-green);
    color: #1e293b;
    border: var(--ink-border);
    padding: 11px 18px;
    border-radius: 12px 16px 14px 16px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 3px 3px 0px var(--ink);
    transition: all 0.12s;
}

.play-btn:hover {
    background: #4ade80;
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px var(--ink);
}

.play-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0px var(--ink);
}

.roulette-btn {
    width: 100%;
    justify-content: center;
    background: var(--accent-orange);
    color: white;
    border: var(--ink-border);
    box-shadow: 3px 3px 0px var(--ink);
    font-size: 1.15rem;
}

.roulette-btn:hover {
    background: #f97316;
}

.vote-counter {
    background: #e0f2fe;
    border: var(--ink-border);
    border-radius: 8px;
    padding: 4px 8px;
    text-align: center;
    font-size: 0.95rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: #0369a1;
}

.vote-card-btn {
    width: 100%;
    background: white;
    color: var(--ink);
    border: var(--ink-border);
    padding: 8px 12px;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 2px 2px 0px var(--ink);
    transition: all 0.1s;
}

.vote-card-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 0px 0px 0px var(--ink);
}

.vote-card-btn.voted {
    background: var(--accent-green);
    color: #1e293b;
}

/* ==========================================================================
   ACTIVE GAME OVERLAY / IFRAME HUD
   ========================================================================== */
.active-game-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #f8fafc;
    z-index: 1000;
    flex-direction: column;
}

.active-game-overlay.active {
    display: flex;
}

.game-hud {
    height: 56px;
    background: var(--bg-surface);
    border-bottom: var(--ink-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    box-shadow: 0 3px 0px rgba(0, 0, 0, 0.05);
}

.hud-btn {
    background: var(--accent-yellow);
    color: #1e293b;
    border: var(--ink-border);
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 2px 2px 0px var(--ink);
    transition: all 0.1s;
}

.hud-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--ink);
}

.hud-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 0px 0px 0px var(--ink);
}

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

.hud-game-icon {
    font-size: 1.35rem;
}

.hud-game-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
}

.hud-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    border: 1.5px solid var(--ink);
}

.hud-status {
    font-size: 0.88rem;
    font-family: var(--font-heading);
    color: var(--ink-light);
}

.hud-room {
    font-size: 0.95rem;
    font-family: var(--font-heading);
    color: var(--ink-light);
}

.hud-room strong {
    color: var(--ink);
    background: var(--accent-yellow);
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid var(--ink);
}

.game-frame-container {
    flex-grow: 1;
    width: 100%;
    height: calc(100% - 56px);
    background: #ffffff;
}

.game-frame-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ==========================================================================
   MODAL / POPUP (DOODLE STYLE)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease-out;
}

.modal-card {
    background: var(--bg-surface);
    border: var(--ink-border);
    border-radius: var(--radius-doodle);
    width: 100%;
    max-width: 540px;
    padding: 28px;
    position: relative;
    box-shadow: 8px 8px 0px var(--ink);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.close-modal-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    background: var(--bg-surface-elevated);
    border: var(--ink-border);
    color: var(--ink);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 2px 2px 0px var(--ink);
    transition: all 0.1s;
}

.close-modal-btn:hover {
    background: var(--accent-red);
    color: white;
}

.close-modal-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 0px 0px 0px var(--ink);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.modal-game-icon {
    font-size: 2.8rem;
    background: var(--accent-yellow);
    width: 64px;
    height: 64px;
    border-radius: 14px 18px 16px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: var(--ink-border);
    box-shadow: 2px 2px 0px var(--ink);
}

.modal-header h2 {
    font-size: 1.7rem;
    font-family: var(--font-heading);
    font-weight: 700;
}

.modal-meta {
    font-size: 0.9rem;
    font-family: var(--font-heading);
    color: var(--ink-light);
}

.modal-desc {
    font-size: 0.95rem;
    color: var(--ink-light);
    line-height: 1.45;
}

.config-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-label {
    font-size: 0.9rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0.02em;
}

.mode-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mode-chip {
    background: var(--bg-surface-elevated);
    border: var(--ink-border);
    border-radius: 10px 14px 12px 14px;
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 3px;
    box-shadow: 2px 2px 0px var(--ink);
    transition: all 0.12s;
}

.mode-chip:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--ink);
}

.mode-chip.selected {
    background: #fef08a;
    border-color: #1e293b;
    box-shadow: 3px 3px 0px var(--ink);
}

.mode-chip strong {
    font-size: 1rem;
    font-family: var(--font-heading);
    color: var(--ink);
}

.mode-chip span {
    font-size: 0.78rem;
    color: var(--ink-light);
}

/* Ready Check in Modal */
.ready-check-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 6px 0;
}

.ready-banner {
    background: var(--bg-surface-elevated);
    border: var(--ink-border);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 2px 2px 0px var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--ink);
}

.ready-banner-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 180px;
}

.ready-bell {
    font-size: 1.8rem;
}

.ready-title {
    font-size: 1.05rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--ink);
}

.ready-subtext {
    font-size: 0.82rem;
    color: var(--ink-light);
    margin: 2px 0 0 0;
    line-height: 1.3;
}

.ready-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    border: var(--ink-border);
    cursor: pointer;
    box-shadow: 2px 2px 0px var(--ink);
    transition: all 0.15s ease;
}

.ready-toggle-btn.ready {
    background: #86efac;
    color: #14532d;
}

.ready-toggle-btn.not-ready {
    background: #fef08a;
    color: #854d0e;
}

.ready-toggle-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px var(--ink);
}

.party-readiness-box {
    background: var(--bg-surface-elevated);
    border: var(--ink-border);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--ink);
}

.readiness-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.92rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--ink);
}

.green-text {
    color: var(--accent-green, #16a34a);
    font-weight: 800;
}

.player-mini-avatars {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.mini-player-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mini-player-name {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ink);
    font-family: var(--font-heading);
}

.mini-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 2px solid var(--ink);
    background: var(--bg-surface);
    box-shadow: 1.5px 1.5px 0px var(--ink);
}

.mini-ready-check {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 15px;
    height: 15px;
    background: #22c55e;
    color: white;
    font-size: 0.65rem;
    font-weight: 900;
    border-radius: 50%;
    border: 1.5px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-avatar:not(.is-ready) .mini-ready-check {
    background: #cbd5e1;
    color: #475569;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 10px;
    border-top: var(--ink-border);
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    color: var(--ink);
    border: var(--ink-border);
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 2px 2px 0px var(--ink);
}

.btn-secondary:hover {
    background: var(--bg-surface);
}

.btn-primary-launch {
    background: var(--accent-green);
    color: #1e293b;
    border: var(--ink-border);
    padding: 10px 22px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 3px 3px 0px var(--ink);
    transition: all 0.12s;
}

.btn-primary-launch:hover {
    background: #4ade80;
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px var(--ink);
}

.btn-primary-launch:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0px var(--ink);
}

/* ==========================================================================
   COUNTDOWN OVERLAY
   ========================================================================== */
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    background: white;
    border: 3px solid #1e293b;
    border-radius: 24px;
    padding: 36px 48px;
    box-shadow: 8px 8px 0px #1e293b;
}

.countdown-icon {
    font-size: 4rem;
    animation: bounce 0.8s infinite alternate;
}

.countdown-number {
    font-size: 6.5rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: #dc2626;
    line-height: 1;
    text-shadow: 4px 4px 0px #1e293b;
    animation: pulse 1s infinite;
}

.countdown-card h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
}

.countdown-card p {
    color: var(--ink-light);
    font-family: var(--font-heading);
    font-size: 1.15rem;
}

/* ==========================================================================
   QR / SHARE CARD
   ========================================================================== */
.share-card {
    text-align: center;
    align-items: center;
}

.share-card h2 {
    font-family: var(--font-heading);
    font-size: 1.7rem;
}

.share-card p {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--ink-light);
}

.qr-placeholder {
    margin: 16px 0;
    padding: 16px;
    background: white;
    border: var(--ink-border);
    border-radius: 16px;
    display: inline-block;
    box-shadow: 4px 4px 0px var(--ink);
}

.qr-box {
    width: 160px;
    height: 160px;
    background: #1e293b;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    gap: 8px;
}

.qr-text {
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.1em;
    color: var(--accent-yellow);
}

.share-code-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 10px 0 14px;
    font-family: var(--font-heading);
}

.share-code-label {
    color: var(--ink-light);
    font-size: 1rem;
    font-weight: 700;
}

.share-code-value {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 1.35rem;
    letter-spacing: 0.14em;
    color: var(--primary);
    background: var(--bg-surface);
    padding: 3px 10px;
    border-radius: 8px;
    border: var(--ink-border);
    box-shadow: 2px 2px 0px var(--ink);
}

.share-url-box {
    display: flex;
    width: 100%;
    gap: 8px;
}

.share-url-box input {
    flex-grow: 1;
    background: var(--bg-surface);
    border: var(--ink-border);
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--ink);
    font-family: monospace;
    font-size: 0.95rem;
    box-shadow: 2px 2px 0px var(--ink);
}

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-yellow);
    color: #1e293b;
    border: 2px solid #1e293b;
    padding: 10px 24px;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    box-shadow: 4px 4px 0px #1e293b;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 3000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-8px); }
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVENESS (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .party-header {
        height: auto;
        padding: 10px 14px;
        flex-direction: column;
        gap: 10px;
    }

    .header-left {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: wrap;
    }

    .logo {
        font-size: 1.55rem;
        gap: 8px;
    }

    .logo-doodle-img {
        width: 38px;
        height: 38px;
    }

    .room-pill {
        padding: 4px 10px;
        gap: 6px;
        font-size: 0.9rem;
    }

    .room-code {
        font-size: 1rem;
    }

    .icon-btn {
        padding: 3px 6px;
        font-size: 0.85rem;
    }

    .header-right {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: wrap;
    }

    .theme-picker-wrapper {
        flex: 1 1 auto;
        min-width: 130px;
    }

    .theme-dropdown-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
        gap: 5px;
        width: 100%;
        justify-content: space-between;
    }

    .theme-dropdown-menu {
        position: fixed;
        top: 90px;
        left: 14px;
        right: 14px;
        width: auto;
        max-width: calc(100vw - 28px);
        max-height: 70vh;
        overflow-y: auto;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.65);
        z-index: 2000;
    }

    .action-btn.vote-mode-btn {
        padding: 6px 12px;
        font-size: 0.88rem;
    }

    .user-badge {
        padding: 4px 10px 4px 6px;
        gap: 8px;
    }

    .avatar-small {
        width: 32px;
        height: 32px;
        font-size: 1.15rem;
    }

    .user-name {
        font-size: 0.88rem;
    }

    .user-role {
        font-size: 0.7rem;
    }

    .living-room-container {
        padding: 14px 12px 48px 12px;
        gap: 18px;
    }

    .couch-section {
        padding: 14px 12px;
    }

    .player-roster {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 8px;
    }

    .player-card {
        padding: 8px 10px;
        gap: 8px;
    }

    .player-card-avatar {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .player-card-name {
        font-size: 0.92rem;
    }

    .player-card-tag {
        font-size: 0.76rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card-media {
        height: 150px;
    }

    .mode-options {
        grid-template-columns: 1fr;
    }

    /* Active Game Overlay HUD on Mobile */
    .game-hud {
        height: 48px;
        padding: 0 12px;
    }

    .hud-btn.back-to-hub {
        padding: 4px 10px;
        font-size: 0.85rem;
    }

    .hud-game-title {
        font-size: 1rem;
    }

    .hud-status {
        display: none;
    }

    .hud-right {
        display: none;
    }

    /* Modals & Ready Check on Mobile */
    .modal-card {
        width: calc(100vw - 24px);
        max-width: 100%;
        padding: 16px 14px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .ready-banner {
        padding: 10px 12px;
        gap: 10px;
    }

    .ready-title {
        font-size: 0.95rem;
    }

    .ready-toggle-btn {
        width: 100%;
        justify-content: center;
        padding: 8px 12px;
        font-size: 0.92rem;
    }

    .party-readiness-box {
        padding: 10px 12px;
    }

    .player-mini-avatars {
        gap: 10px;
    }

    .mini-avatar {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
    }

    .modal-footer {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .btn-secondary, .btn-primary-launch {
        width: 100%;
        text-align: center;
    }

    .countdown-card {
        padding: 24px 16px;
        width: calc(100vw - 32px);
    }

    .countdown-number {
        font-size: 4rem;
    }
}

/* ==========================================================================
   Host Permission & Waiting States
   ========================================================================== */
.play-btn.waiting-host {
    background: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.9;
}

.play-btn.waiting-host:hover {
    transform: none;
    box-shadow: none;
    background: #e2e8f0;
}

.roulette-btn.waiting-host {
    background: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.9;
}

.roulette-btn.waiting-host:hover {
    transform: none;
    box-shadow: none;
    background: #e2e8f0;
}

.non-host-wait-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: #f8fafc;
    border: 2px dashed #94a3b8;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-weight: 700;
    color: #475569;
    font-size: 0.95rem;
    animation: pulse 2s infinite ease-in-out;
}

/* ==========================================================================
   Skribbl Shared Game Settings (Live Sync Host vs Guest)
   ========================================================================== */
.game-settings-box {
    background: var(--bg-surface-elevated);
    border: var(--ink-border);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 14px;
    box-shadow: 2px 2px 0px var(--ink);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1.5px dashed #cbd5e1;
    padding-bottom: 8px;
}

.settings-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--ink);
}

.settings-header-icon {
    font-size: 1.3rem;
}

.settings-role-badge {
    font-size: 0.8rem;
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--ink);
    background: #fef08a;
    color: #854d0e;
    box-shadow: 1.5px 1.5px 0px var(--ink);
}

.settings-role-badge.guest {
    background: #f1f5f9;
    color: #475569;
    border-color: #94a3b8;
    box-shadow: none;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

.settings-field.full-width {
    grid-column: 1 / -1;
}

.settings-field label {
    font-size: 0.85rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--ink);
}

.setting-input {
    background: var(--bg-surface);
    border: var(--ink-border);
    border-radius: 10px;
    padding: 8px 12px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--ink);
    width: 100%;
    box-sizing: border-box;
    box-shadow: 1.5px 1.5px 0px var(--ink);
    transition: all 0.12s;
}

.setting-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 2px 2px 0px var(--primary);
}

.setting-input:disabled,
.setting-input.is-disabled {
    background: #f8fafc;
    color: #64748b;
    border-color: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.85;
}

/* ==========================================================================
   Mobile-Optimized Join Modal (Nickname & Avatar)
   ========================================================================== */
.join-card {
    max-width: 440px;
    padding: 22px 20px;
    text-align: center;
    max-height: 92vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: auto;
    background: var(--bg-surface);
}

.join-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.join-title {
    font-size: 1.45rem;
    font-family: var(--font-heading);
    font-weight: 800;
    margin: 0;
    color: var(--ink);
}

.join-subtitle {
    font-size: 0.88rem;
    color: var(--ink-light);
    margin: 0 0 2px 0;
    line-height: 1.35;
}

.join-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    text-align: left;
}

.join-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.join-field label {
    font-size: 0.85rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--ink);
}

#joinNicknameInput {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: var(--ink-border);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 1.05rem;
    background: var(--bg-surface);
    color: var(--ink);
    box-shadow: 2px 2px 0px var(--ink);
}

.join-avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    justify-items: center;
}

.join-avatar-grid .avatar-pick-item {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1.4rem;
}

.join-submit-btn {
    width: 100%;
    margin-top: 4px;
    padding: 10px 16px;
    font-size: 1.05rem;
    text-align: center;
    justify-content: center;
}

@media (max-width: 480px), (max-height: 720px) {
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .join-card {
        padding: 16px 14px;
        gap: 8px;
        border-radius: 18px;
        max-height: 94vh;
        width: calc(100vw - 20px);
    }

    .join-icon {
        font-size: 1.8rem;
    }

    .join-title {
        font-size: 1.25rem;
    }

    .join-subtitle {
        font-size: 0.82rem;
        margin-bottom: 2px;
    }

    .join-form {
        gap: 9px;
    }

    .join-field {
        gap: 3px;
    }

    #joinNicknameInput {
        padding: 7px 10px;
        font-size: 0.95rem;
    }

    .join-avatar-grid {
        gap: 5px;
    }

    .join-avatar-grid .avatar-pick-item {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
        border-radius: 8px;
    }

    .join-submit-btn {
        padding: 9px 12px;
        font-size: 0.98rem;
    }
}

/* ==========================================================================
   WELCOME & PARTY SELECTION OVERLAY (Landing & Join Choice)
   ========================================================================== */
.welcome-backdrop {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    padding: 16px;
    box-sizing: border-box;
    animation: welcomeFadeIn 0.25s ease-out;
}

@keyframes welcomeFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.welcome-card {
    max-width: 480px;
    width: 100%;
    padding: 24px 22px;
    text-align: center;
    max-height: 94vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: auto;
    background: var(--bg-surface);
    border: var(--ink-border);
    border-radius: var(--radius-doodle);
    box-shadow: var(--shadow-doodle);
    position: relative;
    box-sizing: border-box;
}

.welcome-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.welcome-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 2px;
}

.welcome-title {
    font-size: 1.65rem;
    font-family: var(--font-heading);
    font-weight: 800;
    margin: 0;
    color: var(--ink);
}

.welcome-subtitle {
    font-size: 0.92rem;
    color: var(--ink-light);
    margin: 0;
    line-height: 1.35;
}

.welcome-direct-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 5px 14px;
    background: var(--bg-surface-elevated);
    border: var(--ink-border);
    border-radius: var(--radius-pill);
    box-shadow: 2px 2px 0px var(--ink);
}

.direct-badge-label {
    font-size: 0.82rem;
    color: var(--ink-light);
    font-weight: 600;
}

.direct-badge-code {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--primary);
}

.welcome-profile-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: var(--bg-surface-elevated);
    padding: 14px 16px;
    border-radius: 16px;
    border: var(--ink-border);
    box-shadow: 2px 2px 0px var(--ink);
}

.welcome-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.welcome-field label {
    font-size: 0.88rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--ink);
}

#welcomeNicknameInput {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: var(--ink-border);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 1.05rem;
    background: var(--bg-surface);
    color: var(--ink);
    box-shadow: 2px 2px 0px var(--ink);
    transition: transform 0.15s, box-shadow 0.15s;
}

#welcomeNicknameInput:focus {
    outline: none;
    box-shadow: 3px 3px 0px var(--ink);
    transform: translateY(-1px);
}

.welcome-avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    justify-items: center;
}

.welcome-avatar-grid .avatar-pick-item {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.45rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: var(--ink-border);
    transition: transform 0.15s, box-shadow 0.15s;
}

.welcome-avatar-grid .avatar-pick-item:hover {
    transform: scale(1.12);
}

.welcome-avatar-grid .avatar-pick-item.selected {
    background: var(--primary);
    box-shadow: 2px 2px 0px var(--ink);
    transform: scale(1.15);
}

.welcome-actions-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.btn-welcome-create {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    padding: 13px 18px;
    background: var(--accent-green);
    color: #ffffff;
    border: var(--ink-border);
    border-radius: 16px;
    box-shadow: var(--shadow-doodle);
    cursor: pointer;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-welcome-create:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-doodle-hover);
}

.btn-welcome-create:active {
    transform: translate(1px, 1px);
    box-shadow: var(--shadow-doodle-active);
}

.btn-welcome-icon {
    font-size: 2.1rem;
    line-height: 1;
}

.btn-welcome-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.btn-welcome-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
}

.btn-welcome-desc {
    font-size: 0.8rem;
    opacity: 0.95;
    font-weight: 600;
}

.welcome-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 4px 0;
    color: var(--ink-light);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.welcome-divider::before,
.welcome-divider::after {
    content: '';
    flex: 1;
    border-bottom: 2px dashed rgba(30, 41, 59, 0.25);
}

[data-theme="dark"] .welcome-divider::before,
[data-theme="dark"] .welcome-divider::after {
    border-bottom-color: rgba(255, 255, 255, 0.25);
}

.welcome-divider span {
    padding: 0 12px;
}

.welcome-join-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.welcome-join-label {
    font-size: 0.88rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--ink);
}

.welcome-join-form {
    display: flex;
    gap: 8px;
    width: 100%;
}

#welcomeCodeInput {
    flex: 1;
    box-sizing: border-box;
    padding: 10px 14px;
    border: var(--ink-border);
    border-radius: 12px;
    font-family: monospace;
    font-size: 1.15rem;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.15em;
    background: var(--bg-surface);
    color: var(--ink);
    box-shadow: 2px 2px 0px var(--ink);
}

#welcomeCodeInput.input-error {
    border-color: var(--accent-red);
    animation: inputShake 0.4s ease;
}

@keyframes inputShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.btn-welcome-join {
    padding: 10px 20px;
    background: var(--primary);
    color: var(--primary-text);
    border: var(--ink-border);
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    box-shadow: var(--shadow-doodle);
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-welcome-join:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-doodle-hover);
}

.btn-welcome-join:active {
    transform: translate(1px, 1px);
    box-shadow: var(--shadow-doodle-active);
}

.welcome-direct-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.welcome-direct-btn {
    width: 100%;
    padding: 13px 18px;
    font-size: 1.15rem;
    justify-content: center;
}

.btn-welcome-switch-mode {
    background: none;
    border: none;
    color: var(--ink-light);
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
    padding: 6px;
    font-family: var(--font-body);
    transition: color 0.15s;
}

.btn-welcome-switch-mode:hover {
    color: var(--ink);
}

@media (max-width: 480px), (max-height: 720px) {
    .welcome-card {
        padding: 16px 14px;
        gap: 10px;
        border-radius: 18px;
        max-height: 96vh;
    }

    .welcome-icon { font-size: 2rem; }
    .welcome-title { font-size: 1.35rem; }
    .welcome-subtitle { font-size: 0.82rem; }
    .welcome-profile-section { padding: 10px 12px; gap: 8px; }
    .btn-welcome-create { padding: 10px 14px; gap: 10px; }
    .btn-welcome-icon { font-size: 1.6rem; }
    .btn-welcome-title { font-size: 1.1rem; }
    .welcome-avatar-grid .avatar-pick-item {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
}

/* ==========================================================================
   SLOT MACHINE (EINARMIGER BANDIT) MODAL & ARCADE STYLING
   ========================================================================== */
.slot-modal-card {
    max-width: 520px;
    width: 95vw;
    background: linear-gradient(145deg, #18122B 0%, #251B37 50%, #392852 100%);
    border: 3.5px solid #FFD369;
    box-shadow: 0 0 35px rgba(255, 211, 105, 0.4), 6px 6px 0px var(--ink);
    border-radius: 28px;
    padding: 24px 28px;
    color: #ffffff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.slot-header {
    margin-bottom: 16px;
}

.slot-neon-badge {
    display: inline-block;
    padding: 3px 12px;
    background: #FF007F;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.22em;
    border-radius: 999px;
    box-shadow: 0 0 12px #FF007F;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.slot-title {
    font-size: 1.9rem;
    font-family: var(--font-heading);
    font-weight: 900;
    color: #FFD369;
    text-shadow: 0 0 14px rgba(255, 211, 105, 0.6), 2px 2px 0px #000;
    margin: 4px 0;
}

.slot-subtitle {
    font-size: 0.88rem;
    color: #E0E7FF;
    opacity: 0.9;
}

.slot-machine-body {
    background: #0f0a1c;
    border: 3px solid #FFD369;
    border-radius: 20px;
    padding: 12px 14px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8), 0 8px 18px rgba(0,0,0,0.4);
    position: relative;
    margin-bottom: 14px;
}

.slot-lights-bar {
    display: flex;
    justify-content: space-around;
    padding: 4px 6px;
}

.slot-lights-bar .bulb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FFD369;
    box-shadow: 0 0 8px #FFD369;
    animation: bulbBlink 0.9s infinite alternate;
}

.slot-lights-bar .bulb:nth-child(2n) {
    background: #FF007F;
    box-shadow: 0 0 8px #FF007F;
    animation-delay: 0.45s;
}

@keyframes bulbBlink {
    0% { opacity: 0.35; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1.15); }
}

.slot-reels-stage {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    background: #000;
    border: 2.5px solid #4a3869;
    border-radius: 14px;
    padding: 8px 10px;
    position: relative;
    box-shadow: inset 0 0 24px rgba(0,0,0,0.95);
    overflow: hidden;
}

.slot-reel-window {
    flex: 1;
    height: 140px;
    max-width: 130px;
    background: #ffffff;
    border: 2.5px solid #22153b;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 10px 14px rgba(0,0,0,0.45), inset 0 -10px 14px rgba(0,0,0,0.45);
}

.reel-glass-glare {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 35%, rgba(0,0,0,0) 65%, rgba(0,0,0,0.3) 100%);
    border-radius: 10px;
}

.slot-payline {
    position: absolute;
    left: 4px;
    right: 4px;
    top: 50%;
    height: 3px;
    background: rgba(255, 0, 127, 0.7);
    box-shadow: 0 0 8px #ff007f;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10;
}

.slot-reel-strip {
    display: flex;
    flex-direction: column;
    width: 100%;
    will-change: transform;
}

.slot-item {
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
    color: #1e1b4b;
    font-family: var(--font-heading);
    user-select: none;
}

.slot-item-icon {
    font-size: 3.2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    line-height: 1;
}

.slot-item-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #1e1b4b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Result Jackpot Banner */
.slot-result-banner {
    background: linear-gradient(135deg, #FFD369 0%, #F59E0B 100%);
    border: 2px solid #fff;
    border-radius: 16px;
    padding: 10px 14px;
    margin-bottom: 14px;
    color: #18122B;
    animation: jackpotPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 25px rgba(255, 211, 105, 0.8);
}

@keyframes jackpotPop {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.slot-jackpot-icon {
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 0.15em;
    color: #92400E;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.slot-winner-title {
    font-size: 1.6rem;
    font-weight: 900;
    font-family: var(--font-heading);
    color: #1e1b4b;
}

.slot-winner-countdown {
    font-size: 0.8rem;
    font-weight: 700;
    color: #78350F;
    margin-top: 2px;
}

/* Slot Controls & Lever */
.slot-controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding-top: 4px;
}

.slot-lever-container {
    width: 44px;
    height: 70px;
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s;
}

.slot-lever-container:hover {
    transform: scale(1.05);
}

.slot-lever-base {
    position: absolute;
    bottom: 0;
    left: 8px;
    width: 28px;
    height: 22px;
    background: linear-gradient(180deg, #64748B 0%, #334155 100%);
    border: 2px solid #000;
    border-radius: 6px;
    box-shadow: 2px 2px 0px #000;
}

.slot-lever-arm {
    position: absolute;
    bottom: 12px;
    left: 20px;
    width: 6px;
    height: 52px;
    background: linear-gradient(90deg, #E2E8F0 0%, #94A3B8 50%, #475569 100%);
    border-radius: 3px;
    transform-origin: bottom center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.slot-lever-knob {
    position: absolute;
    top: -14px;
    left: -11px;
    width: 28px;
    height: 28px;
    background: radial-gradient(circle at 35% 35%, #FF007F 0%, #be185d 65%, #831843 100%);
    border: 2px solid #000;
    border-radius: 50%;
    box-shadow: 0 0 10px #ff007f, 2px 2px 0px #000;
}

.slot-lever-container.pulled .slot-lever-arm {
    transform: rotate(65deg) scaleY(0.7);
}

.slot-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.slot-spin-btn {
    padding: 12px 20px;
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #FF007F 0%, #D946EF 100%);
    border: 2.5px solid #000;
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.5), 3px 3px 0px #000;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.slot-spin-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 0 22px rgba(255, 0, 127, 0.8), 3px 3px 0px #000;
}

.slot-spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   Treffen Avatar & Freehand Face Editor (Skribbl-Style)
   ========================================================================== */

.treffen-avatar {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.treffen-avatar-body {
    width: 100%;
    height: 100%;
    display: block;
}

.treffen-avatar-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.treffen-avatar-xs {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border: 1.5px solid var(--ink);
    background: var(--bg-surface);
}

.open-room-player-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-surface-elevated);
    padding: 1px 6px 1px 3px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.avatar-editor-host {
    width: 100%;
}

.avatar-editor {
    display: flex;
    gap: 16px;
    align-items: center;
    background: var(--bg-surface-elevated);
    border: var(--ink-border);
    border-radius: 16px;
    padding: 14px;
}

.avatar-editor-stage-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.avatar-editor-stage {
    position: relative;
    width: 156px;
    height: 156px;
    border-radius: 20px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    box-shadow: 3px 3px 0px var(--ink);
    overflow: hidden;
}

.avatar-draw-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.avatar-editor-hint {
    font-size: 0.72rem;
    color: var(--ink-light);
    font-weight: 700;
    text-align: center;
}

.avatar-editor-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.ae-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ae-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-light);
}

.ae-color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ae-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--ink);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    padding: 0;
}

.ae-color-swatch:hover {
    transform: scale(1.14);
}

.ae-color-swatch.selected {
    transform: scale(1.18);
    box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--primary);
}

.ae-pen-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.ae-pen-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ae-pen-swatch {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--ink);
    cursor: pointer;
    transition: transform 0.12s ease;
    padding: 0;
}

.ae-pen-swatch.selected {
    transform: scale(1.16);
    box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--primary);
}

.ae-brush-sizes {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ae-brush-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 2px solid var(--ink);
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.ae-brush-btn span {
    display: block;
    border-radius: 50%;
    background: var(--ink);
}

.ae-brush-btn.selected {
    background: var(--primary);
    border-color: var(--ink);
}

.ae-brush-btn.selected span {
    background: #ffffff;
}

.ae-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ae-tool-btn {
    padding: 5px 9px;
    font-size: 0.76rem;
    font-weight: 700;
    border-radius: 8px;
    border: 2px solid var(--ink);
    background: var(--bg-surface);
    color: var(--ink);
    cursor: pointer;
    transition: transform 0.1s ease, background 0.1s ease;
}

.ae-tool-btn:hover {
    transform: translateY(-1px);
}

.ae-tool-btn.active {
    background: var(--primary);
    color: #ffffff;
}

@media (max-width: 600px) {
    .avatar-editor {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        gap: 10px;
    }

    .avatar-editor-stage {
        width: 140px;
        height: 140px;
    }

    .ae-color-swatch {
        width: 26px;
        height: 26px;
    }
}





/* ===== Raum-Einstellungen (Host) ===== */
.action-btn.hub-settings-btn {
    padding: 6px 10px;
    min-width: 40px;
}
.hub-settings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.hub-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border: var(--ink-border, 1.5px solid currentColor);
    border-radius: 12px;
    background: var(--bg-surface, transparent);
    cursor: pointer;
}
.hub-setting-row strong { display: block; }
.hub-setting-row small { opacity: 0.75; }
.hub-setting-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
}


/* ==========================================================================
 * Treffen Welcome Clean Redesign + Host Crown on Avatar (Zero-Emoji UI)
 * ========================================================================== */
.treffen-avatar {
    position: relative;
}
.treffen-avatar-crown {
    position: absolute;
    inset: -2% 0 auto 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}
.ae-crown-preview {
    position: absolute;
    inset: -10% 0 auto 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    animation: crownPop 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes crownPop {
    from { opacity: 0; transform: translateY(-8px) scale(0.85); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ae-name-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.22);
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--ink);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ae-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.ae-preset-btn {
    padding: 4px 9px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.ae-preset-btn:hover {
    background: rgba(56, 189, 248, 0.16);
    border-color: rgba(56, 189, 248, 0.55);
}

.ae-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
}
.ae-tool-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 9px !important;
    font-size: 0.76rem !important;
    border-radius: 9px !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    box-shadow: none !important;
}
.ae-tool-btn:hover {
    background: rgba(255, 255, 255, 0.12) !important;
}
.ae-tool-btn.active {
    background: rgba(56, 189, 248, 0.22) !important;
    border-color: #38bdf8 !important;
    color: #e0f2fe !important;
}

/* Weniger Box-in-Box in der Welcome Card */
.welcome-card.welcome-clean {
    border: 1px solid rgba(56, 189, 248, 0.26) !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55) !important;
}
.welcome-brand-mark {
    width: 46px;
    height: 46px;
    margin: 0 auto 10px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(16, 185, 129, 0.22));
    border: 1px solid rgba(56, 189, 248, 0.45);
    color: #7dd3fc;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.welcome-clean .welcome-profile-section {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(148, 163, 184, 0.14) !important;
    box-shadow: none !important;
    border-radius: 14px;
}
.welcome-clean .avatar-editor {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 4px 0 0 !important;
}
.welcome-clean #welcomeNicknameInput,
.welcome-clean #welcomeCodeInput {
    box-shadow: none !important;
    border: 1.5px solid rgba(148, 163, 184, 0.28) !important;
    background: rgba(15, 23, 42, 0.55) !important;
}
.welcome-clean #welcomeNicknameInput:focus,
.welcome-clean #welcomeCodeInput:focus {
    border-color: #38bdf8 !important;
}

/* Schärferer Kontrast auf dem Haupt-CTA (dunkler Text auf Neongrün) */
.welcome-clean .btn-welcome-create {
    color: #052e1c !important;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.28) !important;
}
.welcome-clean .btn-welcome-create .btn-welcome-title {
    color: #052e1c !important;
}
.welcome-clean .btn-welcome-create .btn-welcome-desc {
    color: rgba(5, 46, 28, 0.78) !important;
}
.welcome-clean .btn-welcome-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #052e1c;
}
.welcome-clean .btn-welcome-join {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Offene Party-Räume kompakter & mit pulsierendem Statuspunkt */
.welcome-open-rooms { margin-top: 6px; text-align: left; }
.welcome-open-rooms-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.welcome-open-rooms-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    animation: livePulse 2s infinite;
}
@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.welcome-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--ink-light);
    font-size: 0.76rem;
    cursor: pointer;
    font-weight: 700;
}
.welcome-refresh-btn:hover { color: var(--ink); }
.welcome-open-rooms-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}
.welcome-empty-rooms {
    font-size: 0.82rem;
    color: var(--ink-light);
    text-align: center;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
}


/* ==========================================================================
 * Welcome Studio Split (Variante B, poliert für Desktop)
 * ========================================================================== */
.welcome-card.welcome-split {
    max-width: 860px !important;
    width: min(94vw, 860px) !important;
    padding: 24px !important;
    display: grid !important;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    align-items: stretch;
    text-align: left !important;
}
@media (max-width: 820px) {
    .welcome-card.welcome-split {
        grid-template-columns: 1fr;
        max-width: 480px !important;
        padding: 18px !important;
        gap: 16px;
    }
}

.welcome-studio-col {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.welcome-studio-glow {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 240px;
    height: 150px;
    border-radius: 50%;
    background: #3b82f6;
    filter: blur(65px);
    opacity: 0.22;
    pointer-events: none;
    transition: background 0.25s ease;
}
.welcome-col-label {
    position: relative;
    z-index: 2;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-light);
    text-align: center;
}

/* Im Studio-Split stapelt sich der Avatar-Editor vertikal: große Bühne oben, Tools sauber darunter */
.welcome-split .avatar-editor {
    position: relative;
    z-index: 2;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 0 !important;
}
.welcome-split .avatar-editor-stage {
    width: 168px !important;
    height: 168px !important;
    border-radius: 22px !important;
    border: 2px solid rgba(255, 255, 255, 0.22) !important;
    background: rgba(15, 23, 42, 0.65) !important;
}
.welcome-split .avatar-editor-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.welcome-split .ae-color-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    row-gap: 12px !important;
    column-gap: 8px !important;
    padding: 4px 2px !important;
    justify-items: center;
}
.welcome-split .ae-color-swatch.selected {
    transform: scale(1.06) !important;
}
.welcome-split .ae-actions {
    justify-content: space-between;
}
.welcome-split .ae-tool-btn {
    flex: 1;
}

.welcome-action-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}
.welcome-header-left {
    text-align: left !important;
    margin-bottom: 2px !important;
}
.welcome-brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.welcome-brand-row .welcome-brand-mark {
    margin: 0 !important;
    flex-shrink: 0;
}
.welcome-brand-row .welcome-title {
    margin: 0 !important;
    font-size: 1.45rem !important;
    line-height: 1.15;
}
.welcome-brand-row .welcome-subtitle {
    margin: 3px 0 0 !important;
    font-size: 0.86rem !important;
}


/* ==========================================================================
 * Kompakte Pfeile, Mix-FAB oben rechts, Crown-Overflow & Kontrast-Fixes
 * ========================================================================== */
.welcome-clean,
.welcome-clean .welcome-title,
.welcome-clean .welcome-field label,
.welcome-clean .welcome-join-label,
.welcome-clean .ae-tool-btn,
.welcome-clean .ae-name-preview {
    color: #f8fafc !important;
}
.welcome-clean .welcome-subtitle,
.welcome-clean .welcome-col-label,
.welcome-clean .ae-label,
.welcome-clean .avatar-editor-hint,
.welcome-clean .welcome-divider span {
    color: #94a3b8 !important;
}
.welcome-clean input[type="text"] {
    color: #f8fafc !important;
    background: rgba(15, 23, 42, 0.72) !important;
    border: 1.5px solid rgba(148, 163, 184, 0.3) !important;
    box-shadow: none !important;
}
.welcome-clean input[type="text"]::placeholder {
    color: rgba(148, 163, 184, 0.65) !important;
}
.welcome-clean input[type="text"]:focus {
    border-color: #38bdf8 !important;
}

/* Avatar-Bühne + kompakte Pfeile + Mix-FAB oben rechts */
.ae-stage-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.ae-arrow-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 122px;
}
.ae-arrow-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s ease, background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.ae-arrow-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.65);
    color: #ffffff;
    transform: scale(1.08);
}
.ae-arrow-btn:active { transform: scale(0.94); }

.ae-stage-frame {
    position: relative;
    overflow: visible;
    margin-top: 10px;
}
.ae-stage-frame .ae-crown-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 7;
}
.ae-random-fab {
    position: absolute;
    right: -11px;
    top: -11px;
    z-index: 9;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid rgba(148, 163, 184, 0.4);
    background: #182036;
    color: #e2e8f0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.ae-random-fab:hover {
    transform: scale(1.06);
    border-color: #38bdf8;
    color: #38bdf8;
}

/* Host-Krone in Lobby-Spielerliste darf leicht über den Avatar-Kreis ragen */
.slot-avatar,
.user-avatar-badge {
    overflow: visible !important;
}
.slot-avatar .treffen-avatar,
.user-avatar-badge .treffen-avatar {
    overflow: visible !important;
}
.slot-avatar .treffen-avatar-body,
.user-avatar-badge .treffen-avatar-body {
    border-radius: 50%;
    overflow: hidden;
}


/* ==========================================================================
 * Profile Modal – aligned mit Welcome-Editor (sauberes 7x2 Grid, kein Überlauf)
 * ========================================================================== */
.profile-modal-card {
    max-width: 630px !important;
    width: min(94vw, 630px) !important;
    border: 1px solid rgba(56, 189, 248, 0.26) !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55) !important;
}
.profile-modal-card .avatar-editor {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(148, 163, 184, 0.16) !important;
    border-radius: 16px !important;
    padding: 16px !important;
    gap: 20px !important;
    align-items: center !important;
    box-shadow: none !important;
}
.profile-modal-card .avatar-editor-stage {
    width: 152px !important;
    height: 152px !important;
    border-radius: 20px !important;
    border: 2px solid rgba(255, 255, 255, 0.22) !important;
    background: rgba(15, 23, 42, 0.65) !important;
    box-shadow: none !important;
}
.profile-modal-card .avatar-editor-controls {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.profile-modal-card .ae-color-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    row-gap: 11px !important;
    column-gap: 6px !important;
    padding: 4px 2px !important;
    justify-items: center;
}
.profile-modal-card .ae-color-swatch.selected {
    transform: scale(1.06) !important;
}
.profile-modal-card .ae-pen-colors {
    display: grid !important;
    grid-template-columns: repeat(8, 1fr) !important;
    gap: 5px !important;
    justify-items: center;
}
.profile-modal-card .ae-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
}
.profile-modal-card .ae-tool-btn {
    flex: 1 1 auto;
    padding: 6px 8px !important;
    font-size: 0.74rem !important;
    white-space: nowrap;
}


/* ==========================================================================
 * Mobile Welcome & Avatar-Editor (iPhone 15 Pro 393×852 & kleine Handys)
 * Desktop (> 700px Breite & > 520px Höhe) bleibt unverändert.
 * ========================================================================== */
@media (max-width: 700px) {
    .welcome-backdrop {
        height: 100dvh;
        padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
        overflow: hidden;
    }

    .welcome-card.welcome-split {
        width: 100% !important;
        max-width: 430px !important;
        max-height: calc(100dvh - 16px) !important;
        padding: 12px !important;
        gap: 10px !important;
        grid-template-columns: minmax(0, 1fr) !important;
        overflow-y: auto;
        overflow-x: hidden !important;
        border-radius: 20px !important;
    }

    .welcome-studio-col,
    .welcome-action-col,
    .welcome-split .avatar-editor-host,
    .welcome-split .avatar-editor,
    .welcome-split .avatar-editor-controls,
    .welcome-split .ae-section {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .welcome-studio-col {
        padding: 10px 12px !important;
        gap: 6px !important;
        border-radius: 14px !important;
    }

    .welcome-col-label {
        font-size: 0.68rem;
        margin: 0;
    }

    .welcome-split .avatar-editor {
        gap: 8px !important;
    }

    .welcome-split .avatar-editor-stage-wrap {
        gap: 4px;
    }

    .welcome-split .ae-stage-frame {
        margin-top: 4px;
    }

    .welcome-split .avatar-editor-stage {
        width: 124px !important;
        height: 124px !important;
        border-radius: 18px !important;
    }

    .welcome-split .ae-arrow-col {
        height: 102px;
    }

    .welcome-split .ae-arrow-btn {
        width: 28px;
        height: 28px;
    }

    .welcome-split .ae-random-fab {
        width: 28px;
        height: 28px;
        right: -8px;
        top: -8px;
    }

    .welcome-split .ae-name-preview {
        display: none !important;
    }

    .welcome-split .avatar-editor-hint {
        font-size: 0.66rem;
        line-height: 1.2;
    }

    .welcome-split .avatar-editor-controls {
        gap: 7px !important;
    }

    .welcome-split .ae-section {
        gap: 4px;
    }

    .welcome-split .ae-label {
        font-size: 0.65rem;
    }

    .welcome-split .ae-color-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
        row-gap: 7px !important;
        column-gap: 6px !important;
        padding: 2px 0 !important;
    }

    .welcome-split .ae-color-swatch {
        width: 24px;
        height: 24px;
    }

    .welcome-split .ae-pen-row {
        flex-wrap: nowrap;
        gap: 6px;
        width: 100%;
    }

    .welcome-split .ae-pen-colors {
        display: grid;
        grid-template-columns: repeat(8, minmax(0, 1fr));
        gap: 4px;
        flex: 1;
        min-width: 0;
        justify-items: center;
    }

    .welcome-split .ae-pen-swatch {
        width: 21px;
        height: 21px;
        border-radius: 6px;
    }

    .welcome-split .ae-brush-sizes {
        gap: 4px;
        flex-shrink: 0;
    }

    .welcome-split .ae-brush-btn {
        width: 25px;
        height: 25px;
        border-radius: 7px;
    }

    .welcome-split .ae-actions {
        gap: 6px !important;
        width: 100%;
    }

    .welcome-split .ae-tool-btn {
        min-width: 0;
        padding: 6px 6px !important;
        font-size: 0.72rem !important;
        gap: 4px;
        white-space: nowrap;
    }

    .welcome-action-col {
        gap: 8px !important;
    }

    .welcome-header-left {
        margin-bottom: 0 !important;
    }

    .welcome-brand-row {
        gap: 10px;
    }

    .welcome-brand-row .welcome-brand-mark {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .welcome-brand-row .welcome-brand-mark svg {
        width: 17px;
        height: 17px;
    }

    .welcome-brand-row .welcome-title {
        font-size: 1.12rem !important;
    }

    .welcome-brand-row .welcome-subtitle {
        font-size: 0.74rem !important;
        margin-top: 1px !important;
        line-height: 1.25;
    }

    .welcome-field {
        gap: 4px;
    }

    .welcome-field label,
    .welcome-join-label {
        font-size: 0.78rem;
    }

    #welcomeNicknameInput {
        padding: 8px 11px;
        font-size: 1rem;
        border-radius: 10px;
    }

    .welcome-actions-section {
        gap: 8px;
    }

    .btn-welcome-create {
        padding: 9px 14px;
        gap: 10px;
        border-radius: 13px;
    }

    .btn-welcome-create .btn-welcome-icon svg {
        width: 18px;
        height: 18px;
    }

    .btn-welcome-title {
        font-size: 1.02rem;
    }

    .btn-welcome-desc {
        font-size: 0.73rem;
    }

    .welcome-divider {
        margin: 0;
        font-size: 0.68rem;
    }

    .welcome-join-box {
        gap: 4px;
    }

    .welcome-join-form {
        gap: 6px;
    }

    #welcomeCodeInput {
        min-width: 0;
        width: 100%;
        padding: 8px 10px;
        font-size: 1rem;
        letter-spacing: 0.1em;
        border-radius: 10px;
    }

    .btn-welcome-join {
        padding: 8px 14px;
        font-size: 0.92rem;
        border-radius: 10px;
        flex-shrink: 0;
    }

    .welcome-open-rooms {
        margin-top: 2px;
    }

    .welcome-open-rooms-head {
        margin-bottom: 4px;
    }

    .welcome-open-rooms-label,
    .welcome-refresh-btn {
        font-size: 0.7rem;
    }

    .welcome-open-rooms-list {
        max-height: 72px;
        gap: 4px;
    }

    .welcome-empty-rooms {
        font-size: 0.76rem;
        padding: 6px 8px;
    }

    /* Profil-Modal auf Mobilgeräten ebenfalls überlauffrei & kompakt */
    .profile-modal-card {
        width: calc(100vw - 20px) !important;
        max-width: 430px !important;
        max-height: calc(100dvh - 20px) !important;
        padding: 14px 12px !important;
        overflow-x: hidden !important;
    }

    .profile-modal-card .avatar-editor {
        flex-direction: column !important;
        align-items: center !important;
        padding: 10px !important;
        gap: 10px !important;
    }

    .profile-modal-card .avatar-editor-stage {
        width: 124px !important;
        height: 124px !important;
    }

    .profile-modal-card .avatar-editor-controls {
        width: 100%;
    }

    .profile-modal-card .ae-pen-row {
        flex-wrap: nowrap;
        gap: 6px;
        width: 100%;
    }

    .profile-modal-card .ae-pen-colors {
        flex: 1;
        min-width: 0;
        gap: 4px !important;
    }

    .profile-modal-card .ae-pen-swatch {
        width: 21px;
        height: 21px;
    }

    .profile-modal-card .ae-brush-btn {
        width: 25px;
        height: 25px;
    }
}

/* Sehr niedrige Handys (z. B. iPhone SE 375×667) */
@media (max-width: 700px) and (max-height: 740px) {
    .welcome-card.welcome-split {
        padding: 9px 10px !important;
        gap: 7px !important;
    }

    .welcome-studio-col {
        padding: 8px 10px !important;
        gap: 4px !important;
    }

    .welcome-split .avatar-editor-stage {
        width: 102px !important;
        height: 102px !important;
    }

    .welcome-split .ae-arrow-col {
        height: 86px;
    }

    .welcome-split .ae-arrow-btn {
        width: 25px;
        height: 25px;
    }

    .welcome-split .avatar-editor-hint,
    .welcome-brand-row .welcome-subtitle {
        display: none !important;
    }

    .welcome-split .ae-color-swatch {
        width: 22px;
        height: 22px;
    }
}

/* Handy Querformat (z. B. iPhone 15 Pro Landscape 852×393): 2-Spalten-Split bleibt nutzbar */
@media (max-height: 520px) and (orientation: landscape) {
    .welcome-backdrop {
        height: 100dvh;
        padding: 6px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
    }

    .welcome-card.welcome-split {
        width: min(96vw, 820px) !important;
        max-height: calc(100dvh - 12px) !important;
        padding: 12px 14px !important;
        gap: 14px !important;
        grid-template-columns: 300px minmax(0, 1fr) !important;
        overflow-y: auto;
        overflow-x: hidden !important;
    }

    .welcome-studio-col {
        padding: 10px 12px !important;
        gap: 6px !important;
    }

    .welcome-split .avatar-editor {
        gap: 8px !important;
    }

    .welcome-split .avatar-editor-stage {
        width: 104px !important;
        height: 104px !important;
    }

    .welcome-split .ae-arrow-col {
        height: 88px;
    }

    .welcome-split .ae-name-preview,
    .welcome-split .avatar-editor-hint {
        display: none !important;
    }

    .welcome-split .ae-color-grid {
        row-gap: 6px !important;
    }

    .welcome-split .ae-color-swatch {
        width: 22px;
        height: 22px;
    }

    .welcome-split .ae-pen-row {
        flex-wrap: nowrap;
        gap: 5px;
    }

    .welcome-split .ae-pen-swatch {
        width: 19px;
        height: 19px;
    }

    .welcome-split .ae-brush-btn {
        width: 23px;
        height: 23px;
    }

    .welcome-action-col {
        gap: 8px !important;
        min-width: 0;
    }

    .welcome-brand-row .welcome-brand-mark {
        width: 34px;
        height: 34px;
    }

    .welcome-brand-row .welcome-title {
        font-size: 1.1rem !important;
    }

    .welcome-brand-row .welcome-subtitle {
        font-size: 0.75rem !important;
    }

    .btn-welcome-create {
        padding: 9px 14px;
    }

    #welcomeCodeInput {
        min-width: 0;
    }
}

/* ==========================================================================
 * Vollbild-Button & PWA Standalone Safe-Area (iPhone Dynamic Island / Notch)
 * ========================================================================== */
.hud-fullscreen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    margin-left: 6px;
    flex-shrink: 0;
}

[data-fullscreen-btn].is-fullscreen {
    border-color: var(--primary, #38bdf8);
    color: var(--primary, #38bdf8);
}

@media (display-mode: standalone) {
    .hub-header {
        padding-top: max(10px, env(safe-area-inset-top));
    }

    .game-hud {
        padding-top: max(6px, env(safe-area-inset-top));
    }
}

/* ==========================================================================
 * Optionales Konto-System & Admin-Panel
 * ========================================================================== */
.welcome-auth-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.16);
}
.welcome-auth-status {
    font-size: 0.76rem;
    color: #94a3b8;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.welcome-auth-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(56, 189, 248, 0.45);
    background: rgba(56, 189, 248, 0.12);
    color: #7dd3fc;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}
.welcome-auth-btn:hover {
    background: rgba(56, 189, 248, 0.22);
}

#hubAccountBtn {
    position: relative;
}
#hubAccountBtn.has-account::after {
    content: "";
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}
#hubAdminBtn {
    border-color: rgba(255, 209, 102, 0.45);
    color: #ffd166;
}

.auth-modal-card {
    max-width: 440px !important;
    width: min(94vw, 440px) !important;
    border: 1px solid rgba(56, 189, 248, 0.28) !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.58) !important;
}
.auth-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}
.auth-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.16);
}
.auth-tab {
    padding: 7px 8px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}
.auth-tab.active {
    background: rgba(56, 189, 248, 0.2);
    color: #e0f2fe;
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.auth-form input[type="text"],
.auth-form input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 1rem;
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.72);
    border: 1.5px solid rgba(148, 163, 184, 0.3);
}
.auth-form input:focus {
    outline: none;
    border-color: #38bdf8;
}
.auth-submit-btn {
    width: 100%;
    justify-content: center;
    margin-top: 2px;
}
.auth-notice {
    padding: 9px 11px;
    border-radius: 10px;
    background: rgba(255, 209, 102, 0.12);
    border: 1px solid rgba(255, 209, 102, 0.38);
    color: #fde68a;
    font-size: 0.78rem;
    line-height: 1.35;
}
.auth-hint {
    margin: 0;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.35;
}
.auth-error {
    padding: 8px 10px;
    border-radius: 9px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
    font-size: 0.8rem;
    font-weight: 600;
}
.auth-account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.18);
}
.auth-account-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: #f8fafc;
}
.auth-account-role {
    font-size: 0.8rem;
    color: #94a3b8;
}
.auth-role-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: rgba(56, 189, 248, 0.16);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.4);
}
.auth-role-pill.is-admin {
    background: rgba(255, 209, 102, 0.18);
    color: #ffd166;
    border-color: rgba(255, 209, 102, 0.5);
}
.auth-signedin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.auth-signedin-actions > * {
    flex: 1;
}

/* Admin-Panel Modal */
.admin-modal-card {
    max-width: 720px !important;
    width: min(95vw, 720px) !important;
    max-height: 90dvh !important;
    overflow-y: auto;
    border: 1px solid rgba(255, 209, 102, 0.32) !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.62) !important;
}
.admin-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 14px;
}
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.admin-stat-card {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.16);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.admin-stat-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}
.admin-stat-val {
    font-size: 1.08rem;
    font-weight: 800;
    color: #f8fafc;
}
.admin-stat-sub {
    font-size: 0.75rem;
    color: #94a3b8;
}
.admin-bar-track {
    width: 100%;
    height: 6px;
    border-radius: 99px;
    background: rgba(148, 163, 184, 0.18);
    overflow: hidden;
    margin-top: 2px;
}
.admin-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #22c55e);
    transition: width 0.25s ease;
}
.admin-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.admin-section-title {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #cbd5e1;
}
.admin-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.14);
}
.admin-row-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}
.admin-row-sub {
    font-size: 0.78rem;
    color: #94a3b8;
}
.admin-row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.admin-badge {
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    background: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}
.admin-badge.is-admin {
    background: rgba(255, 209, 102, 0.2);
    color: #ffd166;
}
.admin-reset-banner {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.45);
    color: #e0f2fe;
    font-size: 0.82rem;
}
.admin-reset-banner code {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.65);
    color: #7dd3fc;
}
.admin-danger-btn {
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #fca5a5 !important;
}
.admin-update-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.14);
}
.admin-update-hint {
    font-size: 0.78rem;
    color: #94a3b8;
    flex: 1;
    min-width: 180px;
}
.admin-empty {
    font-size: 0.82rem;
    color: #94a3b8;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 700px) {
    .welcome-auth-bar {
        margin-top: 5px;
        padding: 4px 8px;
    }
    .welcome-auth-status,
    .welcome-auth-btn {
        font-size: 0.7rem;
    }
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }
}
