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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #ffffff;
}

/* 設定面板 */
.settings-panel {
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.app-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 24px;
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 輸入區塊 */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #a0a0a0;
}

.input-group textarea {
    width: 100%;
    height: 80px;
    padding: 12px;
    border: 2px solid #3a3a5a;
    border-radius: 12px;
    background: #252540;
    color: #ffffff;
    font-size: 1.1rem;
    resize: none;
    transition: border-color 0.3s;
}

.input-group textarea:focus {
    outline: none;
    border-color: #48dbfb;
}

.input-group textarea::placeholder {
    color: #6a6a8a;
}

/* 設定項目 */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.setting-item {
    margin-bottom: 16px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #a0a0a0;
}

/* 顏色選擇器 */
input[type="color"] {
    width: 100%;
    height: 44px;
    border: 2px solid #3a3a5a;
    border-radius: 10px;
    cursor: pointer;
    background: #252540;
    padding: 4px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
    border-radius: 6px;
    border: none;
}

/* 下拉選單 */
select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 2px solid #3a3a5a;
    border-radius: 10px;
    background: #252540;
    color: #ffffff;
    font-size: 1rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

select:focus {
    outline: none;
    border-color: #48dbfb;
}

select option {
    background: #252540;
    color: #ffffff;
}

/* 字體類別 */
.font-system {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.font-noto-sans {
    font-family: 'Noto Sans TC', sans-serif;
}

.font-noto-serif {
    font-family: 'Noto Serif TC', serif;
}

.font-zcool-kuaile {
    font-family: 'ZCOOL KuaiLe', sans-serif;
}

.font-zcool-qingke {
    font-family: 'ZCOOL QingKe HuangYou', sans-serif;
}

.font-ma-shan-zheng {
    font-family: 'Ma Shan Zheng', cursive;
}

.font-long-cang {
    font-family: 'Long Cang', cursive;
}

/* ===== 文字特效 ===== */

/* 霓虹發光 */
.effect-glow {
    text-shadow:
        0 0 10px var(--glow-color, #00ffff),
        0 0 20px var(--glow-color, #00ffff),
        0 0 40px var(--glow-color, #00ffff),
        0 0 80px var(--glow-color, #00ffff);
    animation: glow-pulse 2s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
    from {
        filter: brightness(1);
    }
    to {
        filter: brightness(1.3);
    }
}

/* 彩虹漸變 */
.effect-rainbow {
    background: linear-gradient(
        90deg,
        #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3, #ff0000
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbow-move 3s linear infinite;
}

@keyframes rainbow-move {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

/* 脈動呼吸 - 用 filter 實現避免與 transform 衝突 */
.effect-pulse {
    animation: pulse-effect 1.5s ease-in-out infinite;
}

@keyframes pulse-effect {
    0%, 100% {
        filter: brightness(1);
        opacity: 1;
    }
    50% {
        filter: brightness(1.3);
        opacity: 0.7;
    }
}

/* 搖晃震動 - 用 filter 和 letter-spacing 實現 */
.effect-shake {
    animation: shake-effect 0.15s ease-in-out infinite;
}

@keyframes shake-effect {
    0%, 100% {
        filter: blur(0px);
        letter-spacing: 0;
    }
    25% {
        filter: blur(0.5px);
        letter-spacing: 2px;
    }
    75% {
        filter: blur(0.5px);
        letter-spacing: -1px;
    }
}

/* 描邊效果 */
.effect-outline {
    -webkit-text-stroke: 3px var(--glow-color, #ffffff);
    paint-order: stroke fill;
}

/* 立體陰影 */
.effect-shadow {
    text-shadow:
        2px 2px 0 #000,
        4px 4px 0 #333,
        6px 6px 0 #666,
        8px 8px 10px rgba(0,0,0,0.5);
}

/* 閃爍效果 - 更明顯的閃爍 */
.effect-flicker {
    animation: flicker-effect 0.08s steps(2) infinite;
}

@keyframes flicker-effect {
    0%, 100% {
        opacity: 1;
        filter: brightness(1);
    }
    50% {
        opacity: 0.4;
        filter: brightness(1.5);
    }
}

/* 特效與動畫組合 - 水平滾動 */
.marquee-horizontal.effect-pulse,
.marquee-horizontal.effect-shake {
    animation: scroll-horizontal var(--duration, 10s) linear infinite;
}

.marquee-horizontal.effect-pulse .marquee-text-inner,
.marquee-horizontal.effect-shake .marquee-text-inner {
    display: inline-block;
}

/* 特效與動畫組合 - 垂直滾動 */
.marquee-vertical.effect-pulse,
.marquee-vertical.effect-shake {
    animation: scroll-vertical var(--duration, 10s) linear infinite;
}

/* 固定模式特效保持原樣 */
.marquee-static.effect-pulse {
    animation: pulse-static 1.5s ease-in-out infinite;
}

@keyframes pulse-static {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        opacity: 0.8;
    }
}

.marquee-static.effect-shake {
    animation: shake-static 0.5s ease-in-out infinite;
}

@keyframes shake-static {
    0%, 100% {
        transform: translate(-50%, -50%);
    }
    25% {
        transform: translate(calc(-50% - 5px), -50%) rotate(-1deg);
    }
    75% {
        transform: translate(calc(-50% + 5px), -50%) rotate(1deg);
    }
}

/* 滑桿 */
.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-label {
    font-size: 0.85rem;
    color: #6a6a8a;
    min-width: 24px;
}

input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #3a3a5a;
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #48dbfb, #0abde3);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(72, 219, 251, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #48dbfb, #0abde3);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(72, 219, 251, 0.4);
}

/* 方向按鈕 */
.direction-buttons {
    display: flex;
    gap: 10px;
}

.dir-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #3a3a5a;
    border-radius: 10px;
    background: #252540;
    color: #a0a0a0;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.dir-btn.active {
    border-color: #48dbfb;
    background: rgba(72, 219, 251, 0.15);
    color: #48dbfb;
}

.dir-btn:hover {
    border-color: #48dbfb;
}

/* 開始按鈕 */
.start-button {
    width: 100%;
    padding: 16px;
    margin-top: 8px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.start-button:active {
    transform: translateY(0);
}

/* 預覽區 */
.preview-section {
    margin-top: 24px;
}

.preview-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #a0a0a0;
}

.preview-container {
    height: 120px;
    border: 2px solid #3a3a5a;
    border-radius: 12px;
    background: #000000;
    overflow: hidden;
    position: relative;
}

/* 跑馬燈文字 */
.marquee-text {
    position: absolute;
    white-space: nowrap;
    font-weight: bold;
    will-change: transform;
}

/* 水平動畫 - 保持垂直置中 */
.marquee-horizontal {
    top: 50%;
    animation: scroll-horizontal linear infinite;
}

@keyframes scroll-horizontal {
    0% {
        transform: translate(100vw, -50%);
    }
    100% {
        transform: translate(-100%, -50%);
    }
}

/* 垂直動畫 - 保持水平置中 */
.marquee-vertical {
    left: 50%;
    animation: scroll-vertical linear infinite;
    white-space: pre-wrap;
    writing-mode: horizontal-tb;
}

@keyframes scroll-vertical {
    0% {
        transform: translate(-50%, 100vh);
    }
    100% {
        transform: translate(-50%, -100%);
    }
}

/* 固定顯示 - 置中不滾動 */
.marquee-static {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    max-width: 90%;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 全螢幕跑馬燈顯示 */
.marquee-display {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marquee-display.hidden {
    display: none;
}

.marquee-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 退出按鈕 */
.exit-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1001;
}

.marquee-display:hover .exit-button,
.marquee-display:active .exit-button {
    opacity: 1;
}

.exit-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 全螢幕時隱藏設定面板 */
.fullscreen-active .settings-panel {
    display: none;
}

/* 手機橫向適應 */
@media (orientation: landscape) {
    .settings-panel {
        padding: 15px 20px;
    }

    .app-title {
        font-size: 1.4rem;
        margin-bottom: 16px;
    }

    .input-group textarea {
        height: 60px;
    }

    .preview-container {
        height: 80px;
    }
}

/* 小螢幕適應 */
@media (max-width: 380px) {
    .settings-panel {
        padding: 16px;
    }

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

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