/* 
  =========================================
  AnimeChatHub Core Design System & Styling
  =========================================
*/

/* Variables & Base Themes */
:root {
    --bg-base: #0a0a10;
    --panel-bg: rgba(18, 18, 28, 0.65);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f0f0f7;
    --text-secondary: #a0a0ba;
    
    /* Neon Palette */
    --neon-blue: #00ffff;
    --neon-pink: #ff007f;
    --neon-purple: #bd00ff;
    --neon-glow-blue: 0 0 10px rgba(0, 255, 255, 0.5), 0 0 20px rgba(0, 255, 255, 0.2);
    --neon-glow-pink: 0 0 10px rgba(255, 0, 127, 0.5), 0 0 20px rgba(255, 0, 127, 0.2);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base resets & scrollbars */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Canvas Background for Particle Systems */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

/* Theme Configuration Overlays */
body.theme-cyberpunk {
    --bg-base: #05050a;
    --panel-bg: rgba(6, 6, 15, 0.75);
    --panel-border: rgba(0, 255, 255, 0.15);
    --text-primary: #e6ffff;
    --text-secondary: #80b3b3;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

body.theme-sakura {
    --bg-base: #100a14;
    --panel-bg: rgba(26, 15, 30, 0.7);
    --panel-border: rgba(255, 183, 197, 0.2);
    --text-primary: #fff0f3;
    --text-secondary: #d9b8c0;
    background-image: radial-gradient(circle at 50% 50%, #29152e 0%, #100a14 100%);
}

body.theme-guild {
    --bg-base: #0f0b07;
    --panel-bg: rgba(31, 22, 14, 0.75);
    --panel-border: rgba(255, 170, 0, 0.2);
    --text-primary: #fffaf0;
    --text-secondary: #d4c0ab;
    background-image: radial-gradient(circle at 50% 50%, #2b1c0e 0%, #0f0b07 100%);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 
  =========================================
  Global Layout Components
  =========================================
*/

.global-header {
    background: rgba(10, 10, 16, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--panel-border);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.logo-kanji {
    font-family: 'Shojumaru', cursive;
    color: var(--neon-pink);
    text-shadow: var(--neon-glow-pink);
    font-size: 1.8rem;
}

.logo-text {
    color: var(--text-primary);
}

.logo-text .highlight {
    color: var(--neon-blue);
    text-shadow: var(--neon-glow-blue);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    z-index: 2;
}

.global-footer {
    padding: 20px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--panel-border);
    background: rgba(5, 5, 8, 0.9);
}

/* User Profile Badge */
.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-badge .username {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* 
  =========================================
  Buttons & Interactive Elements
  =========================================
*/

.btn {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 255, 0.5), 0 0 10px var(--neon-purple);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
    text-shadow: var(--neon-glow-blue);
}

.btn-danger {
    background: rgba(255, 0, 127, 0.15);
    color: var(--neon-pink);
    border: 1px solid rgba(255, 0, 127, 0.3);
}

.btn-danger:hover {
    background: rgba(255, 0, 127, 0.3);
    color: #fff;
    box-shadow: var(--neon-glow-pink);
}

.btn-synth {
    background: rgba(189, 0, 255, 0.15);
    color: #e0a3ff;
    border: 1px solid rgba(189, 0, 255, 0.3);
}

.btn-synth:hover {
    background: rgba(189, 0, 255, 0.3);
    color: #fff;
    box-shadow: 0 0 15px rgba(189, 0, 255, 0.4);
}

.btn-glowing {
    position: relative;
    overflow: hidden;
}

.btn-glowing::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 30%;
    height: 200%;
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(30deg);
    transition: all 0.5s ease;
}

.btn-glowing:hover::after {
    left: 130%;
}

/* 
  =========================================
  CSS Avatars System
  =========================================
*/

.avatar-icon {
    display: inline-block;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #fff;
    flex-shrink: 0;
}

/* Avatar Classes */
.avatar-ninja {
    border-color: #4ef037;
    box-shadow: 0 0 8px rgba(78, 240, 55, 0.5);
    background-image: radial-gradient(circle, rgba(78, 240, 55, 0.2) 20%, transparent 80%);
}
.avatar-ninja::before {
    content: '\f51b'; /* Shuriken */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #4ef037;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
}

.avatar-saiyan {
    border-color: #ffaa00;
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.5);
    background-image: radial-gradient(circle, rgba(255, 170, 0, 0.2) 20%, transparent 80%);
}
.avatar-saiyan::before {
    content: '\e0b7'; /* Bolt */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #ffaa00;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
}

.avatar-cyber {
    border-color: var(--neon-blue);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
    background-image: radial-gradient(circle, rgba(0, 255, 255, 0.2) 20%, transparent 80%);
}
.avatar-cyber::before {
    content: '\f2db'; /* Microchip */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--neon-blue);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
}

.avatar-mage {
    border-color: #b05eff;
    box-shadow: 0 0 8px rgba(176, 94, 255, 0.5);
    background-image: radial-gradient(circle, rgba(176, 94, 255, 0.2) 20%, transparent 80%);
}
.avatar-mage::before {
    content: '\f72b'; /* Magic Wand */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #b05eff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
}

.avatar-maid {
    border-color: var(--neon-pink);
    box-shadow: 0 0 8px rgba(255, 0, 127, 0.5);
    background-image: radial-gradient(circle, rgba(255, 0, 127, 0.2) 20%, transparent 80%);
}
.avatar-maid::before {
    content: '\f004'; /* Heart */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--neon-pink);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
}

/* 
  =========================================
  Page View: Landing Page
  =========================================
*/

.landing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    gap: 40px;
    padding: 40px 0;
}

