/* ===== Root Variables (Light Mode: Cafe au lait / Pastel) ===== */
:root {
    --bg: #faf5ef;
    --bg2: #fff8f2;
    --bg3: #f5ece3;
    --text: #3d3428;
    --text-muted: #7a6e5e;
    --header-text: #2c2316;
    --accent: #8b6e4e;
    --accent2: #a0845e;
    --accent3: #c4a882;
    --pink: #c97878;
    --glow: #8b6e4e1a;
    --shadow: #8b6e4e2e;
    --border: #e8ddd0;
    --border-light: #f0e6d9;
    --font-main: 'Noto Sans JP', 'Inter', sans-serif;
    --radius: 18px;
    --radius-sm: 12px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-bg: rgba(255, 248, 242, 0.78);
    --glass-border: rgba(232, 221, 208, 0.5);
    --card-shadow: 0 1px 3px rgba(139, 110, 78, 0.06), 0 4px 12px rgba(139, 110, 78, 0.04);
    --card-shadow-hover: 0 8px 32px rgba(139, 110, 78, 0.12), 0 2px 8px rgba(139, 110, 78, 0.06);
    --focus-ring: 0 0 0 3px rgba(139, 110, 78, 0.25);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --header-h: 58px;
}

/* ===== Dark Mode ===== */
body.dark {
    --bg: #171310;
    --bg2: #1f1a15;
    --bg3: #2a241d;
    --text: #f0e8df;
    --text-muted: #a89b8a;
    --header-text: #f5efe8;
    --border: #362e24;
    --border-light: #403629;
    --glow: #8b6e4e2a;
    --shadow: #8b6e4e3e;
    --glass-bg: rgba(31, 26, 21, 0.82);
    --glass-border: rgba(54, 46, 36, 0.65);
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.18);
    --card-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.22);
}

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

/* ===== Skip to main content (a11y) ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 100000;
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: top 0.3s;
}
.skip-link:focus {
    top: 0;
}

body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.65;
    -webkit-tap-highlight-color: transparent;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

/* ===== Selection ===== */
::selection {
    background: var(--accent);
    color: white;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent3); }

/* ===== Background Canvas ===== */
#stars-canvas {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
}

.bg-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.10;
    animation: orbFloat 25s ease-in-out infinite;
    will-change: transform;
}

.bg-orb-1 { width: 500px; height: 500px; background: var(--accent); top: -120px; right: -120px; }
.bg-orb-2 { width: 350px; height: 350px; background: var(--pink); bottom: -100px; left: -100px; animation-delay: -8s; }
.bg-orb-3 { width: 280px; height: 280px; background: var(--accent2); top: 50%; left: 50%; animation-delay: -16s; }

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -40px) scale(1.08); }
    66% { transform: translate(-30px, 30px) scale(0.92); }
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: var(--glass-bg);
    color: var(--text);
    padding: 12px 28px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: var(--card-shadow-hover);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    pointer-events: auto;
}

.toast.fade-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(0.95); } }

/* ===== Announcement Banner ===== */
#announcement-banner {
    position: fixed;
    top: -60px;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#announcement-banner.active { top: 0; }

.banner-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    margin-left: auto;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    transition: box-shadow 0.3s, background 0.3s;
}

.site-header.scrolled {
    box-shadow: 0 4px 24px rgba(139, 110, 78, 0.08);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 16px;
    gap: 12px;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition), transform 0.2s;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.menu-btn:hover { background: var(--bg3); }
.menu-btn:active { transform: scale(0.92); }
.menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.header-brand { display: flex; align-items: center; gap: 10px; flex: 1; }

.header-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(139, 110, 78, 0.2);
    flex-shrink: 0;
}

.header-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--header-text);
    letter-spacing: -0.02em;
}

.header-actions { display: flex; align-items: center; gap: 6px; }

.admin-badge-header {
    display: none;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    font-size: 0.58rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 50px;
    letter-spacing: 0.06em;
}

.theme-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition), transform 0.2s;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-btn:hover { background: var(--bg3); }
.theme-btn:active { transform: scale(0.92); }
.theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.user-avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    transition: border-color var(--transition), transform 0.2s;
}
.user-avatar-btn:hover { border-color: var(--accent); transform: scale(1.05); }
.user-avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* ===== Stats Strip ===== */
.stats-strip {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.stats-strip::-webkit-scrollbar { display: none; }

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.stat-item:hover { background: var(--bg3); }

.stat-num {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1.2;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px;
    padding-bottom: calc(100px + var(--safe-bottom));
}

/* ===== Tab Switcher ===== */
.tab-switcher-desktop {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: var(--glass-bg);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    scrollbar-width: none;
}
.tab-switcher-desktop::-webkit-scrollbar { display: none; }

.tab-btn {
    flex: 0 0 auto;
    padding: 10px 18px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    min-height: 40px;
}
.tab-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 12px var(--shadow);
}
.tab-btn:hover:not(.active) { background: var(--bg3); color: var(--text); }
.tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ===== Side Menu ===== */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.overlay.active { opacity: 1; visibility: visible; }

.side-menu-panel {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: var(--bg2);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.1);
}
.overlay.active .side-menu-panel { transform: translateX(0); }

