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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #ff6b9d 0%, #c44569 50%, #f8b500 100%);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* 左側預覽區 */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px 0 0 20px;
    margin: 10px 0 10px 10px;
    box-shadow: 0 20px 40px rgba(255, 107, 157, 0.3);
}

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    overflow: hidden;
    background: linear-gradient(45deg, #ffeef8 0%, #fff0f5 100%);
    border-radius: 20px 0 0 0;
    position: relative;
}

#canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(255, 107, 157, 0.2);
    transition: transform 0.3s ease;
}

#canvas:hover {
    transform: scale(1.02);
}

.download-bar {
    padding: 20px 30px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8fab 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0 0 0 20px;
}

.download-bar > span {
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.download-buttons {
    display: flex;
    gap: 12px;
}

.download-buttons button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.download-buttons button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.3);
}

/* 右側設定區 */
.settings-panel {
    width: 350px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 25px;
    border-radius: 0 20px 20px 0;
    margin: 10px 10px 10px 0;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(255, 107, 157, 0.3);
}

.settings-panel h2 {
    color: #c44569;
    font-size: 24px;
    margin-bottom: 25px;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    padding: 15px 0;
    border-radius: 15px;
    background-color: rgba(255, 240, 245, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 107, 157, 0.2);
    transition: all 0.3s ease;
}

.setting-group {
    margin-bottom: 20px;
    background: rgba(255, 240, 245, 0.6);
    padding: 15px;
    border-radius: 15px;
    border: 1px solid rgba(255, 107, 157, 0.1);
}

.setting-group > label {
    display: flex;
    justify-content: space-between;
    color: #c44569;
    font-size: 13px;
    margin-bottom: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-group > label span {
    color: #ff6b9d;
    font-weight: 800;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(255, 107, 157, 0.2);
    border-radius: 12px;
    color: #c44569;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #ff6b9d;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.2);
    transform: translateY(-1px);
}

select {
    cursor: pointer;
}

select option {
    background: rgba(255, 240, 245, 0.9);
    color: #c44569;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #ffb3d1 0%, #ff6b9d 100%);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.6);
}

input[type="color"] {
    height: 40px;
    border: 2px solid rgba(255, 107, 157, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px;
    transition: all 0.3s ease;
}

input[type="color"]:hover {
    border-color: #ff6b9d;
    transform: scale(1.05);
}

.color-row {
    display: flex;
    gap: 10px;
}

.color-row input[type="color"] {
    width: 60px;
}

.color-row input[type="text"] {
    flex: 1;
    text-transform: uppercase;
}

/* 類型選擇器 */
.type-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 背景選項 */
.bg-options {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #c44569;
    font-size: 13px;
    cursor: pointer;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 20px;
    background: rgba(255, 107, 157, 0.1);
    transition: all 0.3s ease;
}

.radio-label:hover {
    background: rgba(255, 107, 157, 0.2);
    transform: translateY(-1px);
}

.radio-label input[type="radio"] {
    accent-color: #ff6b9d;
    transform: scale(1.2);
}

.bg-options input[type="color"] {
    width: 60px;
    height: 40px;
}

/* 尺寸網格 */
.size-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.size-btn {
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid rgba(255, 107, 157, 0.2);
    border-radius: 12px;
    color: #c44569;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.size-btn:hover {
    border-color: #ff6b9d;
    background: rgba(255, 107, 157, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.2);
}

.size-btn.active {
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    border-color: #ff6b9d;
    color: white;
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.4);
}

.custom-size {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-size input {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
}

.custom-size span {
    color: #ff6b9d;
    font-weight: 800;
    font-size: 16px;
}

.custom-size button {
    padding: 10px 15px;
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-size button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.4);
}

/* 檔案上傳 */
.file-upload {
    margin-bottom: 12px;
}

.upload-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.1), rgba(196, 69, 105, 0.1));
    border: 2px dashed #ff6b9d;
    border-radius: 15px;
    color: #c44569;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-btn:hover {
    border-color: #c44569;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.2), rgba(196, 69, 105, 0.2));
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.2);
}

#imagePreview {
    text-align: center;
}

#imagePreview img {
    max-width: 100%;
    max-height: 100px;
    border-radius: 12px;
    margin-top: 10px;
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.2);
    transition: transform 0.3s ease;
}

#imagePreview img:hover {
    transform: scale(1.05);
}

/* 版權資訊 */
.footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 107, 157, 0.2);
    text-align: center;
}

.logo-link {
    color: #c44569;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    padding: 10px 20px;
    border-radius: 25px;
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.1), rgba(196, 69, 105, 0.1));
    display: inline-block;
}

.logo-link:hover {
    color: white;
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.4);
}

/* 滾動條 */
.settings-panel::-webkit-scrollbar {
    width: 8px;
}

.settings-panel::-webkit-scrollbar-track {
    background: rgba(255, 107, 157, 0.1);
    border-radius: 10px;
}

.settings-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    border-radius: 10px;
}

.settings-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #c44569, #ff6b9d);
}

