/* ==========================================================================
   1. GLOBAL RESETS & VARIABLES
   ========================================================================== */
* {
    box-sizing: border-box;
}

:root {
    --bg: #020d25;
    --panel: #061a43;
    --panel2: #092557;
    --line: #1264d8;
    --text: #f6f8ff;
    --muted: #9eafd0;
    --blue: #258cff;
    --green: #2bd47d;
    --yellow: #ffc72c;
    --danger: #ff4264;
    --purple: #8b5cf6;
    --header-height: 80px;
}

html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 0, #103879 0, #041637 45%, #020b20 100%);
    color: var(--text);
    font-family: Inter, 'Segoe UI', Arial, sans-serif;
}

button, input, textarea, select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   2. TOP NAVIGATION HEADER
   ========================================================================== */
header.topbar {
    width: 100vw !important;
    max-width: 100vw !important;
    height: var(--header-height);
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 12px 30px !important;
    border-radius: 0 !important;
    border-bottom: 1px solid #123c77;
    background: rgba(2, 13, 37, 0.92);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.room-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.room-code {
    border: 1px solid #245aa6;
    border-radius: 24px;
    padding: 8px 16px;
    color: #d8e4ff;
    font-weight: bold;
    background: #031331;
}

.icon-btn {
    background: #092352;
    border: 1px solid #2863ad;
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: #143c7d;
}

#player-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #092352;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #2863ad;
    cursor: pointer;
}

/* ==========================================================================
   3. APP CONTAINER & FLEX/GRID LAYOUTS
   ========================================================================== */
.app {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto !important;
    padding: 20px;
    min-height: calc(100vh - var(--header-height));
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.content {
    display: grid;
    gap: 22px;
}

.main-wrapper,
.game-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 20px;
    box-sizing: border-box;
}

.landing-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    align-items: stretch;
    gap: 20px;
    background: #040e24;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #112d60;
    box-sizing: border-box;
}

.lobby-content {
    display: grid;
    grid-template-columns: 200px 1fr 320px;
    align-items: stretch;
    gap: 20px;
    background: #040e24;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #112d60;
    box-sizing: border-box;
}

/* Full Width 2-Column Lobby & Game Layout */
.lobby-content-full {
    display: grid;
    grid-template-columns: 1fr 340px;
    align-items: stretch;
    gap: 20px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    background: #040e24;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #112d60;
    box-sizing: border-box;
}

.panel {
    background: linear-gradient(145deg, rgba(8, 31, 74, 0.98), rgba(3, 19, 48, 0.98));
    border: 1px solid #145cc2;
    border-radius: 18px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    padding: 24px;
    box-sizing: border-box;
}

.left-panel,
.main-card,
.full-width-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.right-panel,
.players-card,
.players-sidebar-panel {
    width: 340px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* ==========================================================================
   4. HERO LOGO & RIGHT PANEL RULES
   ========================================================================== */
.main-hero-logo-container,
.create-hero-logo-container,
.join-hero-logo-container,
.lobby-logo-container {
    text-align: center;
    margin-bottom: 24px;
    flex-shrink: 0;
}

.main-hero-logo,
.create-hero-logo,
.join-hero-logo,
.lobby-center-logo {
    max-width: 280px !important;
    max-height: 140px !important;
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
    filter: drop-shadow(0px 8px 16px rgba(0, 0, 0, 0.5));
}

.create-hero-logo:hover,
.join-hero-logo:hover {
    transform: scale(1.02);
}

.rules-side-panel {
    text-align: left !important;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 24px;
    box-sizing: border-box;
}

.rules-side-panel h2 {
    margin-top: 0;
    font-size: 22px;
    color: #ffffff;
    border-bottom: 1px solid #144385;
    padding-bottom: 14px;
    margin-bottom: 16px;
    width: 100%;
    text-align: center;
    letter-spacing: 0.5px;
}

.rules-list {
    color: #b3c7eb;
    line-height: 1.65;
    padding-left: 20px;
    margin: 0;
    font-size: 14px;
}

.rules-list li {
    margin-bottom: 14px;
}

.rules-hero-art-container {
    text-align: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.rules-hero-art {
    max-width: 110px !important;
    max-height: 70px !important;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.brand-container {
    padding: 10px 0;
    text-align: center;
}

.lobby-logo {
    width: 100%;
    max-width: 140px;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 10px auto;
}

.sidebar .nav {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: #8da4d0;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sidebar .nav.active, 
.sidebar .nav:hover {
    background: linear-gradient(90deg, #244d9f, #17366f);
    color: #ffffff;
}

.center-panel {
    background: #081738;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    border: 1px solid #133373;
}

.welcome-panel {
    background: #081738;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid #133373;
}

.hero-illustration .art-img {
    width: 100%;
    max-width: 180px;
    margin-bottom: 15px;
}

.room-code-box {
    text-align: center;
    background: rgba(3, 21, 54, 0.6);
    border: 1px solid #164b91;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
}

.code-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #7997c9;
    display: block;
    margin-bottom: 6px;
}

.code-value-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #031536;
    border: 1px dashed #258cff;
    border-radius: 10px;
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-value-wrapper:hover {
    border-style: solid;
    background: #071f4c;
}

#display-code-val {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: #ffffff;
}

.copy-btn {
    background: transparent;
    border: none;
    color: #258cff;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    transition: transform 0.2s ease, color 0.2s ease;
}

.copy-btn:hover {
    transform: scale(1.15);
    color: #52a3ff;
}

.muted-sub {
    font-size: 0.8rem;
    color: #688abf;
    margin-top: 8px;
    margin-bottom: 0;
}

.players-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #7997c9;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #164b91;
}

.status-hint {
    font-size: 0.75rem;
    color: #ff9f43;
    font-weight: 600;
}

.scrollable-players,
.players-list,
.player-slots-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
    flex: 1;
}

.player-row-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #031536;
    border: 1px solid #164b91;
    border-radius: 10px;
    transition: border-color 0.15s ease;
}

