/* ===== RESET Y ESTILOS GENERALES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 12px;
    background: linear-gradient(145deg, #d4dfff 0%, #b3c9ff 40%, #7a9eff 100%);
    background-size: 400% 400%;
    animation: gradientMove 12s ease-in-out infinite alternate;
    position: relative;
    overflow-x: hidden;
}

@keyframes gradientMove {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 100%; }
}

.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
    animation: blobFloat 20s ease-in-out infinite alternate;
}
.bg-blob.blob1 {
    width: 400px;
    height: 400px;
    background: #5b7fff;
    top: -100px;
    left: -100px;
    animation-duration: 25s;
}
.bg-blob.blob2 {
    width: 500px;
    height: 500px;
    background: #3b5bbf;
    bottom: -150px;
    right: -150px;
    animation-duration: 30s;
    animation-delay: 5s;
}
.bg-blob.blob3 {
    width: 300px;
    height: 300px;
    background: #8aadff;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-duration: 20s;
    animation-delay: 3s;
    opacity: 0.2;
}

@keyframes blobFloat {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, -80px) scale(1.1); }
    66% { transform: translate(-40px, 60px) scale(0.9); }
    100% { transform: translate(30px, -30px) scale(1.05); }
}

.container {
    position: relative;
    z-index: 1;
    max-width: 860px;
    width: 100%;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 32px;
    box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.15);
    padding: 20px 18px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    margin-bottom: 16px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
    flex-wrap: wrap;
    gap: 8px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(145deg, #6366f1, #8b5cf6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.header-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: white;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

h1 {
    font-weight: 700;
    font-size: 20px;
    color: #0b1120;
    letter-spacing: -0.3px;
}

h1 span {
    font-weight: 400;
    font-size: 13px;
    color: #6366f1;
    background: #eef2ff;
    padding: 2px 12px;
    border-radius: 40px;
    margin-left: 4px;
}

.subtitle {
    color: #475569;
    font-size: 12px;
    margin-bottom: 14px;
    padding-left: 44px;
    font-weight: 400;
}

.avatar-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.arrow-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 48px;
}

.arrow-column .arrow-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.arrow-column .arrow-label {
    font-size: 9px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: rgba(241, 245, 249, 0.8);
    padding: 1px 8px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.arrow-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.9);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.arrow-btn:hover {
    background: #6366f1;
    border-color: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.2);
}

.arrow-btn:hover svg {
    stroke: white;
}

.arrow-btn:active {
    transform: scale(0.92);
}

.arrow-btn svg {
    width: 16px;
    height: 16px;
    stroke: #334155;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s;
}

.avatar-wrapper {
    flex: 1;
    min-width: 180px;
    max-width: 340px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    border: 2px solid rgba(226, 232, 240, 0.5);
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 180px;
    position: relative;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
}

.avatar-wrapper:hover {
    border-color: #a5b4fc;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.06);
}

.avatar-wrapper img {
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
    display: block;
    border-radius: 4px;
}

.placeholder {
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
    padding: 12px;
    font-weight: 400;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
    background: rgba(248, 250, 252, 0.7);
    backdrop-filter: blur(8px);
    padding: 14px 16px;
    border-radius: 20px;
    border: 1px solid rgba(238, 242, 246, 0.6);
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.control-item label {
    font-weight: 500;
    font-size: 10px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.control-item .hint {
    font-size: 9px;
    color: #94a3b8;
    margin-top: 1px;
    font-style: italic;
}

.control-item input,
.control-item select {
    padding: 5px 10px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 12px;
    background: white;
    transition: all 0.2s ease;
    font-family: inherit;
    color: #0f172a;
    height: 30px;
    line-height: 1.3;
    appearance: auto;
}

.control-item select:hover,
.control-item input:hover {
    border-color: #a5b4fc;
}

.control-item select:focus,
.control-item input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.dance-frame-row {
    display: flex;
    gap: 10px;
    grid-column: 1 / -1;
}

.dance-frame-row .control-item {
    flex: 1;
}

.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 2px;
}

.toggle {
    position: relative;
    width: 36px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 40px;
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.toggle.active {
    background: #6366f1;
}

.toggle .toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.toggle.active .toggle-knob {
    transform: translateX(16px);
}

.toggle-label {
    font-size: 11px;
    font-weight: 500;
    color: #334155;
}

.toggle-label small {
    font-weight: 400;
    color: #94a3b8;
    font-size: 10px;
}

.action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    justify-content: center;
}

.btn {
    padding: 7px 20px;
    border: none;
    border-radius: 40px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-primary {
    background: linear-gradient(145deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.btn-success {
    background: linear-gradient(145deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.25);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.35);
}

.btn-restore {
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
}

.btn-restore:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
    background: rgba(241, 245, 249, 0.8);
    color: #1e293b;
    border: 1px solid rgba(226, 232, 240, 0.5);
    backdrop-filter: blur(4px);
}

.btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.debug-box {
    margin-top: 12px;
    background: rgba(241, 245, 249, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 10px;
    font-family: 'Courier New', monospace;
    color: #1e293b;
    word-break: break-all;
    border: 1px solid rgba(226, 232, 240, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.debug-box strong {
    color: #475569;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
    flex-shrink: 0;
    font-size: 10px;
}

.debug-box .url-text {
    color: #2563eb;
    font-size: 10px;
    font-weight: 500;
}

.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    padding: 8px 0 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 860px;
    width: 100%;
    text-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.footer span {
    color: #ffffff;
    font-weight: 500;
}

@media (max-width: 700px) {
    .container {
        padding: 14px 12px;
        border-radius: 24px;
    }
    .avatar-section {
        flex-direction: column;
        gap: 10px;
    }
    .arrow-column {
        flex-direction: row;
        gap: 16px;
        min-width: unset;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    .arrow-column .arrow-group {
        flex-direction: row;
        gap: 4px;
    }
    .arrow-btn {
        width: 32px;
        height: 32px;
    }
    .avatar-wrapper {
        min-height: 140px;
        min-width: 140px;
        padding: 10px;
    }
    .controls-grid {
        grid-template-columns: 1fr 1fr;
        padding: 10px;
        gap: 8px;
    }
    .dance-frame-row {
        flex-direction: column;
        gap: 8px;
    }
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    .subtitle {
        padding-left: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px 8px;
        border-radius: 18px;
    }
    .controls-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 8px;
    }
    .action-row .btn {
        padding: 6px 14px;
        font-size: 11px;
    }
}