.hero-section {
    max-width: 800px;
}

.glitch-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 5px;
    color: #fff;
    position: relative;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.glitch-title::before,
.glitch-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.glitch-title::before {
    left: 2px;
    text-shadow: -2px 0 var(--neon-blue);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch-title::after {
    left: -2px;
    text-shadow: -2px 0 var(--neon-pink);
    clip: rect(85px, 450px, 140px, 0);
    animation: glitch-anim-2 5s infinite linear alternate-reverse;
}

.subtitle {
    font-size: 1.25rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.realm-showcase {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    max-width: 900px;
    width: 100%;
}

.showcase-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 30px 20px;
    transition: all var(--transition-medium);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.showcase-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.showcase-cyber:hover { border-color: var(--neon-blue); box-shadow: 0 0 20px rgba(0, 255, 255, 0.15); }
.showcase-sakura:hover { border-color: var(--neon-pink); box-shadow: 0 0 20px rgba(255, 0, 127, 0.15); }
.showcase-guild:hover { border-color: #ffaa00; box-shadow: 0 0 20px rgba(255, 170, 0, 0.15); }

.card-icon {
    font-size: 2.2rem;
    color: var(--text-primary);
}

.showcase-cyber .card-icon { color: var(--neon-blue); text-shadow: var(--neon-glow-blue); }
.showcase-sakura .card-icon { color: var(--neon-pink); text-shadow: var(--neon-glow-pink); }
.showcase-guild .card-icon { color: #ffaa00; text-shadow: 0 0 10px rgba(255, 170, 0, 0.5); }

.showcase-card h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.showcase-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.landing-actions {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

/* 
  =========================================
  Page View: Auth (Login/Register)
  =========================================
*/

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 20px 0;
}

.auth-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    width: 100%;
    max-width: 450px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.auth-card.wide-card {
    max-width: 800px;
}

.auth-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 25px;
    text-align: center;
    letter-spacing: 2px;
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-cols {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 40px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 12px 15px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.25);
}

.btn-submit {
    width: 100%;
    justify-content: center;
    padding: 12px;
    margin-top: 10px;
}

.auth-footer {
    margin-top: 25px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--neon-blue);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
    text-shadow: var(--neon-glow-blue);
}

/* Alert Boxes */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: rgba(255, 0, 127, 0.12);
    border: 1px solid rgba(255, 0, 127, 0.3);
    color: #ff5e9c;
}

/* Avatar Class grid in register */
.avatar-selection-col {
    display: flex;
    flex-direction: column;
}

.section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    flex: 1;
}

.avatar-option {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.avatar-option:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.2);
}

.avatar-option.active {
    background: rgba(0, 255, 255, 0.05);
    border-color: var(--neon-blue);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.15);
}