.player-row-slot:hover {
    border-color: #258cff;
}

.player-row-slot .avatar-circle,
.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    background: #258cff;
    color: white;
}

.player-row-slot.waiting-slot,
.player-row-slot.empty {
    border-style: dashed;
    background: transparent;
    opacity: 0.6;
}

.host-badge {
    background: #ffb703;
    color: #000;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
}

/* ==========================================================================
   5. BUTTONS & UI CONTROLS
   ========================================================================== */
.primary-btn {
    border: 0;
    border-radius: 28px;
    padding: 14px 28px;
    background: linear-gradient(90deg, #2ad27a, #24c879);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    width: 100%;
    box-shadow: 0 8px 20px rgba(26, 210, 119, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    margin: 8px 0;
}

.primary-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.primary-btn.disabled,
.primary-btn:disabled {
    background: #1c3254 !important;
    color: #5d7ca6 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
    border: 1px solid #28446e;
}

.btn-green {
    background: #25be6a !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(37, 190, 106, 0.25) !important;
}

.btn-green:hover {
    background: #20c06a !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 190, 106, 0.4) !important;
}

.btn-secondary {
    background: #143872 !important;
    border: 1px solid #2763b0 !important;
    box-shadow: none !important;
}

.btn-secondary:hover {
    background: #19468e !important;
    border-color: #387bd2 !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(23, 67, 137, 0.3) !important;
}

.btn-icon-cog {
    background: rgba(37, 140, 255, 0.12);
    border: 1px solid rgba(37, 140, 255, 0.4);
    color: #bae0ff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-icon-cog:hover {
    background: rgba(37, 140, 255, 0.25);
    border-color: #258cff;
    box-shadow: 0 0 10px rgba(37, 140, 255, 0.4);
    transform: translateY(-1px);
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.checkbox-group {
    text-align: left;
    background: #031331;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #1a66d0;
    margin: 15px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: #c0d0ed;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label:last-child {
    margin-bottom: 0;
}

.checkbox-label input {
    accent-color: var(--blue);
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   6. GAME SCREENS & CLUE SUBMISSION
   ========================================================================== */
.compact-game-screen {
    max-height: calc(100vh - var(--header-height) - 40px);
}

.game-main-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px 24px;
}

.game-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, rgba(3, 17, 43, 0.9), rgba(9, 32, 74, 0.9));
    backdrop-filter: blur(8px);
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid #1a4999;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    margin-bottom: 16px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compact-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.game-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(10, 35, 82, 0.75);
    border: 1px solid #245aa6;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #b8c9e8;
    font-weight: 600;
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.05);
}

.game-info-badge strong {
    color: #ffffff;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.timer-badge {
    /* Background and border removed so it inherits the standard blue badge style */
}

.timer-badge strong {
    color: var(--yellow);
    font-size: 1.05rem;
}

