:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --accent: #48bb78;
    --accent-dark: #38a169;
    --warning: #ed8936;
    --danger: #fc8181;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.97);
    --radius: 16px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

html {
    scroll-behavior: smooth;
}

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

body {
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background: var(--bg-gradient);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation Bar */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 12px 0;
    margin-bottom: 20px;
}

.nav-inner {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
}

/* 導覽列左側 BBD LOGO */
.nav-brand {
    display: inline-flex;
    flex: 0 0 auto;
    border-radius: 9px;
}

.nav-brand img {
    display: block;
    width: 108px;
    height: 40px;
}

.nav-brand:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.45);
    outline-offset: 2px;
}

.nav-links {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
    justify-content: center;
    flex-wrap: nowrap;
}

/* 漢堡選單按鈕：只在 .is-collapsed（連結放不下）時顯示 */
.nav-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    border: 0;
    border-radius: 20px;
    background: transparent;
    color: #4a5568;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.nav-toggle-icon {
    width: 1.2em;
    font-size: 1.15rem;
    line-height: 1;
    text-align: center;
}

.nav-toggle:hover,
.nav-toggle[aria-expanded="true"] {
    background: var(--primary);
    color: white;
}

.nav-toggle:focus-visible,
.nav-link:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.45);
    outline-offset: 2px;
}

.nav-bar.is-collapsed .nav-inner {
    justify-content: space-between;
}

.nav-bar.is-collapsed .nav-toggle {
    display: inline-flex;
}

.nav-bar.is-collapsed .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    left: 16px;
    right: 16px;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    animation: nav-menu-in 0.18s ease-out;
}

.nav-bar.is-collapsed.is-open .nav-links {
    display: flex;
}

.nav-bar.is-collapsed .nav-link {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
}

@keyframes nav-menu-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
}

.nav-link {
    color: #4a5568;
    text-decoration: none;
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--primary);
    color: white;
}

/* 未登入或未審核：隱藏橫幅以下的會員內容與對應導覽連結 */
body:not(.is-member) .member-only {
    display: none !important;
}

/* 會員內容載入中 / 載入失敗狀態 */
.member-content-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
    padding: 24px 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    color: #4a5568;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.member-content-status.is-error {
    color: #c53030;
}

.member-content-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.25);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: member-content-spin 0.8s linear infinite;
}

.member-content-retry {
    padding: 8px 18px;
    border: 0;
    border-radius: 20px;
    background: var(--primary);
    color: white;
    font: inherit;
    cursor: pointer;
}

.member-content-retry:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.45);
    outline-offset: 2px;
}

@keyframes member-content-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .member-content-spinner {
        animation-duration: 2.4s;
    }
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s ease-out;
}

.header h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

/* 標題左側 BBD 圖示，大小跟著標題字級 */
.header-logo {
    width: 1.4em;
    height: 1.4em;
    flex: 0 0 auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Guide Sections */
.guide-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.8s ease-out;
    transition: transform 0.3s ease;
}

.guide-section:hover {
    transform: translateY(-3px);
}

.section-title {
    color: #2d3748;
    font-size: 1.8rem;
    margin-bottom: 24px;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

/* Site Cards */
.site-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    margin: 20px 0;
    border-left: 5px solid var(--primary);
    transition: all 0.3s ease;
}

.site-card:hover {
    background: #edf2f7;
    transform: translateX(3px);
}

.site-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 10px;
}

.site-description {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

/* Link Category Headers (replaces ▲ separators) */
.link-category {
    margin-top: 20px;
    margin-bottom: 10px;
    padding: 8px 14px;
    border-left: 4px solid var(--primary);
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.08), transparent);
    border-radius: 0 8px 8px 0;
    font-weight: 500;
    color: #2d3748;
    font-size: 0.95rem;
}

/* Keyword Cloud */
.collapsible-section {
    border: none;
}

.collapsible-section summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.collapsible-section summary::-webkit-details-marker {
    display: none;
}