.avatar-icon-wrapper {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    transition: all var(--transition-fast);
}

.avatar-option.active .avatar-icon-wrapper {
    border-color: var(--neon-blue);
    background: rgba(0, 255, 255, 0.1);
    color: var(--neon-blue);
}

.avatar-option:nth-child(1).active .avatar-icon-wrapper { border-color: #4ef037; color: #4ef037; background: rgba(78, 240, 55, 0.1); }
.avatar-option:nth-child(2).active .avatar-icon-wrapper { border-color: #ffaa00; color: #ffaa00; background: rgba(255, 170, 0, 0.1); }
.avatar-option:nth-child(3).active .avatar-icon-wrapper { border-color: var(--neon-blue); color: var(--neon-blue); background: rgba(0, 255, 255, 0.1); }
.avatar-option:nth-child(4).active .avatar-icon-wrapper { border-color: #b05eff; color: #b05eff; background: rgba(176, 94, 255, 0.1); }
.avatar-option:nth-child(5).active .avatar-icon-wrapper { border-color: var(--neon-pink); color: var(--neon-pink); background: rgba(255, 0, 127, 0.1); }

.avatar-label {
    font-size: 0.85rem;
    font-weight: 600;
}

/* 
  =========================================
  Page View: Lobby Dashboard
  =========================================
*/

.lobby-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.lobby-welcome {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 25px;
}

.lobby-welcome h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.lobby-welcome p {
    color: var(--text-secondary);
}

.lobby-welcome .highlight {
    color: var(--neon-blue);
    text-shadow: var(--neon-glow-blue);
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.room-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 30px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all var(--transition-medium);
}

.room-card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--panel-border);
    transition: all var(--transition-fast);
}

/* Theme overrides for cards */
.room-card.theme-cyberpunk { --card-theme: var(--neon-blue); }
.room-card.theme-sakura { --card-theme: var(--neon-pink); }
.room-card.theme-guild { --card-theme: #ffaa00; }

.room-card:hover {
    transform: translateY(-5px);
    border-color: var(--card-theme);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(var(--card-theme), 0.1);
}

.room-card:hover .room-card-glow {
    background: var(--card-theme);
    box-shadow: 0 0 10px var(--card-theme);
}

.room-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.room-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    color: var(--card-theme);
}

.room-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.room-desc {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.room-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 15px;
}

.bot-badge {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.bot-badge strong {
    color: var(--text-primary);
}

.btn-enter-room {
    width: 100%;
    justify-content: center;
}

.room-card.theme-cyberpunk .btn-enter-room { background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple)); }
.room-card.theme-sakura .btn-enter-room { background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple)); color: #fff; }
.room-card.theme-guild .btn-enter-room { background: linear-gradient(135deg, #ffaa00, #ff5500); color: #fff; }

/* 
  =========================================
  Page View: Immersive Chat Room
  =========================================
*/

.chat-interface-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
    flex: 1;
    min-height: calc(100vh - 190px);
}

/* Chat Sidebar */
.chat-sidebar {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 1px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-rooms {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.sidebar-room-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.sidebar-room-item.active {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.theme-cyberpunk .sidebar-room-item.active { border-color: var(--neon-blue); box-shadow: 0 0 10px rgba(0, 255, 255, 0.15); color: var(--neon-blue); }
.theme-sakura .sidebar-room-item.active { border-color: var(--neon-pink); box-shadow: 0 0 10px rgba(255, 0, 127, 0.15); color: var(--neon-pink); }
.theme-guild .sidebar-room-item.active { border-color: #ffaa00; box-shadow: 0 0 10px rgba(255, 170, 0, 0.15); color: #ffaa00; }

.room-item-icon {
    font-size: 1.1rem;
}

.room-item-name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Chat Main Panel */
.chat-main-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.chat-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
}

.chat-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.chat-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.chat-header-bot {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.bot-presence-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff66;
    box-shadow: 0 0 8px #00ff66;
}

/* Message Log Container */
.chat-messages-container {
    flex: 1;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    max-height: 480px;
    min-height: 380px;
}

.message-bubble-wrapper {
    display: flex;
    gap: 12px;
    max-width: 75%;
    align-items: flex-start;
    animation: messageSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message-bubble-wrapper.msg-user {
    align-self: flex-start;
}

.message-bubble-wrapper.msg-own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-bubble-wrapper.msg-bot {
    align-self: flex-start;
}

.msg-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.message-bubble-wrapper.msg-own .msg-meta {
    flex-direction: row-reverse;
}

.msg-sender {
    font-weight: 600;
}

.message-bubble-wrapper.msg-own .msg-sender {
    color: var(--neon-blue);
}

.bot-label {
    background: rgba(0, 255, 255, 0.15);
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: var(--neon-blue);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.theme-sakura .bot-label {
    background: rgba(255, 0, 127, 0.15);
    border-color: rgba(255, 0, 127, 0.3);
    color: var(--neon-pink);
}

.theme-guild .bot-label {
    background: rgba(255, 170, 0, 0.15);
    border-color: rgba(255, 170, 0, 0.3);
    color: #ffaa00;
}

.msg-time {
    opacity: 0.7;
}

.msg-text {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 16px;
    border-radius: 14px;
    border-top-left-radius: 2px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
    word-break: break-word;
}

/* Bubbles tailoring */
.message-bubble-wrapper.msg-own .msg-text {
    background: rgba(0, 255, 255, 0.05);
    border-color: rgba(0, 255, 255, 0.15);
    border-radius: 14px;
    border-top-right-radius: 2px;
    box-shadow: 0 4px 10px rgba(0, 255, 255, 0.03);
}

.message-bubble-wrapper.msg-bot .msg-text {
    background: rgba(189, 0, 255, 0.06);
    border-color: rgba(189, 0, 255, 0.2);
    border-radius: 14px;
    border-top-left-radius: 2px;
    box-shadow: 0 4px 12px rgba(189, 0, 255, 0.05);
}

.theme-sakura .message-bubble-wrapper.msg-bot .msg-text {
    background: rgba(255, 0, 127, 0.06);
    border-color: rgba(255, 0, 127, 0.2);
    box-shadow: 0 4px 12px rgba(255, 0, 127, 0.05);
}

.theme-guild .message-bubble-wrapper.msg-bot .msg-text {
    background: rgba(255, 170, 0, 0.06);
    border-color: rgba(255, 170, 0, 0.2);
    box-shadow: 0 4px 12px rgba(255, 170, 0, 0.05);
}

/* Chat Input Bar */
.chat-input-wrapper {
    padding: 20px 25px;
    border-top: 1px solid var(--panel-border);
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 15px;
}

.chat-input-wrapper input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 30px;
    padding: 14px 22px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.chat-input-wrapper input:focus {
    outline: none;
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.theme-sakura .chat-input-wrapper input:focus { border-color: var(--neon-pink); box-shadow: 0 0 10px rgba(255, 0, 127, 0.2); }
.theme-guild .chat-input-wrapper input:focus { border-color: #ffaa00; box-shadow: 0 0 10px rgba(255, 170, 0, 0.2); }

.btn-send {
    border-radius: 50%;
    width: 48px;
    height: 48px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
}

/* 
  =========================================
  Keyframes & Animations
  =========================================
*/

@keyframes glitch-anim {
    0% { clip: rect(44px, 9999px, 56px, 0); }
    5% { clip: rect(12px, 9999px, 85px, 0); }
    10% { clip: rect(78px, 9999px, 5px, 0); }
    15% { clip: rect(98px, 9999px, 43px, 0); }
    20% { clip: rect(2px, 9999px, 60px, 0); }
    100% { clip: rect(2px, 9999px, 60px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(85px, 9999px, 140px, 0); }
    5% { clip: rect(56px, 9999px, 12px, 0); }
    10% { clip: rect(100px, 9999px, 4px, 0); }
    15% { clip: rect(2px, 9999px, 90px, 0); }
    20% { clip: rect(70px, 9999px, 110px, 0); }
    100% { clip: rect(70px, 9999px, 110px, 0); }
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.anime-fade-in {
    animation: messageSlide 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.6;
        box-shadow: 0 0 5px #00ff66;
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 15px #00ff66, 0 0 5px #00ff66;
    }
}

.glow-pulse {
    animation: pulseGlow 2s infinite ease-in-out;
}

/* 
  =========================================
  Responsive Media Queries
  =========================================
*/

/* Mobile-only visibility helper */
.mobile-only {
    display: none !important;
}

/* Prevent iOS Mobile Safari zoom on focus */
input[type="text"],
input[type="password"] {
    font-size: 16px;
}

@media (max-width: 1024px) {
    .rooms-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .realm-showcase {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .mobile-only {
        display: inline-flex !important;
    }
    
    .content-wrapper {
        padding: 15px;
    }

    /* Keep Header Row-Aligned and Slim on Mobile */
    .global-header {
        padding: 10px 15px;
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center;
        gap: 0;
    }
    .global-header .logo {
        font-size: 1.1rem;
    }
    .global-header .logo-kanji {
        font-size: 1.3rem;
    }
    .global-header .user-badge {
        display: none !important; /* Managed in sidebar drawer */
    }
    .global-header .btn-text {
        display: none !important; /* Hide button labels, icons only */
    }
    .global-header .btn {
        padding: 8px 12px;
    }

    /* Login / Register Layout */
    .form-cols {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    .auth-card {
        padding: 25px;
    }

    /* Lobby Dashboard */
    .rooms-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .realm-showcase {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .glitch-title {
        font-size: 2.2rem;
        letter-spacing: 2px;
    }

    /* Immersive Chatroom Sidebar Drawer */
    .chat-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        background: rgba(10, 10, 16, 0.98);
        backdrop-filter: blur(20px);
        z-index: 1050;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--panel-border);
        padding: 20px;
        display: flex;
        flex-direction: column;
        gap: 20px;
        transition: transform var(--transition-medium);
        box-shadow: none;
    }
    
    .chat-sidebar.sidebar-open {
        transform: translateX(300px);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.8);
    }

    .sidebar-header-wrapper {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-bottom: 15px;
        margin-bottom: 10px;
    }

    .sidebar-header-wrapper .sidebar-title {
        border-bottom: none;
        padding-bottom: 0;
    }

    .btn-close-sidebar {
        width: 34px;
        height: 34px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .sidebar-mobile-actions {
        margin-top: auto;
        display: flex;
        flex-direction: column;
        gap: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        padding-top: 20px;
    }

    .user-badge-mobile {
        display: flex;
        align-items: center;
        gap: 10px;
        background: rgba(255, 255, 255, 0.04);
        padding: 8px 15px;
        border-radius: 20px;
        justify-content: center;
        margin-bottom: 5px;
    }

    .user-badge-mobile .username {
        font-weight: 600;
        font-size: 0.95rem;
    }

    .sidebar-mobile-actions .nav-btn {
        width: 100%;
        justify-content: center;
    }

    /* Chat UI adjustments for Mobile Viewports */
    .chat-interface-wrapper {
        grid-template-columns: 1fr;
        height: calc(100vh - 150px);
        min-height: auto;
        gap: 0;
    }

    .chat-main-panel {
        border-radius: 12px;
        height: 100%;
    }

    .chat-header {
        padding: 12px 15px;
    }

    .chat-header-left {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .sidebar-toggle-btn {
        width: 38px;
        height: 38px;
        padding: 0;
        justify-content: center;
        border-radius: 6px;
        flex-shrink: 0;
    }

    .chat-header-info h2 {
        font-size: 1.1rem;
    }

    .chat-subtitle {
        font-size: 0.75rem;
        max-width: 160px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .chat-header-bot {
        padding: 4px 10px;
        font-size: 0.72rem;
    }
    
    .chat-header-bot .bot-presence-name {
        display: none; /* Hide 'Active Bot: Goku' text to save space */
    }
    
    .chat-header-bot::after {
        content: ' Bot'; /* Just display 'Bot' next to the green status dot */
    }

    .chat-messages-container {
        padding: 15px;
        max-height: none;
        min-height: auto;
    }

    .message-bubble-wrapper {
        max-width: 90%;
    }

    .msg-text {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .chat-input-wrapper {
        padding: 12px 15px;
        gap: 10px;
    }

    .chat-input-wrapper input {
        padding: 10px 18px;
    }

    .btn-send {
        width: 40px;
        height: 40px;
    }

    /* Sidebar drawer dark background overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(3px);
        z-index: 1040;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-fast);
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
}
