:root {
    --bg-dark: #0b0e14;
    --bg-card: rgba(22, 27, 38, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.3);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --accent: #6366f1;
}

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

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

.background-radial {
    position: absolute;
    top: -20%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
    z-index: 0;
    pointer-events: none;
}

.main-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}

.app-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.logo-area {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    margin-bottom: 0.75rem;
}

.logo-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--primary);
    filter: blur(25px);
    opacity: 0.25;
    z-index: -1;
}

.logo-area h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    letter-spacing: 0.05em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
}

.sandbox-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    padding: 2.5rem;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.03);
    box-shadow: 0 0 30px var(--primary-glow);
}

.upload-icon-wrapper {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.drop-zone:hover .upload-icon-wrapper {
    transform: translateY(-4px);
    border-color: var(--primary);
    color: var(--primary);
}

.upload-icon {
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.drop-zone:hover .upload-icon {
    color: var(--primary);
}

.drop-zone h3 {
    font-size: 1.3rem;
    font-weight: 500;
}

.drop-zone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 400px;
    line-height: 1.5;
}

.hidden-input {
    display: none;
}

.btn {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.75rem 1.75rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.processing-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 4rem 2rem;
}

.loader-ring {
    width: 64px;
    height: 64px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

.processing-panel h4 {
    font-size: 1.25rem;
    font-weight: 500;
}

.processing-panel p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.grid-split {
    display: grid;
    grid-template-columns: 1.1fr 1.9fr;
    gap: 2.5rem;
}

.panel-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.panel-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.preview-viewport {
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: sticky;
    top: 2rem;
}

.preview-image, .preview-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.result-items {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.result-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.item-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.item-meta label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.media-badge {
    align-self: flex-start;
    background: var(--success-glow);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    text-transform: uppercase;
}

.hash-field-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.hash-text {
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-all;
    user-select: all;
}

.btn-copy {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0.25rem;
    display: flex;
    align-items: center;
}

.btn-copy:hover {
    color: var(--primary);
}

.btn-copy svg {
    width: 18px;
    height: 18px;
}

.keyframes-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.section-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 1rem;
}

.keyframes-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.5rem;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 1rem;
}

.keyframe-node {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 140px;
    flex-grow: 1;
}

.kf-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
}

.kf-hash {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.json-section {
    margin-bottom: 2rem;
}

.json-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.json-header label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.btn-text-copy {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.btn-text-copy:hover {
    opacity: 0.8;
}

.json-code {
    background: #06080c;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    max-height: 250px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.85rem;
    color: #38bdf8;
    line-height: 1.6;
}

.action-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.hidden {
    display: none !important;
}

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

@media (max-width: 968px) {
    .grid-split {
        grid-template-columns: 1fr;
    }
    .preview-viewport {
        position: relative;
        top: 0;
        aspect-ratio: 16/9;
    }
}