.side-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.side-menu-title { font-size: 0.95rem; font-weight: 900; color: var(--header-text); }

.close-side-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.close-side-btn:hover { background: var(--bg3); }
.close-side-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.side-menu-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
}

.side-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1rem;
    overflow: hidden;
    flex-shrink: 0;
}
.side-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.side-user-details { min-width: 0; }
.side-user-name { font-weight: 900; font-size: 0.92rem; color: var(--header-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-title-display { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }

.side-menu-body { padding: 8px 0; }

.side-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: background var(--transition), padding-left 0.2s;
    min-height: 48px;
}
.side-menu-item:hover { background: var(--bg3); padding-left: 24px; }
.side-menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-menu-item i { width: 20px; text-align: center; color: var(--accent); }

.side-menu-divider { border: none; border-top: 1px solid var(--border-light); margin: 4px 16px; }

.side-menu-badge {
    background: var(--pink);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 50px;
    min-width: 18px;
    text-align: center;
}
.side-menu-badge.hidden { display: none; }

/* ===== Filter Section ===== */
.filter-section { margin-bottom: 24px; }

.search-wrapper { position: relative; margin-bottom: 12px; }

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

#search-box {
    width: 100%;
    padding: 14px 44px 14px 44px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text);
    font-size: 0.88rem;
    font-family: var(--font-main);
    font-weight: 600;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
#search-box:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
    background: var(--bg2);
}
#search-box::placeholder { color: var(--text-muted); opacity: 0.7; }

.search-clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
}

.sort-row { display: flex; gap: 8px; align-items: center; }

.sort-select {
    flex: 1;
    padding: 11px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg2);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-main);
    outline: none;
    cursor: pointer;
    min-height: 44px;
    transition: border-color var(--transition);
}
.sort-select:focus-visible { border-color: var(--accent); box-shadow: var(--focus-ring); }

.toggle-filter-btn {
    padding: 11px 18px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg2);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    min-height: 44px;
}
.toggle-filter-btn.filter-active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 2px 12px var(--shadow);
}
.toggle-filter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.filter-container {
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-top: 12px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.35s ease;
}
.filter-container.collapsed { display: none; }

.filter-group { margin-bottom: 14px; }
.filter-group:last-child { margin-bottom: 0; }

.filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tag-container { display: flex; flex-wrap: wrap; gap: 6px; }

.tag-btn-filter {
    padding: 6px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: 50px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    min-height: 32px;
}
.tag-btn-filter:hover:not(.active) { border-color: var(--accent3); background: var(--bg3); }
.tag-btn-filter.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 2px 8px var(--shadow);
}
.tag-btn-filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.results-info { margin-bottom: 14px; }
.results-count { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); }
.results-count span { color: var(--accent); font-weight: 900; }

/* ===== Song Grid ===== */
.song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 14px;
}

/* ===== Song Card ===== */
.song-card {
    position: relative;
    background: var(--glass-bg);
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s, border-color 0.3s;
    animation: cardFade 0.5s ease both;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.song-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--accent3);
}
.song-card:active { transform: translateY(-1px) scale(1); transition-duration: 0.1s; }
.song-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.card-color-bar {
    height: 3px;
    width: 100%;
    opacity: 0.85;
    transition: height 0.3s, opacity 0.3s;
}
.song-card:hover .card-color-bar { height: 4px; opacity: 1; }

.card-new-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, var(--pink), #e06060);
    color: white;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 50px;
    letter-spacing: 0.1em;
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201, 120, 120, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(201, 120, 120, 0); }
}

.card-body { padding: 16px 18px; min-width: 0; overflow: hidden; }

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--header-text);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.fav-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
    padding: 4px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.fav-btn.active { color: #ef4444; }
.fav-btn:hover { transform: scale(1.2); background: rgba(239, 68, 68, 0.08); }
.fav-btn:active { transform: scale(0.9); }
.fav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card-date {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.mini-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--bg3);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
}
.mini-tag.y {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    border: none;
}
.mini-tag.no-yt {
    background: #f59e0b15;
    color: #d97706;
    border-color: #f59e0b33;
}

/* ===== Views Badge ===== */
.views-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.62rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.views-badge.views-100million {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #78350f;
    box-shadow: 0 2px 8px #f59e0b44;
    animation: goldShimmer 3s ease-in-out infinite;
}
@keyframes goldShimmer {
    0%, 100% { box-shadow: 0 2px 8px #f59e0b44; }
    50% { box-shadow: 0 2px 16px #f59e0b66; }
}
.views-badge.views-10million { background: linear-gradient(135deg, #818cf8, #6366f1); color: white; }
.views-badge.views-million { background: linear-gradient(135deg, #34d399, #10b981); color: #064e3b; }
.views-badge.views-normal { background: var(--bg3); color: var(--text-muted); border: 1px solid var(--border-light); }

/* ===== Detail Page ===== */
#detail-page { display: none; }
#detail-page.visible { display: block; animation: fadeSlideIn 0.5s ease; }
#detail-page.hidden { display: none; }

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

.detail-view { max-width: 800px; margin: 0 auto; contain: layout; }

.detail-hero {
    position: relative;
    padding: 32px 28px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    color: white;
    overflow: hidden;
}
.detail-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.35) 100%);
    z-index: 0;
}
.detail-hero > * { position: relative; z-index: 1; }

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 18px;
    transition: background 0.2s;
    backdrop-filter: blur(8px);
    min-height: 44px;
}
.back-btn:hover { background: rgba(255, 255, 255, 0.25); }
.back-btn:focus-visible { outline: 2px solid white; outline-offset: 2px; }

.detail-title { font-size: 1.8rem; font-weight: 900; margin-bottom: 14px; line-height: 1.25; text-shadow: 0 2px 12px rgba(0,0,0,0.15); }

.detail-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.detail-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    backdrop-filter: blur(8px);
}

.detail-meta { font-size: 0.78rem; font-weight: 600; opacity: 0.85; }

.detail-body {
    background: var(--glass-bg);
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    padding: 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--card-shadow);
}

