:root {
    --gemini-bg: #131314;
    --gemini-sidebar: #1e1f20;
    --gemini-text: #ffffff;
    --gemini-dim: #b4b4b4;
    --gemini-blue: #4285f4;
    --gemini-input: #1e1f20;
    --status-color: var(--gemini-blue);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Google Sans', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

body {
    background-color: var(--gemini-bg);
    color: var(--gemini-text);
}

/* App Layout */
.app-container { 
    display: flex; 
    width: 100%; 
    height: 80dvh; 
    margin-top: 10dvh;
    overflow: hidden;
}

aside {
    width: 280px;
    height: 100%;
    background: var(--gemini-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 500;
}

.sidebar-header .gemini-logo-small {
    width: 28px;
    height: 28px;
    background: url('https://www.gstatic.com/lamda/images/gemini_sparkle_v002_d4735304ff6292a694845.svg') no-repeat center;
    background-size: contain;
}

nav { flex: 1; overflow-y: auto; padding: 10px; }
.section-title { color: var(--gemini-dim); font-size: 11px; padding: 10px 15px; text-transform: uppercase; letter-spacing: 1px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--gemini-text);
    background: transparent;
    border: none;
    text-align: left;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 4px;
    font-size: 14px;
    opacity: 0.8;
    transition: background 0.2s, opacity 0.2s;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.06); opacity: 1; }
