:root {
    --primary: #181d1f;
    --primary-rgb: 24, 29, 31;
    --accent: #f0ff9e;
    --accent-secondary: #ff8c69;
    --bg-soft: #f7f9fb;
    --text-main: #181d1f;
    --text-muted: #5f6368;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --radius-pill: 9999px;
    --radius-card: 24px;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.08);
    --shadow-tactile: 0 4px 20px -2px rgba(0, 0, 0, 0.04), 0 2px 10px -2px rgba(0, 0, 0, 0.02);
}

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

body {
    font-family: 'Archivo', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background: #f1f3f5;
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 100px 24px 60px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.main-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 32px;
    align-items: stretch;
}

header {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: calc(100% - 48px);
    max-width: 600px;
}

.nav-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-pill);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 12px;
}

.brand img {
    height: 28px;
    width: auto;
}

.mode-selector {
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-pill);
    padding: 4px;
    display: flex;
    gap: 4px;
}

.mode-selector button {
    border: none;
    background: transparent;
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.mode-selector button.active {
    background: #ffffff;
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: #ffffff;
    border-radius: var(--radius-card);
    padding: 32px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--accent-secondary);
}

.inputs-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    /* Push absolute bottom actions */
}

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

.input-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    padding-left: 4px;
}

input {
    background: var(--bg-soft);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.05);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.view-tabs {
    background: rgba(0, 0, 0, 0.03);
    padding: 4px;
    border-radius: var(--radius-pill);
    display: flex;
}

.view-tabs button {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
}

.view-tabs button.active,
.theme-tabs button.active {
    background: #ffffff;
    color: var(--text-main);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.preview-container {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    flex: 1;
    display: flex;
    flex-direction: column;
}

iframe {
    width: 100%;
    flex: 1;
    min-height: 400px;
    border: none;
    border-radius: 12px;
    overflow: hidden;
}

#code-viewer {
    display: none;
    width: 100%;
    height: 400px;
    background: #181d1f;
    color: #d1d5db;
    padding: 12px;
    border-radius: 12px;
    overflow: auto;
}

code {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
    border: none;
    padding: 12px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-main);
}

.btn-secondary:active {
    transform: scale(0.95);
}

.btn-ghost {
    background: transparent;
    border: none;
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: var(--radius-pill);
}

.btn-ghost:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.04);
}

.btn-ghost:active {
    transform: scale(0.98);
}

.btn-success {
    background: #10b981 !important;
}

.copy-float {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

.tag-new {
    background: var(--accent);
    color: var(--text-main);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    body {
        padding-top: 100px;
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .nav-header {
        position: fixed;
        top: 12px;
        width: calc(100% - 24px);
    }

    .nav-pill {
        padding: 6px 8px;
    }

    .brand span:nth-child(2) {
        display: none;
        /* Hide 'Branding DX' on mobile, keep 'BAND' */
    }

    .app-container {
        padding: 0 16px 40px;
        height: auto;
    }

    .main-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        height: auto;
        margin: 0;
    }

    aside.card {
        order: 2;
        /* Move config below preview on mobile */
    }

    section.card {
        order: 1;
    }

    .preview-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .preview-header>div {
        width: 100%;
        justify-content: space-between;
    }

    #preview-iframe {
        min-height: 300px;
    }
}

.animate-slide-up {
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}