/* ==========================================================================
   Typolab - Production Dark Mode CSS
   Version: 2.0.0
   Design System: Linear/Vercel/VS Code inspired
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS / CSS CUSTOM PROPERTIES
   ========================================================================== */

:root {
    /* Dark palette */
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-tertiary: #1a1a24;
    --bg-elevated: #222230;
    --bg-hover: #2a2a3a;

    --surface: #16161e;
    --surface-hover: #1e1e28;
    --surface-active: #262632;

    --border: #2a2a3a;
    --border-hover: #3a3a4e;
    --border-focus: #667eea;

    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-muted: #52525b;

    /* Accent - Violet */
    --accent-violet: #667eea;
    --accent-violet-hover: #7c8ff2;
    --accent-violet-glow: rgba(102, 126, 234, 0.15);
    --accent-violet-ring: rgba(102, 126, 234, 0.3);

    /* Accent - Orange */
    --accent-orange: #f59e0b;
    --accent-orange-hover: #fbbf24;
    --accent-orange-glow: rgba(245, 158, 11, 0.15);

    /* Accent - Semantic */
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.15);
    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.15);
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.15);

    /* Typography */
    --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-glow-violet: 0 0 20px rgba(102, 126, 234, 0.2), 0 0 60px rgba(102, 126, 234, 0.1);
    --shadow-glow-orange: 0 0 20px rgba(245, 158, 11, 0.2), 0 0 60px rgba(245, 158, 11, 0.1);
    --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.2), 0 0 60px rgba(16, 185, 129, 0.1);

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Card sizes (zoom system) */
    --card-size-xs: 200px;
    --card-size-sm: 250px;
    --card-size-md: 300px;
    --card-size-lg: 350px;
    --card-size-xl: 400px;
    --current-card-size: var(--card-size-md);

    /* Zoom & layout transitions */
    --zoom-transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-speed: 0.3s;

    /* Card shadows (overrides for dark) */
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 1px rgba(102, 126, 234, 0.1);
    --card-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 1px rgba(102, 126, 234, 0.2);
}


/* ==========================================================================
   2. GLOBAL RESET & BASE
   ========================================================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary) !important;
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    line-height: 1.6;
}


/* ==========================================================================
   3. BACKGROUND EFFECTS
   ========================================================================== */

/* Override the light overlay with dark radial gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 20%, rgba(102, 126, 234, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(245, 158, 11, 0.03) 0%, transparent 60%) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: -1;
    pointer-events: none;
}

/* Dot grid pattern */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(rgba(102, 126, 234, 0.07) 1px, transparent 1px);
    background-size: 32px 32px;
    z-index: -1;
    pointer-events: none;
    animation: gradient-shift 60s linear infinite;
}

/* Noise texture via SVG filter */
body > .container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.015;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}


/* ==========================================================================
   4. CONTAINER
   ========================================================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    position: relative;
    z-index: 1;
    animation: fadeIn 0.8s ease-out;
}


/* ==========================================================================
   5. HEADER
   ========================================================================== */

.header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    padding-top: 1rem;
}

.logo {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary) !important;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
    animation: slideDown 0.6s ease-out;
    position: relative;
    display: inline-block;
}

/* Gradient text effect on hover */
.logo::after {
    content: 'Typolab';
    position: absolute;
    left: 0;
    top: 0;
    background: linear-gradient(135deg, var(--accent-violet) 0%, var(--accent-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.logo:hover::after {
    opacity: 1;
}

.tagline {
    font-size: 1.125rem;
    color: var(--text-secondary) !important;
    max-width: 600px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
    animation: slideUp 0.6s ease-out 0.2s both;
    font-weight: 400;
}


/* ==========================================================================
   6. ZOOM CONTROLS
   ========================================================================== */

.zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface) !important;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md) !important;
    animation: slideUp 0.6s ease-out 0.4s both;
    transition: var(--transition);
}

.zoom-controls:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg) !important;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent !important;
    color: var(--text-secondary) !important;
    font-size: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.zoom-btn svg {
    stroke: currentColor;
}

.zoom-btn:hover:not(:disabled) {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
    transform: scale(1.1);
}

.zoom-btn:active:not(:disabled) {
    transform: scale(0.95);
    background: var(--accent-violet-glow) !important;
}

.zoom-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.zoom-btn:focus {
    outline: 2px solid var(--accent-violet) !important;
    outline-offset: 2px;
}

.zoom-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    min-width: 120px;
    justify-content: center;
}

