:root {
    --bg-color: #0d0f1a;
    --text-primary: #ffffff;
    --text-muted: #94a3b8;

    /* Glassmorphism settings */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

    /* Accents */
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-danger: #ef4444;
    --accent-danger-hover: #dc2828;

    --blur: blur(12px);
    --font-ui: 'Outfit', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Menlo', monospace;
}

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

html,
body {
    height: 100%;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-ui);
    overflow: hidden;
    touch-action: manipulation;
}

/* Dynamic Animated Background */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
    animation: float 20s infinite alternate ease-in-out;
}

.circle-1 {
    width: 300px;
    height: 300px;
    background: #4f46e5;
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.circle-2 {
    width: 400px;
    height: 400px;
    background: #2563eb;
    bottom: -20%;
    right: -10%;
    animation-delay: -5s;
}

.circle-3 {
    width: 250px;
    height: 250px;
    background: #0ea5e9;
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom) 12px;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
}

@media (max-width: 480px) {
    .app-container {
        padding: 8px 8px env(safe-area-inset-bottom) 8px;
        gap: 8px;
    }
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 8px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo h1 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.prompt-icon {
    color: var(--accent-primary);
    font-size: 1.2rem;
}

/* Buttons */
button {
    font-family: var(--font-ui);
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.icon-button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 8px;
}

.icon-button:hover {
    color: var(--text-primary);
    transform: rotate(15deg);
}

.primary-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(1px);
}

/* Terminal Area */
.terminal-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.terminal-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 16px;
}

.setup-hint {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
    animation: fadeIn 0.5s ease-out;
}

.setup-hint i {
    margin-bottom: 20px;
    color: var(--accent-primary);
    opacity: 0.8;
}

.setup-hint h2 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.setup-hint p {
    margin-bottom: 24px;
    font-size: 0.95rem;
}

/* Quick Keys */
.quick-keys {
    display: flex;
    gap: 8px;
    padding: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
}

.quick-keys::-webkit-scrollbar {
    display: none;
}

.quick-keys button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: var(--font-mono);
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-keys button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.quick-keys button:active {
    transform: scale(0.95);
}

.quick-keys button.primary {
    border-color: var(--accent-primary);
    color: #60a5fa;
}

.quick-keys button.danger {
    border-color: var(--accent-danger);
    color: #f87171;
}

.upload-btn-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.upload-btn-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

/* Input Bar */
.input-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px;
}

.textarea-wrapper {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    padding: 2px;
}

textarea#cmd {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 12px;
    font-size: 16px;
    /* Prevents auto-zoom on iOS */
    font-family: var(--font-ui);
    resize: none;
    max-height: 120px;
    outline: none;
    line-height: 1.4;
}

textarea#cmd::placeholder {
    color: var(--text-muted);
}

.send-button,
.mic-button {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.mic-button {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    border: 1px solid var(--glass-border);
}

.mic-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.mic-button.recording {
    background: var(--accent-danger);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    width: 100%;
    max-width: 450px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.full-modal {
    height: 90vh;
    max-width: 800px;
    padding: 0;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-header button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.input-group input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--accent-primary);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.checkbox-group input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
}

.modal-body.no-pad {
    flex: 1;
    padding: 0;
}

textarea#copyText {
    width: 100%;
    height: 100%;
    background: transparent;
    color: #e0e0e0;
    border: none;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    resize: none;
    outline: none;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}