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

:root {
    --primary: #007AFF;
    --primary-glow: rgba(0, 122, 255, 0.5);
    --bg-dark: #000000;
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #0f0f23;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --surface: rgba(255, 255, 255, 0.1);
    --surface-hover: rgba(255, 255, 255, 0.15);
    --border: rgba(255, 255, 255, 0.1);
    --orb-size: 180px;
    --orb-color: #007AFF;
    --orb-glow: rgba(0, 122, 255, 0.6);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Background Effects */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 50%, var(--bg-dark) 100%);
    z-index: -2;
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 15s infinite linear;
}

@keyframes float {
    from { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    to { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

/* Main Interface */
.assistant-wrapper {
    width: 100%;
    max-width: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
}

/* Header */
.assistant-header {
    text-align: center;
    padding-top: 20px;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-icons {
    display: flex;
    gap: 8px;
}

.greeting {
    margin-top: 20px;
}

.greeting h1 {
    font-size: 32px;
    font-weight: 600;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.greeting .date {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Visual Core */
.visual-core {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.orb-container {
    position: relative;
    width: var(--orb-size);
    height: var(--orb-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.orb:hover {
    transform: scale(1.05);
}

.orb-inner {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
}

.orb-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8) 0%, var(--orb-color) 50%, var(--orb-color) 100%);
    border-radius: 50%;
    box-shadow: 
        0 0 60px var(--orb-glow),
        0 0 100px var(--orb-glow),
        inset 0 0 40px rgba(255,255,255,0.3);
    animation: orb-breathe 4s ease-in-out infinite;
}

.orb-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140%;
    height: 140%;
    background: radial-gradient(circle, var(--orb-glow) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.5;
    animation: glow-pulse 4s ease-in-out infinite;
}

.orb-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border: 2px solid var(--orb-color);
    border-radius: 50%;
    opacity: 0;
    animation: pulse-ring 3s ease-out infinite;
}

@keyframes orb-breathe {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes pulse-ring {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* Orb Rings */
.orb-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    opacity: 0;
}

.ring-1 { width: 140%; height: 140%; animation: ring-appear 4s ease-out infinite; }
.ring-2 { width: 180%; height: 180%; animation: ring-appear 4s ease-out infinite 0.5s; }
.ring-3 { width: 220%; height: 220%; animation: ring-appear 4s ease-out infinite 1s; }

@keyframes ring-appear {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 0.3; }
    80% { opacity: 0.1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

/* Listening State */
.orb.listening .orb-core {
    animation: orb-listen 0.5s ease-in-out infinite alternate;
}

.orb.listening .orb-glow {
    animation: glow-listen 0.5s ease-in-out infinite alternate;
}

@keyframes orb-listen {
    from { transform: translate(-50%, -50%) scale(1); }
    to { transform: translate(-50%, -50%) scale(1.15); }
}

@keyframes glow-listen {
    from { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    to { opacity: 0.8; transform: translate(-50%, -50%) scale(1.2); }
}

/* Listening Indicator */
.listening-indicator {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.listening-indicator.active {
    opacity: 1;
}

.listening-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: block;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.sound-waves {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 30px;
}

.wave {
    width: 4px;
    background: var(--orb-color);
    border-radius: 2px;
    animation: wave 0.5s ease-in-out infinite;
}

.wave:nth-child(1) { height: 20%; animation-delay: 0s; }
.wave:nth-child(2) { height: 40%; animation-delay: 0.1s; }
.wave:nth-child(3) { height: 60%; animation-delay: 0.2s; }
.wave:nth-child(4) { height: 40%; animation-delay: 0.3s; }
.wave:nth-child(5) { height: 20%; animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

/* Conversation Area */
.conversation-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 200px;
}

.conversation-area::-webkit-scrollbar {
    width: 4px;
}

.conversation-area::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.welcome-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 20px;
}

.message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.5;
    animation: message-appear 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background: var(--surface);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

/* Input Area */
.input-area {
    padding: 20px 0;
}

.input-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border-radius: 30px;
    padding: 8px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.input-container:focus-within {
    background: var(--surface-hover);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.keyboard-btn, .mic-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.keyboard-btn:hover, .mic-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.keyboard-btn svg, .mic-btn svg {
    width: 22px;
    height: 22px;
}

.mic-btn.active {
    background: var(--primary);
    color: white;
    animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
    50% { box-shadow: 0 0 0 10px transparent; }
}

.text-input-wrapper {
    flex: 1;
    display: none;
    align-items: center;
    gap: 8px;
}

.text-input-wrapper.active {
    display: flex;
}

.text-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    padding: 8px;
    outline: none;
}

.text-input::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.1);
}

.hint-text {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 12px;
    transition: opacity 0.3s ease;
}

/* Suggestions */
.suggestions {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: none;
}

.suggestions::-webkit-scrollbar {
    display: none;
}

.suggestion-chip {
    flex-shrink: 0;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Settings */
.settings-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background: var(--surface-hover);
    transform: rotate(30deg);
}

.settings-panel {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 280px;
    background: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 99;
}

.settings-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-panel h3 {
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.setting-item:last-child {
    border-bottom: none;
}

.toggle {
    position: relative;
    width: 50px;
    height: 28px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    border-radius: 28px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .toggle-slider {
    background: var(--primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.color-picker {
    display: flex;
    gap: 8px;
}

.color-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-btn[data-color="blue"] { background: #007AFF; }
.color-btn[data-color="purple"] { background: #AF52DE; }
.color-btn[data-color="green"] { background: #34C759; }
.color-btn[data-color="orange"] { background: #FF9500; }

.color-btn.active {
    border-color: white;
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 480px) {
    .assistant-wrapper {
        padding: 16px;
    }
    
    .greeting h1 {
        font-size: 28px;
    }
    
    :root {
        --orb-size: 150px;
    }
}