/* ===== Detail Actions ===== */
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.yt-link, .share-btn, .full-btn, .playlist-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    border: 1.5px solid var(--border-light);
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
    min-height: 44px;
}
.yt-link { background: #ff0000; color: white; border-color: #ff0000; }
.yt-link:hover { background: #cc0000; transform: translateY(-1px); }
.share-btn:hover, .full-btn:hover, .playlist-add-btn:hover { background: var(--bg3); border-color: var(--accent3); transform: translateY(-1px); }

/* ===== YouTube Views Section ===== */
.yt-views-section {
    background: var(--glass-bg);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 20px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.yt-views-header {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--header-text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.yt-views-header i { color: #ff0000; }

.views-exact-count {
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    font-weight: 900;
    color: var(--header-text);
    margin-bottom: 10px;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.views-exact-count small { font-size: 0.55em; font-weight: 700; color: var(--text-muted); margin-left: 4px; }

.views-progress-wrap { margin-bottom: 14px; }
.views-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 4px;
}
.views-progress-label strong { color: var(--accent); }

.views-progress-bar { height: 10px; background: var(--border-light); border-radius: 5px; overflow: hidden; }
.views-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.views-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: progressShine 2s ease-in-out infinite;
}
@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.views-milestone-toggle { margin-top: 10px; }
.milestone-toggle-btn {
    background: none;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    transition: all var(--transition);
    min-height: 44px;
}
.milestone-toggle-btn:hover { background: var(--bg3); border-color: var(--accent3); }
.milestone-toggle-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.milestone-chevron { transition: transform 0.3s ease; font-size: 0.7rem; }
.milestone-chevron.rotated { transform: rotate(180deg); }

.milestone-detail-collapsible { margin-top: 14px; }

.milestone-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.milestone-item { padding: 6px 16px; border-radius: 50px; font-size: 0.72rem; font-weight: 800; }
.milestone-achieved { background: linear-gradient(135deg, #34d399, #10b981); color: #064e3b; }
.milestone-pending { background: var(--bg2); color: var(--text-muted); border: 1px solid var(--border-light); }
.milestone-super { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #78350f; box-shadow: 0 2px 8px #f59e0b33; }

.views-breakdown { display: grid; grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); gap: 8px; }
.views-breakdown-item {
    text-align: center;
    padding: 10px;
    background: var(--bg2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    transition: border-color 0.2s;
}
.views-breakdown-item.achieved { border-color: #10b98155; background: #10b98111; }
.vb-number { font-size: 0.78rem; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.views-breakdown-item.achieved .vb-number { color: #10b981; }
.vb-label { font-size: 0.62rem; font-weight: 700; color: var(--text-muted); margin-top: 2px; }

/* ===== Reaction Section ===== */
.reaction-section { margin-bottom: 20px; }
.reaction-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: 50px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-height: 40px;
}
.reaction-btn:hover { border-color: var(--accent3); background: var(--bg3); transform: scale(1.04); }
.reaction-btn:active { transform: scale(0.96); }
.reaction-btn.reacted { background: var(--accent); color: white; border-color: var(--accent); }
.reaction-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.reaction-count { font-weight: 800; margin-left: 2px; }

/* ===== Section Divider ===== */
.section-divider { border: none; border-top: 1px solid var(--border-light); margin: 20px 0; }
.section-title { font-size: 0.88rem; font-weight: 900; color: var(--header-text); margin-bottom: 16px; }

/* ===== Comments ===== */
.comment-item {
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 10px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.comment-item:hover { border-color: var(--accent3); box-shadow: var(--card-shadow); }
.comment-pinned { border-left: 3px solid var(--accent3); }
.announcement-item { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: white; border: none; }

.comment-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.82rem;
}
.comment-header b { font-weight: 900; }
.comment-date { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; margin-left: auto; }

.admin-label {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 50px;
    letter-spacing: 0.04em;
}

.comment-title-badge {
    background: var(--bg3);
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    border: 1px solid var(--border-light);
}

.comment-avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.comment-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

.comment-text-p { font-size: 0.88rem; line-height: 1.65; color: var(--text); word-break: break-word; }

.comment-actions {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}
.comment-actions span {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color var(--transition);
    padding: 4px 0;
    min-height: 32px;
}
.comment-actions span:hover { color: var(--accent); }

.admin-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.admin-action-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg2);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    min-height: 32px;
}
.admin-action-btn.del:hover { background: #ef444418; color: #ef4444; border-color: #ef444444; }
.admin-action-btn.pin:hover { background: #f59e0b18; color: #d97706; border-color: #f59e0b44; }
.admin-action-btn.vis:hover { background: #3b82f618; color: #3b82f6; border-color: #3b82f644; }

.thread-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1.5px solid var(--border-light);
    padding: 7px 16px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 10px;
    transition: all var(--transition);
    min-height: 36px;
}
.thread-btn:hover { border-color: var(--accent3); color: var(--accent); }
.thread-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Post Area ===== */
.post-area-inline { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.post-area-inline input,
.post-area-inline textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
    font-family: var(--font-main);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.post-area-inline input:focus,
.post-area-inline textarea:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }

.post-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition);
    min-height: 48px;
}
.post-submit-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow); }
.post-submit-btn:active { transform: translateY(0); transition-duration: 0.1s; }
.post-submit-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Overlay Headers ===== */
.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--bg2);
    z-index: 10;
}
.overlay-header-left { display: flex; align-items: center; gap: 10px; }
.overlay-title { font-size: 0.92rem; font-weight: 900; color: var(--header-text); }

#admin-badge {
    display: none;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 50px;
}

.close-btn {
    background: none;
    border: 1px solid var(--border-light);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    min-height: 40px;
}
.close-btn:hover { background: var(--bg3); color: var(--text); }
.close-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Full-screen comment overlay ===== */
.fs-container {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 480px;
    max-width: 100vw;
    background: var(--bg2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.1);
}
.overlay.active .fs-container { transform: translateX(0); }

#overlay-comment-list { flex: 1; overflow-y: auto; padding: 16px; }

.fs-post-area { padding: 14px 16px; border-top: 1px solid var(--border-light); background: var(--bg2); }
.fs-post-row { display: flex; gap: 10px; align-items: flex-end; }
.fs-post-inputs { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.fs-post-inputs input,
.fs-post-inputs textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.82rem;
    font-family: var(--font-main);
    outline: none;
    transition: border-color var(--transition);
}
.fs-post-inputs input:focus,
.fs-post-inputs textarea:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px var(--shadow);
}
.send-btn:hover { transform: scale(1.08); box-shadow: 0 4px 16px var(--shadow); }
.send-btn:active { transform: scale(0.95); }
.send-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.admin-options {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}
.admin-options.hidden { display: none; }

/* ===== Thread Overlay ===== */
.thread-overlay {
    position: fixed;
    right: -100%;
    top: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: var(--bg2);
    z-index: 6000;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.thread-overlay.active { right: 0; }
#thread-content { flex: 1; overflow-y: auto; padding: 16px; }

/* ===== Settings Panel ===== */
.settings-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: var(--bg2);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.1);
}
.overlay.active .settings-panel { transform: translateX(0); }