.collapsible-toggle {
    position: relative;
}

.toggle-arrow {
    font-size: 0.8rem;
    margin-left: auto;
    transition: transform 0.3s ease;
    color: var(--primary);
}

.collapsible-section[open] .toggle-arrow {
    transform: rotate(90deg);
}

.collapsible-section .keyword-cloud {
    animation: fadeInUp 0.3s ease-out;
}

.keyword-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
}

.keyword-tag {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 20px;
    color: var(--primary-dark);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.keyword-tag:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Flow Steps */
.flow-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 15px 0;
    position: relative;
}

.step {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 18px;
    border-radius: 10px;
    text-align: center;
    position: relative;
    transition: transform 0.3s ease;
}

.step::after {
    content: '→';
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: bold;
    z-index: 1;
}

.step:last-child::after {
    display: none;
}

.step_big {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 18px;
    border-radius: 10px;
    text-align: left;
    position: relative;
    transition: transform 0.3s ease;
}

.step:hover,
.step_big:hover {
    transform: scale(1.03);
}

.step-number {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: bold;
}

/* Demo Image Placeholder */
.demo-image {
    width: 100%;
    max-width: 280px;
    height: 120px;
    background: #e2e8f0;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px auto;
    color: #a0aec0;
    font-style: italic;
    font-size: 0.9rem;
}

/* Buttons */
.link-button {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 8px 5px;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
    font-size: 0.9rem;
}

.link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
    background: linear-gradient(135deg, var(--accent-dark), #2f855a);
}

.link-button_fast {
    display: inline-block;
    background: linear-gradient(138deg, #cddfff, var(--primary-dark));
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 6px 4px;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.25);
    font-size: 0.85rem;
}

.link-button_fast:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(102, 126, 234, 0.4);
    background: linear-gradient(138deg, #4c7fdae3, var(--primary-dark));
}

/* Warning & Info Boxes */
.warning-box {
    background: linear-gradient(135deg, var(--danger), var(--warning));
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 4px 15px rgba(252, 129, 129, 0.3);
}

.header-box {
    --spot-x: 50%;
    --spot-y: 50%;
    --tilt-x: 0deg;
    --tilt-y: 0deg;
    --autoplay-duration: 7000ms;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: none;
    margin: 22px auto 0;
    padding: 0;
    border: 1px solid rgba(103, 232, 249, 0.46);
    border-radius: 18px;
    background:
        radial-gradient(circle at var(--spot-x) var(--spot-y), rgba(34, 211, 238, 0.2), transparent 29%),
        linear-gradient(120deg, rgba(255, 255, 255, 0.97), rgba(238, 250, 248, 0.95) 48%, rgba(255, 247, 230, 0.96));
    color: #243047;
    text-align: left;
    box-shadow:
        0 22px 60px rgba(15, 23, 42, 0.24),
        0 0 34px rgba(34, 211, 238, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    isolation: isolate;
    transition: border-color 300ms ease, box-shadow 300ms ease, background 160ms linear;
}

.header-box:hover {
    border-color: rgba(45, 212, 191, 0.78);
    box-shadow:
        0 28px 74px rgba(15, 23, 42, 0.28),
        0 0 48px rgba(34, 211, 238, 0.24),
        0 0 84px rgba(245, 158, 11, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.header-box::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 5;
    padding: 2px;
    border-radius: inherit;
    background: linear-gradient(115deg, #22d3ee, #14b8a6, #f59e0b, #fb7185, #8b5cf6, #22d3ee);
    background-size: 320% 100%;
    pointer-events: none;
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: header-border-flow 5s linear infinite;
}

.header-box::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    background: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.08) 0,
        rgba(255, 255, 255, 0.08) 1px,
        transparent 1px,
        transparent 5px
    );
    opacity: 0.32;
    pointer-events: none;
    mix-blend-mode: overlay;
}

.header-box p {
    margin: 0;
    opacity: 1;
}

