@font-face { font-family: 'ITC Avant Garde Gothic Std Extra Light'; src: url('fonts/ITC Avant Garde Gothic Std Extra Light.woff2') format('woff2'); }
@font-face { font-family: 'AR ADGothicJP'; src: url('fonts/jadhei01m.woff2') format('woff2'); }
@font-face { font-family: 'KozGoPr6N'; src: url('fonts/KozGoPr6N-Medium.woff2') format('woff2'); }

:root {
    --cyber-pink: #F676A6;
    --cyber-pink-hover: #E55A8C;
    --cyber-pink-glow: rgba(246, 118, 166, 0.36);
    --sakura-light: #FFB6C1;
    --digital-white: #F8F9FA;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --text-main: #2D3436;
    --text-muted: #636E72;
    --font-jp: 'Noto Sans TC', 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans SC', 'Microsoft YaHei', 'KozGoPr6N', 'AR ADGothicJP', 'Noto Sans JP', sans-serif;
    --font-en: 'ITC Avant Garde Gothic Std Extra Light', 'Inter', sans-serif;
    --tool48-account-bg: rgba(255, 255, 255, 0.58);
    --tool48-account-border: rgba(255, 255, 255, 0.6);
}

* { margin: 0; padding: 0; box-sizing: border-box; cursor: none !important; }

body {
    font-family: var(--font-jp);
    color: var(--text-main);
    background: linear-gradient(135deg, #e0eafc, #cfdef3, var(--sakura-light), #e0eafc);
    background-size: 300% 300%;
    animation: gradientMove 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
input, textarea, select { -webkit-user-select: text; user-select: text; }
.tool48-home-link {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    z-index: 80;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid var(--tool48-account-border);
    background: var(--tool48-account-bg);
    color: var(--cyber-pink);
    box-shadow: 0 8px 22px rgba(246,118,166,0.14);
    font-size: 0.78rem;
    font-weight: 900;
    text-decoration: none;
}

@keyframes gradientMove { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

#app-container {
    width: 100vw;
    max-width: 480px; 
    min-height: 100vh;
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.hidden { display: none !important; }

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 25px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.glass-panel-top {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 15px;
    border-radius: 0 0 16px 16px;
    margin: -20px -20px 20px -20px;
}

.glass-panel-bottom {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--glass-border);
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 15px;
    border-radius: 16px 16px 0 0;
    margin: 20px -20px -20px -20px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

h1 { font-size: 28px; font-weight: 800; line-height: 1.3; margin-bottom: 15px; }
.highlight { color: var(--cyber-pink); text-shadow: 0 0 10px var(--cyber-pink-glow); }
.subtitle { font-family: var(--font-en); font-size: 14px; font-weight: 600; color: var(--cyber-pink); letter-spacing: 2px; }
.description { font-size: 15px; line-height: 1.6; color: var(--text-muted); margin-bottom: 30px; }

.cyber-btn {
    width: 100%; padding: 15px; border: none; border-radius: 12px; background: var(--cyber-pink);
    color: white; font-size: 16px; font-weight: 700; letter-spacing: 1px;
    box-shadow: 0 4px 15px var(--cyber-pink-glow); transition: all 0.3s ease;
}
.cyber-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--cyber-pink-glow); }
.cyber-btn:disabled { background: #ccc; box-shadow: none; transform: none; cursor: not-allowed !important; }
.nav-btn { flex: 1; padding: 12px; }

.pulse-glow { animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 20, 147, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(255, 20, 147, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 20, 147, 0); } }

.quiz-viewport { overflow: hidden; flex-grow: 1; width: 100%; position: relative; padding-top: 15px; }
.quiz-track { display: flex; transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1); width: 600%; }
.quiz-page { width: 16.666%; flex-shrink: 0; padding: 5px; }