/* 響應式 */
@media (max-width: 800px) {
    .app-container {
        flex-direction: column;
    }
    
    .settings-panel {
        width: 100%;
        max-height: 50vh;
        border-radius: 20px 20px 0 0;
        margin: 0 10px 10px 10px;
    }
    
    .preview-panel {
        flex: 1;
        border-radius: 0 0 20px 20px;
        margin: 10px 10px 0 10px;
    }
    
    .preview-container {
        border-radius: 0;
    }
    
    .download-bar {
        border-radius: 0 0 20px 20px;
    }
    
    .size-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.settings-panel h2:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 157, 0.2);
    background-color: rgba(255, 240, 245, 0.5);
}

/* 漸變動畫 */
@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
}

/* ❄️ 雪花容器 ❄️ */
.snowflakes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -10px;
    color: white;
    font-size: 1em;
    animation-name: snowfall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    user-select: none;
}

.snowflake:nth-child(odd) {
    color: rgba(255, 182, 193, 0.8);
}

.snowflake:nth-child(3n) {
    color: rgba(255, 192, 203, 0.9);
}

@keyframes snowfall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(calc(100vh + 100px)) rotate(360deg);
        opacity: 0.3;
    }
}
/* JavaScript 未啟用警告 */
.noscript-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.warning-content {
    background: linear-gradient(135deg, #ff6b9d, #c44569);
    color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    margin: 20px;
    box-shadow: 0 20px 40px rgba(255, 107, 157, 0.3);
}

.warning-content h2 {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 700;
}

.warning-content p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.warning-content p:last-child {
    margin-bottom: 0;
}
/* 自訂字體相關樣式 */
#customFontGroup {
    background: linear-gradient(135deg, rgba(255, 107, 157, 0.1), rgba(196, 69, 105, 0.1));
    border: 2px dashed rgba(255, 107, 157, 0.3);
}

.font-tips {
    margin-top: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    border-left: 4px solid #ff6b9d;
}

.font-tips p {
    margin: 0;
    font-size: 12px;
    color: #c44569;
    line-height: 1.4;
}

.font-tips p:first-child {
    font-weight: 700;
    margin-bottom: 5px;
}

.font-tips p:not(:first-child) {
    margin-left: 10px;
}

/* 字體選擇器樣式優化 */
select optgroup {
    font-weight: 700;
    color: #c44569;
    background: rgba(255, 240, 245, 0.9);
}

select option {
    font-weight: 500;
    padding: 5px;
}

/* 字體預覽樣式 */
#fontPreview {
    margin-top: 10px;
}

#fontPreview div {
    border: 1px solid rgba(255, 107, 157, 0.2);
    transition: all 0.3s ease;
}

#fontPreview div:hover {
    border-color: #ff6b9d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.2);
}
/* 畫布飄浮動畫效果 */
#canvas {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center center;
    box-shadow: 0 15px 35px rgba(255, 107, 157, 0.2);
    animation: float 6s ease-in-out infinite;
}

#canvas:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 25px 50px rgba(255, 107, 157, 0.3);
    animation-play-state: paused;
}

/* 飄浮動畫 */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        box-shadow: 0 15px 35px rgba(255, 107, 157, 0.2);
    }
    25% {
        transform: translateY(-8px) rotate(0.5deg);
        box-shadow: 0 20px 40px rgba(255, 107, 157, 0.25);
    }
    50% {
        transform: translateY(-5px) rotate(0deg);
        box-shadow: 0 25px 45px rgba(255, 107, 157, 0.3);
    }
    75% {
        transform: translateY(-10px) rotate(-0.5deg);
        box-shadow: 0 20px 40px rgba(255, 107, 157, 0.25);
    }
}

/* 畫布切換動畫 */
#canvas.switching {
    animation: none; /* 暫停飄浮動畫 */
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: scale(0.9) rotateY(10deg);
    opacity: 0.7;
    filter: blur(1px);
}

#canvas.switch-complete {
    animation: none; /* 暫停飄浮動畫 */
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform: scale(1.05);
    opacity: 1;
    filter: none;
}

/* 當動畫完成後恢復飄浮效果 */
#canvas:not(.switching):not(.switch-complete):not(.pulse) {
    animation: float 6s ease-in-out infinite;
}

/* 預覽容器背景動畫 */
.preview-container {
    transition: background-color 0.3s ease;
    position: relative;
    background: linear-gradient(45deg, #ffeef8 0%, #fff0f5 100%);
    border-radius: 20px 0 0 0;
}

.preview-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        rgba(255, 107, 157, 0.05) 0%, 
        rgba(196, 69, 105, 0.05) 50%, 
        rgba(255, 107, 157, 0.05) 100%);
    background-size: 200% 200%;
    animation: backgroundFloat 8s ease-in-out infinite;
    border-radius: 20px 0 0 0;
    pointer-events: none;
}

@keyframes backgroundFloat {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.3;
    }
    50% {
        background-position: 100% 50%;
        opacity: 0.6;
    }
}

/* 尺寸按鈕點擊動畫 */
.size-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.size-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.size-btn.clicked::before {
    width: 300px;
    height: 300px;
}

.size-btn:active {
    transform: scale(0.95);
}

/* 畫布資訊動畫 */
#canvasInfo {
    transition: all 0.3s ease;
}

#canvasInfo.updating {
    transform: scale(1.1);
    color: #ff6b9d;
    text-shadow: 0 0 10px rgba(255, 107, 157, 0.3);
}

/* 脈衝動畫 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
}

.pulse {
    animation: pulse 0.4s ease-in-out;
}