.header-carousel-track {
    position: relative;
    z-index: 1;
    display: grid;
    overflow: hidden;
    perspective: 1400px;
    transform: perspective(1400px) rotateX(var(--tilt-y)) rotateY(var(--tilt-x));
    transform-style: preserve-3d;
    transition: transform 180ms ease-out;
}

.header-carousel-track::before,
.header-carousel-track::after {
    content: '';
    position: absolute;
    z-index: 0;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(64px);
    opacity: 0.3;
}

.header-carousel-track::before {
    top: -190px;
    left: -70px;
    background: #22d3ee;
    animation: header-orb-cyan 9s ease-in-out infinite;
}

.header-carousel-track::after {
    right: -90px;
    bottom: -205px;
    background: #f59e0b;
    animation: header-orb-gold 11s ease-in-out infinite;
}

.header-slide {
    position: relative;
    z-index: 1;
    grid-area: 1 / 1;
    min-width: 0;
    padding: 8px 70px 10px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, 18px, -100px) scale(0.94);
    transform-style: preserve-3d;
    backface-visibility: hidden;
    filter: blur(8px) saturate(0.7);
}

.header-slide.is-active {
    z-index: 2;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) scale(1);
    filter: none;
}

.header-slide.is-leaving {
    z-index: 1;
    visibility: visible;
    pointer-events: none;
}