.question-item {
    background: rgba(255, 255, 255, 0.5); border-radius: 16px; padding: 20px 15px; margin-bottom: 20px;
    opacity: 0.3; transform: scale(0.98); transition: all 0.3s ease; pointer-events: none;
}
.question-item.active { opacity: 1; transform: scale(1); background: rgba(255, 255, 255, 0.9); box-shadow: 0 4px 15px rgba(255, 20, 147, 0.1); border: 1px solid var(--sakura-light); pointer-events: auto; }
.question-text { font-size: 16px; font-weight: 500; margin-bottom: 20px; line-height: 1.6; min-height: 3em; }

.slider-container { position: relative; padding: 10px 0; user-select: none; -webkit-user-select: none; }
.slider-ticks { position: absolute; top: 50%; left: 12px; right: 12px; display: flex; justify-content: space-between; transform: translateY(-50%); pointer-events: none; z-index: 1; }
.slider-ticks span { width: 6px; height: 6px; background: #ccc; border-radius: 50%; }
input[type=range].custom-range { -webkit-appearance: none; width: 100%; background: transparent; position: relative; z-index: 100; cursor: pointer; margin: 0; }
input[type=range].custom-range:focus { outline: none; }
input[type=range].custom-range::-webkit-slider-runnable-track { width: 100%; height: 4px; background: rgba(255, 20, 147, 0.15); border-radius: 2px; pointer-events: auto; }
input[type=range].custom-range::-webkit-slider-thumb { -webkit-appearance: none; height: 24px; width: 24px; border-radius: 50%; background: #dcdcdc; border: 3px solid white; box-shadow: 0 2px 6px rgba(0,0,0,0.2); margin-top: -10px; transition: all 0.2s ease; position: relative; z-index: 101; pointer-events: auto; }
input[type=range].custom-range.touched::-webkit-slider-thumb { background: var(--cyber-pink); border-color: white; transform: scale(1.2); box-shadow: 0 0 12px var(--cyber-pink-glow); }
.slider-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 15px; font-weight: 500; }

.progress-text { font-family: var(--font-en); font-size: 12px; color: var(--cyber-pink); margin-bottom: 5px; text-align: right; font-weight: 600; }
.progress-bar-bg { width: 100%; height: 6px; background: rgba(255, 20, 147, 0.1); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0%; background: var(--cyber-pink); box-shadow: 0 0 10px var(--cyber-pink-glow); transition: width 0.3s ease; }

.dark-badge {
    background: #2D3436; color: white; padding: 6px 12px; border-radius: 6px;
    font-size: 13px; font-weight: bold; display: inline-block; margin-bottom: 10px;
}

#lang-switcher-container { 
    position: absolute; top: 20px; right: 20px; z-index: 1000;
    display: flex; align-items: center; gap: 8px;              
}

#music-toggle-btn { margin: 0 !important; white-space: nowrap; }