.timer-icon {
    font-size: 1.15rem;
    line-height: 1;
    filter: drop-shadow(0 0 4px rgba(255, 199, 44, 0.5));
}

.word-submission-area {
    text-align: center;
    margin-bottom: 10px;
}

.word-submission-area h2 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.word-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #ffca2b, #ffbc16);
    color: #081633;
    border-radius: 20px;
    padding: 8px 28px;
    font-size: 1.25rem;
    font-weight: 800;
    margin: 8px auto;
}

.clue-input-container {
    margin-top: 5px;
}

textarea {
    width: 100%;
    height: 80px;
    background: #031536;
    border: 1px solid #2674d9;
    border-radius: 12px;
    color: white;
    padding: 12px;
    resize: none;
    outline: none;
    box-sizing: border-box;
    font-size: 0.95rem;
}

textarea:focus {
    border-color: #42a0ff;
}

.counter {
    text-align: right;
    color: #7d94bb;
    font-size: 12px;
    margin-top: 4px;
    margin-bottom: 10px;
}

.submit-btn {
    padding: 12px;
    font-size: 0.95rem;
    margin: 0;
}

.clue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin: 25px 0;
}

.clue-card {
    border: 1px solid #1d68c8;
    border-radius: 14px;
    background: #041738;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clue-card:hover {
    border-color: #4ca0ff;
    background: #07214b;
}

.clue-card.selected {
    border: 2px solid var(--yellow);
    background: #08295e;
    box-shadow: 0 0 15px rgba(255, 199, 44, 0.4);
}

.clue-card small {
    color: #c0d0ed;
    line-height: 1.4;
    font-style: italic;
}

.table-wrap {
    overflow-x: auto;
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    text-align: left;
}

th, td {
    padding: 13px;
    border-bottom: 1px solid #183b70;
    font-size: 14px;
}

th {
    color: #91abd3;
}

.badge {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
}

.badge.danger {
    background: var(--danger);
    color: white;
}

.player-row-slot .player-info {
    display: flex;
    flex-direction: column;
}

.player-row-slot .player-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.badge.status-waiting {
    background: #143872;
    color: #8da4d0;
    border: 1px solid #2763b0;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    margin-left: auto;
}

.badge.success {
    background: rgba(43, 212, 125, 0.15);
    color: var(--green);
    border: 1px solid var(--green);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    margin-left: auto;
}

/* ==========================================================================
   7. MODAL & PROFILE STYLES
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(1, 8, 22, 0.85);
    backdrop-filter: blur(12px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.hidden,
.modal-overlay[style*="display: none"] {
    display: none !important;
}

.modal-card {
    width: 100%;
    max-width: 440px;
    background: linear-gradient(165deg, #091f4a 0%, #041029 100%);
    border: 1px solid #1a51a1;
    border-radius: 24px;
    padding: 32px 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6),
                0 0 30px rgba(26, 81, 161, 0.25);
    text-align: center;
}

.modal-card h2 {
    margin: 0 0 24px 0;
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.input-label {
    display: block;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #83a5e1;
    margin-bottom: 10px;
}

.avatar-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding: 4px 6px 12px 4px; /* added bottom padding to prevent bottom row clipping */
    margin-bottom: 18px;
}

/* Optional custom scrollbar track */
.avatar-picker-grid::-webkit-scrollbar {
    width: 6px;
}
.avatar-picker-grid::-webkit-scrollbar-thumb {
    background: #144385;
    border-radius: 4px;
}

.avatar-option {
    background: #03112c;
    border: 1.5px solid #14376e;
    border-radius: 16px;
    font-size: 30px;
    padding: 12px 0;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.avatar-option:hover {
    border-color: #3b82f6;
    background: #0a224f;
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.avatar-option.selected {
    border: 2px solid var(--yellow);
    background: linear-gradient(135deg, #103473 0%, #092049 100%);
    box-shadow: 0 0 16px rgba(255, 199, 44, 0.35), 
                inset 0 0 8px rgba(255, 199, 44, 0.15);
    transform: scale(1.05);
}

.modal-card input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    background: #020b1e;
    border: 1.5px solid #184285;
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.modal-card input[type="text"]::placeholder {
    color: #4a689b;
}

.modal-card input[type="text"]:focus {
    border-color: var(--blue);
    background: #04122f;
    box-shadow: 0 0 0 3px rgba(37, 140, 255, 0.2);
}

.modal-card .primary-btn {
    margin-top: 24px;
    padding: 15px 24px;
    font-size: 16px;
    letter-spacing: 0.5px;
    border-radius: 14px;
}

.join-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
    text-align: left;
}

.join-input-group .input-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #7997c9;
    letter-spacing: 1px;
    text-transform: uppercase;
}

#join-code {
    width: 100%;
    padding: 16px;
    background: #031536;
    border: 1px solid #1a66d0;
    border-radius: 10px;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;
    text-transform: uppercase;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#join-code:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 140, 255, 0.25);
}

