/* =============================================
   進場動畫（Splash Screen）
============================================= */
#splash-screen {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 不在這裡設 transition，由 JS 加 class 觸發，確保白幕淡出與網頁淡入同步 */
}

#splash-screen.fade-out {
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#splash-content {
    opacity: 0;
    transition: opacity 0.6s ease;
}

#splash-content.visible {
    opacity: 1;
}

#splash-content.fade-out {
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* 網頁主體的淡入（交叉溶解轉場關鍵） */
#page-main,
#top-bar {
    opacity: 0;
}

#page-main.page-visible,
#top-bar.page-visible {
    opacity: 1;
    transition: opacity 1.0s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 文字模式 */
.splash-text {
    font-family: 'Cinzel', serif;
    font-size: clamp(2rem, 8vw, 5rem);
    color: #111111;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

/* 圖片模式 */
.splash-image {
    max-width: 40vw;
    max-height: 40vh;
    object-fit: contain;
}

/* =============================================
   CSS 變數 & 基礎重置
============================================= */
:root {
    --theme-color: #c0c0c0;
    --theme-rgb: 192, 192, 192;
    --bg: #0a0a0a;
    --bg-card: #111111;
    --bg-card-hover: #1a1a1a;
    --border: rgba(192, 192, 192, 0.2);
    --border-hover: rgba(192, 192, 192, 0.8);
    --text-primary: #e8e8e8;
    --text-secondary: #888888;
    --text-dim: #444444;
    --topbar-height: 52px;
    --section-gap: 70px;
    --font-display: 'Cinzel', serif;
    --font-body: 'Noto Serif TC', serif;
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--bg);
    overscroll-behavior: none;
    /* Bug 2：display:flex 讓 body 緊貼內容高度，不留底部空白 */
    display: flex;
    flex-direction: column;
}

body {
    background-color: transparent;
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    max-width: 100vw;
    overscroll-behavior-y: none;
    /* Bug 2：flex 子元素，由內容高度決定，不被視窗撐高 */
    flex: 1 0 auto;
}

/* =============================================
   背景光暈
   - body 透明，html 承擔背景色，bg-glow z-index:0 夾在中間可見
   - 使用 vmax 取寬高較大值，手機直立時圓以螢幕高度計算，夠大
============================================= */
#bg-glow {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

#bg-glow::before,
#bg-glow::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    background: rgba(var(--theme-rgb), 1);
    animation: glow-drift 12s ease-in-out infinite alternate;
    /* Bug 3：預建 GPU 合成層，消除手機端動畫閃爍 */
    will-change: transform;
    /* backface-visibility 同樣有助於穩定合成層 */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

#bg-glow::before {
    width: 60vmax;
    height: 60vmax;
    top: -20vmax;
    left: -10vmax;
    animation-delay: 0s;
}

#bg-glow::after {
    width: 50vmax;
    height: 50vmax;
    bottom: -15vmax;
    right: -10vmax;
    animation-delay: -6s;
    opacity: 0.08;
}

@keyframes glow-drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(4vw, 3vw) scale(1.05); }
    100% { transform: translate(-3vw, 5vw) scale(0.97); }
}

/* 手機版：縮小 blur 半徑，讓小螢幕上光暈不會被模糊到消失 */
@media (max-width: 768px) {
    #bg-glow::before,
    #bg-glow::after {
        filter: blur(60px);
        opacity: 0.18;
    }
}

/* 電路背景遮罩 — 介於 bg-glow 與 circuit-canvas 之間，提升對比度 */
#circuit-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

/* 電路紋路 Canvas — 在遮罩之上 */
#circuit-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
}

@media (max-width: 768px) {
    #circuit-canvas {
        opacity: 0.18;
    }
}

/* 電路顏色選擇 — 觸發按鈕 */
.circuit-color-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9100;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--theme-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.circuit-color-toggle svg {
    width: 18px;
    height: 18px;
}

