:root {
    --bg-page: #222222;
    --bg-card: #0a5755;
    --text-primary: #e1f8cf;
    --text-secondary: #0a5755;
    --border: #e1f8cf;
    --accent-red: #d5141e;
    --accent-light: #e1f8cf;
    --hover-card: #0d6b68;
    --hover-light: #c5e3af;
}

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

body {
    font-family: 'Cinzel', serif;
    background: var(--bg-page);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(225, 248, 207, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(10, 87, 85, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ASCII Wave Background */
#ascii-wave-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

#ascii-wave-canvas {
    white-space: pre;
    font-size: 10px;
    line-height: 10px;
    color: var(--text-primary);
    text-shadow: 0 0 2px rgba(225, 248, 207, 0.15);
    letter-spacing: 2px;
    opacity: 0.25;
    font-family: 'JetBrains Mono', monospace;
    margin: 0;
}

/* Organic blob shapes */
@keyframes blobFloat {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        transform: translate(20px, -30px) rotate(5deg) scale(1.05);
        border-radius: 40% 60% 70% 30% / 40% 70% 30% 60%;
    }
    50% {
        transform: translate(40px, 10px) rotate(-5deg) scale(0.95);
        border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%;
    }
    75% {
        transform: translate(-10px, 30px) rotate(3deg) scale(1.02);
        border-radius: 50% 50% 30% 70% / 60% 40% 60% 40%;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

/* Subtle ambient shapes */
.glow {
    position: fixed;
    filter: blur(80px);
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
    animation: blobFloat 20s ease-in-out infinite;
}

.glow:nth-child(1) {
    top: 10%;
    left: 5%;
    width: 400px;
    height: 400px;
    background: #e1f8cf;
    animation-delay: 0s;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
}
.glow:nth-child(2) {
    bottom: 10%;
    right: 10%;
    width: 450px;
    height: 450px;
    background: #0a5755;
    animation-delay: 7s;
    border-radius: 40% 60% 70% 30% / 40% 70% 30% 60%;
}
.glow:nth-child(3) {
    top: 50%;
    left: 50%;
    width: 350px;
    height: 350px;
    background: #d5141e;
    animation-delay: 14s;
    transform: translate(-50%, -50%);
    border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%;
}

.ascii-header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    z-index: 1;
    animation: bounceIn 0.8s ease-out;
    padding: 2rem;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    60% {
        opacity: 1;
        transform: scale(1.02) translateY(0);
    }
    100% {
        transform: scale(1) translateY(0);
    }
}

.ascii-header pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.15rem, 1vw, 0.8rem);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
    font-weight: 500;
    text-shadow: 0 0 10px rgba(225, 248, 207, 0.5);
    display: inline-block;
    text-align: left;
    max-width: 100%;
    overflow: hidden;
}

.subtitle {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-align: center;
    margin-top: 1.5rem;
    font-weight: 400;
    opacity: 0.85;
    letter-spacing: 0.05em;
}