.nav-item.logout { color: #ff4d4d; }

.nav-footer { padding: 20px; border-top: 1px solid rgba(255, 255, 255, 0.05); }

main { flex: 1; display: flex; flex-direction: column; position: relative; background: var(--gemini-bg); min-width: 0; }

header {
    height: 64px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-left { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 500; }
.sparkle-logo { cursor: pointer; display: inline-block; transition: transform 0.3s; }
.sparkle-logo:active { transform: scale(1.2); }

.header-right { display: flex; align-items: center; gap: 16px; }

.ai-pro-text {
    font-size: 13px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 8px;
    background: linear-gradient(90deg, #4285f4, #9b72cb, #d96570, #4285f4);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmerText 3s linear infinite;
    border: 1px solid rgba(155, 114, 203, 0.2);
}

@keyframes shimmerText { to { background-position: 200% center; } }

.timer-container { position: relative; width: 32px; height: 32px; }
.timer-container svg { transform: rotate(-90deg); width: 32px; height: 32px; }
.timer-container circle { fill: none; stroke-width: 3; }
.timer-container .bg { stroke: rgba(255,255,255,0.05); }
.timer-container .progress {
    stroke: var(--status-color);
    stroke-dasharray: 88;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-btn {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: none; border: none; font-size: 12px;
    color: var(--gemini-dim); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-weight: bold;
}

/* Chat Window */
#chat-window { flex: 1; overflow-y: auto; padding: 20px 0; display: flex; flex-direction: column; }
#chat-inner { width: 100%; max-width: 800px; margin: 0 auto; padding: 0 20px; }

.message-row { margin-bottom: 35px; display: flex; gap: 20px; width: 100%; animation: fadeIn 0.4s ease-out; }

.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    font-size: 18px; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.avatar.ai {
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
}

.avatar.ai.colorful-sparkle {
    background: linear-gradient(45deg, #4285f4, #9b72cb, #d96570, #4285f4);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: premiumSparkle 4s infinite ease-in-out, gradientShift 3s ease infinite;
    filter: drop-shadow(0 0 5px rgba(155, 114, 203, 0.3));
}

.avatar.ai.white-sparkle {
    background: none;
    -webkit-text-fill-color: #fff;
    opacity: 0.8;
    animation: none;
    filter: none;
}

.avatar.user { background: #5f6368; color: #fff; }

.msg-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }

.msg-text {
    line-height: 1.6;
    font-size: 15px;
    color: rgba(255,255,255,0.95);
    word-break: break-word;
}

.msg-text.glass { background: transparent; padding: 0; border: none; }

.msg-text.revealed {
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    border-left: 3px solid var(--gemini-blue);
    padding: 15px;
    background: rgba(66, 133, 244, 0.08);
    border-radius: 0 12px 12px 0;
}

.timestamp { font-size: 11px; color: var(--gemini-dim); font-family: 'Roboto Mono', monospace; }

/* Thinking Area */
.thinking-area {
    width: 100%; max-width: 800px; margin: 0 auto;
    padding: 0 20px 24px; display: flex; align-items: flex-start; gap: 20px;
}

.thinking-sparkle {
    width: 36px; height: 36px; border-radius: 50%;
    background: #222; display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff; flex-shrink: 0; position: relative; overflow: hidden;
}

.thinking-sparkle.active {
    background: linear-gradient(45deg, #4285f4, #9b72cb, #d96570, #4285f4);
    background-size: 300% 300%;
    animation: sparklePulse 2s infinite, gradientShift 3s ease infinite;
}

@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes sparklePulse { 0% { transform: scale(1); box-shadow: 0 0 0 rgba(66, 133, 244, 0); } 50% { transform: scale(1.1); box-shadow: 0 0 15px rgba(155, 114, 203, 0.3); } 100% { transform: scale(1); box-shadow: 0 0 0 rgba(66, 133, 244, 0); } }

.thinking-content { flex: 1; }
.thinking-main-text { font-size: 14px; color: var(--gemini-blue); font-weight: 500; margin-bottom: 6px; }

.shimmer-line { height: 8px; width: 60%; background: #222; border-radius: 4px; position: relative; overflow: hidden; margin-bottom: 8px; }
.shimmer-line::after {
    content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    animation: shimmer 2s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.status-log { font-size: 11px; color: var(--gemini-dim); font-family: 'Roboto Mono', monospace; opacity: 0.6; }

/* Input Area */
.input-outer { 
    padding: 12px 20px calc(15px + env(safe-area-inset-bottom, 12px)); 
    background: var(--gemini-bg); 
    display: flex; 
    justify-content: center; 
}
.input-wrapper {
    width: 100%; max-width: 800px; background: var(--gemini-input);
    border-radius: 32px; padding: 6px 20px; display: flex; align-items: center; gap: 15px;
    border: 1px solid rgba(255,255,255,0.05); transition: border-color 0.3s;
}
.input-wrapper:focus-within { border-color: rgba(66, 133, 244, 0.3); }

#message-input {
    flex: 1; background: none; border: none; color: var(--gemini-text);
    font-size: 16px; outline: none; padding: 12px 0; -webkit-text-security: disc;
}

#send-btn, #attach-btn, #view-text-btn {
    background: none; border: none; color: var(--gemini-dim);
    font-size: 20px; cursor: pointer; display: flex; align-items: center; padding: 6px;
    transition: color 0.2s;
}

#send-btn { color: var(--gemini-blue); font-size: 26px; }
#send-btn:hover { color: #fff; }

/* Modals */
.modal {
    display: none; position: fixed;
    top: 0; left: 0; width: 100%; height: 100dvh;
    background: rgba(0, 0, 0, 0.85); z-index: 2000;
    justify-content: center; align-items: center;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    width: 90%; max-width: 440px; padding: 40px;
    border-radius: 32px; text-align: center;
    background: var(--gemini-sidebar);
    border: 1px solid var(--glass-border);
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}

.modal-content h2 { font-size: 22px; font-weight: 500; margin-bottom: 25px; }

.modal-buttons { display: flex; flex-direction: column; gap: 12px; margin-top: 30px; }
.modal-buttons button {
    padding: 14px; border-radius: 16px; border: none; cursor: pointer;
    font-size: 15px; font-weight: 500; transition: background 0.2s;
}

.modal-buttons .btn-save { background: var(--gemini-blue); color: #fff; }
.modal-buttons .btn-cancel { background: rgba(255,255,255,0.05); color: var(--gemini-dim); }
.modal-buttons .btn-save:hover { opacity: 0.9; }
.modal-buttons .btn-cancel:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Utils */
.hidden { display: none !important; }

@media (max-width: 768px) {
    aside { position: fixed; left: 0; top: 0; height: 100dvh; transform: translateX(-100%); width: 80%; max-width: 300px; }
    aside.active { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,0.6); }
    #menu-toggle { display: block; }
    
    #chat-inner { padding: 0 12px; }
    .message-row { gap: 12px; margin-bottom: 24px; }
    .avatar { width: 32px; height: 32px; font-size: 16px; }
    .msg-text { font-size: 14px; }
    .thinking-area { gap: 12px; padding: 0 12px 16px; }
    .thinking-sparkle { width: 32px; height: 32px; font-size: 18px; }
    
    .input-outer { padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); }
    .input-wrapper { gap: 10px; padding: 4px 14px; }
    #message-input { font-size: 15px; }
    
    .login-container { width: 90%; padding: 40px 24px; }
    .gemini-ai-text { font-size: 28px; }
}

#menu-toggle { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 8px; margin-left: -8px; }

.image-camouflage {
    background: rgba(255,255,255,0.03); border-radius: 16px;
    padding: 20px; display: flex; align-items: center; gap: 15px;
    color: var(--gemini-dim); font-size: 13px; border: 1px dashed rgba(255,255,255,0.1);
}

.real-img { max-width: 100%; border-radius: 16px; border: 2px solid var(--gemini-blue); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }

.burn-timer { font-size: 12px; color: #ff4d4d; margin-top: 8px; font-weight: bold; display: flex; align-items: center; gap: 5px; }