.zoom-dots {
    display: flex;
    gap: 0.375rem;
}

.zoom-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bg-elevated) !important;
    transition: var(--transition);
    cursor: pointer;
}

.zoom-dot:hover {
    background: var(--text-muted) !important;
    transform: scale(1.3);
}

.zoom-dot.active {
    background: var(--accent-violet) !important;
    transform: scale(1.5);
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.4);
}

.zoom-level {
    font-size: 0.75rem;
    color: var(--text-tertiary) !important;
    font-weight: 500;
    margin-left: 0.5rem;
    min-width: 35px;
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   7. APPS GRID
   ========================================================================== */

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--current-card-size), 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
    transition: grid-template-columns var(--zoom-transition);
}


/* ==========================================================================
   8. APP CARDS
   ========================================================================== */

.app-card {
    background: var(--surface) !important;
    border-radius: var(--radius-lg) !important;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    transition:
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
    position: relative;
    animation: card-reveal 0.6s ease-out both;
}

.app-card:nth-child(1) { animation-delay: 0.1s; }
.app-card:nth-child(2) { animation-delay: 0.18s; }
.app-card:nth-child(3) { animation-delay: 0.26s; }
.app-card:nth-child(4) { animation-delay: 0.34s; }
.app-card:nth-child(5) { animation-delay: 0.42s; }
.app-card:nth-child(6) { animation-delay: 0.50s; }
.app-card:nth-child(7) { animation-delay: 0.58s; }
.app-card:nth-child(8) { animation-delay: 0.66s; }

.app-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-violet) !important;
    box-shadow: var(--shadow-glow-violet), var(--card-shadow-hover) !important;
}

.app-card:active {
    transform: translateY(-1px) scale(0.99);
    transition-duration: 0.1s;
    box-shadow: 0 0 0 3px var(--accent-violet-ring), var(--card-shadow) !important;
}

.app-card:focus {
    outline: none;
    border-color: var(--accent-violet) !important;
    box-shadow: 0 0 0 3px var(--accent-violet-ring), var(--card-shadow) !important;
}

/* Subtle top accent line on hover */
.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-violet), var(--accent-orange));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.app-card:hover::before {
    opacity: 1;
}


/* ==========================================================================
   9. CARD IMAGE
   ========================================================================== */

.app-image {
    aspect-ratio: 4/3;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

/* Dark overlay on image */
.app-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.3);
    transition: background 0.3s ease;
    z-index: 1;
}

.app-card:hover .app-image::before {
    background: rgba(10, 10, 15, 0.15);
}

/* Bottom fade into card body */
.app-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, transparent 0%, var(--surface) 100%);
    z-index: 1;
    opacity: 0.8;
    transition: opacity var(--transition-speed);
}

.app-card:hover .app-image::after {
    opacity: 1;
}

/* Color indicator dot */
.color-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: var(--transition-bounce);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

.app-card:hover .color-indicator {
    opacity: 1;
    transform: scale(1);
}


/* ==========================================================================
   10. CARD CONTENT
   ========================================================================== */

.app-content {
    padding: 1.5rem;
    transition: padding var(--zoom-transition);
    position: relative;
}

.app-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary) !important;
    margin-bottom: 0.5rem;
    text-align: center;
    transition: font-size var(--zoom-transition), color 0.3s ease;
    letter-spacing: -0.01em;
}

.app-card:hover .app-name {
    color: var(--accent-violet-hover) !important;
}

.app-category {
    font-size: 0.8rem;
    color: var(--text-tertiary) !important;
    text-align: center;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    transition: var(--zoom-transition);
}

.app-description {
    font-size: 0.875rem;
    color: var(--text-secondary) !important;
    text-align: center;
    margin-bottom: 0.5rem;
    line-height: 1.5;
    transition: var(--zoom-transition);
}

.app-details {
    font-size: 0.75rem;
    color: var(--text-muted) !important;
    text-align: center;
    font-style: italic;
    transition: var(--zoom-transition);
}


/* ==========================================================================
   11. ZOOM LEVELS — CARD CONTENT ADAPTATION
   ========================================================================== */

.zoom-xs { --current-card-size: var(--card-size-xs); }
.zoom-sm { --current-card-size: var(--card-size-sm); }
.zoom-md { --current-card-size: var(--card-size-md); }
.zoom-lg { --current-card-size: var(--card-size-lg); }
.zoom-xl { --current-card-size: var(--card-size-xl); }