.glass-select { padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(246,118,166,0.5); background: rgba(255,255,255,0.8); backdrop-filter: blur(5px); color: var(--cyber-pink); font-weight: bold; cursor: pointer; outline: none; }
.icon-button-text { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mbti-ui-icon { width: 16px; height: 16px; flex: 0 0 auto; background: currentColor; -webkit-mask: var(--mbti-icon) center/contain no-repeat; mask: var(--mbti-icon) center/contain no-repeat; }
.mbti-icon-music { --mbti-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M10 4v12.5A3.5 3.5 0 1 1 8 13.3V6l10-2v10.5a3.5 3.5 0 1 1-2-3.2V7.1L10 8.3V4Z'/%3E%3C/svg%3E"); }
.mbti-heart-mark { position: relative; width: min(48vw, 260px); aspect-ratio: 1; margin: 0 auto; color: rgba(246,118,166,0.18); filter: drop-shadow(0 18px 32px rgba(246,118,166,0.18)); }
.mbti-heart-mark span { position: absolute; background: currentColor; }
.mbti-heart-mark span:nth-child(1),
.mbti-heart-mark span:nth-child(2) { width: 58%; height: 58%; top: 12%; border-radius: 999px; }
.mbti-heart-mark span:nth-child(1) { left: 4%; }
.mbti-heart-mark span:nth-child(2) { right: 4%; }
.mbti-heart-mark span:nth-child(3) { left: 21%; top: 31%; width: 58%; height: 58%; transform: rotate(45deg); border-radius: 12px; }
.match-heart { width: 16px; height: 16px; display: inline-block; margin-left: 5px; vertical-align: -2px; background: var(--cyber-pink); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 21s-7.5-4.4-10-9.2C.3 8.5 2.3 4.5 6 4.2c2.1-.2 3.7.9 4.7 2.2.4.5 1 .5 1.4 0 1-1.3 2.6-2.4 4.7-2.2 3.7.3 5.7 4.3 4 7.6C19.5 16.6 12 21 12 21z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 21s-7.5-4.4-10-9.2C.3 8.5 2.3 4.5 6 4.2c2.1-.2 3.7.9 4.7 2.2.4.5 1 .5 1.4 0 1-1.3 2.6-2.4 4.7-2.2 3.7.3 5.7 4.3 4 7.6C19.5 16.6 12 21 12 21z'/%3E%3C/svg%3E") center/contain no-repeat; animation: heart-beat 1s infinite; }

.account-shell { position: relative; flex-shrink: 0; }
.account-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 180px;
    min-height: 36px;
    font-family: inherit;
    border-radius: 999px;
    border-color: var(--tool48-account-border);
    background: var(--tool48-account-bg);
    box-shadow: 0 8px 22px rgba(246,118,166,0.14);
}
.account-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3Cpath d='M7 20.7c1.2-2.1 3-3.2 5-3.2s3.8 1.1 5 3.2'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3Cpath d='M7 20.7c1.2-2.1 3-3.2 5-3.2s3.8 1.1 5 3.2'/%3E%3C/svg%3E") center / contain no-repeat;
}
.account-toggle-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1200;
    width: min(340px, calc(100vw - 24px));
    padding: 14px;
    display: grid;
    gap: 10px;
    text-align: left;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 12px 34px rgba(255, 20, 147, 0.18);
}
.account-popover[hidden], .cloud-login-form[hidden], .cloud-actions[hidden] { display: none !important; }
.cloud-login-form { display: grid; gap: 8px; }
.cloud-input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 12px;
    border: 1px solid rgba(255, 20, 147, 0.22);
    background: rgba(255, 255, 255, 0.88);
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    outline: none;
}
.cloud-input:focus { border-color: var(--cyber-pink); box-shadow: 0 0 0 3px rgba(255, 20, 147, 0.12); }
.cloud-form-button {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 20, 147, 0.26);
    background: rgba(255, 255, 255, 0.86);
    color: var(--cyber-pink);
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
.cloud-form-button.primary {
    background: var(--cyber-pink);
    border-color: var(--cyber-pink);
    color: white;
    box-shadow: 0 4px 14px rgba(255, 20, 147, 0.24);
}
.cloud-form-button:hover:not(:disabled) { transform: translateY(-1px); }
.cloud-form-button:disabled { opacity: 0.55; transform: none; box-shadow: none; }
.cloud-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.cloud-user-pill {
    max-width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255, 20, 147, 0.1);
    color: var(--text-main);
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cloud-status-text, .cloud-message {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

#page-quiz:not(.hidden) ~ #cloud-hub { display: none !important; }
.cloud-hub {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}
.cloud-hub-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.cloud-title {
    margin: 0 0 4px;
    color: var(--cyber-pink);
    font-weight: 900;
    font-size: 15px;
    line-height: 1.25;
}
.cloud-pill {
    flex-shrink: 0;
    max-width: 140px;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(255, 20, 147, 0.1);
    color: var(--cyber-pink);
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    text-align: center;
}
.cloud-hub-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.cloud-results-list {
    display: grid;
    gap: 10px;
}
.cloud-result-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 20, 147, 0.16);
    background: rgba(255, 255, 255, 0.56);
}
.cloud-result-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.cloud-result-title {
    display: block;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.cloud-result-meta {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}
.cloud-result-code {
    flex-shrink: 0;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 20, 147, 0.12);
    color: var(--cyber-pink);
    font-family: var(--font-en);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
}
.cloud-result-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.cloud-result-actions .delete { color: #B92355; border-color: rgba(185, 35, 85, 0.3); }
.cloud-result-actions .delete:hover:not(:disabled) { background: #B92355; color: white; }

#custom-cursor { transition: opacity 0.3s ease; }
#custom-cursor.hidden-cursor { opacity: 0 !important; }

/* Animation effects */
@keyframes pulse-glow { 0%, 80% { filter: drop-shadow(0 0 5px rgba(255, 20, 147, 0.3)); } 50% { filter: drop-shadow(0 0 15px rgba(255, 20, 147, 0.8)); } }
.pulse-glow { animation: pulse-glow 2.5s infinite ease-in-out; }
@keyframes pulse-border { 0%, 100% { box-shadow: 0 0 8px var(--cyber-pink), inset 0 0 4px var(--cyber-pink); } 50% { box-shadow: 0 0 20px var(--cyber-pink), inset 0 0 10px var(--cyber-pink); } }
.pulse-border { animation: pulse-border 2.5s infinite ease-in-out; border-radius: 50%; transition: all 0.5s; }
.thick-pulse-border { border: 2px solid var(--cyber-pink); animation: pulse-border 1.5s infinite ease-in-out; }
@keyframes pulse-text { 0%, 100% { text-shadow: 0 0 5px rgba(255, 20, 147, 0.4); } 50% { text-shadow: 0 0 15px rgba(255, 20, 147, 0.9); } }
.pulse-text { animation: pulse-text 2.5s infinite ease-in-out; }
@keyframes burst-light { 0% { filter: brightness(1) drop-shadow(0 0 0px #fff); transform: scale(1); } 50% { filter: brightness(1.5) drop-shadow(0 0 20px #FF1493); transform: scale(1.2); } 100% { filter: brightness(1) drop-shadow(0 0 5px #FF1493); transform: scale(1); } }
.burst-light-anim { animation: burst-light 0.8s ease-out forwards; display: inline-block; }

#giant-heart-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    display: flex; justify-content: center; align-items: center;
    z-index: 10005; pointer-events: none; opacity: 0; transition: opacity 0.5s;
}
.giant-heart {
    font-size: 380px; margin-top: 18vh; 
    filter: drop-shadow(0 0 20px rgba(255, 20, 147, 0.8));
    animation: giant-heartbeat 1.5s ease-in-out infinite;
}
.giant-heart.mbti-heart-mark {
    width: min(48vw, 260px);
    font-size: 0;
    margin-top: 18vh;
    filter: drop-shadow(0 0 20px rgba(255, 20, 147, 0.45));
}
@keyframes giant-heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.3); } 30% { transform: scale(1.1); } 45% { transform: scale(1.3); } }

#loading-overlay {
    position: fixed; inset: 0; background: rgba(255,255,255,0.85);
    backdrop-filter: blur(5px); z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    opacity: 1; transition: opacity 0.5s ease;
}
#loading-overlay.hidden { opacity: 0; pointer-events: none; display: none; }
.loader-container { display: flex; flex-direction: column; align-items: center; }
.loader-circle { width: 120px; height: 120px; transform: rotate(-90deg); margin-bottom: 20px; }
.loader-circle circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.loader-circle .bg { stroke: #eee; }
.loader-circle .progress {
    stroke: var(--cyber-pink); stroke-dasharray: 283; stroke-dashoffset: 283;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.loader-text { font-family: var(--font-jp); font-weight: bold; font-size: 1.2rem; color: var(--cyber-pink); letter-spacing: 2px; }

.result-avatar { position: relative; overflow: hidden; transform: translateZ(0); }
.result-avatar::after {
    content: ""; position: absolute; top: -50%; left: -150%; width: 80%; height: 200%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.1) 20%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.1) 80%, rgba(255, 255, 255, 0) 100%);
    transform: rotate(30deg); opacity: 0; animation: shine-sweep 4.2s infinite; pointer-events: none; z-index: 2;
}
@keyframes shine-sweep { 0%, 70% { left: -150%; opacity: 0; } 71% { left: -150%; opacity: 1; } 100% { left: 150%; opacity: 1; } }