.circuit-color-toggle:hover,
.circuit-color-toggle.open {
    border-color: var(--border-hover);
    box-shadow: 0 0 12px rgba(var(--theme-rgb), 0.4);
    background: rgba(var(--theme-rgb), 0.08);
}

/* 電路顏色選擇 — 面板 */
.circuit-color-panel {
    position: fixed;
    bottom: 72px;
    right: 24px;
    z-index: 9100;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.circuit-color-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* 色票列 */
.circuit-color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.circuit-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    outline: 2px solid rgba(255, 255, 255, 0.08);
    outline-offset: 1px;
}

.circuit-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
}

.circuit-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    outline-color: transparent;
}

/* 自訂顏色列 */
.circuit-color-custom {
    display: flex;
    align-items: center;
    gap: 10px;
}

.circuit-color-custom span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    white-space: nowrap;
}

.circuit-color-custom input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

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

.circuit-color-custom input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

/* 手機版微調 */
@media (max-width: 768px) {
    .circuit-color-toggle {
        width: 34px;
        height: 34px;
        bottom: 16px;
        right: 16px;
    }

    .circuit-color-toggle svg {
        width: 16px;
        height: 16px;
    }

    .circuit-color-panel {
        bottom: 60px;
        right: 16px;
        padding: 12px;
    }

    .circuit-swatch {
        width: 26px;
        height: 26px;
    }
}

/* top-bar 已有 position:fixed + z-index:9000，自然在光暈之上 */

img {
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
    user-select: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =============================================
   頂部固定列
============================================= */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--topbar-height);
    background: rgba(10, 10, 10, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9000;
    display: flex;
    align-items: center;
}

.top-bar-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.site-title-bar {
    grid-column: 2;
    text-align: center;
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* BGM 控制 */
.bgm-controls {
    grid-column: 1;
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bgm-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--theme-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.bgm-btn svg {
    width: 16px;
    height: 16px;
}

.bgm-btn:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 10px rgba(var(--theme-rgb), 0.4);
    background: rgba(var(--theme-rgb), 0.08);
}

.bgm-btn.playing {
    border-color: var(--theme-color);
    box-shadow: 0 0 14px rgba(var(--theme-rgb), 0.5);
}

/* 瀏覽器封鎖 autoplay 時，播放鍵輕微閃爍提示使用者 */
@keyframes bgm-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(var(--theme-rgb), 0.3); }
    50%       { box-shadow: 0 0 16px rgba(var(--theme-rgb), 0.8); border-color: var(--theme-color); }
}
.bgm-btn.autoplay-blocked {
    animation: bgm-pulse 1.8s ease-in-out infinite;
}

.volume-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vol-icon {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
    flex-shrink: 0;
}

#volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 2px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--theme-color);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(var(--theme-rgb), 0.6);
}

#volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--theme-color);
    border: none;
    cursor: pointer;
}

/* =============================================
   主體
============================================= */
#page-main {
    padding-top: var(--topbar-height);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    /* 防止跑馬燈 transform 被誤解為 scroll 而跳回頂部 */
    overscroll-behavior: none;
}

/* =============================================
   區塊共用標題
============================================= */
.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding: 0 40px;
}

.section-label {
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-secondary);
    white-space: nowrap;
}

.section-line {
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* =============================================
   ① Banner 輪播
============================================= */
.section-banner {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16 / 5;
    max-height: 480px;
}

.banner-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.7s cubic-bezier(0.77, 0, 0.175, 1);
}

.banner-slide {
    min-width: 100%;
    height: 100%;
    overflow: hidden;
    flex-shrink: 0;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    opacity: 0.6;
}

.banner-arrow:hover {
    opacity: 1;
    border-color: var(--border-hover);
    box-shadow: 0 0 12px rgba(var(--theme-rgb), 0.4);
    background: rgba(0, 0, 0, 0.85);
}

.banner-arrow.left { left: 16px; }
.banner-arrow.right { right: 16px; }

.banner-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.banner-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background 0.3s, box-shadow 0.3s, transform 0.3s;
}