#join-code::placeholder {
    color: #3b5a8c;
    letter-spacing: 1px;
    font-weight: 500;
}

.lobby-welcome-box {
    text-align: center;
    padding: 20px 10px;
    background: rgba(3, 21, 54, 0.3);
    border-radius: 14px;
    border: 1px dashed rgba(26, 102, 208, 0.4);
}

.lobby-welcome-box h2 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
}

/* ==========================================================================
   8. LOADER & RESPONSIVE BREAKPOINTS
   ========================================================================= */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 14, 38, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: center;
}

.loader-glow-orb {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 25px rgba(37, 140, 255, 0.6), 
                0 0 50px rgba(37, 140, 255, 0.25),
                inset 0 0 15px rgba(37, 140, 255, 0.35);
    animation: orbFloatPulse 2s infinite ease-in-out;
}

.loader-ring-spinner {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #258cff;
    border-right-color: #00d2ff;
    border-bottom-color: rgba(37, 140, 255, 0.2);
    animation: orbSpin 1.4s linear infinite;
    filter: drop-shadow(0 0 8px #00d2ff);
    pointer-events: none;
}

.loader-inner-circle {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: radial-gradient(circle at center, #0f2b5c 0%, #061633 80%);
    border: 1px solid rgba(37, 140, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.loader-core-img {
    width: 62px;
    height: 62px;
    object-fit: contain;
    background: transparent !important;
    filter: drop-shadow(0 0 8px rgba(37, 140, 255, 0.7));
    display: block;
}

.loader-subtext {
    color: #bae0ff;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    margin: 0;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(37, 140, 255, 0.6);
    animation: loaderTextFade 1.8s infinite ease-in-out;
}

@keyframes orbSpin {
    100% { transform: rotate(360deg); }
}

@keyframes orbFloatPulse {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 0 22px rgba(37, 140, 255, 0.5), inset 0 0 14px rgba(37, 140, 255, 0.3);
    }
    50% {
        transform: translateY(-6px) scale(1.04);
        box-shadow: 0 0 36px rgba(0, 210, 255, 0.75), inset 0 0 20px rgba(0, 210, 255, 0.45);
    }
}

@keyframes loaderTextFade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@media (max-width: 480px) {
    .loader-glow-orb {
        width: 94px;
        height: 94px;
    }
    .loader-inner-circle {
        width: 82px;
        height: 82px;
    }
    .loader-core-img {
        width: 52px;
        height: 52px;
    }
    .loader-subtext {
        font-size: 0.85rem;
    }
}

@media (max-width: 850px) {
    html, body {
        height: auto;
    }

    .app {
        height: auto;
    }

    .main-wrapper,
    .game-container,
    .landing-content,
    .lobby-content,
    .lobby-content-full {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .right-panel,
    .players-card,
    .players-sidebar-panel {
        width: 100%;
    }

    .sidebar {
        display: none;
    }

    header.topbar {
        padding: 12px 16px !important;
    }

    .room-code {
        display: none;
    }

    .compact-game-screen {
        max-height: none;
    }
}

/* --- THEMED RESULTS HEADER & RESPONSIVE CENTERING --- */
.results-header-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    position: relative;
}

.results-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}

.results-title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.results-trophy-icon {
    font-size: 34px;
    line-height: 1;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.45));
}

.results-heading-text {
    margin: 4px 0 0 0;
    font-size: 1.65rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: linear-gradient(180deg, #ffffff 15%, #bae0ff 70%, #4facfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 10px rgba(37, 140, 255, 0.45));
}

@media (min-width: 640px) {
    .results-header-container {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        min-height: 72px;
    }

    .results-logo-wrapper {
        grid-column: 1;
        justify-self: start;
    }

    .results-title-wrapper {
        grid-column: 2;
        justify-self: center;
        margin-left: -70px;
    }

    .results-heading-text {
        font-size: 1.85rem;
    }
}