.header-slide.fx-enter-next {
    animation: header-enter-next 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.header-slide.fx-exit-next {
    animation: header-exit-next 620ms cubic-bezier(0.7, 0, 0.84, 0) both;
}

.header-slide.fx-enter-previous {
    animation: header-enter-previous 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.header-slide.fx-exit-previous {
    animation: header-exit-previous 620ms cubic-bezier(0.7, 0, 0.84, 0) both;
}

.header-slide.fx-enter-next > *,
.header-slide.fx-enter-previous > * {
    animation: header-content-rise 560ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.header-slide.fx-enter-next > :nth-child(2),
.header-slide.fx-enter-previous > :nth-child(2) {
    animation-delay: 80ms;
}

.header-slide.fx-enter-next > :nth-child(3),
.header-slide.fx-enter-previous > :nth-child(3) {
    animation-delay: 130ms;
}

.header-slide.fx-enter-next > :nth-child(4),
.header-slide.fx-enter-previous > :nth-child(4) {
    animation-delay: 180ms;
}

.header-slide.fx-enter-next > :nth-child(n + 5),
.header-slide.fx-enter-previous > :nth-child(n + 5) {
    animation-delay: 230ms;
}

.header-carousel-button {
    position: absolute;
    top: 50%;
    z-index: 4;
    display: grid;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(45, 212, 191, 0.58);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.76);
    color: #176b63;
    box-shadow:
        0 7px 22px rgba(15, 118, 110, 0.18),
        inset 0 0 0 1px rgba(255, 255, 255, 0.72);
    font-family: Georgia, serif;
    font-size: 1.8rem;
    line-height: 1;
    transform: translateY(-50%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    transition: color 220ms ease, background 220ms ease, border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.header-carousel-button:hover,
.header-carousel-button:focus-visible {
    border-color: #22d3ee;
    background: rgba(15, 118, 110, 0.92);
    color: #fff;
    box-shadow:
        0 9px 26px rgba(14, 116, 144, 0.3),
        0 0 22px rgba(34, 211, 238, 0.55);
}

.header-carousel-previous:hover,
.header-carousel-previous:focus-visible {
    transform: translateY(-50%) scale(1.12) rotate(-8deg);
}

.header-carousel-next:hover,
.header-carousel-next:focus-visible {
    transform: translateY(-50%) scale(1.12) rotate(8deg);
}

.header-carousel-previous {
    left: 15px;
}

.header-carousel-next {
    right: 15px;
}

.header-carousel-status {
    position: absolute;
    top: 14px;
    right: 57px;
    z-index: 2;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border: 1px solid rgba(45, 212, 191, 0.34);
    border-radius: 999px;
    background: rgba(240, 253, 250, 0.8);
    color: #37615d;
    font-size: 0.76rem;
    font-weight: 700;
    box-shadow: 0 5px 16px rgba(15, 118, 110, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-carousel-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #14b8a6;
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.58);
    animation: header-status-pulse 2s ease-out infinite;
}

.header-carousel-status::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #14b8a6, #22d3ee, #f59e0b);
    transform: scaleX(0);
    transform-origin: left center;
}

.header-box.is-autoplaying .header-carousel-status::after {
    animation: header-autoplay-progress var(--autoplay-duration) linear both;
}

.header-carousel-toggle {
    position: absolute;
    top: 14px;
    right: 15px;
    z-index: 4;
    display: grid;
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(45, 212, 191, 0.5);
    border-radius: 50%;
    background: rgba(240, 253, 250, 0.82);
    color: #0f766e;
    box-shadow: 0 5px 16px rgba(15, 118, 110, 0.14);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    transition: transform 220ms ease, color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.header-carousel-toggle:hover,
.header-carousel-toggle:focus-visible {
    background: #0f766e;
    color: #fff;
    box-shadow: 0 7px 20px rgba(15, 118, 110, 0.3), 0 0 18px rgba(34, 211, 238, 0.44);
    transform: scale(1.1);
}

.header-carousel-toggle[aria-pressed='true'] {
    border-color: rgba(245, 158, 11, 0.66);
    background: rgba(255, 247, 230, 0.9);
    color: #b45309;
}

.header-carousel-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.header-box .header-lead {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 0 15px;
    color: #173d42;
    font-size: 1.08rem;
    font-weight: 700;
}

.header-symbol {
    display: grid;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    background: #dff4ef;
    color: #087f76;
    font-family: Georgia, serif;
    font-size: 1.05rem;
    font-weight: 700;
}

.header-box .header-notice {
    padding: 15px 0 15px 18px;
    border-top: 1px solid #dce7e3;
    border-left: 3px solid #e6a23c;
    color: #4b5565;
    font-size: 0.92rem;
    line-height: 1.75;
}

.header-notice span {
    display: block;
}

.header-notice span+span {
    margin-top: 4px;
}

.header-box .header-signature {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 13px 0 4px;
    border-top: 1px solid #dce7e3;
    color: #647277;
    font-size: 0.82rem;
    font-weight: 500;
}

.header-version {
    padding: 3px 8px;
    border: 1px solid #b9d8d2;
    border-radius: 999px;
    background: #edf7f4;
    color: #176b63;
}

.header-slide-search {
    display: grid;
    min-height: 210px;
    align-content: center;
    justify-items: start;
    overflow: hidden;
    background:
        linear-gradient(rgba(15, 118, 110, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 118, 110, 0.045) 1px, transparent 1px),
        linear-gradient(120deg, rgba(232, 247, 243, 0.92) 0%, rgba(247, 251, 250, 0.9) 58%, rgba(255, 243, 217, 0.9) 100%);
    background-size: 28px 28px, 28px 28px, 100% 100%;
}

.header-slide-search h2 {
    margin: 2px 0 8px;
    color: #143c40;
    font-size: 1.55rem;
    line-height: 1.3;
}

.header-slide-song {
    display: grid;
    min-height: 210px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 36px;
    overflow: hidden;
    background:
        radial-gradient(circle at 82% 50%, rgba(129, 140, 248, 0.27), transparent 23%),
        linear-gradient(120deg, rgba(241, 245, 255, 0.96), rgba(248, 245, 255, 0.94) 52%, rgba(233, 250, 249, 0.94));
}

.header-song-content {
    position: relative;
    z-index: 1;
}

.header-slide-song h2 {
    margin: 4px 0 9px;
    color: #302e64;
    font-size: 1.75rem;
    line-height: 1.25;
}

.header-song-link {
    background: linear-gradient(120deg, #6d28d9, #db2777, #0891b2);
    box-shadow: 0 8px 22px rgba(109, 40, 217, 0.25);
}

.header-song-visual {
    position: relative;
    display: grid;
    width: 148px;
    height: 148px;
    place-items: center;
}

.header-song-disc {
    position: relative;
    display: grid;
    width: 132px;
    height: 132px;
    place-items: center;
    border: 8px solid rgba(255, 255, 255, 0.62);
    border-radius: 50%;
    background:
        radial-gradient(circle, #fff 0 7%, #f472b6 7% 15%, transparent 15%),
        repeating-radial-gradient(circle, transparent 0 8px, rgba(255, 255, 255, 0.13) 9px 10px),
        conic-gradient(from 35deg, #312e81, #7c3aed, #db2777, #0891b2, #312e81);
    box-shadow: 0 18px 38px rgba(49, 46, 129, 0.28), 0 0 32px rgba(219, 39, 119, 0.18);
    animation: header-disc-spin 14s linear infinite;
}

.header-song-play {
    display: grid;
    width: 42px;
    height: 42px;
    padding-left: 3px;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #6d28d9;
    font-size: 0.95rem;
    box-shadow: 0 7px 20px rgba(49, 46, 129, 0.28);
    animation: header-disc-counter-spin 14s linear infinite;
}

.header-song-wave {
    position: absolute;
    right: -4px;
    bottom: 12px;
    display: flex;
    height: 40px;
    align-items: center;
    gap: 4px;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    background: rgba(49, 46, 129, 0.82);
    box-shadow: 0 8px 20px rgba(49, 46, 129, 0.24);
}

.header-song-wave i {
    display: block;
    width: 3px;
    height: 10px;
    border-radius: 999px;
    background: #f0fdfa;
    animation: header-wave 1s ease-in-out infinite alternate;
}

.header-song-wave i:nth-child(2),
.header-song-wave i:nth-child(4) {
    animation-delay: -0.35s;
}

.header-song-wave i:nth-child(3) {
    animation-delay: -0.7s;
}

.header-box .header-promo-eyebrow {
    color: #087f76;
    font-size: 0.74rem;
    font-weight: 800;
}

.header-box .header-promo-copy {
    max-width: 680px;
    color: #40575a;
    font-size: 1rem;
    line-height: 1.7;
}

.header-promo-link {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    margin-top: 17px;
    padding: 8px 16px;
    border-radius: 6px;
    background: linear-gradient(120deg, #0f766e, #0891b2, #7c3aed);
    background-size: 200% 100%;
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(8, 127, 118, 0.28);
    transition: transform 220ms ease, box-shadow 220ms ease, background-position 420ms ease;
}

.header-promo-link::after {
    content: '';
    position: absolute;
    top: -120%;
    left: -45%;
    width: 28%;
    height: 340%;
    background: rgba(255, 255, 255, 0.62);
    filter: blur(5px);
    transform: rotate(22deg);
    transition: left 520ms ease;
}

.header-promo-link:hover,
.header-promo-link:focus-visible {
    background-position: 100% 0;
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 12px 30px rgba(8, 145, 178, 0.38);
}

.header-promo-link:hover::after,
.header-promo-link:focus-visible::after {
    left: 125%;
}

@keyframes header-border-flow {
    to {
        background-position: 320% 0;
    }
}

@keyframes header-disc-spin {
    to {
        transform: rotate(1turn);
    }
}

@keyframes header-disc-counter-spin {
    to {
        transform: rotate(-1turn);
    }
}

@keyframes header-wave {
    to {
        height: 25px;
    }
}

@keyframes header-orb-cyan {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(170px, 72px, 0) scale(1.24);
    }
}

@keyframes header-orb-gold {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(-190px, -58px, 0) scale(1.18);
    }
}

@keyframes header-enter-next {
    0% {
        opacity: 0;
        transform: translate3d(18%, 0, -180px) rotateY(-13deg) scale(0.9);
        filter: blur(12px) saturate(0.55);
        clip-path: inset(0 0 0 42%);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotateY(0) scale(1);
        filter: none;
        clip-path: inset(0);
    }
}

@keyframes header-exit-next {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotateY(0) scale(1);
        filter: none;
        clip-path: inset(0);
    }
    100% {
        opacity: 0;
        transform: translate3d(-13%, 0, -120px) rotateY(10deg) scale(1.04);
        filter: blur(9px) saturate(0.7);
        clip-path: inset(0 38% 0 0);
    }
}

@keyframes header-enter-previous {
    0% {
        opacity: 0;
        transform: translate3d(-18%, 0, -180px) rotateY(13deg) scale(0.9);
        filter: blur(12px) saturate(0.55);
        clip-path: inset(0 42% 0 0);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotateY(0) scale(1);
        filter: none;
        clip-path: inset(0);
    }
}

@keyframes header-exit-previous {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotateY(0) scale(1);
        filter: none;
        clip-path: inset(0);
    }
    100% {
        opacity: 0;
        transform: translate3d(13%, 0, -120px) rotateY(-10deg) scale(1.04);
        filter: blur(9px) saturate(0.7);
        clip-path: inset(0 0 0 38%);
    }
}

@keyframes header-content-rise {
    0% {
        opacity: 0;
        transform: translateY(18px) scale(0.97);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: none;
    }
}

@keyframes header-status-pulse {
    70% {
        box-shadow: 0 0 0 7px rgba(20, 184, 166, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(20, 184, 166, 0);
    }
}

@keyframes header-autoplay-progress {
    to {
        transform: scaleX(1);
    }
}

.tips-box {
    background: linear-gradient(135deg, #17a2b8, #007bff);
    color: white;
    padding: 24px;
    border-radius: 12px;
    margin: 20px 0;
}

.tips-box ul {
    text-align: left;
    margin-left: 20px;
    margin-top: 10px;
}

.tips-box li {
    margin-bottom: 6px;
}

/* Auth Container */
.auth-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.auth-btn {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(66, 133, 244, 0.3);
    font-family: inherit;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.4);
}

.auth-btn:disabled {
    cursor: wait;
    opacity: 0.7;
    transform: none;
}

/* Google 與 Email 登入按鈕並排，窄螢幕自動換行 */
.auth-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.auth-btn-email {
    background: linear-gradient(135deg, #475569, #1e293b);
    box-shadow: 0 2px 10px rgba(30, 41, 59, 0.3);
}

/* ===== Email 登入／註冊對話框 ===== */
.email-auth-dialog {
    /* 全域 margin: 0 會蓋掉瀏覽器預設的置中，這裡補回來 */
    margin: auto;
    width: min(420px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    overflow-y: auto;
    padding: 22px;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    color: #2d3748;
}

.email-auth-dialog::backdrop {
    background: rgba(17, 24, 39, 0.55);
}

.email-auth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.email-auth-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.email-auth-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #edf2f7;
    color: #4a5568;
    font: inherit;
    cursor: pointer;
}

.email-auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: #edf2f7;
}

.email-auth-tabs button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #4a5568;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.email-auth-tabs button[aria-selected="true"] {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.email-auth-form {
    display: grid;
    gap: 8px;
}

.email-auth-form[hidden] {
    display: none;
}

.email-auth-form label {
    font-weight: 700;
    font-size: 0.92rem;
}

.email-auth-form input {
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font: inherit;
}

/* 註冊密碼規則：符合的項目打勾變綠 */
.password-rules {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    margin: 2px 0 0;
    padding: 0;
    color: #718096;
    font-size: 0.85rem;
    list-style: none;
}

.password-rules li::before {
    display: inline-block;
    width: 1.2em;
    content: '○';
}

.password-rules li.is-met {
    color: #15803d;
}

.password-rules li.is-met::before {
    content: '✓';
}

@media (max-width: 420px) {
    .password-rules {
        grid-template-columns: 1fr;
    }
}

.password-rules-note {
    margin: 0;
    color: #718096;
    font-size: 0.8rem;
}

/* 密碼欄位：右側眼睛按鈕切換顯示／隱藏 */
.password-field {
    position: relative;
    display: grid;
}

.password-field input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 40px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #718096;
    cursor: pointer;
    transform: translateY(-50%);
}

.password-toggle:hover {
    color: #4c51bf;
}

.password-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.password-toggle .eye-closed,
.password-toggle[aria-pressed="true"] .eye-open {
    display: none;
}

.password-toggle[aria-pressed="true"] .eye-closed {
    display: block;
}

.password-toggle:focus-visible,
.email-auth-form input:focus-visible,
.email-auth-tabs button:focus-visible,
.email-auth-close:focus-visible,
.email-auth-link:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.45);
    outline-offset: 2px;
}

.email-auth-hint {
    margin: 4px 0;
    color: #718096;
    font-size: 0.85rem;
    line-height: 1.6;
}

.email-auth-submit {
    min-height: 46px;
    margin-top: 8px;
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.email-auth-submit:disabled {
    cursor: wait;
    opacity: 0.7;
}

.email-auth-link {
    justify-self: center;
    padding: 6px 10px;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-size: 0.9rem;
    text-decoration: underline;
    cursor: pointer;
}

/* ===== Toast（畫面中間下方） ===== */
.toast-region {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 10000;
    display: grid;
    gap: 8px;
    width: min(420px, calc(100% - 32px));
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    padding: 12px 16px;
    border-radius: 10px;
    background: #1f2937;
    color: white;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: toast-in 0.2s ease-out;
    transition: opacity 0.3s, transform 0.3s;
}

.toast-success {
    background: #217a4b;
}

.toast-error {
    background: #b42318;
}

.toast.is-leaving {
    opacity: 0;
    transform: translateY(8px);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 15px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
}

.logout-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 10px;
    font-family: inherit;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #e53e3e;
}

.admin-badge {
    background: #ffc107;
    color: #000;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

/* Status Sections */
/* 右上角使用者列：使用者資訊＋三角形選單 */
.user-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* 三角形選單（不論寬度都是三角形按鈕，與導覽列 ☰ 區隔） */
.quick-menu {
    position: relative;
    flex: 0 0 auto;
}

.quick-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

.quick-menu-toggle:hover,
.quick-menu-toggle[aria-expanded="true"] {
    background: var(--primary);
}

.quick-menu-toggle:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.75);
    outline-offset: 2px;
}

