:root {
    --font: 'Inter', system-ui, sans-serif;
    --mono: 'SF Mono', 'Fira Code', monospace;
    --bg: #0A141A;
    --bg-secondary: #0F1E28;
    --bg-card: rgba(15, 30, 40, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --bg-input: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(9, 132, 227, 0.5);
    --text: #E8F1F5;
    --text-secondary: #8BA4B4;
    --text-muted: #5A7585;
    --primary: #0984E3;
    --secondary: #74B9FF;
    --accent: #FDCB6E;
    --gradient: linear-gradient(135deg, #0984E3, #74B9FF);
    --c1: #74B9FF;
    --c2: #00B894;
    --c3: #FDCB6E;
    --c4: #E17055;
    --c5: #D63031;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg: #F0F6FA;
    --bg-secondary: #FFF;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.6);
    --bg-glass-hover: rgba(0, 0, 0, 0.04);
    --bg-input: rgba(0, 0, 0, 0.04);
    --border: rgba(0, 0, 0, 0.08);
    --text: #0A141A;
    --text-secondary: #5A7585;
    --text-muted: #8BA4B4;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    top: -40%;
    left: -20%;
    width: 70%;
    height: 70%;
    background: radial-gradient(ellipse, rgba(9, 132, 227, 0.07) 0%, transparent 70%);
    pointer-events: none;
}

.app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-title {
    font-size: 1.125rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    gap: 0.375rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-weight: 500;
    transition: all var(--transition);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: var(--bg-glass-hover);
    color: var(--text);
    border-color: var(--border);
}

.btn-icon {
    padding: 0.5rem;
}

.main {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    transition: border-color var(--transition);
}

.search-bar:focus-within {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-sm), 0 0 0 3px rgba(9, 132, 227, 0.1);
}

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9375rem;
    outline: none;
}

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

.category-filters {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-chip {
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.filter-chip:hover {
    background: var(--bg-glass-hover);
    color: var(--text);
    border-color: var(--primary);
}

.filter-chip.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-1xx {
    background: var(--c1);
}

.dot-2xx {
    background: var(--c2);
}

.dot-3xx {
    background: var(--c3);
}

.dot-4xx {
    background: var(--c4);
}

.dot-5xx {
    background: var(--c5);
}

.codes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.code-card {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all var(--transition);
    animation: fadeInUp 0.3s ease-out backwards;
}

.code-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.code-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.375rem;
}

.code-number {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
}

.code-number.c1xx {
    color: var(--c1);
}

.code-number.c2xx {
    color: var(--c2);
}

.code-number.c3xx {
    color: var(--c3);
}

.code-number.c4xx {
    color: var(--c4);
}

.code-number.c5xx {
    color: var(--c5);
}

.bookmark-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    transition: transform var(--transition);
}

.bookmark-btn:hover {
    transform: scale(1.2);
}

.code-name {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.code-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.modal-detail {
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    animation: scaleIn 0.25s ease-out;
}

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

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.detail-code-num {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.detail-name {
    font-size: 1.125rem;
    font-weight: 600;
}

.detail-section {
    margin-bottom: 1.25rem;
}

.detail-section-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.detail-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.detail-tag {
    padding: 0.1875rem 0.625rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    background: rgba(9, 132, 227, 0.12);
    color: var(--primary);
}

.curl-block {
    font-family: var(--mono);
    font-size: 0.8125rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
    overflow: auto;
}

.curl-copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--bg-glass-hover);
    border: 1px solid var(--border);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: var(--font);
    transition: all var(--transition);
}

.curl-copy:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.response-builder {
    margin-top: 0.75rem;
}

.builder-output {
    font-family: var(--mono);
    font-size: 0.8125rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    white-space: pre-wrap;
    line-height: 1.6;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1rem;
}

.footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

@media (max-width:640px) {
    .header-content {
        padding: 0.625rem 1rem;
    }

    .main {
        padding: 1rem;
    }

    .codes-grid {
        grid-template-columns: 1fr;
    }

    .logo-subtitle {
        display: none;
    }
}