/* Core Portal Container */
.portal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0b0f19; /* Deep, sophisticated dark blue-gray */
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Vibrant Ambient Glowing Orbs */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.25;
    pointer-events: none;
    z-index: 1;
    animation: pulseGlow 8s infinite alternate ease-in-out;
}
.orb-1 {
    top: -10%;
    right: 10%;
    width: 500px;
    height: 500px;
    background: linear-gradient(45deg, #ff7b00, #ffae00);
}
.orb-2 {
    bottom: -10%;
    left: 10%;
    width: 600px;
    height: 600px;
    background: linear-gradient(45deg, #8a2be2, #4a00e0);
    animation-delay: -4s;
}

@keyframes pulseGlow {
    0% { transform: scale(1) translate(0, 0); opacity: 0.2; }
    100% { transform: scale(1.2) translate(30px, -40px); opacity: 0.35; }
}

/* Layout Content Wrapper */
.portal-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1150px;
    padding: 40px;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 60px;
    align-items: center;
}

/* Left Side: Hero Column */
.portal-hero {
    color: #ffffff;
}
.brand-badge {
    display: inline-block;
    background: rgba(255, 123, 0, 0.15);
    border: 1px solid rgba(255, 123, 0, 0.3);
    color: #ff9100;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
}
.portal-title {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 20px 0;
    letter-spacing: -1px;
}
.gradient-text {
    background: linear-gradient(135deg, #ff7b00 0%, #ffae00 50%, #e0a0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.portal-subtitle {
    font-size: 1.1rem;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 32px;
}
.feature-pills {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #cbd5e1;
}

/* Right Side: Sophisticated Glassmorphic Card Terminal */
.portal-card {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.15); /* Sleek reflection line */
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 
                inset 0 1px 0 rgba(255,255,255,0.1);
    transition: border-color 0.4s ease;
}
.portal-card:focus-within {
    border-color: rgba(255, 123, 0, 0.4);
}
.card-header h2 {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 8px 0;
}
.card-header p {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0 0 32px 0;
    line-height: 1.4;
}

/* Form Styling Elements */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 28px;
}
.input-group label {
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    left: 16px;
    font-size: 1.1rem;
    opacity: 0.6;
}
.input-wrapper input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 16px 16px 48px;
    border-radius: 14px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}
.input-wrapper input:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.4);
    border-color: #ff7b00;
    box-shadow: 0 0 15px rgba(255, 123, 0, 0.15);
}

/* Vibrant Action Button */
.prime-btn {
    width: 100%;
    background: linear-gradient(135deg, #ff7b00 0%, #ff9100 100%);
    border: none;
    padding: 16px;
    border-radius: 14px;
    color: #000;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px rgba(255, 123, 0, 0.3);
}
.prime-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(255, 123, 0, 0.45);
    background: linear-gradient(135deg, #ff8c1a 0%, #ffaa1a 100%);
}
.prime-btn:active {
    transform: translateY(1px);
}
.prime-btn svg {
    transition: transform 0.3s ease;
}
.prime-btn:hover svg {
    transform: translateX(4px);
}

/* Responsive Scaling Rules */
@media (max-width: 968px) {
    .portal-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    .feature-pills {
        justify-content: center;
    }
    .brand-badge { margin: 0 auto 20px auto; }
}

/* Chat UI Styling */
.msg.user {
    display: flex;
    flex-direction: column;
    align-items: flex-end; 
    background: transparent !important;
    border: none !important;
    padding: 4px 10px !important;
}

.msg-username-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5); 
    margin-bottom: 3px;
    font-weight: 600;
    text-transform: capitalize;
}

