* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tahoma', 'Arial', sans-serif;
    background: linear-gradient(135deg, #0a192f, #1a3a5f);
    color: #e6f1ff;
    line-height: 1.6;
    padding: 20px;
    height: 100vh;
    overflow: hidden;
}

@media (min-width: 768px) {
    body {
        padding: 30px;
    }
    
    .chat-container {
        max-width: 900px;
        margin: 0 auto;
        height: calc(100vh - 60px);
        max-height: calc(100vh - 60px);
    }
    
    .messages {
        height: 500px;
    }
    
    .message-content {
        max-width: 65%;
    }
    
    .input-area {
        padding: 20px;
    }
    
    .quick-buttons {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) and (min-width: 480px) {
    body {
        padding: 15px;
    }
    
    .chat-container {
        max-width: 95%;
        margin: 0 auto;
        height: calc(100vh - 30px);
        max-height: calc(100vh - 30px);
    }
    
    .messages {
        height: 450px;
    }
    
    .message-content {
        max-width: 75%;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .input-area {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .chat-container {
        width: 100%;
        height: calc(100vh - 20px); 
        max-height: calc(100vh - 20px);
        border-radius: 10px;
    }
    
    .messages {
        height: calc(100% - 150px);
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .header p {
        font-size: 14px;
    }
    
    .input-area {
        padding: 10px;
        flex-direction: column;
    }
    
    .input-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    
    .send-btn {
        width: 100%;
    }
    
    .quick-buttons {
        max-height: 70px;
    }
    
    .quick-btn {
        flex: 0 0 auto;
        font-size: 11px;
        padding: 5px 8px;
        min-width: 70px;
        max-width: 120px;
        height: 32px;
    }
}

.chat-container {
    background: rgba(13, 27, 42, 0.9);
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 183, 255, 0.15);
    border: 1px solid rgba(0, 183, 255, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #00b7ff, #0066cc);
    color: white;
    padding: 25px 20px;
    text-align: center;
    position: relative;
    border-bottom: 2px solid rgba(0, 183, 255, 0.3);
}

.header h1 {
    margin-bottom: 10px;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header p {
    opacity: 0.9;
    font-size: 16px;
}

.device-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.15);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(10px);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(10, 25, 47, 0.7);
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
}

.message {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.user-message {
    justify-content: flex-end;
}

.message-content {
    padding: 12px 18px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.user-message .message-content {
    background: linear-gradient(135deg, #00b7ff, #0066cc);
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: 0 3px 10px rgba(0, 183, 255, 0.3);
}

.bot-message .message-content {
    background: rgba(30, 58, 90, 0.8);
    color: #e6f1ff;
    border: 1px solid rgba(0, 183, 255, 0.2);
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.input-area {
    padding: 20px;
    background: rgba(13, 27, 42, 0.95);
    border-top: 1px solid rgba(0, 183, 255, 0.2);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#userInput {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid rgba(0, 183, 255, 0.3);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    transition: 0.3s;
    background: rgba(20, 40, 60, 0.8);
    color: #e6f1ff;
}

#userInput:focus {
    outline: none;
    border-color: #00b7ff;
    box-shadow: 0 0 10px rgba(0, 183, 255, 0.5);
}

#userInput::placeholder {
    color: rgba(230, 241, 255, 0.5);
}

.send-btn {
    background: linear-gradient(135deg, #00b7ff, #0066cc);
    color: white;
    border: none;
    padding: 0 25px;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
    min-width: 100px;
    font-weight: bold;
}

.send-btn:hover {
    background: linear-gradient(135deg, #00a3e6, #0055aa);
    box-shadow: 0 0 15px rgba(0, 183, 255, 0.5);
}

.quick-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    padding: 10px 0 15px 0;
    margin-top: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 183, 255, 0.3) rgba(13, 27, 42, 0.9);
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
    width: 100%;
    background: linear-gradient(to bottom, 
        rgba(13, 27, 42, 0.95) 0%, 
        rgba(13, 27, 42, 0.95) 50%, 
        rgba(20, 40, 65, 0.95) 50%, 
        rgba(20, 40, 65, 0.95) 100%);
    border-radius: 8px;
    border: 1px solid rgba(0, 183, 255, 0.15);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.quick-buttons::-webkit-scrollbar {
    height: 6px;
}

.quick-buttons::-webkit-scrollbar-track {
    background: rgba(13, 27, 42, 0.9);
    border-radius: 3px;
}

.quick-buttons::-webkit-scrollbar-thumb {
    background: rgba(0, 183, 255, 0.3);
    border-radius: 3px;
}

.quick-buttons::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 183, 255, 0.5);
}

.quick-btn {
    background: rgba(0, 183, 255, 0.1);
    border: 2px solid rgba(0, 183, 255, 0.4);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #00b7ff;
    transition: 0.3s;
    flex: 0 0 auto;
    min-width: 90px;
    max-width: 150px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2);
    position: relative;
}

.quick-btn::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 5px;
    right: 5px;
    height: 3px;
    background: rgba(0, 183, 255, 0.6);
    border-radius: 2px;
}

.quick-btn:hover {
    background: rgba(0, 183, 255, 0.2);
    transform: translateY(-1px);
    border-color: rgba(0, 183, 255, 0.6);
    box-shadow: 0 5px 8px rgba(0, 183, 255, 0.3);
}

.quick-btn:hover::after {
    background: rgba(0, 183, 255, 0.8);
}

#deviceInfo {
    text-align: center;
    padding: 10px;
    font-size: 14px;
    color: #88cfff;
    background: rgba(13, 27, 42, 0.9);
    border-top: 1px solid rgba(0, 183, 255, 0.2);
    flex-shrink: 0;
}

.security-badge {
    display: inline-block;
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin: 2px;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.warning-badge {
    display: inline-block;
    background: rgba(255, 100, 100, 0.1);
    color: #ff6464;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin: 2px;
    border: 1px solid rgba(255, 100, 100, 0.3);
}

.tip-box {
    background: rgba(255, 215, 0, 0.1);
    border-right: 3px solid #ffd700;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

.code-block {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 183, 255, 0.3);
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    margin: 10px 0;
    overflow-x: auto;
}

.number-options {
    background: rgba(0, 183, 255, 0.05);
    border: 1px solid rgba(0, 183, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
}

.number-option {
    padding: 8px 0;
    border-bottom: 1px dashed rgba(0, 183, 255, 0.1);
}

.number-option:last-child {
    border-bottom: none;
}

.option-number {
    display: inline-block;
    background: linear-gradient(135deg, #00b7ff, #0066cc);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    text-align: center;
    line-height: 25px;
    margin-left: 10px;
    font-weight: bold;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 183, 255, 0.3);
    border-radius: 50%;
    border-top-color: #00b7ff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.menu-toggle {
    position: absolute;
    right: 5px;
    top: 5px;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background 0.2s;
    z-index: 10;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.menu-line {
    width: 18px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

.history-sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100vh;
    background: #202123;
    border-left: 1px solid #333;
    z-index: 200;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-sidebar.open {
    right: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #333;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background: #40414f;
    border: 1px solid #555;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

.new-chat-btn:hover {
    background: #4d4f5e;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.date-title {
    color: #9ca3af;
    font-size: 12px;
    padding: 12px 8px 8px;
    font-weight: 500;
}

.history-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ececf1;
}

.history-item:hover {
    background: #2d2d32;
}

.history-item.active {
    background: #343541;
}

.history-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #10a37f;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}