/* 跑马灯生成器 - 工具专属样式（通用布局/卡片/按钮等由 common.css 提供） */

/* ============ 跑马灯动画（无缝循环：平移正好一份文字宽度 = 100%/n） ============ */
@keyframes marqueeLeft {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(calc(-100% / var(--n)));
    }
}

@keyframes marqueeRight {
    from {
        transform: translateX(calc(-100% / var(--n)));
    }
    to {
        transform: translateX(0);
    }
}

@keyframes marqueeUp {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(calc(-100% / var(--n)));
    }
}

@keyframes marqueeDown {
    from {
        transform: translateY(calc(-100% / var(--n)));
    }
    to {
        transform: translateY(0);
    }
}

/* ============ 全屏模式 ============ */
::fullscreen .preview-display {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

::fullscreen .marquee-wrapper {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
}

::fullscreen .marquee-text {
    text-align: center !important;
}

::fullscreen .fullscreen-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    pointer-events: none;
}

.fullscreen-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
}

.fullscreen-control {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 15px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    flex-wrap: wrap;
    justify-content: center;
}

.fullscreen-label {
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.fullscreen-range {
    width: 300px;
}

.fullscreen-exit-btn {
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.9) !important;
    color: #374151 !important;
}

.fullscreen-exit-btn:hover {
    background: #ffffff !important;
}

/* ============ 预览区 ============ */
.marquee-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-display {
    background-color: #000000;
    border-radius: 16px;
    padding: 60px 40px;
    min-height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #e9d5ff;
}

.marquee-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    will-change: transform;
}

.marquee-wrapper.is-vertical {
    flex-direction: column;
}

.marquee-text {
    color: #ffffff;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    display: inline-block;
    text-align: center;
    flex-shrink: 0;
    padding-right: 3rem;
}

.marquee-wrapper.is-vertical .marquee-text {
    padding-right: 0;
    padding-bottom: 2rem;
}

/* ============ 对齐修复 ============ */
/* common.css 给非首个 .settings-card 统一加了 margin-top:16px（用于纵向堆叠间距），
   在左右分栏布局中会导致右侧卡片整体下移，这里取消，间距交给容器 gap */
.section-row-1-2 > .settings-card {
    margin-top: 0;
}

/* 统一两卡头部高度（左卡含按钮略高），保证标题与分隔线水平对齐 */
.section-row-1-2 .card-header {
    min-height: 48px;
}

/* ============ 样式设置 ============ */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============ 输入控件 ============ */
.input-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}

.input-textarea:focus {
    border-color: #8b5cf6;
}

.input-textarea::placeholder {
    color: #9ca3af;
}

.color-input {
    width: 50px;
    height: 36px;
    border: 2px solid #e9d5ff;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-input:hover {
    border-color: #8b5cf6;
}

.color-text-input {
    width: 100px;
    padding: 6px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.color-text-input:focus {
    border-color: #8b5cf6;
}

.range-input {
    width: 120px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #8b5cf6, #6b21a8);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.4);
}

.range-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #8b5cf6, #6b21a8);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.4);
}

.range-value {
    font-size: 13px;
    color: #64748b;
    min-width: 50px;
}

.select-input {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    background: white;
}

.select-input:focus {
    border-color: #8b5cf6;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============ 常用模板 ============ */
.template-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.template-btn {
    padding: 8px 18px;
    border: 1.5px solid #e9d5ff;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #6b21a8;
}

.template-btn:hover {
    background: #f5f3ff;
    border-color: #8b5cf6;
    transform: translateY(-1px);
}

/* ============ 勾选标签 ============ */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #8b5cf6;
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
    .preview-display {
        padding: 40px 20px;
        min-height: 200px;
    }

    .fullscreen-range {
        width: 200px;
    }

    .fullscreen-control {
        padding: 12px 16px;
        gap: 12px;
    }

    .fullscreen-label {
        font-size: 14px;
    }
}

/* ============ 深色模式适配 ============ */
body.dark .input-textarea {
    background: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

body.dark .input-textarea::placeholder {
    color: #6b7280;
}

body.dark .color-input {
    border-color: #4c1d95;
}

body.dark .color-text-input,
body.dark .select-input {
    background: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

body.dark .range-value {
    color: #9ca3af;
}

body.dark .template-btn {
    background: #1f2937;
    border-color: #4c1d95;
    color: #c4b5fd;
}

body.dark .template-btn:hover {
    background: #2e1065;
    border-color: #8b5cf6;
}

body.dark .checkbox-label {
    color: #e5e7eb;
}
