:root {
    --model-offset-bottom: -155px;
    --chat-offset-bottom: -200px;
    --costume-btn-offset: -20px;
    --scale-factor: 1.1;
    --global-offset-x: 33px;
    --icon-offset-x: -6px;
    --costume-icon-offset-x: -6px;
    --toggle-chat-icon-offset-x: -2px;
    --right-offset: 15px;
    --chat-box-offset-x: 30px;
    --summary-icon-offset-x: -3px;
}

.live2d-wrapper {
    position: fixed;
    right: var(--right-offset);
    bottom: var(--model-offset-bottom);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    gap: 15px;
    width: calc(270px * var(--live2d-wrapper-width) / 100);
    height: calc(600px * var(--live2d-wrapper-height) / 100);
    transform: none;
}

.model-container {
    position: relative;
    width: 300px;
    height: 650px;
    right: var(--right-offset);
    transform: none;
}

.chat-box {
    position: absolute;
    bottom: calc(100% + var(--chat-offset-bottom));
    right: var(--right-offset);
    width: 380px;
    height: 286px;
    background: rgba(255, 246, 191, 0.85);
    border-radius: 12px 12px 0 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(6px);
    transition: all 0.3s ease;
    opacity: 0.9;
    padding: 12px;
    display: flex;
    flex-direction: column;
    transform-origin: bottom right;
    transform: translateX(var(--chat-box-offset-x)) scaleY(1);
    overflow: hidden;
}

.chat-box.hidden {
    transform: scaleY(0);
    opacity: 0;
    pointer-events: none;
}

.chat-box:hover {
    opacity: 1;
    transform: translateX(var(--chat-box-offset-x)) scaleY(1) translateY(-2px);
}

.messages {
    flex: 1;
    overflow-y: auto;
    max-height: 100%;
    margin-bottom: 12px;
}

.message {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.4;
    animation: fadeIn 0.25s ease;
    word-wrap: break-word;
    white-space: pre-wrap;
    max-width: 85%;
}

.message[style*="marginLeft: 20%"] {
    margin-right: 2%;
    max-width: 78%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-area {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.message-input {
    flex: 1;
    border: none;
    background: rgba(255, 253, 237, 0.9);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    min-width: 160px;
}

.send-btn {
    all: unset;
    background: rgba(255, 186, 73, 0.9);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #ff9f1a;
}

.costume-btn {
    position: absolute;
    right: calc(var(--right-offset) + var(--costume-btn-offset));
    top: 38%;
    background: #fff3cd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #ffe08a;
    transform: scale(var(--scale-factor));
}

.costume-btn:hover {
    transform: scale(var(--scale-factor));
    filter: drop-shadow(0 0 8px rgba(255, 159, 26, 0.3));
}

.fa-tshirt {
    color: #ff9f1a;
    font-size: 20px;
}

.costume-btn i {
    transform: translateX(var(--costume-icon-offset-x));
}

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 200, 100, 0.6);
    border-radius: 3px;
}

.typing-indicator {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    margin: 6px 0;
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.dot {
    width: 6px;
    height: 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-6px);
    }
}

.loading-dots:after {
    content: '...';
    animation: dots 1s steps(5, end) infinite;
    display: inline-block;
    width: 20px;
}

@keyframes dots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60% {
        content: '...';
    }
    80%, 100% {
        content: '';
    }
}

.toggle-chat-btn {
    position: absolute;
    right: calc(var(--right-offset) + var(--costume-btn-offset));
    top: calc(38% + 100px);
    background: #fff3cd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #ffe08a;
    transform: scale(var(--scale-factor));
}

.toggle-chat-btn:hover {
    transform: scale(var(--scale-factor));
    filter: drop-shadow(0 0 8px rgba(255, 159, 26, 0.3));
}

.toggle-chat-btn i {
    transform: translateX(var(--toggle-chat-icon-offset-x));
}

.toggle-chat-btn i {
    color: #ff9f1a;
    font-size: 20px;
    transition: all 0.3s ease;
}

.summary-btn {
    position: absolute;
    right: calc(var(--right-offset) + var(--costume-btn-offset));
    top: calc(38% + 50px);
    background: #fff3cd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #ffe08a;
    transform: scale(var(--scale-factor));
}

.summary-btn:hover {
    transform: scale(var(--scale-factor));
    filter: drop-shadow(0 0 8px rgba(255, 159, 26, 0.3));
}

.summary-btn i {
    transform: translateX(var(--summary-icon-offset-x));
    color: #ff9f1a;
    font-size: 20px;
    transition: color 0.3s ease;
}

.chat-box, 
.message, 
.message-input, 
.send-btn, 
.costume-btn, 
.toggle-chat-btn, 
.typing-indicator, 
.loading-dots {
    font-family: 'Roboto', sans-serif;
}