:root {
    --bg: #F5F5F7;
    --surface: #FFFFFF;
    --surface-2: #FAFAFB;
    --ink: #0B0F1E;
    --ink-muted: #64748B;
    --border: rgba(15, 23, 42, 0.07);
    --violet: #7C3AED;
    --violet-soft: #F3EEFF;
    --cyan: #06B6D4;
    --cyan-soft: #E6FAFE;
    --pink: #EC4899;
    --line: #06C755;
}
.dark {
    --bg: #0B0F1E;
    --surface: #171F35;
    --surface-2: #1F2945;
    --ink: #F8FAFC;
    --ink-muted: #94A3B8;
    --border: rgba(255, 255, 255, 0.06);
    --violet: #A78BFA;
    --violet-soft: rgba(124, 58, 237, 0.15);
    --cyan: #22D3EE;
    --cyan-soft: rgba(6, 182, 212, 0.15);
    --line: #06C755;
}

.landing-shell {
    position: relative;
    isolation: isolate;
}
.landing-shell::before {
    content: '';
    position: absolute;
    inset: -120px -80px auto -80px;
    height: 520px;
    z-index: -1;
    background:
        radial-gradient(circle at 16% 18%, rgba(236,72,153,0.18), transparent 28%),
        radial-gradient(circle at 82% 20%, rgba(34,211,238,0.2), transparent 30%),
        linear-gradient(180deg, rgba(124,58,237,0.12), transparent 76%);
    pointer-events: none;
}
.brand-logo {
    filter: drop-shadow(0 22px 36px rgba(76,29,149,0.18));
    animation: logoGlow 3.2s ease-in-out infinite;
}
.brand-logo:hover {
    animation-play-state: paused;
    transform: scale(1.04) rotate(-1deg);
    transition: transform .35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hero-stage {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.92), rgba(255,255,255,0.68)),
        radial-gradient(circle at 74% 18%, rgba(6,199,85,0.18), transparent 30%),
        radial-gradient(circle at 20% 76%, rgba(236,72,153,0.16), transparent 36%);
}
.dark .hero-stage {
    background:
        linear-gradient(135deg, rgba(23,31,53,0.94), rgba(15,23,42,0.82)),
        radial-gradient(circle at 74% 18%, rgba(6,199,85,0.16), transparent 30%),
        radial-gradient(circle at 20% 76%, rgba(236,72,153,0.13), transparent 36%);
}
.line-login-btn {
    background: #06C755;
    color: white;
    box-shadow: 0 10px 30px rgba(6,199,85,0.28);
}
.line-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 36px rgba(6,199,85,0.36);
}
.sticker-preview-card {
    background: rgba(255,255,255,0.84);
    border: 1px solid rgba(255,255,255,0.72);
    box-shadow: 0 24px 70px rgba(76,29,149,0.14);
}
.dark .sticker-preview-card {
    background: rgba(23,31,53,0.78);
    border-color: rgba(255,255,255,0.08);
}
.landing-chip {
    background: rgba(255,255,255,0.74);
    border: 1px solid rgba(124,58,237,0.12);
    box-shadow: 0 8px 26px rgba(15,23,42,0.06);
}
.dark .landing-chip {
    background: rgba(23,31,53,0.78);
    border-color: rgba(255,255,255,0.08);
}
.marquee-track {
    animation: marquee 22s linear infinite;
}
.spark-float-a { animation: floatSpark 4.6s ease-in-out infinite; }
.spark-float-b { animation: floatSpark 5.4s ease-in-out infinite reverse; }
.logo-breathe { animation: logoBreathe 3.4s ease-in-out infinite; }
.frame-bounce { animation: frameBounce 3.2s ease-in-out infinite; }
.frame-bounce-b { animation: frameBounceB 3.6s ease-in-out infinite; }
.hero-fade-in { animation: heroFadeIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}
@keyframes floatSpark {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
    50% { transform: translateY(-18px) rotate(12deg) scale(1.08); }
}
@keyframes logoBreathe {
    0%, 100% { transform: translateY(0) scale(1) rotate(-1.5deg); }
    50% { transform: translateY(-14px) scale(1.03) rotate(1.5deg); }
}
@keyframes logoGlow {
    0%, 100% { filter: drop-shadow(0 22px 36px rgba(76,29,149,0.18)) drop-shadow(0 0 0 rgba(236,72,153,0)); }
    50% { filter: drop-shadow(0 28px 48px rgba(76,29,149,0.28)) drop-shadow(0 0 24px rgba(236,72,153,0.35)); }
}
@keyframes frameBounce {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-14px) rotate(3deg); }
}
@keyframes frameBounceB {
    0%, 100% { transform: translateY(0) rotate(2deg) scale(1); }
    50% { transform: translateY(-10px) rotate(-2deg) scale(1.04); }
}
@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

