:root {
    --primary: #ee4d2d;
    --primary-dark: #d73211;
    --primary-light: #ff6b4a;
    --primary-gradient: linear-gradient(135deg, #ee4d2d 0%, #ff6b4a 100%);
    --secondary: #2673dd;
    --bg-dark: #0a0e1a;
    --bg-card: #141925;
    --bg-card-hover: #1a202e;
    --text-main: #ffffff;
    --text-secondary: #b8c7e0;
    --text-muted: #6b7c93;
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(238, 77, 45, 0.3);
    --glass: rgba(20, 25, 37, 0.8);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(238, 77, 45, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* Background Effects */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #ee4d2d 0%, transparent 70%);
    top: -200px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #2673dd 0%, transparent 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -7s;
}

.shape-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #ff6b4a 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 1rem 0;
    animation: fadeInDown 0.6s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    box-shadow: var(--shadow-glow);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(238, 77, 45, 0.4); }
    50% { box-shadow: 0 0 30px rgba(238, 77, 45, 0.6); }
}

h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.01em;
}

.badges {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.badge i {
    color: var(--primary-light);
    font-size: 0.7rem;
}

/* Main Card */
.main-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg);
    animation: scaleUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.main-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

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

.card-icon {
    width: 40px;
    height: 40px;
    background: rgba(238, 77, 45, 0.1);
    border: 1px solid rgba(238, 77, 45, 0.2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--primary-light);
    flex-shrink: 0;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.card-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* IO Container */
.io-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.input-section,
.output-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.output-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

label i {
    color: var(--primary-light);
    font-size: 0.8rem;
}

textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    color: var(--text-main);
    font-size: 0.9rem;
    resize: none;
    transition: var(--transition);
    font-family: 'Inter', monospace;
    line-height: 1.5;
    flex: 1;
    min-height: 80px;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(238, 77, 45, 0.1);
    background: rgba(0, 0, 0, 0.4);
}

textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
    font-size: 0.85rem;
}

textarea:read-only {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

/* Buttons */
.btn-primary {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md), 0 4px 15px rgba(238, 77, 45, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before,
.btn-primary:active::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), 0 6px 20px rgba(238, 77, 45, 0.4);
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

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

.btn-content i {
    font-size: 1rem;
}

.btn-copy {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    touch-action: manipulation;
}

.btn-copy:hover:not(:disabled),
.btn-copy:active:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary-light);
    background: rgba(238, 77, 45, 0.1);
}

.btn-copy:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-copy.copied {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.btn-copy i {
    font-size: 0.8rem;
}

/* Loader */
.loader {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    display: none;
}

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

/* Notifications */
.notification {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    z-index: 1000;
    transform: translateY(150%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.3s ease;
    max-width: calc(100% - 2rem);
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.notification-success i { color: #10b981; }
.notification-error i { color: #ef4444; }
.notification-info i { color: #3b82f6; }

.notification span {
    color: var(--text-main);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}

/* Footer */
.footer {
    padding: 1rem 0 0.5rem;
    text-align: center;
}

.footer-content p {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Large Mobile - Landscape */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        max-width: 550px;
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .logo-icon {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }

    .main-card {
        padding: 1.5rem;
    }

    .badge {
        padding: 0.4rem 0.875rem;
        font-size: 0.8rem;
    }

    textarea {
        min-height: 100px;
    }
}

/* Tablet */
@media (min-width: 769px) {
    .container {
        max-width: 600px;
        padding: 2rem;
    }

    h1 {
        font-size: 2rem;
    }

    .logo {
        gap: 1rem;
    }

    .logo-icon {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
    }

    .main-card {
        padding: 1.75rem;
    }

    .card-header h2 {
        font-size: 1.25rem;
    }

    .badge {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    label {
        font-size: 0.9rem;
    }

    textarea {
        min-height: 120px;
        font-size: 0.95rem;
    }

    .btn-primary {
        padding: 1rem 2rem;
        font-size: 1rem;
    }

    .btn-copy {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .notification {
        bottom: 2rem;
        left: auto;
        right: 2rem;
        max-width: 400px;
    }
}

/* Safe area for notch devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .notification {
        bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .footer {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }
}

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

    .shape {
        animation: none;
    }
}
