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

body {
    background-color: #222;
    font-family: tauhu-oo, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 15px;
    transition: background-color 0.3s;
}

.app-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.marquee-container {
    background-color: #000;
    width: 100%;
    height: 80px; /* 減少高度 */
    overflow: hidden;
    position: relative;
    border-radius: 5px;
    border: 2px solid #333;
    transition: all 0.3s;
    margin-bottom: 5px;
    display: flex; /* 新增 */
    align-items: center; /* 新增：垂直居中 */
    justify-content: center; /* 新增：水平居中 */
}

.marquee-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    z-index: 100;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 全螢幕控制按鈕 */
.fullscreen-controls {
    position: fixed;
    left: 15px;
    bottom: 15px;
    z-index: 200;
    display: none;
}

.fullscreen-controls.visible {
    display: flex;
}

.fullscreen-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 18px;
}

.exit-fullscreen {
    position: fixed;
    top: 15px;
    left: 15px; /* 改到左上角 */
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.exit-fullscreen.visible {
    display: flex;
}

/* 字體大小調整按鈕 */
.font-size-controls {
    position: fixed;
    right: 15px;
    bottom: 15px;
    z-index: 200;
    display: none;
}

.font-size-controls.visible {
    display: flex;
    flex-direction: row; /* 改為水平排列 */
    gap: 10px;
}

/* 速度控制按鈕 */
.speed-controls {
    position: fixed;
    left: 70px; /* 位於暫停按鈕右側 */
    bottom: 15px;
    z-index: 200;
    display: none;
}

.speed-controls.visible {
    display: flex;
    gap: 10px;
}

/* 文字導航控制按鈕 */
.text-nav-controls {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: none;
    gap: 10px;
    align-items: center;
}

.text-nav-controls.visible {
    display: flex;
}

.text-select-btn {
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.text-select-btn:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

/* 文字選擇面板 */
.text-selection-panel {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    max-height: 60vh;
    background-color: rgba(40, 40, 40, 0.95);
    border-radius: 10px;
    z-index: 300;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.text-selection-panel.visible {
    display: flex;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h3 {
    color: #fff;
    margin: 0;
    font-size: 16px;
}

.close-panel-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-panel-btn:hover {
    color: #fff;
}

.panel-content {
    padding: 10px;
    overflow-y: auto;
    max-height: calc(60vh - 50px);
}

.panel-text-item {
    background-color: rgba(60, 60, 60, 0.7);
    color: #fff;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.panel-text-item:hover {
    background-color: rgba(80, 80, 80, 0.7);
}

.panel-text-item.active {
    background-color: rgba(100, 100, 100, 0.7);
    border-left: 3px solid #ffcc00;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.speed-value {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 5px 10px;
    min-width: 40px;
    text-align: center;
}

.led-text {
    position: absolute;
    white-space: nowrap;
    font-size: 48px;
    font-weight: bold;
    font-family: tauhu-oo, sans-serif;
    text-shadow: 0 0 10px currentColor, 0 0 20px currentColor, 0 0 30px currentColor;
    color: #ff0;
}

/* 當LED文字在全螢幕模式下且為靜態顯示時的樣式 */
.marquee-container.fullscreen .led-text.static-mode {
    position: relative;
    left: 0 !important;
    transform: none !important;
    text-align: center;
}

.quick-settings {
    background-color: #333;
    padding: 15px;
    border-radius: 10px;
    width: 100%;
}

.basic-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* 輸入框與按鈕組合 */
.input-with-button {
    display: flex;
    width: 100%;
    position: relative;
}

.input-with-button input {
    width: 100%;
    padding-right: 40px; /* 為按鈕留出空間 */
}

.inline-action-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #555;
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.inline-action-btn:hover {
    background-color: #666;
}

@media (max-width: 480px) {
    .button-row button {
        padding: 10px 5px;
        font-size: 14px;
    }
}

.button-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.button-row button {
    flex: 1;
    min-width: fit-content;
}

input, button, select {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #444;
    color: #fff;
    font-family: tauhu-oo, sans-serif;
}

input[type="range"] {
    flex-grow: 1;
    min-width: 0;
}

button {
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #555;
}

label {
    color: #ccc;
    white-space: nowrap;
}

/* 頁籤式設定區塊 */
.tabbed-settings {
    background-color: #333;
    border-radius: 10px;
    width: 100%;
    overflow: hidden;
}

/* 頁籤導航 */
.tabs-nav {
    display: flex;
    background-color: #222;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 12px 15px;
    background-color: #222;
    color: #aaa;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    transition: all 0.3s;
    text-align: center;
}

.tab-btn:hover {
    background-color: #2a2a2a;
    color: #ddd;
}

.tab-btn.active {
    background-color: #333;
    color: #fff;
    border-bottom: 3px solid #ffcc00;
}

/* 頁籤內容 */
.tab-content {
    padding: 15px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* 已儲存文字頁籤標題和編輯按鈕 */
.saved-texts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.saved-texts-header h3 {
    color: #fff;
    margin: 0;
    font-size: 16px;
}

.edit-controls {
    display: flex;
    align-items: center;
}

.edit-texts-btn {
    background-color: #444;
    color: #fff;
    border: none;
    border-radius: 5px;
    width: 36px;
    height: 36px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.edit-texts-btn:hover {
    background-color: #555;
}

.edit-action-buttons {
    display: flex;
    gap: 5px;
}

.small-action-btn {
    background-color: #444;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.small-action-btn:hover {
    background-color: #555;
}

.small-action-btn.save-btn {
    background-color: #4a8;
}

.small-action-btn.save-btn:hover {
    background-color: #5b9;
}

/* 編輯模式 */
.saved-texts-edit-mode {
    width: 100%;
}

#textsEditor {
    width: 100%;
    min-height: 150px;
    background-color: #444;
    color: #fff;
    border: 1px solid #555;
    border-radius: 5px;
    padding: 10px;
    font-family: tauhu-oo, sans-serif;
    resize: vertical;
}

/* 儲存的文字清單 */
.saved-texts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.no-saved-texts {
    color: #999;
    text-align: center;
    width: 100%;
    padding: 20px 0;
}

.saved-text-item {
    background-color: #444;
    color: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
    max-width: 100%;
}

.saved-text-item:hover {
    background-color: #555;
}

.saved-text-content {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.delete-text-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    padding: 0 5px;
}

.delete-text-btn:hover {
    color: #ff6b6b;
}

.settings-title {
    color: #fff;
    font-size: 16px;
    margin-bottom: 10px;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
}

.color-option {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    margin: 0 5px 5px 0;
    cursor: pointer;
    border: 2px solid transparent;
    display: inline-block;
}

.color-option.active {
    border: 2px solid white;
}

#colorPicker, #bgColorPicker {
    height: 30px;
    width: 60px;
    padding: 0;
    border: none;
    vertical-align: middle;
}

.style-options {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.style-option {
    padding: 5px 10px;
    background-color: #444;
    color: #ccc;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 5px 5px 0;
    display: inline-block;
}

.style-option.active {
    background-color: #666;
    color: #fff;
    border: 1px solid #888;
}

.effect-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}

.effect-option {
    display: flex;
    align-items: center;
    gap: 5px;
}

.speed-control-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.speed-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #444;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.speed-display {
    background-color: #444;
    color: #fff;
    padding: 5px 10px;
    border-radius: 15px;
    min-width: 40px;
    text-align: center;
}

.font-neon {
    text-shadow: 0 0 10px currentColor, 0 0 20px currentColor, 0 0 30px currentColor, 0 0 40px currentColor;
}

.font-digital {
    letter-spacing: 2px;
}

.font-bubble {
    text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
}

.font-retro {
    letter-spacing: 1px;
}

.font-elegant {
    font-style: italic;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.effect-blink {
    animation: blink 1s infinite;
}

.effect-shadow {
    text-shadow: 3px 3px 0 currentColor, 6px 6px 0 rgba(0,0,0,0.3);
}

.effect-outline {
    -webkit-text-stroke: 1px #fff;
}

@media (max-width: 600px) {
    .control-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .control-row input[type="text"] {
        width: 100%;
    }
    
    .button-row {
        flex-direction: row;
    }
    
    .marquee-container {
        height: 70px;
    }
    
    .led-text {
        font-size: 36px;
    }
    
    .tab-btn {
        padding: 10px 5px;
        font-size: 14px;
    }
}