:root {
    /* Sunset Fire Theme Variables */
    --primary: #F97316;
    --primary-hover: #EA580C;
    --secondary: #FB923C;
    --accent: #14B8A6;
    
    --bg-base: #1A100A;
    --bg-surface: #241710;
    --bg-surface-2: #2E1D14;
    
    --text-primary: #FFFFFF;
    --text-secondary: #D4D4D8;
    --text-muted: #A1A1AA;
    
    --border: #3F2C22;
    --border-hover: #523A2D;
    
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography Utilities */
.text-sm { font-size: 0.875rem; }
.text-xl { font-size: 1.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: var(--font-mono); }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }

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

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary);
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(249, 115, 22, 0.39);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: var(--bg-surface-2);
    color: var(--text-primary);
}

/* Layout */
.header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background-color: rgba(36, 23, 16, 0.8);
}

.header-container {
    max-w: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.main-content {
    max-w: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    flex-grow: 1;
}

@media (min-width: 1024px) {
    .main-content {
        flex-direction: row;
        align-items: flex-start;
    }
}

.sidebar {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .sidebar {
        width: 320px;
        flex-shrink: 0;
        position: sticky;
        top: 6rem;
    }
}

.workspace {
    flex-grow: 1;
    min-width: 0;
}

/* Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.section-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Controls */
.input-group {
    display: flex;
    align-items: center;
    background-color: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    transition: border-color 0.2s;
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.color-picker-wrapper {
    position: relative;
    width: 2rem;
    height: 2rem;
    margin-left: 0.25rem;
}

.sr-only-picker {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.color-preview {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    pointer-events: none;
}

.text-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    outline: none;
}

select.text-input {
    appearance: none;
    background-color: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23D4D4D8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    cursor: pointer;
}

.input-formats {
    display: flex;
    gap: 0.5rem;
}

.format-badge {
    background-color: var(--bg-surface-2);
    border: 1px solid var(--border);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* Theme Tabs */
.theme-tab {
    flex: 1;
    padding: 0.375rem 0;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-tab:hover {
    color: var(--text-primary);
}

.theme-tab.active {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Scale Grid */
.scale-container {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .scale-container {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
}

.token-swatch {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.swatch-color {
    aspect-ratio: 1;
    width: 100%;
    border-radius: var(--radius-sm);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
    overflow: hidden;
}

.swatch-color:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.1);
    z-index: 10;
}

.swatch-base-indicator {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swatch-base-dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}

.contrast-indicator {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s;
}

.swatch-color:hover .contrast-indicator {
    opacity: 1;
}

.swatch-info {
    display: flex;
    flex-direction: column;
}

.swatch-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.swatch-hex {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* Usage Pairs */
.usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.usage-card {
    background-color: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}
/* Glassmorphism accent on usage cards */
.usage-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.usage-preview {
    height: 100px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.usage-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: default;
}
.usage-btn.outline {
    background: transparent !important;
    border: 1px solid currentColor;
}

.usage-alert {
    padding: 0.625rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.usage-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-label {
    color: var(--text-secondary);
}

.badge {
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}
.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-error { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s ease;
}

.modal.active {
    visibility: visible;
    opacity: 1;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface-2);
}

.modal-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.modal-tab:hover {
    color: var(--text-primary);
}

.modal-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--bg-base);
}

.code-block {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-all;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    background: var(--bg-surface);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--success);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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