/* ============================================
   FORM.CSS - 表单、按钮、选择器样式
   ============================================ */

/* --- INPUT --- */
.input-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    opacity: 0;
    transform: translateY(20px);
    animation: textReveal 1.2s var(--easing) forwards 0.8s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: var(--font-sans);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    padding: 10px 0;
    text-align: center;
    transition: border-color 0.4s var(--easing);
    caret-color: var(--accent-2);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.1);
    transition: color 0.3s ease;
}

input:focus {
    border-bottom-color: rgba(255, 255, 255, 0.8);
}

input:focus::placeholder {
    color: transparent;
}

/* --- NAVIGATION BUTTONS --- */
.button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2.5rem;
    opacity: 0;
    transform: translateY(10px);
    animation: textReveal 1.2s var(--easing) forwards 1s;
}

.nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s var(--easing);
    color: #fff;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.5;
    transition: transform 0.4s var(--easing);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.nav-btn:active {
    transform: translateY(0) scale(0.95);
}

.back-btn {
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
}

.back-btn.visible {
    opacity: 0.6;
    pointer-events: auto;
    transform: translateX(0);
}

.back-btn.visible:hover {
    opacity: 1;
}

.back-btn:hover svg {
    transform: translateX(-3px);
}

.next-btn {
    opacity: 0.3;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.05);
}

.next-btn.active {
    opacity: 1;
    pointer-events: auto;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.next-btn.active:hover {
    border-color: #00f2fe;
    box-shadow: 0 0 20px -5px #00f2fe;
}

.next-btn:hover svg {
    transform: translateX(3px);
}

/* --- COLOR PICKER --- */
.color-picker-container {
    display: none;
    gap: 1.2rem;
    margin: 1.5rem 0;
    justify-content: center;
    perspective: 1000px;
    flex-wrap: wrap;
    max-width: 350px;
}

.color-picker-container.active {
    display: flex;
    animation: fadeIn 0.8s var(--easing) forwards;
}

.color-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--btn-color);
    cursor: pointer;
    position: relative;
    transition: all 0.4s var(--easing);
    opacity: 0.6;
    border: 2px solid transparent;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.color-btn:hover {
    transform: scale(1.1);
    opacity: 1;
}

.color-btn.selected {
    opacity: 1;
    transform: scale(1.2);
    box-shadow: 0 0 20px var(--btn-color);
    border-color: rgba(255, 255, 255, 0.8);
}

.color-btn::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity 0.3s;
}

.color-btn:hover::after {
    opacity: 1;
}

/* --- OPACITY PICKER --- */
.opacity-picker-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-top: 1rem;
    width: 100%;
}

.opacity-picker-container.active {
    display: flex;
    animation: fadeIn 0.8s var(--easing) forwards;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 300px;
}

.slider-label {
    font-size: 0.8rem;
    opacity: 0.6;
    font-family: var(--font-sans);
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    padding: 0;
    margin: 0;
    border: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* --- BACKGROUND IMAGE PICKER --- */
.bg-image-picker-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
    width: 100%;
    animation: fadeIn 0.8s var(--easing) forwards;
}

.bg-image-picker-container.active {
    display: flex;
}

.bg-preview {
    width: 200px;
    height: 120px;
    border-radius: 12px;
    background-color: #fff;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

body.light-theme .bg-preview {
    border-color: rgba(0, 0, 0, 0.2);
}

.bg-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.upload-btn,
.reset-bg-btn {
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

body.light-theme .upload-btn,
body.light-theme .reset-bg-btn {
    color: #000;
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.05);
}

.upload-btn:hover,
.reset-bg-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

body.light-theme .upload-btn:hover,
body.light-theme .reset-bg-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* --- PLAYBACK PICKER STYLES --- */
.playback-picker-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    margin-top: 1.5rem;
    width: 100%;
    animation: fadeIn 0.8s var(--easing) forwards;
}

.playback-picker-container.active {
    display: flex;
}

.mode-toggle-wrapper {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
    backdrop-filter: blur(10px);
}