.quick-menu-icon {
    display: block;
    width: 16px;
    height: 12px;
    background: currentColor;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transition: transform 0.2s;
}

.quick-menu-toggle[aria-expanded="true"] .quick-menu-icon {
    transform: rotate(180deg);
}

.quick-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1001;
    width: min(300px, calc(100vw - 32px));
    padding: 6px;
    border-radius: 14px;
    background: white;
    color: #2d3748;
    text-align: left;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    animation: nav-menu-in 0.18s ease-out;
}

.quick-menu-panel[hidden] {
    display: none;
}

/* 兩個區塊由程式依登入／管理員狀態切換 display */
.quick-menu-section {
    display: none;
    padding: 8px;
}

.quick-menu-section + .quick-menu-section {
    margin-top: 4px;
    border-top: 1px solid #e2e8f0;
}

.quick-menu-section h3 {
    margin: 2px 4px;
    font-size: 0.95rem;
}

.quick-menu-section p {
    margin: 0 4px 6px;
    color: #718096;
    font-size: 0.8rem;
}

.quick-menu-admin h3 {
    color: #c2410c;
}

.quick-menu-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #2d3748;
    font-weight: 600;
    text-decoration: none;
}

.quick-menu-link:hover,
.quick-menu-link:focus-visible {
    background: #edf2f7;
}

