:root {
    --primary-color: #007AFF;
    --secondary-color: #5856D6;
    --success-color: #34C759;
    --danger-color: #FF3B30;
    --background: #F2F2F7;
    --card-background: rgba(255, 255, 255, 0.7);
    --text-primary: #1C1C1E;
    --text-secondary: #8E8E93;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.12);
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-color: rgba(255, 255, 255, 0.5);
    --input-background: rgba(255, 255, 255, 0.8);
}

body.dark-mode {
    --background: #1C1C1E;
    --card-background: rgba(44, 44, 46, 0.8);
    --text-primary: #F5F5F7;
    --text-secondary: #AEAEB2;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
    --input-background: rgba(58, 58, 60, 0.8);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    padding: 40px 20px;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.allow-select {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(0, 122, 255, 0.1) 0%, 
        rgba(88, 86, 214, 0.1) 50%, 
        rgba(52, 199, 89, 0.1) 100%);
    z-index: -1;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.header {
    text-align: center;
    margin-bottom: 48px;
    animation: fadeInDown 0.6s ease;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.3);
}

.logo .material-symbols-rounded {
    font-size: 40px;
    color: white;
}

h1 {
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 400;
}

.card {
    background: var(--card-background);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    animation: fadeInUp 0.6s ease backwards;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.input-card { animation-delay: 0.1s; }
.gradient-card { animation-delay: 0.2s; }
.preview-card { animation-delay: 0.3s; }
.output-card { animation-delay: 0.4s; }

label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

label .material-symbols-rounded {
    font-size: 22px;
    color: var(--primary-color);
}

#textInput {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 400;
    border: 2px solid rgba(0, 122, 255, 0.2);
    border-radius: 12px;
    background: var(--input-background);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: inherit;
}

#textInput:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

body.dark-mode #textInput {
    background: var(--input-background);
    color: var(--text-primary);
}

body.dark-mode #textInput:focus {
    background: rgba(58, 58, 60, 1);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.gradient-bar-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.gradient-bar {
    position: relative;
    height: 50px;
    background: var(--input-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: visible;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.color-point {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.color-point-handle {
    width: 16px;
    height: 48px;
    border: 3px solid white;
    border-radius: 8px;
    cursor: grab;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
}

.color-point-handle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.color-point-handle:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.color-picker-wrapper {
    display: none;
}

.color-picker {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.remove-point {
    display: none;
}

.btn-help {
    display: block;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.6;
}

.btn-help .material-symbols-rounded {
    font-size: 16px;
    vertical-align: middle;
    margin-right: 4px;
}

.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 122, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-secondary.copied {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.preview-content {
    padding: 40px 20px;
    background: var(--input-background);
    border-radius: 12px;
    min-height: 100px;
    font-size: 48px;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-all;
    letter-spacing: -0.5px;
    border: 2px solid var(--border-color);
}

#output {
    width: 100%;
    min-height: 120px;
    padding: 16px 20px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 14px;
    border: 2px solid rgba(0, 122, 255, 0.2);
    border-radius: 12px;
    background: var(--input-background);
    color: var(--text-primary);
    resize: vertical;
    transition: var(--transition);
    margin-bottom: 16px;
}

#output:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

body.dark-mode #output {
    background: var(--input-background);
    color: var(--text-primary);
}

body.dark-mode #output:focus {
    background: rgba(58, 58, 60, 1);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

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

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

.dark-mode-toggle {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--card-background);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover {
    transform: scale(1.1) rotate(20deg);
    box-shadow: var(--shadow-hover);
}

.dark-mode-toggle .material-symbols-rounded {
    font-size: 28px;
}

body.dark-mode .dark-mode-toggle .material-symbols-rounded {
    content: 'light_mode';
}

.footer {
    text-align: center;
    margin-top: 60px;
    margin-bottom: 40px;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    animation: fadeInUp 0.6s ease backwards;
    animation-delay: 0.5s;
}

@media (max-width: 768px) {
    body {
        padding: 20px 16px;
    }
    
    h1 {
        font-size: 36px;
    }
    
    .card {
        padding: 24px;
    }
    
    .preview-content {
        font-size: 32px;
        padding: 30px 15px;
    }
}