body {
    font-family: 'Inter', 'Noto Sans TC', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    transition: background 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
}
.font-display { font-family: 'Outfit', 'Noto Sans TC', system-ui, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', Inter, monospace; }

/* 玻璃感頂部 */
.glass {
    background: rgba(245, 245, 247, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
}
.dark .glass {
    background: rgba(11, 15, 30, 0.72);
}

/* Bento 卡片 */
.bento {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px rgba(15,23,42,0.04);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s;
    overflow: hidden;
    position: relative;
}
.dark .bento {
    box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 12px 32px rgba(0,0,0,0.32);
}
.bento:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(15,23,42,0.06), 0 16px 48px rgba(15,23,42,0.08);
}
.dark .bento:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.4), 0 20px 56px rgba(0,0,0,0.5);
}
.bento-hero {
    background: linear-gradient(135deg, var(--violet) 0%, #A855F7 50%, var(--cyan) 100%);
    border: none;
    color: white;
}
.bento-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.15) 0%, transparent 50%),
                      radial-gradient(circle at 80% 80%, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* 主按鈕 */
.btn-primary {
    background: linear-gradient(135deg, #7C3AED 0%, #6366F1 100%);
    color: white;
    font-weight: 700;
    border-radius: 16px;
    padding: 12px 24px;
    box-shadow: 0 4px 16px rgba(124,58,237,0.3), 0 0 0 1px rgba(255,255,255,0.06) inset;
    transition: all 0.2s;
    position: relative;
}
.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(124,58,237,0.45), 0 0 32px rgba(124,58,237,0.3);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    border-radius: 14px;
    padding: 10px 18px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.btn-secondary:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--violet);
}
.dark .btn-secondary:hover:not(:disabled) {
    background: var(--surface-2);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-muted);
    font-weight: 600;
    border-radius: 12px;
    padding: 8px 12px;
    transition: all 0.15s;
}
.btn-ghost:hover {
    background: rgba(124,58,237,0.08);
    color: var(--violet);
}

.pill {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    transition: all 0.15s;
}
.pill.active {
    background: var(--violet);
    color: white;
    border-color: var(--violet);
    box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}
.pill:hover:not(.active) {
    border-color: var(--violet);
    color: var(--violet);
}