.main-card {
    background: rgba(10, 87, 85, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 3rem;
    box-shadow:
        0 0 0 1px rgba(225, 248, 207, 0.2),
        0 2px 8px rgba(225, 248, 207, 0.1),
        0 8px 24px rgba(10, 87, 85, 0.3);
    position: relative;
    z-index: 1;
    animation: popUp 0.8s ease-out;
}

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

.upload-zone {
    border: 2px dashed rgba(225, 248, 207, 0.3);
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
    background: rgba(225, 248, 207, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.upload-zone::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(10, 87, 85, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.upload-zone:hover {
    background: rgba(225, 248, 207, 0.1);
    border-color: rgba(225, 248, 207, 0.5);
    box-shadow: 0 0 0 1px rgba(225, 248, 207, 0.3);
}

.upload-zone:hover::before {
    opacity: 1;
}

.upload-zone.dragover {
    background: rgba(225, 248, 207, 0.15);
    border-color: var(--accent-red);
    border-style: solid;
    box-shadow: 0 0 0 2px var(--accent-red);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    display: block;
    opacity: 0.4;
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
    opacity: 0.8;
}

input[type="file"] {
    display: none;
}

.url-input-wrapper {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

#urlInput {
    flex: 1;
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
    border: 1px solid var(--text-secondary);
    border-radius: 8px;
    background: var(--text-primary);
    color: var(--text-secondary);
    font-family: 'Cinzel', serif;
    transition: all 0.2s ease;
}

#urlInput:hover {
    background: var(--hover-light);
    border-color: var(--text-secondary);
}

#urlInput:focus {
    outline: none;
    border-color: var(--accent-red);
    background: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(213, 20, 30, 0.1);
}

#urlInput::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.load-url-btn {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    background: var(--text-primary);
    color: var(--text-secondary);
    white-space: nowrap;
}

.load-url-btn:hover {
    background: var(--accent-red);
    color: var(--text-primary);
    border-color: var(--accent-red);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(213, 20, 30, 0.3);
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.control-group {
    background: var(--text-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid var(--text-primary);
    transition: all 0.3s ease;
    position: relative;
}

.control-group:hover {
    background: var(--hover-card);
    border-color: var(--text-primary);
    box-shadow: 0 0 0 1px var(--text-primary);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-transform: lowercase;
    letter-spacing: 0.05em;
    font-family: 'Cinzel', serif;
}

input[type="range"] {
    width: 100%;
    height: 4px;
    background: var(--text-primary);
    outline: none;
    border-radius: 10px;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-red);
    cursor: pointer;
    border-radius: 50%;
    border: none;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(213, 20, 30, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent-red);
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: 2px solid var(--text-primary);
    border-radius: 8px;
    background: var(--text-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-family: 'Cinzel', serif;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e1f8cf' 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.75rem center;
    background-size: 1.25em;
}

select:hover {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 1px var(--text-primary);
    background: var(--hover-card);
}

select:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 2px rgba(213, 20, 30, 0.2);
}

.value-display {
    display: inline-block;
    background: var(--accent-red);
    color: var(--text-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    margin-left: 0.5rem;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
}

.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

button {
    flex: 1;
    min-width: 200px;
    padding: 1rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid var(--accent-red);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    position: relative;
    background: var(--accent-red);
    color: var(--text-primary);
}

button:hover:not(:disabled) {
    background: #b71119;
    border-color: #b71119;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(213, 20, 30, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-convert {
    background: var(--accent-red);
    color: var(--text-primary);
}

.btn-download,
.btn-copy,
.btn-play {
    background: var(--text-secondary);
    color: var(--text-primary);
    border: 2px solid var(--text-primary);
}

.btn-download:hover,
.btn-copy:hover,
.btn-play:hover {
    background: var(--hover-card);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.output-container {
    margin-top: 2rem;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s ease;
}

.output-container.visible {
    opacity: 1;
    max-height: none;
}

.preview-container {
    border-radius: 12px;
    border: 2px solid rgba(225, 248, 207, 0.2);
    overflow: auto;
    max-height: calc(100vh - 400px);
    min-height: 200px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    line-height: 1;
    white-space: pre;
    box-shadow:
        0 2px 8px rgba(225, 248, 207, 0.1),
        inset 0 0 40px rgba(10, 87, 85, 0.1);
    position: relative;
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.ascii-output {
    margin: 0;
    padding: 0;
    white-space: pre;
    overflow-wrap: normal;
    word-break: keep-all;
    display: block;
    width: fit-content;
    max-width: none;
}

/* Theme Styles */
.preview-container.green-on-black {
    background: rgba(0, 0, 0, 0.7);
    color: #0f0;
}

.preview-container.white-on-black {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}

.preview-container.black-on-white {
    background: rgba(255, 255, 255, 0.7);
    color: #000;
    border-color: var(--border);
}

.preview-container.amber-on-black {
    background: rgba(0, 0, 0, 0.7);
    color: #ffb000;
}

.preview-container.amber-on-dark {
    background: rgba(45, 31, 13, 0.7);
    color: #ffb000;
}

.preview-container.blue-on-black {
    background: rgba(0, 0, 0, 0.7);
    color: #00bfff;
}

.preview-container.blue-on-dark {
    background: rgba(10, 25, 41, 0.7);
    color: #00bfff;
}

.preview-container.blue-on-orange {
    background: rgba(255, 140, 0, 0.7);
    color: #0066ff;
}

.preview-container.cyan-on-black {
    background: rgba(0, 0, 0, 0.7);
    color: #00ffff;
}

.preview-container.pink-on-black {
    background: rgba(0, 0, 0, 0.7);
    color: #ff69b4;
}

.preview-container::-webkit-scrollbar {
    width: 10px;
}

.preview-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.preview-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.preview-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.processing-status {
    text-align: center;
    padding: 2rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.processing-status:not(:empty)::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.examples-section {
    margin-top: 4rem;
    position: relative;
    z-index: 1;
}

.examples-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: lowercase;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-bottom: 3rem;
}

.example-item {
    background: rgba(10, 87, 85, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(225, 248, 207, 0.2);
    transition: all 0.3s ease;
}

.example-item:hover {
    background: rgba(10, 87, 85, 0.3);
    border-color: rgba(225, 248, 207, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(10, 87, 85, 0.3);
}

.example-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    display: block;
    background: #000;
    object-fit: cover;
}

footer {
    text-align: center;
    margin-top: 5rem;
    padding: 2rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    animation: fadeIn 1s ease-out 0.8s backwards;
    opacity: 0.7;
}

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

footer a {
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

footer a:hover {
    color: var(--accent-red);
    border-bottom-color: var(--accent-red);
}

.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--accent-red);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transform: translateX(400px);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(213, 20, 30, 0.4);
}

.notification.show {
    transform: translateX(0);
}

/* Welcome overlay */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-page);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.welcome-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.welcome-overlay.hidden {
    display: none;
}

.welcome-ascii {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.15rem, 1vw, 0.8rem);
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(225, 248, 207, 0.8);
    text-align: left;
    line-height: 1.2;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
}

.welcome-overlay .subtitle {
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

.welcome-overlay .subtitle.revealed {
    opacity: 0.85;
}

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

    .main-card {
        padding: 1.5rem;
        border-radius: 20px;
    }

    h1 {
        font-size: 3rem;
    }

    .ascii-header {
        padding: 1rem 0.5rem;
        margin-bottom: 2rem;
    }

    .ascii-header pre {
        font-size: clamp(0.08rem, 1.2vw, 0.3rem);
    }

    .subtitle {
        font-size: 0.9rem;
        margin-top: 1rem;
        padding: 0 1rem;
    }

    .welcome-ascii {
        font-size: clamp(0.08rem, 1.2vw, 0.3rem);
    }

    .preview-container {
        max-height: calc(100vh - 600px);
    }

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

    .btn-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    button {
        min-width: 100%;
        width: 100%;
        padding: 0.875rem 1.5rem;
    }

    .upload-zone {
        padding: 3rem 1.5rem;
    }

    .preview-container {
        font-size: 8px;
    }

    .url-input-wrapper {
        flex-direction: column;
    }

    .load-url-btn {
        width: 100%;
    }

    .examples-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .examples-title {
        font-size: 1.5rem;
    }
}