.settings-body { padding: 18px; overflow-y: auto; }
.settings-section-title {
    font-size: 0.78rem;
    font-weight: 900;
    color: var(--header-text);
    margin-bottom: 12px;
    margin-top: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}
.settings-section-title:first-child { margin-top: 0; }

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    gap: 12px;
}
.settings-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.settings-btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border-light);
    transition: all var(--transition);
    min-height: 40px;
}
.settings-btn.theme { background: var(--bg); color: var(--text); }
.settings-btn.theme:hover { background: var(--bg3); }
.settings-btn.admin-login { background: var(--accent); color: white; border-color: var(--accent); }
.settings-btn.admin-login:hover { box-shadow: 0 4px 12px var(--shadow); }
.settings-btn.admin-logout { background: #ef4444; color: white; border-color: #ef4444; }
.settings-btn.admin-logout:hover { background: #dc2626; }

.settings-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
    font-family: var(--font-main);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.settings-input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }

/* Color picker */
.color-picker-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-swatch {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.color-swatch.selected { border-color: var(--header-text); transform: scale(1.15); box-shadow: 0 2px 8px var(--shadow); }
.color-swatch:hover { transform: scale(1.1); }
.color-swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.color-slider-wrap { width: 100%; margin-top: 14px; }
.color-slider-label { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; }

.hue-slider, .sat-slider, .light-slider {
    width: 100%;
    height: 10px;
    border-radius: 5px;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    margin-bottom: 10px;
}
.hue-slider { background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.sat-slider { background: linear-gradient(to right, #888, var(--accent)); }
.light-slider { background: linear-gradient(to right, #000, var(--accent), #fff); }

.hue-slider::-webkit-slider-thumb, .sat-slider::-webkit-slider-thumb, .light-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.color-preview { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--border-light); }

/* Font select */
.font-select {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-main);
    outline: none;
    cursor: pointer;
    min-height: 44px;
}
.font-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    min-height: 44px;
}
.font-upload-btn:hover { border-color: var(--accent3); }

/* ===== Account Panel ===== */
.account-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: var(--bg2);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.1);
}
.overlay.active .account-panel { transform: translateX(0); }

.account-hero {
    padding: 28px;
    text-align: center;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    position: relative;
    overflow: hidden;
}
.account-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.12), transparent 60%);
}
.account-hero > * { position: relative; z-index: 1; }