*, body, html { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="%23FF69B4" stroke="black" stroke-width="1" d="M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86 3.73 8.35c.16.36.61.52.97.35l2.43-1.09c.36-.16.52-.61.35-.97l-3.72-8.33 6.01.55c.45.04.77-.47.49-.83L6.34 2.86c-.24-.31-.84-.13-.84.35z"/></svg>'), auto !important; }
a, button, input, select, .question-item, label, .slider-ticks span { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="%23FF69B4" stroke="black" stroke-width="1" d="M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86 3.73 8.35c.16.36.61.52.97.35l2.43-1.09c.36-.16.52-.61.35-.97l-3.72-8.33 6.01.55c.45.04.77-.47.49-.83L6.34 2.86c-.24-.31-.84-.13-.84.35z"/></svg>'), pointer !important; }

.ripple-effect {
    position: fixed; border-radius: 50%; transform: scale(0); transform-origin: center center;
    width: 15px !important; height: 15px !important; 
    background-color: rgba(255, 105, 180, 0.4); pointer-events: none; z-index: 99999; 
    animation: ripple-anim 600ms ease-out forwards;
}
@keyframes ripple-anim { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(2.0); opacity: 0; } }

#radar-wrapper { position: relative; width: 100%; max-width: 380px; aspect-ratio: 1 / 1; margin: 0 auto 20px auto !important; display: flex; justify-content: center; align-items: center; }
#radarChart { width: 100% !important; height: 100% !important; margin: 0 auto !important; display: block !important; }

.export-only { display: none; }
#export-card .export-only { display: none; }
.html2canvas-container .web-only { display: none !important; }
.html2canvas-container .export-only { display: grid !important; }

.exporting-mode {
    padding-bottom: 30px !important; 
    width: 540px !important; height: 960px !important; position: absolute !important; top: 0 !important; left: 0 !important;
    z-index: -1 !important; overflow: hidden !important; background: #FFF5F8 !important;
    display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: flex-start !important;
    padding-top: -15px !important; 
}
.exporting-mode .chart-container, .exporting-mode #radar-wrapper { transform: scale(0.85); margin-top: -15px; margin-bottom: -15px; }
.exporting-mode .web-only { display: none !important; }
.exporting-mode .export-only { display: grid !important; margin-top: 0px !important; gap: 6px !important;}
.exporting-mode .deep-analysis-box { display: block !important; font-size: 0.85em; margin-top: 10px; line-height: 1.4; }
.exporting-mode .landing-header { width: 100% !important; text-align: center !important; margin-bottom: -25px !important; transform: scale(1.2); }
.exporting-mode .landing-header h2 { font-size: 46px !important; margin-top: -5px !important; }
.exporting-mode #radar-wrapper { width: 320px !important; margin-left: auto !important; margin-right: auto !important; margin-top: -25px !important; margin-bottom: -25px !important; display: block !important; }
.exporting-mode #radarChart { margin: 0 auto !important; }
.exporting-mode #main-display-section { width: 98% !important; margin-top: -25px !important; padding: 9px 15px 15px 15px !important; transform: scale(1.0); transform-origin: top center; border: 3px solid #ffb7c5 !important; }
.exporting-mode #deep-analysis-box { font-size: 12px !important; margin-top: 6px !important; padding: 8px !important; line-height: 1.4 !important; }
.exporting-mode .result-avatar { animation: none !important; box-shadow: none !important; border: 1px solid rgba(255, 105, 180, 0.2) !important; }
.exporting-mode .pulse-border, .exporting-mode .thick-pulse-border { animation: none !important; box-shadow: none !important; }

#oshi-select, #oshi-select option { font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif !important; }

.sakura-petal { position: fixed; top: -10%; z-index: 1; pointer-events: none; animation: fall linear infinite; background-color: rgba(255, 182, 193, 0.6); border-radius: 15px 0px 15px 0px; }
@keyframes fall { 0% { top: -10%; transform: translateX(0) rotate(0deg); opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { top: 110%; transform: translateX(100px) rotate(360deg); opacity: 0; } }

body > canvas { z-index: 999999 !important; pointer-events: none !important; }

.site-footer { position: relative; width: 100%; height: auto; min-height: 0; display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; margin: 18px 0 12px; font-size: 0.6rem; color: var(--text-muted); border: 1px solid var(--glass-border); border-radius: 18px; background: rgba(255,255,255,0.46); box-shadow: 0 10px 28px rgba(246,118,166,0.08); flex-wrap: wrap; gap: 6px 10px; z-index: 10; text-align: left; line-height: 1.35; opacity: 1; }
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 0; font-weight: 700; }
.footer-copy { flex: 1 1 220px; min-width: 0; }
.footer-copy p { display: inline; }
.footer-copy p + p::before { content: " "; }
.footer-links { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px 10px; align-items: center; flex-shrink: 0; }
.footer-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-weight: 900; text-decoration: none; white-space: nowrap; }
.footer-link-icon { width: 14px; height: 14px; flex: 0 0 auto; background: currentColor; -webkit-mask: var(--footer-icon) center/contain no-repeat; mask: var(--footer-icon) center/contain no-repeat; }
.footer-link-icon-bug { --footer-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m8 2 1.9 1.9'/%3E%3Cpath d='M14.1 3.9 16 2'/%3E%3Cpath d='M9 7h6'/%3E%3Cpath d='M8 7v8a4 4 0 0 0 8 0V7'/%3E%3Cpath d='M3 13h4'/%3E%3Cpath d='M17 13h4'/%3E%3Cpath d='m5 19 3-3'/%3E%3Cpath d='m19 19-3-3'/%3E%3C/svg%3E"); }
.footer-link-icon-heart { --footer-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 21s-7.5-4.4-10-9.2C.3 8.5 2.3 4.5 6 4.2c2.1-.2 3.7.9 4.7 2.2.4.5 1 .5 1.4 0 1-1.3 2.6-2.4 4.7-2.2 3.7.3 5.7 4.3 4 7.6C19.5 16.6 12 21 12 21z'/%3E%3C/svg%3E"); }

#footer-mv-wrap {
    width: 280px; 
    background: #000; 
    border-radius: 12px; 
    overflow: hidden; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
    
    /* Animate only position and opacity here; width must stay stable. */
    transition: transform 0.4s ease, opacity 0.4s ease, bottom 0.4s ease, right 0.4s ease; 
    
    z-index: 999; 
}
#footer-mv-wrap.floating-mode { position: fixed; right: 20px; bottom: 80px; transform: scale(1); opacity: 1; }
#footer-mv-wrap.docked-mode { position: relative; right: 0; bottom: 0; margin: 20px auto; width: 100%; max-width: 560px; transform: scale(1); }
#footer-mv-wrap.hidden { opacity: 0; pointer-events: none; transform: translateY(20px) scale(0.8); display: none !important; }
#yt-player-container { width: 100%; aspect-ratio: 16 / 9; background: #000; }

/* ==================================
   修復版：成就勳章 (Badges) 樣式
   ================================== */
.badge-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px; /* 縮細間距 */
    margin: 8px 0 10px 0; /* Keep vertical space compact. */
}