body.light-theme .mode-toggle-wrapper {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

.mode-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 10px 24px;
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s var(--easing);
}

body.light-theme .mode-btn {
    color: rgba(0, 0, 0, 0.6);
}

.mode-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

body.light-theme .mode-btn:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.05);
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

body.light-theme .mode-btn.active {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.highlight-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    animation: fadeIn 0.5s ease;
}

body.light-theme .highlight-controls {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

.highlight-instruction {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

body.light-theme .highlight-instruction {
    color: rgba(0, 0, 0, 0.5);
}

.time-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    color: rgba(255, 255, 255, 0.8);
    font-family: monospace;
    font-size: 0.9rem;
}

body.light-theme .time-slider-wrapper {
    color: rgba(0, 0, 0, 0.7);
}

.preview-start-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

body.light-theme .preview-start-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
    color: #333;
}

.preview-start-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

body.light-theme .preview-start-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* --- PLAYBACK TIME SLIDER (Black with Animation) --- */
.time-slider-wrapper input[type=range] {
    position: relative;
}

.time-slider-wrapper input[type=range]::-webkit-slider-runnable-track {
    background: linear-gradient(90deg,
            #000000 0%,
            #333333 50%,
            #000000 100%);
    background-size: 200% 100%;
    animation: sliderGlow 2s ease-in-out infinite;
    height: 6px;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.time-slider-wrapper input[type=range]::-webkit-slider-thumb {
    background: #000000;
    border: 2px solid rgba(255, 255, 255, 0.8);
    height: 18px;
    width: 18px;
    margin-top: -6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.time-slider-wrapper input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

/* Firefox support */
.time-slider-wrapper input[type=range]::-moz-range-track {
    background: linear-gradient(90deg,
            #000000 0%,
            #333333 50%,
            #000000 100%);
    background-size: 200% 100%;
    animation: sliderGlow 2s ease-in-out infinite;
    height: 6px;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.time-slider-wrapper input[type=range]::-moz-range-thumb {
    background: #000000;
    border: 2px solid rgba(255, 255, 255, 0.8);
    height: 18px;
    width: 18px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

@keyframes sliderGlow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* --- LETTER PICKER STYLES --- */
.letter-picker-container {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-top: 1.5rem;
    width: 100%;
    animation: fadeIn 0.8s var(--easing) forwards;
}

.letter-picker-container.active {
    display: flex;
}

.letter-content-section {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.5s ease;
}

.letter-content-section .letter-textarea {
    min-height: 200px;
    font-size: 1.1rem;
    line-height: 1.6;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    resize: none;
    width: 100%;
    color: #fff;
    font-family: var(--font-sans);
    transition: all 0.3s ease;
    text-align: left;
    overflow-y: auto;
    touch-action: pan-y;
}

.letter-textarea:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    outline: none;
}

body.light-theme .letter-textarea {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

body.light-theme .letter-textarea:focus {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
}

/* --- MOBILE RESPONSIVE --- */
@media (max-height: 700px) {
    .button-container {
        margin-top: 1.5rem;
    }

    .nav-btn {
        width: 44px;
        height: 44px;
    }

    h1 {
        margin-bottom: 1.5rem;
    }
}

@media (max-height: 600px) {
    .button-container {
        margin-top: 1rem;
        gap: 1rem;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
    }

    .nav-btn svg {
        width: 16px;
        height: 16px;
    }

    h1 {
        margin-bottom: 1rem;
        font-size: clamp(1.5rem, 4vw, 3rem);
    }

    h1 span.italic {
        margin-top: 0.3rem;
    }

    .playback-picker-container {
        gap: 1.5rem;
        margin-top: 0.5rem;
    }

    .highlight-controls {
        padding: 1rem;
        gap: 1rem;
    }

    .mode-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .letter-picker-container {
        gap: 1rem;
        margin-top: 0.5rem;
    }

    .letter-content-section .letter-textarea {
        min-height: 120px;
        font-size: 0.95rem;
    }
}