.quick-menu-link:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.45);
    outline-offset: -3px;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s;
    z-index: 999;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* Keyboard focus visibility (a11y) */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 3px solid #ffd166;
    outline-offset: 2px;
    border-radius: 6px;
}

/* Inline auth error message */
.auth-error {
    display: none;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(252, 129, 129, 0.95);
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    box-shadow: 0 4px 12px rgba(252, 129, 129, 0.3);
}

.icon {
    font-size: 1.5rem;
    margin-right: 10px;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .header-box {
        margin-top: 16px;
    }

    .header-slide {
        padding: 10px 16px 58px;
    }

    .header-carousel-button {
        top: auto;
        bottom: 11px;
        width: 34px;
        height: 34px;
        min-height: 34px;
        font-size: 1.5rem;
        transform: none;
    }

    .header-carousel-previous:hover,
    .header-carousel-previous:focus-visible {
        transform: scale(1.08) rotate(-8deg);
    }

    .header-carousel-next:hover,
    .header-carousel-next:focus-visible {
        transform: scale(1.08) rotate(8deg);
    }

    .header-carousel-previous {
        left: 16px;
    }

    .header-carousel-next {
        right: 16px;
    }

    .header-carousel-status {
        top: auto;
        right: auto;
        bottom: 17px;
        left: 50%;
        transform: translateX(-50%);
    }

    .header-carousel-toggle {
        top: auto;
        right: auto;
        bottom: 12px;
        left: calc(50% + 43px);
    }

    .header-slide-search {
        min-height: 255px;
    }

    .header-slide-search h2,
    .header-slide-song h2 {
        font-size: 1.3rem;
    }

    .header-slide-song {
        min-height: 255px;
        grid-template-columns: minmax(0, 1fr) 92px;
        gap: 10px;
    }

    .header-song-visual {
        width: 92px;
        height: 110px;
        opacity: 0.9;
    }

    .header-song-disc {
        width: 88px;
        height: 88px;
        border-width: 5px;
    }

    .header-song-play {
        width: 32px;
        height: 32px;
        font-size: 0.72rem;
    }

    .header-song-wave {
        right: -2px;
        bottom: 3px;
        height: 34px;
        padding: 6px 8px;
    }

    .header-box .header-lead {
        align-items: flex-start;
        font-size: 1rem;
    }

    .header-box .header-notice {
        padding-left: 13px;
        font-size: 0.86rem;
    }

    .header-box .header-signature {
        justify-content: space-between;
    }

    .header-box .header-promo-copy {
        font-size: 0.9rem;
    }

    .flow-steps {
        grid-template-columns: 1fr;
    }

    .step::after {
        display: none;
    }

    .auth-container {
        position: relative;
        top: auto;
        right: auto;
        text-align: center;
        margin-bottom: 16px;
    }

    .user-info {
        justify-content: center;
        flex-wrap: wrap;
    }

    .link-button,
    .link-button_fast {
        display: block;
        width: 100%;
        text-align: center;
        margin: 6px 0;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .guide-section {
        padding: 20px;
    }

    .site-card {
        padding: 16px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .nav-bar.is-collapsed .nav-links,
    .quick-menu-panel,
    .quick-menu-icon,
    .toast {
        animation: none;
        transition: none;
    }

    .header-box,
    .header-box::before,
    .header-carousel-track,
    .header-carousel-track::before,
    .header-carousel-track::after,
    .header-slide,
    .header-slide.fx-enter-next,
    .header-slide.fx-exit-next,
    .header-slide.fx-enter-previous,
    .header-slide.fx-exit-previous,
    .header-slide.fx-enter-next > *,
    .header-slide.fx-enter-previous > *,
    .header-carousel-status::before,
    .header-carousel-status::after,
    .header-carousel-toggle,
    .header-promo-link,
    .header-promo-link::after,
    .header-song-disc,
    .header-song-play,
    .header-song-wave i {
        animation: none !important;
        transition: none !important;
    }
}