.account-avatar-large {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: 800;
    margin: 0 auto 14px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.2s;
}
.account-avatar-large:hover { transform: scale(1.05); }
.account-avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.account-display-name { font-size: 1.15rem; font-weight: 900; }
.account-display-title { font-size: 0.78rem; opacity: 0.8; font-weight: 600; margin-top: 4px; }
.account-body { padding: 22px; }
.account-info { margin-bottom: 10px; }

/* ===== Board Items ===== */
.board-header-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.board-header-area h2 { font-size: 1.15rem; font-weight: 900; color: var(--header-text); }

.board-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: cardFade 0.4s ease both;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: var(--card-shadow);
}
.board-item:hover { border-color: var(--accent3); transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.board-item:active { transform: translateY(-1px); transition-duration: 0.1s; }
.board-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.board-item-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
    overflow: hidden;
}
.board-item-avatar img { width: 100%; height: 100%; object-fit: cover; }

.board-item-content { flex: 1; min-width: 0; }
.board-item-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.board-item-top b { font-size: 0.88rem; font-weight: 900; color: var(--header-text); }

.target-song {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--glow);
    padding: 2px 10px;
    border-radius: 50px;
}
.board-item-content p {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.board-item-time { font-size: 0.65rem; color: var(--text-muted); font-weight: 600; flex-shrink: 0; white-space: nowrap; }

/* ===== Archive ===== */
.archive-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.archive-filter-btn {
    padding: 8px 18px;
    border: 1.5px solid var(--border-light);
    border-radius: 50px;
    background: var(--bg2);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    min-height: 40px;
}
.archive-filter-btn.active { background: var(--accent); color: white; border-color: var(--accent); box-shadow: 0 2px 10px var(--shadow); }
.archive-filter-btn:hover:not(.active) { background: var(--bg3); }
.archive-filter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.archive-comment-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.archive-comment-item:hover { border-color: var(--accent3); box-shadow: var(--card-shadow); }

.archive-song-tag {
    background: var(--glow);
    color: var(--accent);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 50px;
}

.archive-load-more {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--bg2);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    margin-top: 14px;
    transition: all var(--transition);
    min-height: 48px;
}
.archive-load-more:hover { background: var(--bg3); border-color: var(--accent3); }
.archive-load-more.hidden { display: none; }