.msg-text-payload {
    background: #ffb700;
    color: #000;
    padding: 10px 14px;
    border-radius: 12px 12px 2px 12px;
    font-size: 0.95rem;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

:root {
    --bg-color: #0b0c10;
    --card-bg: #1f2833;
    --text-color: #c5c6c7;
    
    /* Dynamic character theme variables initialized to Goku (Default) */
    --neon-cyan: #FF6600;
    --neon-purple: #ffb703;
    --bubble-bg: rgba(255, 102, 0, 0.15);
}
body {
    font-family: 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: -webkit-fill-available;
}
html { height: -webkit-fill-available; }

header {
    background: linear-gradient(90deg, var(--card-bg), #000);
    padding: 15px 20px;
    text-align: center;
    border-bottom: 2px solid var(--neon-cyan);
    box-shadow: 0 0 15px var(--neon-cyan);
    flex-shrink: 0;
    transition: all 0.4s ease;
    z-index: 10;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}
header h1 { margin: 0 auto; color: #fff; font-size: 22px; letter-spacing: 2px; }
header span { color: var(--neon-cyan); transition: all 0.4s ease; }

/* Audio Control Button Layout */
/* Power Level Gauge */
.power-gauge-wrapper {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    width: 150px;
}
.power-label {
    font-size: 0.7rem;
    color: var(--neon-cyan);
    font-weight: 700;
    text-transform: uppercase;
}
.power-bar {
    width: 100%;
    height: 6px;
    background: #11141a;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.power-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    width: 30%; /* Start at 30% for demo */
    transition: width 0.5s ease;
}

.main-container { display: flex; flex: 1; overflow: hidden; }

/* Sidebar layout styling */
.sidebar {
    width: 260px;
    background-color: #11141a;
    border-right: 1px solid #2d3748;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex-shrink: 0;
}
.sidebar h3 { margin-top: 0; border-bottom: 1px solid #2d3748; padding-bottom: 10px; font-size: 16px; }

.char-card {
    background: var(--card-bg);
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.char-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, var(--neon-cyan), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.char-card:hover {
    border-color: var(--neon-cyan);
    transform: translateX(5px);
}

.char-card:hover::before {
    opacity: 0.15;
}

.char-card.active {
    border-color: var(--neon-cyan) !important;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.sidebar-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #2d3748;
    object-fit: cover;
    transition: all 0.4s ease;
    flex-shrink: 0;
    z-index: 1;
}

.char-card:hover .sidebar-avatar {
    border-color: var(--neon-cyan);
    transform: scale(1.05);
}

@keyframes auraPulse {
    0% { box-shadow: 0 0 8px var(--bubble-bg), inset 0 0 4px rgba(255,255,255,0.05); border-color: var(--neon-cyan); }
    50% { box-shadow: 0 0 18px var(--neon-cyan), inset 0 0 8px var(--bubble-bg); border-color: #fff; }
    100% { box-shadow: 0 0 8px var(--bubble-bg), inset 0 0 4px rgba(255,255,255,0.05); border-color: var(--neon-cyan); }
}

/* Centralized Chat Container Layout */
.chat-area { flex: 1; display: flex; flex-direction: column; background: #151922; overflow: hidden; }

/* Chat Window Header Styling */
.chat-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 30px;
    background: #1a1f29;
    border-bottom: 1px solid #2d3748;
    flex-shrink: 0;
    animation: headerBreath 4s infinite ease-in-out;
}

@keyframes headerBreath {
    0%, 100% { border-bottom-color: #2d3748; }
    50% { border-bottom-color: var(--neon-cyan); }
}
.chat-header img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--neon-cyan);
    background: #11141a;
    object-fit: cover;
    transition: border-color 0.4s ease;
}
.chat-header h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

/* Fixed wide layout by using a centralized column container */
.chat-messages { 
    flex: 1; 
    padding: 20px 30px; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    gap: 18px; 
    max-width: 850px; 
    width: 100%; 
    margin: 0 auto; 
    box-sizing: border-box;
    padding-bottom: 40px;
}

/* Character Specific Bubble Styles */
.msg.bot.Goku { border-left-color: #FF6600; }
.msg.bot.Naruto { border-left-color: #FFA500; border-radius: 12px 12px 12px 2px; }
.msg.bot.Sasuke { border-left-color: #00E5FF; border-radius: 2px 12px 12px 12px; }
.msg.bot.Sakura { border-left-color: #FFB7C5; border-radius: 12px 2px 12px 12px; }
.msg.bot.Sarada { border-left-color: #E53935; border-radius: 12px 12px 2px 12px; }
.msg.user { background-color: var(--neon-purple); color: #fff; align-self: flex-end; box-shadow: 0 4px 12px var(--bubble-bg); }

.msg.system-status {
    background: var(--bubble-bg);
    color: var(--neon-cyan);
    align-self: center;
    font-size: 12px;
    border: 1px dashed var(--neon-cyan);
    padding: 6px 14px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* Centralized Lower Input Bar Layout */
.chat-input-wrapper { background: #0b0c10; border-top: 1px solid #2d3748; flex-shrink: 0; }
.chat-input-area { max-width: 850px; margin: 0 auto; padding: 15px 20px; display: flex; gap: 12px; box-sizing: border-box; }

input[type="text"] { flex: 1; background: #1f2833; border: 1px solid #2d3748; border-radius: 6px; padding: 14px; color: #fff; outline: none; font-size: 16px; transition: all 0.3s ease; }
input[type="text"]:focus { border-color: var(--neon-cyan); box-shadow: 0 0 10px var(--bubble-bg); background: #232d3a; }

button { background: var(--neon-cyan); color: #000; border: none; padding: 0 24px; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 15px; transition: all 0.3s ease; }
button:hover { box-shadow: 0 0 15px var(--neon-cyan); transform: translateY(-1px); }
button:active { transform: translateY(0); }

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .main-container { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; padding: 10px; gap: 10px; overflow-x: auto; overflow-y: hidden; border-right: none; border-bottom: 1px solid #2d3748; box-sizing: border-box; }
    .sidebar h3 { display: none; }
    .char-card { padding: 8px 12px; min-width: 130px; justify-content: center; gap: 8px; }
    .sidebar-avatar { width: 28px; height: 28px; }
    .sidebar-info p { display: none; }
    .chat-messages { padding: 15px; }
    #music-toggle { 
        padding: 8px 14px;
        font-size: 13px;
        background: rgba(0, 0, 0, 0.4);
        color: var(--neon-cyan);
        border: 1px solid var(--neon-cyan);
        border-radius: 6px;
        font-weight: bold;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    }
    #music-toggle:hover {
        box-shadow: 0 0 12px var(--neon-cyan);
        background: rgba(0, 0, 0, 0.6);
    }
    header { padding: 10px 15px; flex-direction: row; justify-content: space-between; }
    header h1 { margin: 0; font-size: 16px; }
    .chat-header { padding: 10px 15px; gap: 10px; }
    .chat-header img { width: 35px; height: 35px; }
    .chat-header h2 { font-size: 16px; }
}

/* Leaderboard Panel */
#leaderboard-panel {
    position: fixed;
    top: 50px;
    right: 20px;
    width: 250px;
    background: var(--card-bg);
    border: 1px solid var(--neon-cyan);
    border-radius: 12px;
    padding: 20px;
    z-index: 100;
    transition: transform 0.3s ease;
}
#leaderboard-panel.hidden { transform: translateX(300px); }
#leaderboard-panel h3 { margin-top: 0; color: #fff; }
#leaderboard-list { display: flex; flex-direction: column; gap: 8px; }
.leaderboard-item { display: flex; justify-content: space-between; color: #fff; font-size: 0.9rem; }

/* Surge Animation */
.surge-body { animation: surge 0.5s ease-in-out; }
@keyframes surge {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.02); filter: brightness(2) hue-rotate(90deg); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* Awakening Aura Effect */
.awakened-aura {
    animation: awakenedPulse 1.5s infinite alternate;
}

@keyframes awakenedPulse {
    0% { box-shadow: 0 0 10px var(--neon-cyan); border-color: var(--neon-cyan); }
    100% { box-shadow: 0 0 30px #ffffff, 0 0 50px var(--neon-cyan); border-color: #fff; }
}
