@charset "UTF-8";

/* --- Keiko UI CSS (Dark Slate/Blue Theme) --- */

/* Launcher Button */
#keiko-launcher {
    position: fixed;
    bottom: 110px;
    /* Adjusted to avoid overlap with existing buttons */
    right: 30px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
    /* Cyan Glow */
    transition: all 0.3s ease-in-out;
    z-index: 9999;
    background: #0f172a;
    /* Slate 900 */
    border: 2px solid rgba(56, 189, 248, 0.6);
    /* Cyan Border */
}

#keiko-launcher img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    /* Focus on face */
    filter: grayscale(0%);
    transition: all 0.3s ease-in-out;
}

#keiko-launcher:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.8), 0 0 60px rgba(56, 189, 248, 0.4);
    /* Intense Glow */
    border-color: #38bdf8;
}

/* Tablet UI Modal */
#keiko-tablet {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 600px;
    height: 80%;
    max-height: 700px;

    /* Glassmorphism Background */
    background-color: rgba(15, 23, 42, 0.85);
    /* Slate 900 with opacity */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);

    /* Stronger Glowing Border */
    border: 1px solid rgba(56, 189, 248, 0.5);
    box-shadow:
        0 0 30px rgba(56, 189, 248, 0.2),
        0 0 100px rgba(56, 189, 248, 0.1),
        inset 0 0 20px rgba(56, 189, 248, 0.05);

    border-radius: 16px;
    z-index: 10000;

    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Initial State for JS Transition */
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}

/* Active State (toggled by JS) */
#keiko-tablet.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.tablet-header {
    padding: 18px 25px;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.9));
    border-bottom: 1px solid rgba(56, 189, 248, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    height: 24px;
    width: auto;
    filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.5));
    /* Logo Glow */
}

.tablet-header h3 {
    margin: 0;
    color: #e0f2fe;
    /* Light Blue Text */
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.close-button {
    color: rgba(56, 189, 248, 0.7);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
}

.close-button:hover {
    color: #38bdf8;
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.8);
    transform: scale(1.1);
}

/* Content Area */
.tablet-content {
    flex-grow: 1;
    padding: 25px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;

    /* Scrollbar Styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 189, 248, 0.3) transparent;
}

/* Webkit Scrollbar */
.tablet-content::-webkit-scrollbar {
    width: 6px;
}

.tablet-content::-webkit-scrollbar-thumb {
    background-color: rgba(56, 189, 248, 0.3);
    border-radius: 3px;
}

/* Animation: Breathing + Subtle Float */
@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

/* Animation: Eye blink / Light Sheen */
@keyframes light-sheen {

    0%,
    90% {
        opacity: 0;
        left: -100%;
    }

    95% {
        opacity: 0.3;
        left: 100%;
    }

    100% {
        opacity: 0;
        left: 200%;
    }
}

.keiko-video-area {
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 250px;
    background-color: transparent !important;
    /* Transparent background */
    border: none !important;
    margin-bottom: 25px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.keiko-static-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Show full image */
    object-position: center bottom;
    /* Anchor bottom */
    /* Fix face cropping */
    animation: breathe 5s ease-in-out infinite;
    filter: brightness(1.08) contrast(1.05);
    /* Enhance visual pop */
    /* Optional: Add a subtle overlay for "Glassmorphism integration" */
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    position: relative;
    z-index: 1;
}

/* Light Sheen Overlay (Simulating movement/life) */
.keiko-video-area::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(56, 189, 248, 0.2) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    z-index: 2;
    animation: light-sheen 6s infinite ease-in-out;
    pointer-events: none;
}

/* Typing Effect Area */
.typing-indicator {
    display: inline-block;
    font-style: italic;
    color: #38bdf8;
    font-size: 0.8rem;
    margin-bottom: 5px;
    opacity: 0;
    transition: opacity 0.3s;
}

.typing-indicator span {
    animation: blink 1.4s infinite both;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0% {
        opacity: 0.2;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0.2;
    }
}

/* Chat Log */
.chat-log {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    background: rgba(30, 41, 59, 0.7);
    color: #e2e8f0;
    padding: 16px 20px;
    border-radius: 12px;
    border-top-left-radius: 2px;
    border: 1px solid rgba(56, 189, 248, 0.1);
    font-size: 0.95rem;
    line-height: 1.7;
    position: relative;
    min-height: 80px;
    /* Prevent collapse */
    display: flex;
    align-items: center;
}

.chat-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #38bdf8 0%, transparent 70%);
}

/* Footer & Input */
.tablet-footer {
    padding: 20px;
    background-color: rgba(15, 23, 42, 0.8);
    border-top: 1px solid rgba(56, 189, 248, 0.2);
    display: flex;
    gap: 12px;
}

.tablet-footer input {
    flex-grow: 1;
    padding: 12px 16px;
    background-color: rgba(30, 41, 59, 1);
    border: 1px solid rgba(71, 85, 105, 1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.tablet-footer input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.tablet-footer button {
    padding: 0 24px;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.3);
}

.tablet-footer button:hover {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.5);
    transform: translateY(-1px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #keiko-tablet {
        width: 95%;
        height: 92%;
        border-radius: 12px;
    }

    #keiko-launcher {
        width: 60px;
        height: 60px;
        bottom: 90px;
        right: 20px;
    }

    .tablet-header {
        padding: 15px;
    }

    .tablet-footer {
        padding: 15px;
    }
}