.achievement-badge {
    background: rgba(255, 20, 147, 0.1);
    color: var(--cyber-pink);
    border: 1px solid rgba(255, 20, 147, 0.3);
    
    /* Keep the badge group compact. */
    padding: 4px 10px; /* 從 6px 12px 縮細 */
    font-size: 11px; /* 從 12px 縮細 */
    border-radius: 16px; /* 從 20px 縮細 */
    
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(255, 20, 147, 0.05);
    animation: badge-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

/* 針對 Tier 5 (極端高分) 的特別閃亮樣式 */
.achievement-badge.legendary {
    background: linear-gradient(135deg, #FF1493, #FF69B4);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(255, 20, 147, 0.4);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.achievement-badge:nth-child(1) { animation-delay: 0.1s; }
.achievement-badge:nth-child(2) { animation-delay: 0.3s; }
.achievement-badge:nth-child(3) { animation-delay: 0.5s; }

@keyframes badge-pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Disable animations during export. */
.exporting-mode * {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    #lang-switcher-container { position: fixed; top: 10px; right: 10px; left: 10px; justify-content: flex-end; flex-wrap: wrap; }
    .account-toggle { max-width: 142px; min-height: 34px; padding: 7px 9px; font-size: 12px; }
    .account-popover { width: calc(100vw - 20px); }
    .progress-container { top: 55px !important; } 
    #page-landing { justify-content: center; padding-top: 40px; min-height: 85vh; }
    #custom-cursor { display: none; } 
    .giant-heart { font-size: 250px; margin-top: 40vh; }
    #radar-wrapper { transform: translateX(-20px); }
    .quiz-viewport { padding-top: 35px; }
}

@media (max-width: 480px) {
    #footer-mv-wrap.floating-mode { width: 180px; right: 10px; bottom: 100px; }
    .cloud-hub-actions, .cloud-result-actions { grid-template-columns: 1fr; }
    .cloud-hub-header, .cloud-result-main { align-items: stretch; flex-direction: column; }
    .cloud-pill, .cloud-result-code { max-width: none; align-self: flex-start; }
    .site-footer {
        left: auto;
        transform: none;
        width: auto;
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px 10px;
        padding: 8px 10px;
        font-size: 0.6rem;
        line-height: 1.35;
    }
    .footer-copy { flex: 1 1 220px; }
    .footer-copy p { display: inline; }
    .footer-copy p + p { margin-top: 0; }
    .footer-copy p + p::before { content: " "; }
    .footer-links { width: auto; gap: 8px 10px; flex: 0 0 auto; }
    .footer-link-icon { width: 12px; height: 12px; }
}

/* Phase 2G account controls: keep the top-right row compact on mobile. */
#lang-switcher-container {
    flex-wrap: nowrap;
    max-width: calc(100vw - 24px);
}

#music-toggle-btn,
.glass-select,
.account-toggle {
    min-width: 0;
}

@media (max-width: 768px) {
    #lang-switcher-container {
        left: 76px;
        right: 6px;
        gap: 4px;
        flex-wrap: nowrap;
    }
    .tool48-home-link {
        top: 8px;
        left: 8px;
        min-height: 30px;
        padding: 5px 8px;
        font-size: 0.64rem;
    }
    #music-toggle-btn {
        max-width: min(112px, 31vw);
        min-height: 30px;
        padding: 5px 7px !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 10px !important;
        gap: 4px;
    }
    .glass-select {
        max-width: min(82px, 24vw);
        min-height: 30px;
        padding-inline: 6px !important;
        font-size: 10px;
    }
    .account-toggle {
        max-width: min(108px, 30vw);
        min-height: 30px;
        padding: 5px 7px;
        font-size: 10px;
        flex-shrink: 1;
    }
    .account-toggle-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .account-popover {
        position: fixed;
        top: 52px;
        right: 8px;
        left: 8px;
        width: auto;
        max-height: calc(100dvh - 64px);
        overflow: auto;
    }
}

@media (max-width: 380px) {
    #lang-switcher-container { left: 68px; }
    .tool48-home-link {
        min-height: 28px;
        padding: 4px 7px;
        font-size: 0.6rem;
    }
    #music-toggle-btn { max-width: min(104px, 30vw); }
    .glass-select { max-width: min(76px, 23vw); }
    .account-toggle { max-width: min(98px, 29vw); }
}