.banner-dot.active {
    background: var(--theme-color);
    box-shadow: 0 0 8px rgba(var(--theme-rgb), 0.8);
    transform: scale(1.3);
}

/* =============================================
   ② 網誌標題
============================================= */
.section-blog-title {
    padding: 48px 40px;
    display: flex;
    justify-content: center;
}

.blog-title-frame {
    display: inline-block;
    border: 1px solid var(--border);
    padding: 14px 48px;
    position: relative;
    background: rgba(0, 0, 0, 0.75);
}

/* 四角裝飾 */
.blog-title-frame::before,
.blog-title-frame::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-color: var(--theme-color);
    border-style: solid;
}

.blog-title-frame::before {
    top: -2px;
    left: -2px;
    border-width: 2px 0 0 2px;
}

.blog-title-frame::after {
    bottom: -2px;
    right: -2px;
    border-width: 0 2px 2px 0;
}

.blog-title-text {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 3px;
    color: var(--text-primary);
    text-align: center;
    white-space: nowrap;
}

/* =============================================
   ③ 個人創作區（Gallery）
============================================= */
.section-gallery {
    padding: 0 0 var(--section-gap);
}

.gallery-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 56px;
    overflow: hidden; /* 裁切跑馬燈溢出部分 */
}

.gallery-track {
    display: flex;
    gap: 16px;
    flex-shrink: 0;          /* 讓內容撐開 track，wrapper overflow:hidden 裁切 */
    will-change: transform;  /* GPU 加速，避免閃爍 */
}

/* 角色卡片 — 1:1 正方形
   桌機：wrapper padding 112px，顯示 5 張，gap 4×16=64px
   → (100vw - 112px - 64px) / 5 */
.char-card {
    flex-shrink: 0;
    width: calc((100vw - 176px) / 5);
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.char-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 20px rgba(var(--theme-rgb), 0.25),
                inset 0 0 20px rgba(var(--theme-rgb), 0.05);
}

.char-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    pointer-events: none;
}

.char-card:hover .char-card-img {
    transform: scale(1.04);
}

.char-card-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 12px 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: var(--text-primary);
    text-align: center;
}

/* 左右箭頭（共用 gallery & shop） */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(10, 10, 10, 0.8);
    color: var(--text-primary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: border-color 0.2s, box-shadow 0.2s;
    opacity: 0;
    pointer-events: none;
}

.gallery-arrow.visible {
    opacity: 1;
    pointer-events: auto;
}

.gallery-arrow:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 12px rgba(var(--theme-rgb), 0.4);
}

.gallery-arrow.left { left: 8px; }
.gallery-arrow.right { right: 8px; }

/* =============================================
   ④ 個人社群區
============================================= */
.section-social {
    padding: 0 40px var(--section-gap);
}

/* 社群 Banner */
.social-banners {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.social-banner-item {
    flex: 1;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: border-color 0.3s, box-shadow 0.3s;
    display: block;
}

.social-banner-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 16px rgba(var(--theme-rgb), 0.2);
}

.social-banner-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 社群連結格 */
.social-grid {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.social-cell {
    width: calc((100% - 80px) / 6);
    min-width: 70px;
    max-width: 120px;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    flex-shrink: 0;
}

.social-cell:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 18px rgba(var(--theme-rgb), 0.35),
                inset 0 0 18px rgba(var(--theme-rgb), 0.05);
    background: var(--bg-card-hover);
}

.social-cell.disabled {
    opacity: 0.25;
    pointer-events: none;
    border-color: transparent;
}

.social-cell-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.social-cell-label {
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-align: center;
}

/* =============================================
   ⑤ 線上通販區
============================================= */
.section-shop {
    padding: 0 40px var(--section-gap);
}

/* OFF 狀態 - 長 Banner */
.shop-banner-wrap {
    width: 100%;
    border: 1px solid var(--border);
    overflow: hidden;
}

.shop-banner-wrap img {
    width: 100%;
    height: auto;
    display: block;
}