.zoom-xs .app-content { padding: 0.875rem; }
.zoom-sm .app-content { padding: 1.125rem; }
.zoom-lg .app-content { padding: 1.75rem; }
.zoom-xl .app-content { padding: 2rem; }

.zoom-xs .app-name { font-size: 0.95rem; }
.zoom-sm .app-name { font-size: 1.1rem; }
.zoom-lg .app-name { font-size: 1.375rem; }
.zoom-xl .app-name { font-size: 1.5rem; }

.zoom-xs .app-description,
.zoom-xs .app-details {
    display: none;
}

.zoom-sm .app-details {
    display: none;
}


/* ==========================================================================
   12. FOOTER
   ========================================================================== */

.footer {
    text-align: center;
    padding: 3rem 0 1rem;
    animation: fadeIn 0.8s ease-out 0.8s both;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.version-container {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted) !important;
    font-family: var(--font-mono);
}

.version-icon {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border) !important;
    border-radius: 50%;
    color: var(--accent-violet) !important;
    font-weight: 600;
    font-family: var(--font-display);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface) !important;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.8rem;
}

.version-icon:hover {
    background: var(--accent-violet) !important;
    color: white !important;
    border-color: var(--accent-violet) !important;
    transform: rotate(360deg) scale(1.1);
    box-shadow: var(--shadow-glow-violet);
}


/* ==========================================================================
   13. KEYBOARD HINT
   ========================================================================== */

.keyboard-hint {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    font-size: 0.75rem;
    color: var(--text-tertiary) !important;
    background: var(--surface) !important;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
    font-family: var(--font-mono);
    z-index: 100;
}

.keyboard-hint.show {
    opacity: 1;
    transform: translateY(0);
}

.keyboard-hint kbd {
    display: inline-block;
    padding: 0.1em 0.4em;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    margin: 0 0.1em;
}


/* ==========================================================================
   14. ANIMATIONS
   ========================================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes card-reveal {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.15);
    }
    50% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.3), 0 0 60px rgba(102, 126, 234, 0.1);
    }
}

@keyframes typing-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes gradient-shift {
    0% { background-position: 0 0; }
    100% { background-position: 320px 320px; }
}

@keyframes neon-flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.7; }
    94% { opacity: 1; }
    96% { opacity: 0.8; }
    97% { opacity: 1; }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
    100% { box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.zoom-btn:not(:disabled):active {
    animation: pulse 0.5s;
}


/* ==========================================================================
   15. SCROLLBAR
   ========================================================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-primary);
}


/* ==========================================================================
   16. TEXT SELECTION
   ========================================================================== */

::selection {
    background: var(--accent-violet-ring);
    color: var(--text-primary);
}

::-moz-selection {
    background: var(--accent-violet-ring);
    color: var(--text-primary);
}


/* ==========================================================================
   17. LINKS (global)
   ========================================================================== */

a {
    color: var(--accent-violet);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-violet-hover);
}


/* ==========================================================================
   18. BUTTONS — DESIGN SYSTEM
   ========================================================================== */

.btn,
button:not(.zoom-btn) {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-violet);
    color: #fff;
    padding: 0.625rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

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

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 0 0 3px var(--accent-violet-ring);
}

.btn-secondary {
    background: transparent;
    color: var(--accent-violet);
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent-violet);
    background: var(--accent-violet-glow);
}

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

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

.btn-danger {
    background: var(--accent-red);
    color: #fff;
    padding: 0.625rem 1.25rem;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

.btn-lg {
    font-size: 1rem;
    padding: 0.75rem 1.75rem;
}

.btn:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-violet);
    outline-offset: 2px;
}


/* ==========================================================================
   19. FORM ELEMENTS — INPUTS & TEXTAREAS
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="number"],
input[type="password"],
textarea,
select {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.625rem 0.875rem;
    transition: var(--transition);
    width: 100%;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-violet);
    box-shadow: 0 0 0 3px var(--accent-violet-ring);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

/* Monospace inputs for code/tools */
.input-mono,
.tool-input {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--bg-primary);
    letter-spacing: -0.02em;
}

textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

select {
    appearance: none;
    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='%23a1a1aa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* Checkbox & Radio custom */
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    vertical-align: middle;
}

input[type="radio"] {
    border-radius: 50%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background: var(--accent-violet);
    border-color: var(--accent-violet);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}


/* ==========================================================================
   20. CODE BLOCKS
   ========================================================================== */

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-tertiary);
    color: var(--accent-orange);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    border: 1px solid var(--border);
}