/* ===== Timeline ===== */
.timeline-filters { margin-bottom: 16px; }
.timeline-year-divider {
    font-size: 0.92rem;
    font-weight: 900;
    color: var(--header-text);
    padding: 14px 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.timeline-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: cardFade 0.4s ease both;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.timeline-item:hover { border-color: var(--accent3); transform: translateX(6px); box-shadow: var(--card-shadow); }
.timeline-item:active { transform: translateX(3px); transition-duration: 0.1s; }
.timeline-date-badge { padding: 7px 14px; border-radius: var(--radius-sm); font-size: 0.72rem; font-weight: 800; white-space: nowrap; flex-shrink: 0; }

/* ===== Notices ===== */
.notice-card {
    display: flex;
    gap: 14px;
    padding: 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.notice-card:hover { border-color: var(--accent3); box-shadow: var(--card-shadow); }
.notice-card.new-notice { border-left: 3px solid var(--accent); }

.notice-icon-wrap { flex-shrink: 0; }
.notice-icon-new { color: var(--accent); font-size: 1.15rem; }
.notice-icon-read { color: var(--text-muted); font-size: 1.15rem; }
.notice-content { flex: 1; min-width: 0; }
.notice-header { margin-bottom: 8px; }
.notice-title-area { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.notice-title { font-size: 0.95rem; font-weight: 900; color: var(--header-text); }
.notice-meta { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; }
.notice-new-badge {
    background: linear-gradient(135deg, var(--pink), #e06060);
    color: white;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 50px;
    animation: badgePulse 2s ease-in-out infinite;
}
.notice-body { font-size: 0.85rem; line-height: 1.65; color: var(--text); }
.notice-admin-actions { margin-top: 10px; }

.notice-post-area {
    padding: 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 18px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.notice-post-area.hidden { display: none; }
.notice-post-title { font-size: 0.82rem; font-weight: 900; color: var(--header-text); margin-bottom: 14px; }
.notice-post-area .settings-input { margin-bottom: 10px; }

/* ===== Rankings ===== */
.rank-num { font-size: 0.85rem; font-weight: 900; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rank-1 { font-size: 1.25rem; }
.rank-2 { font-size: 1.12rem; }
.rank-3 { font-size: 1.02rem; }

/* ===== User Profile ===== */
.user-profile-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 18px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--card-shadow);
}
.user-profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow);
}
.user-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-profile-info { flex: 1; min-width: 0; }
.user-profile-name { font-size: 1.12rem; font-weight: 900; color: var(--header-text); }
.user-profile-title-text { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }

.follow-btn {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-height: 44px;
}
.follow-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px var(--shadow); }
.follow-btn:active { transform: translateY(0); }
.follow-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Changelog ===== */
.changelog-card {
    padding: 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.changelog-card:hover { border-color: var(--accent3); box-shadow: var(--card-shadow); }
.changelog-card.changelog-recent { border-left: 3px solid var(--accent); }

.changelog-header { margin-bottom: 12px; }
.changelog-version-area { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.changelog-version {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 3px 12px;
    border-radius: 50px;
}
.changelog-date { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; }
.changelog-title { font-size: 0.95rem; font-weight: 900; color: var(--header-text); margin-bottom: 6px; }
.changelog-types { display: flex; flex-wrap: wrap; gap: 6px; }

.cl-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 12px;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 700;
}
.cl-feature { background: #8b5cf618; color: #7c3aed; }
.cl-improve { background: #3b82f618; color: #2563eb; }
.cl-fix { background: #10b98118; color: #059669; }

.changelog-type-label { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; cursor: pointer; }
.changelog-body { font-size: 0.85rem; line-height: 1.65; color: var(--text); }

/* ===== Playlist Modal ===== */
#playlist-modal .settings-panel { max-height: 80vh; }

/* ===== Empty Messages ===== */
.empty-msg {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.8;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: var(--glass-bg);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    padding: 4px 0 max(env(safe-area-inset-bottom, 6px), 6px);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.04);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.58rem;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 12px;
    transition: color var(--transition), transform 0.2s;
    min-width: 48px;
    min-height: 48px;
    position: relative;
}
.nav-item i { font-size: 1.15rem; transition: transform 0.2s; }
.nav-item.active { color: var(--accent); }
.nav-item.active i { transform: scale(1.1); }
.nav-item.active::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}
.nav-item:hover { color: var(--accent); }
.nav-item:active i { transform: scale(0.9); }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }

/* ===== Floating Notes (detail hero) ===== */
.detail-hero .floating-note {
    position: absolute;
    font-size: 1.2rem;
    opacity: 0.2;
    animation: floatNote 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}
@keyframes floatNote {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.15; }
    50% { transform: translateY(-20px) rotate(15deg); opacity: 0.3; }
}

/* ===== Hidden class ===== */
.hidden { display: none !important; }

/* ===== Responsive: Tablet ===== */
@media (min-width: 481px) and (max-width: 768px) {
    .song-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .container { padding: 16px; padding-bottom: calc(90px + var(--safe-bottom)); }
    .tab-switcher-desktop { display: none; }
    .detail-title { font-size: 1.4rem; }
    .detail-hero { padding: 24px 20px; }
    .detail-actions { flex-wrap: wrap; }
    .yt-link, .share-btn, .full-btn, .playlist-add-btn { flex: 1 1 auto; min-width: 120px; justify-content: center; }
    .stats-strip { gap: 2px; padding: 10px 12px; }
    .stat-item { padding: 5px 10px; }
    .user-profile-hero { gap: 14px; padding: 18px; }
    .user-profile-avatar { width: 56px; height: 56px; font-size: 1.2rem; }
    .board-item { gap: 10px; padding: 12px 14px; }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 480px) {
    .tab-switcher-desktop { display: none; }
    .container { padding: 12px; padding-bottom: calc(88px + var(--safe-bottom)); }
    .song-grid { grid-template-columns: 1fr; gap: 10px; }
    .detail-title { font-size: 1.15rem; }
    .detail-hero { padding: 22px 16px; }
    .header-title { font-size: 0.88rem; }
    .stat-num { font-size: 0.92rem; }
    .stat-label { font-size: 0.55rem; }
    .stat-item { min-width: 48px; padding: 4px 6px; }
    .views-badge { font-size: 0.58rem; padding: 2px 8px; }
    .views-exact-count { font-size: 1.1rem; }
    .views-breakdown { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .board-item-top { flex-wrap: wrap; }
    .board-item-content p { font-size: 0.78rem; }
    .fs-container { width: 100%; }
    .side-menu-panel { width: 280px; }
    .filter-section { margin-bottom: 16px; }
    .filter-container { padding: 12px; }
    .tag-btn-filter { padding: 5px 12px; font-size: 0.68rem; }
    .archive-filter-btn { padding: 7px 14px; font-size: 0.75rem; }
    .notice-card { padding: 14px; gap: 10px; }
    .changelog-card { padding: 14px; }
    .detail-body { padding: 18px 14px; }
    .reaction-btn { padding: 7px 12px; font-size: 0.72rem; }
    .comment-item { padding: 14px; }
    .post-area-inline { gap: 8px; }
    .card-title { font-size: 0.88rem; }
    .user-profile-hero { flex-direction: column; text-align: center; padding: 20px; }
    .user-profile-avatar { width: 56px; height: 56px; font-size: 1.2rem; }
    .user-profile-info { text-align: center; }
    .follow-btn { align-self: center; }
    .settings-panel, .account-panel { width: 100%; }
    .account-hero { padding: 22px 16px; }
    .account-avatar-large { width: 72px; height: 72px; font-size: 1.6rem; }
    .thread-overlay { width: 100%; }
    .detail-actions { gap: 6px; }
    .yt-link, .share-btn, .full-btn, .playlist-add-btn { padding: 9px 14px; font-size: 0.78rem; flex: 1 1 calc(50% - 4px); min-width: 0; justify-content: center; }
    .card-body { padding: 14px 16px; }
    .board-header-area h2 { font-size: 1rem; }
    .sort-row { flex-wrap: wrap; }
    .sort-select { flex: 1 1 100%; }
    .toggle-filter-btn { flex: 1; }
    .edit-mode-btn { flex: 1; }
}

@media (max-width: 360px) {
    .detail-actions { flex-direction: column; }
    .yt-link, .share-btn, .full-btn, .playlist-add-btn { width: 100%; flex: initial; }
    .header-logo { width: 32px; height: 32px; font-size: 0.85rem; }
    .header-title { font-size: 0.82rem; }
    .stat-item { min-width: 42px; padding: 3px 5px; }
    .stat-num { font-size: 0.85rem; }
    .header-inner { padding: 8px 12px; gap: 8px; }
    .card-body { padding: 12px 14px; }
    .detail-hero { padding: 18px 14px; }
    .detail-title { font-size: 1rem; }
    .views-breakdown { grid-template-columns: repeat(2, 1fr); }
    .timeline-item { gap: 10px; padding: 12px; }
    .timeline-date-badge { padding: 5px 10px; font-size: 0.65rem; }
}

@media (min-width: 769px) {
    .bottom-nav { display: none; }
}

/* Large screens */
@media (min-width: 1024px) {
    .song-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
    .detail-view { max-width: 860px; }
    .container { padding: 24px 20px; }
}

/* Extra Large screens */
@media (min-width: 1400px) {
    .song-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
    .container { max-width: 1400px; }
}

/* ===== Print ===== */
@media print {
    .site-header, .bottom-nav, .bg-canvas, #stars-canvas, .toast-container, #announcement-banner, .edit-mode-banner { display: none; }
    body { background: white; color: black; }
    .song-card, .board-item, .notice-card, .changelog-card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .song-card:hover { transform: none; }
    .board-item:hover { transform: none; }
    .timeline-item:hover { transform: none; }
    .bg-orb { animation: none; }
}

/* ===== Auth State UI ===== */
.auth-guard-msg {
    background: var(--bg3);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 10px;
}
.auth-guard-msg:hover { background: var(--bg2); border-color: var(--accent); color: var(--accent); }

/* ===== is-logged-in / is-logged-out UI Control ===== */
body.is-logged-out .post-area-inline input,
body.is-logged-out .post-area-inline textarea,
body.is-logged-out .fs-post-area input,
body.is-logged-out .fs-post-area textarea { opacity: 0.5; pointer-events: none; }
body.is-logged-out .post-area-inline .post-submit-btn,
body.is-logged-out .fs-post-area .send-btn { opacity: 0.5; pointer-events: none; }
body.is-logged-in .user-profile-hero .follow-btn { background: var(--accent); color: white; }
body.is-logged-in #nav-user-profile.active i { color: var(--accent); }
body.is-logged-in #auth-login-prompt { display: none !important; }

/* Auth modal */
#auth-overlay .settings-panel { animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes slideUp {
    from { transform: translateY(20px) translateX(100%); opacity: 0; }
    to { transform: translateY(0) translateX(0); opacity: 1; }
}

/* ===== Filter Element Management Buttons ===== */
.filter-tag-wrapper { display: inline-flex; align-items: center; gap: 0; position: relative; }
/* Use edit-mode-active parent to control right radius instead of :has() for broader browser compat */
body.edit-mode-active .filter-tag-wrapper .tag-btn-filter {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding-right: 8px;
}

.filter-delete-element-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 100%;
    padding: 4px 6px;
    border: 1.5px solid var(--border-light);
    border-left: none;
    border-radius: 0 50px 50px 0;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.6rem;
    cursor: pointer;
    transition: all var(--transition);
    min-height: 32px;
}
.filter-delete-element-btn:hover { background: #ef4444; color: white; border-color: #ef4444; }

.filter-add-element-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 6px;
    padding: 0;
    border: 1.5px solid var(--accent3);
    border-radius: 50%;
    background: transparent;
    color: var(--accent);
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    vertical-align: middle;
}
.filter-add-element-btn:hover { background: var(--accent); color: white; border-color: var(--accent); transform: scale(1.15); }
.filter-add-element-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Custom Modal Dialogs ===== */
.custom-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.custom-modal-overlay.active { opacity: 1; visibility: visible; }