/* ON 狀態 - 商品輪播 */
.shop-carousel-wrap {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 56px;
    overflow: hidden;
}

.shop-track {
    flex-shrink: 0;
    will-change: transform;
}

/* 未啟動跑馬燈時（商品數少）置中顯示 */
.shop-track.centered {
    justify-content: center;
    flex-shrink: 1;
    width: 100%;
}

/* 商品卡 — 同 char-card 用 vw 計算 */
.shop-card {
    flex-shrink: 0;
    width: calc((100vw - 176px) / 5);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
    text-decoration: none;
    display: block;
}

.shop-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 16px rgba(var(--theme-rgb), 0.25);
}

.shop-card-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.shop-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 商品圖片不反黑 */
    transition: transform 0.4s ease;
}

.shop-card:hover .shop-card-img-wrap img {
    transform: scale(1.03);
}

.shop-card-label {
    padding: 10px 12px;
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-align: center;
    transition: color 0.3s;
    background: var(--bg-card);
}

.shop-card:hover .shop-card-label {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

/* =============================================
   ⑥ 底部 Profile
============================================= */
.section-profile {
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    padding: 36px 40px 0;
    margin-bottom: 0;
}

/* Bug 2：copyright 是真正的最後元素，之後不允許有任何空白 */
.copyright-footer {
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 14px 0;
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    max-width: 100%;
    margin-bottom: 0;
}

.profile-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 28px;
    padding-bottom: 0;
}

/* 頭貼 */
.profile-avatar-wrap {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--bg-card);
}

.profile-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 筆名 & 簡介 */
.profile-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.profile-name {
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 2px;
    color: var(--text-primary);
}

.profile-bio {
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* 聯絡區 */
.profile-contact {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.profile-email {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.profile-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

/* 句子連結（有 url）*/
.profile-link-btn {
    display: inline-block;
    padding: 6px 18px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    letter-spacing: 1px;
    transition: border-color 0.25s, box-shadow 0.25s, color 0.25s;
    cursor: pointer;
    text-decoration: none;
}

.profile-link-btn:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 10px rgba(var(--theme-rgb), 0.3);
    color: var(--text-primary);
}

/* 純文字（無 url） */
.profile-link-text {
    font-size: 0.78rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}


/* =============================================
   Lightbox
============================================= */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s, visibility 0.3s;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    cursor: pointer;
}

.lightbox-panel {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, color 0.2s;
    z-index: 2;
}

.lightbox-close:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.lightbox-img-wrap {
    width: 55%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0;
}

#lb-img {
    max-width: 100%;
    max-height: 82vh;
    object-fit: contain;
    border: 1px solid var(--border);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
    transition: opacity 0.25s;
    pointer-events: none;
}

.lb-counter {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 3px;
}

.lightbox-nav {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-primary);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.lightbox-nav:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 12px rgba(var(--theme-rgb), 0.4);
}

/* Lightbox 角色資訊面板 */
.lb-info-panel {
    width: 45%;
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid var(--border);
    border-left: none;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.lb-char-name {
    font-family: var(--font-display);
    font-size: 1.4rem;
    letter-spacing: 4px;
    color: var(--text-primary);
    text-align: right;
    text-transform: uppercase;
}

.lb-story {
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--text-secondary);
    overflow-y: auto;
    flex: 1;
}

.lb-settings-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 4px;
    color: var(--text-secondary);
    text-transform: uppercase;
    white-space: nowrap;
}

.lb-settings-bar::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.lb-settings {
    font-family: var(--font-body);
    font-size: 0.8rem;
    line-height: 1.8;
    color: var(--text-secondary);
    overflow-y: auto;
}