/* 棋盤格 */
.checkerboard {
    background-color: #F1F5F9;
    background-image:
        linear-gradient(45deg, #E2E8F0 25%, transparent 25%),
        linear-gradient(-45deg, #E2E8F0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #E2E8F0 75%),
        linear-gradient(-45deg, transparent 75%, #E2E8F0 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px 7px, 7px 0;
}
.dark .checkerboard {
    background-color: #1E293B;
    background-image:
        linear-gradient(45deg, #2D3B55 25%, transparent 25%),
        linear-gradient(-45deg, #2D3B55 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #2D3B55 75%),
        linear-gradient(-45deg, transparent 75%, #2D3B55 75%);
}
.bg-white-preview { background: #FFFFFF !important; background-image: none !important; }
.bg-dark-preview { background: #0F172A !important; background-image: none !important; }
.bg-chat-preview {
    background-color: #8EB1D6 !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23A8C4E1' fill-opacity='0.4'%3E%3Cpath d='M0 0h40v40H0V0zm40 40h40v40H40V40z'/%3E%3C/g%3E%3C/svg%3E") !important;
    background-size: 80px 80px !important;
}

/* Range slider */
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; }
input[type=range]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 18px; width: 18px;
    border-radius: 50%;
    margin-top: -7px;
    background: linear-gradient(135deg, #7C3AED, #6366F1);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(124,58,237,0.4), 0 0 0 3px white;
    transition: transform 0.15s;
}
.dark input[type=range]::-webkit-slider-thumb {
    box-shadow: 0 2px 8px rgba(124,58,237,0.5), 0 0 0 3px var(--surface);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* 分割線手柄 */
.grid-handle-v {
    width: 18px; margin-left: -9px;
    cursor: col-resize;
    background: rgba(124,58,237,0.08);
    transition: background 0.2s;
    z-index: 30;
}
.grid-handle-v:hover { background: rgba(124,58,237,0.35); }
.grid-handle-v::after {
    content: ''; position: absolute;
    left: 8px; top: 0; bottom: 0; width: 2px;
    background: #7C3AED;
    box-shadow: 0 0 12px rgba(124,58,237,0.6);
}
.grid-handle-h {
    height: 18px; margin-top: -9px;
    cursor: row-resize;
    background: rgba(124,58,237,0.08);
    transition: background 0.2s;
    z-index: 30;
}
.grid-handle-h:hover { background: rgba(124,58,237,0.35); }
.grid-handle-h::after {
    content: ''; position: absolute;
    top: 8px; left: 0; right: 0; height: 2px;
    background: #7C3AED;
    box-shadow: 0 0 12px rgba(124,58,237,0.6);
}

/* 動畫 */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes pulseSoft { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.animate-pulse-soft { animation: pulseSoft 2s ease-in-out infinite; }
@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.animate-spin-slow { animation: spin-slow 2s linear infinite; }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
.shimmer {
    background: linear-gradient(90deg, transparent 0%, rgba(124,58,237,0.1) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
.animate-float { animation: float 3s ease-in-out infinite; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) translateX(-50%); } to { opacity: 1; transform: translateY(0) translateX(-50%); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-12px) translateX(-50%); } }
.toast-anim { animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 2.7s forwards; }

.drop-zone-active {
    background: linear-gradient(135deg, var(--violet-soft) 0%, var(--cyan-soft) 100%) !important;
    border-color: var(--violet) !important;
    transform: scale(1.005);
}

/* 縮圖卡 */
.sticker-tile {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 18px;
    padding: 6px;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
.sticker-tile:hover {
    transform: translateY(-3px);
    border-color: var(--violet);
    box-shadow: 0 8px 24px rgba(124,58,237,0.15);
}
.sticker-tile.is-main { border-color: #F59E0B; box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
.sticker-tile.is-tab { border-color: #06B6D4; box-shadow: 0 0 0 3px rgba(6,182,212,0.18); }

/* 滾動條 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* 筆刷游標 */
.brush-cursor {
    position: fixed; pointer-events: none;
    border: 2px solid #fff;
    outline: 1px solid #000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    mix-blend-mode: difference;
}

/* 浮動底部 Dock */
.dock {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px;
    box-shadow: 0 16px 48px rgba(15,23,42,0.12), 0 4px 16px rgba(15,23,42,0.06);
    display: flex;
    gap: 8px;
    align-items: center;
}
.dark .dock {
    background: rgba(23, 31, 53, 0.85);
    box-shadow: 0 20px 56px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.3);
}

.no-select { user-select: none; -webkit-user-select: none; }
.safe-area-inset { inset: 6.5%; border: 2px dashed rgba(124,58,237,0.5); border-radius: 8px; pointer-events: none; }

/* VIP 特效與高級流光漸層 */
.vip-glow-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
}
.vip-glow-card::after {
    content: '';
    position: absolute;
    inset: -2px;
    z-index: -1;
    background: linear-gradient(90deg, #7c3aed, #06b6d4, #ff007f, #7c3aed);
    background-size: 400% 400%;
    border-radius: inherit;
    animation: vipStream 8s linear infinite;
    opacity: 0;
    transition: opacity 0.3s;
}
.vip-glow-card:hover::after {
    opacity: 1;
}
@keyframes vipStream {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 拖曳懸停時的虛線旋轉微動畫 */
.drop-zone-active {
    background: linear-gradient(135deg, var(--violet-soft) 0%, var(--cyan-soft) 100%) !important;
    border-color: var(--violet) !important;
    transform: scale(1.008);
    box-shadow: 0 0 32px rgba(124, 58, 237, 0.25);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.drop-zone-active svg {
    animation: uploadRotate 1.5s linear infinite;
}
@keyframes uploadRotate {
    0% { transform: translateY(-4px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(180deg); }
    100% { transform: translateY(-4px) rotate(360deg); }
}

/* 環狀 Processing 載入特效 */
.ring-loading {
    border: 3px solid rgba(124, 58, 237, 0.15);
    border-top: 3px solid var(--violet);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: ringSpin 0.8s linear infinite;
    display: inline-block;
}
@keyframes ringSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