pre {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-violet);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--text-primary);
    position: relative;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Syntax highlighting tokens */
.token-string,
.hljs-string {
    color: var(--accent-orange);
}

.token-keyword,
.hljs-keyword {
    color: var(--accent-violet);
}

.token-number,
.hljs-number {
    color: var(--accent-green);
}

.token-comment,
.hljs-comment {
    color: var(--text-muted);
    font-style: italic;
}

.token-function,
.hljs-function {
    color: var(--accent-blue);
}


/* ==========================================================================
   21. CARDS — GENERIC REUSABLE
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}


/* ==========================================================================
   22. TOOL PAGE LAYOUT (for sub-apps)
   ========================================================================== */

.tool-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.tool-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: var(--transition);
}

.tool-back:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--surface-hover);
}

.tool-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tool-workspace {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.tool-output {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-green);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    min-height: 80px;
    white-space: pre-wrap;
    word-break: break-word;
}

.tool-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}


/* ==========================================================================
   23. BADGES & TAGS
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.6em;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    background: var(--accent-violet-glow);
    color: var(--accent-violet);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.badge-orange {
    background: var(--accent-orange-glow);
    color: var(--accent-orange);
    border-color: rgba(245, 158, 11, 0.2);
}

.badge-green {
    background: var(--accent-green-glow);
    color: var(--accent-green);
    border-color: rgba(16, 185, 129, 0.2);
}

.badge-red {
    background: var(--accent-red-glow);
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.2);
}


/* ==========================================================================
   24. TOOLTIP
   ========================================================================== */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-family: var(--font-body);
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* ==========================================================================
   25. TABLES (for tool outputs)
   ========================================================================== */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

tr:hover td {
    background: var(--surface-hover);
    color: var(--text-primary);
}


/* ==========================================================================
   26. UTILITY CLASSES
   ========================================================================== */

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-violet { color: var(--accent-violet) !important; }
.text-orange { color: var(--accent-orange) !important; }
.text-green { color: var(--accent-green) !important; }
.text-red { color: var(--accent-red) !important; }

.bg-surface { background: var(--surface) !important; }
.bg-primary { background: var(--bg-primary) !important; }
.bg-elevated { background: var(--bg-elevated) !important; }

.font-display { font-family: var(--font-display) !important; }
.font-mono { font-family: var(--font-mono) !important; }

.gradient-text {
    background: linear-gradient(135deg, var(--accent-violet) 0%, var(--accent-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glow-violet { box-shadow: var(--shadow-glow-violet); }
.glow-orange { box-shadow: var(--shadow-glow-orange); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}


/* ==========================================================================
   27. LOADING STATE
   ========================================================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-elevated) 50%,
        var(--bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-violet);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ==========================================================================
   28. RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .header {
        margin-bottom: 2.5rem;
    }

    .logo {
        font-size: 2.25rem;
    }

    .tagline {
        font-size: 0.95rem;
        margin-bottom: 2rem;
    }

    .zoom-controls {
        transform: scale(0.9);
    }

    :root {
        --current-card-size: var(--card-size-md) !important;
    }

    .apps-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .app-card:hover {
        transform: translateY(-2px);
    }

    .tool-page {
        padding: 1rem;
    }

    .tool-workspace {
        padding: 1rem;
    }

    .tool-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer {
        padding: 2rem 0 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 2rem 1.25rem;
    }

    .apps-grid {
        gap: 1.25rem;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1500px;
    }
}


/* ==========================================================================
   29. REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body::after {
        animation: none !important;
    }

    .app-card:hover {
        transform: none;
    }

    .zoom-btn:hover:not(:disabled) {
        transform: none;
    }

    .version-icon:hover {
        transform: none;
    }
}


/* ==========================================================================
   30. BROWSER COMPAT — FALLBACKS
   ========================================================================== */

@supports not (backdrop-filter: blur(100px)) {
    body::before {
        background: var(--bg-primary) !important;
    }
}

@supports not (aspect-ratio: 4/3) {
    .app-image {
        padding-bottom: 75%;
        height: 0;
    }
}


/* ==========================================================================
   31. PRINT
   ========================================================================== */

@media print {
    body {
        background: white !important;
        color: #000 !important;
    }

    body::before,
    body::after,
    .container::before {
        display: none !important;
    }

    .app-card {
        background: white !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .app-name,
    .app-description {
        color: #000 !important;
    }

    .zoom-controls,
    .keyboard-hint {
        display: none !important;
    }
}