/* =============================================
   RWD — 手機版 (max-width: 768px)
============================================= */
@media (max-width: 768px) {

    :root {
        --section-gap: 48px;
        --topbar-height: 48px;
    }

    /* 頂部列：固定 BGM 區塊寬度，確保標題永遠置中 */
    .top-bar-inner {
        padding: 0 12px;
        grid-template-columns: auto 1fr auto;
    }

    .site-title-bar {
        grid-column: 2;
        font-size: 0.65rem;
        letter-spacing: 2px;
    }

    .bgm-controls {
        grid-column: 1;
    }

    #volume-slider {
        width: 60px;
    }

    /* Banner */
    .section-banner {
        aspect-ratio: 16 / 7;
        overflow: hidden; /* 確保手機不跑版 */
    }

    .banner-track {
        width: 100%;
        /* 手機版強制不換行 */
        flex-wrap: nowrap;
    }

    .banner-slide {
        min-width: 100%;
        max-width: 100%;
    }

    /* 網誌標題 */
    .section-blog-title {
        padding: 32px 20px;
    }

    .blog-title-text {
        font-size: 0.9rem;
        white-space: normal;
        text-align: center;
    }

    /* 區塊標題 */
    .section-header {
        padding: 0 20px;
    }

    /* 創作區 */
    .section-gallery {
        padding-bottom: var(--section-gap);
    }

    .gallery-wrapper {
        padding: 0 40px;
    }

    .char-card {
        /* 手機：wrapper padding 80px，3 張，gap 32px */
        width: calc((100vw - 112px) / 3);
    }

    /* 社群區 */
    .section-social {
        padding: 0 20px var(--section-gap);
    }

    .social-banners {
        flex-direction: column;
    }

    .social-cell {
        width: calc((100% - 40px) / 3);
        min-width: 70px;
    }

    /* 通販區 */
    .section-shop {
        padding: 0 20px var(--section-gap);
    }

    .shop-carousel-wrap {
        padding: 0 40px;
    }

    .shop-card {
        width: calc((100vw - 112px) / 3);
    }

    /* Profile */
    .section-profile {
        padding: 28px 20px 0;
    }

    .profile-inner {
        flex-wrap: wrap;
        gap: 16px;
    }

    .profile-contact {
        width: 100%;
        align-items: flex-start;
    }

    .profile-links {
        align-items: flex-start;
    }

    /* Lightbox — 手機版上下堆疊 */
    .lightbox-backdrop {
        background: rgba(0, 0, 0, 0.75);
    }

    .lightbox-panel {
        width: 100vw;
        height: 100dvh;
        max-width: 100vw;
        max-height: 100dvh;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        overflow: hidden;
    }

    .lightbox-img-wrap {
        width: 100%;
        flex: 0 0 45dvh;          /* 固定高度 45dvh，不縮放 */
        overflow: hidden;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    #lb-img {
        max-width: 100vw;
        max-height: 43dvh;
        width: auto;
        height: auto;
        object-fit: contain;
        border: none;
    }

    .lightbox-nav {
        display: none;
    }

    .lb-counter {
        margin-top: 10px;
    }

    .lb-info-panel {
        width: 100%;
        flex: 1 1 0;              /* 關鍵：撐滿剩餘空間，避免下方露出背景 */
        overflow-y: auto;
        border: none;
        border-top: 1px solid var(--border);
        background: rgba(10, 10, 10, 0.95);
        padding: 16px 20px 24px;
    }

    .lb-char-name {
        font-size: 1.1rem;
        text-align: left;
        margin-bottom: 10px;
    }

    .lb-story {
        font-size: 0.82rem;
        line-height: 1.65;
        display: block;
        margin-bottom: 0;
    }

    .lb-settings-bar {
        margin-top: 16px;
        margin-bottom: 8px;
    }

    .lb-settings {
        font-size: 0.80rem;
        line-height: 1.6;
    }
}

/* =============================================
   RWD — 平板 (769px ~ 1024px)
============================================= */
@media (min-width: 769px) and (max-width: 1024px) {

    .char-card {
        /* 平板：wrapper padding 112px，4 張，gap 48px */
        width: calc((100vw - 160px) / 4);
    }

    .shop-card {
        width: calc((100vw - 160px) / 4);
    }

    .social-cell {
        width: calc((100% - 64px) / 6);
    }
}