.custom-modal-box {
    background: var(--bg2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.custom-modal-message {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--header-text);
    line-height: 1.6;
    margin-bottom: 18px;
    white-space: pre-line;
    word-break: break-word;
}

.custom-modal-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.92rem;
    font-family: var(--font-main);
    font-weight: 600;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    margin-bottom: 18px;
    -webkit-appearance: none;
}
.custom-modal-input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }

.custom-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.custom-modal-btn {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid var(--border-light);
    font-family: var(--font-main);
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
}
.custom-modal-btn.cancel { background: var(--bg); color: var(--text-muted); }
.custom-modal-btn.cancel:hover { background: var(--bg3); color: var(--text); }
.custom-modal-btn.confirm { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: white; border-color: var(--accent); }
.custom-modal-btn.confirm:hover { transform: translateY(-2px); box-shadow: 0 6px 18px var(--shadow); }
.custom-modal-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 480px) {
    .custom-modal-box { max-width: 100%; padding: 22px 18px; }
    .custom-modal-btn { padding: 14px 20px; font-size: 0.88rem; }
    .custom-modal-actions { flex-direction: column-reverse; gap: 8px; }
    .custom-modal-btn { width: 100%; text-align: center; }
}

/* ===== Edit Mode ===== */
.edit-mode-banner {
    position: fixed;
    top: -60px;
    left: 0;
    right: 0;
    z-index: 9998;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    font-weight: 700;
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}
.edit-mode-banner.active { top: 0; }
.edit-mode-banner i:first-child { font-size: 1rem; animation: editPulse 2s ease-in-out infinite; }
@keyframes editPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.edit-mode-banner span { flex: 1; }
.edit-mode-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    min-height: 36px;
}
.edit-mode-close-btn:hover { background: rgba(255, 255, 255, 0.35); }

.edit-mode-btn {
    padding: 11px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg2);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    min-height: 44px;
}
.edit-mode-btn.active {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    border-color: #f59e0b;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.3);
}
.edit-mode-btn:hover:not(.active) { background: var(--bg3); border-color: #f59e0b; color: #d97706; }

body.edit-mode-active .site-header { margin-top: 42px; }
body.edit-mode-active { padding-top: 0; }

.song-card.edit-mode-card { border-color: #f59e0b33; }
.song-card.edit-mode-card:hover { border-color: #f59e0b; }

/* Edit Tags Section */
.edit-tags-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-light);
}
.edit-tags-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.edit-tags-container { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.edit-tags-empty { font-size: 0.65rem; color: var(--text-muted); font-style: italic; font-weight: 600; }

.edit-tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--accent);
    color: white;
    border-radius: 50px;
    font-size: 0.62rem;
    font-weight: 700;
    white-space: nowrap;
}
.edit-tag-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.58rem;
    transition: color var(--transition);
    display: flex;
    align-items: center;
    min-width: 20px;
    min-height: 20px;
    justify-content: center;
}
.edit-tag-remove:hover { color: white; }

.edit-tag-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 12px;
    border: 1.5px dashed var(--accent3);
    border-radius: 50px;
    background: transparent;
    color: var(--accent);
    font-size: 0.62rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    min-height: 24px;
}
.edit-tag-add-btn:hover { background: var(--accent); color: white; border-style: solid; border-color: var(--accent); }

/* Song Tag Selector Modal */
.song-tag-selector { max-height: 50vh; overflow-y: auto; margin-bottom: 18px; padding: 4px; }
.song-tag-group { margin-bottom: 14px; }
.song-tag-group-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.song-tag-group-items { display: flex; flex-wrap: wrap; gap: 6px; }
.song-tag-select-btn {
    padding: 7px 16px;
    border: 1.5px solid var(--border-light);
    border-radius: 50px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
}
.song-tag-select-btn:hover { background: var(--bg3); border-color: var(--accent3); }
.song-tag-select-btn.assigned { background: var(--accent); color: white; border-color: var(--accent); }
.song-tag-select-btn.assigned:hover { background: var(--pink); border-color: var(--pink); }
.song-tag-select-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Focus Visible Global ===== */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ===== Skip Link (a11y) — Enhanced ===== */
.skip-to-main {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    background: var(--accent);
    color: white;
    padding: 14px 28px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 800;
    text-decoration: none;
    transition: top 0.3s;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.skip-to-main:focus {
    top: 0;
}

/* ===== Smooth Scroll (a11y respecting reduced motion) ===== */
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

/* ===== ARIA Live Region ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ===== Loading Skeleton ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Micro-interaction Enhancements ===== */
.song-card {
    will-change: transform;
}

/* ===== Enhanced card color bar with subtle shimmer ===== */
.card-color-bar {
    position: relative;
    overflow: hidden;
}
.song-card:hover .card-color-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: cardBarShine 0.6s ease;
}
@keyframes cardBarShine {
    to { left: 100%; }
}

/* ===== Improved empty state ===== */
.empty-msg i.fa-spinner {
    font-size: 1.5rem;
    color: var(--accent3);
}

/* ===== Landscape phone fixes ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .bottom-nav { padding: 2px 0 2px; }
    .nav-item { padding: 4px 8px; min-height: 40px; }
    .nav-item span { display: none; }
    .nav-item i { font-size: 1rem; }
    .container { padding-bottom: 60px; }
    .stats-strip { padding: 6px 12px; }
    .stat-item { padding: 2px 6px; }
}

/* ===== Hover media query (touch vs pointer) ===== */
@media (hover: none) {
    .song-card:hover { transform: none; box-shadow: var(--card-shadow); }
    .board-item:hover { transform: none; }
    .timeline-item:hover { transform: none; }
    .fav-btn:hover { transform: none; background: none; }
}

/* ===== High contrast mode ===== */
@media (forced-colors: active) {
    .song-card { border: 2px solid CanvasText; }
    .tag-btn-filter { border: 2px solid CanvasText; }
    .tab-btn.active { forced-color-adjust: none; }
    .nav-item.active { forced-color-adjust: none; }
}
