/* ============================================
   せーのぷいの歌の魔導書
   夜の宇宙 × 金の刺繍 × ロゴピンク × ランタン × サイバー
   ============================================ */

:root {
    --night: #14121f;
    --night-2: #1d1a2c;
    --panel: rgba(29, 26, 44, 0.78);
    --gold: #d9b56c;
    --gold-soft: rgba(217, 181, 108, 0.38);
    --gold-faint: rgba(217, 181, 108, 0.13);
    --pink: #f7a8bd;
    --pink-deep: #ee7f9c;
    --lantern: #f5a04a;
    --cyan: #8be9fd;
    --cyan-soft: rgba(139, 233, 253, 0.35);
    --text: #f3ece0;
    --muted: #a99fb8;
    --font-body: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Noto Sans JP', sans-serif;
    --font-hud: 'Orbitron', 'Zen Maru Gothic', sans-serif;
    --font-logo: 'Fredoka', 'Zen Maru Gothic', sans-serif;
    color-scheme: dark;
}

[hidden] { display: none !important; }

/* ★画面全体がスクロールしないよう固定 */
html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background:
        radial-gradient(ellipse 80% 50% at 50% -5%, #2b2442 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(245, 160, 74, 0.07), transparent 70%),
        var(--night);
    color: var(--text);
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh; /* スマホのバーに影響されない動的高さ */
    overflow: hidden; /* 画面全体のスクロールを禁止 */
}

/* ---------- 背景：星空とサイバーグリッド ---------- */
#starfield {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(139, 233, 253, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 233, 253, 0.05) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 70%);
    -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 70%);
}

/* ---------- ヘッダー ---------- */
.header-container {
    position: relative;
    z-index: 10;
    flex-shrink: 0; /* ヘッダーが潰れないように固定 */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 20px 22px;
    box-sizing: border-box;
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
        linear-gradient(180deg, rgba(20, 18, 31, 0.15), rgba(20, 18, 31, 0.88));
    border-bottom: 1px solid var(--gold-soft);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* 下辺を走るサイバーな光 */
.header-container::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent) no-repeat;
    background-size: 40% 100%;
    animation: sweep 6s linear infinite;
}

/* 金の飾り枠（カードの四隅） */
.corner {
    position: absolute;
    width: 34px;
    height: 34px;
    color: var(--gold);
    opacity: 0.85;
    pointer-events: none;
}
.corner.tl { top: 10px; left: 10px; }
.corner.tr { top: 10px; right: 10px; transform: scaleX(-1); }
.corner.bl { bottom: 10px; left: 10px; transform: scaleY(-1); }
.corner.br { bottom: 10px; right: 10px; transform: scale(-1, -1); }

.title-block {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 18px;
}

/* タイトル背後でゆっくり回る魔法陣 */
.header-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    transform: translate(-50%, -50%);
    color: var(--gold);
    opacity: 0.2;
    pointer-events: none;
}
.header-circle svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.spin-cw { animation: spin 90s linear infinite; }
.spin-ccw { animation: spin 60s linear infinite reverse; }

.hud-label {
    position: relative;
    margin: 0 0 6px;
    font-family: var(--font-hud);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.22em;
    color: var(--cyan);
    opacity: 0.85;
}
.caret { animation: blink 1.1s steps(1) infinite; }
/* 「歌える曲リスト」は日本語なので、読みやすい丸ゴシックで少し大きめに */
.hud-ja {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.15em;
}

/* ぷっくり立体のロゴ文字 */
.logo {
    position: relative;
    margin: 0;
    font-family: var(--font-logo);
    font-weight: 700;
    font-size: clamp(36px, 8vw, 58px);
    line-height: 1.1;
    letter-spacing: 0.04em;
    color: #ffccd8;
    text-shadow:
        0 1px 0 #f7b2c3,
        0 2px 0 #f1a3b6,
        0 3px 0 #ea95aa,
        0 4px 0 #e2879e,
        0 5px 0 #d77a92,
        0 10px 16px rgba(0, 0, 0, 0.55),
        0 0 30px rgba(247, 168, 189, 0.35);
}

/* ときどき走るグリッチ */
.logo::before,
.logo::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    text-shadow: none;
    opacity: 0;
    mix-blend-mode: screen;
    pointer-events: none;
}
.logo::before { color: var(--cyan); animation: glitch-a 7s infinite; }
.logo::after { color: var(--pink-deep); animation: glitch-b 7s infinite; }

.subtitle {
    position: relative;
    margin: 10px 0 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--gold);
}
.subtitle::before,
.subtitle::after {
    content: '✦';
    margin: 0 0.6em;
    font-size: 10px;
    color: var(--pink);
}

/* ---------- 検索エリア ---------- */
.search-container {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr 1fr auto;
    gap: 10px;
    width: 100%;
    max-width: 920px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.input-wrapper input {
    width: 100%;
    padding: 13px 44px 13px 20px;
    box-sizing: border-box;
    border: 1px solid var(--gold-soft);
    border-radius: 999px;
    font-size: 15px;
    font-family: var(--font-body);
    font-weight: 500;
    background-color: rgba(20, 18, 31, 0.78);
    color: var(--text);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.input-wrapper input::placeholder { color: var(--muted); }
.input-wrapper input:focus {
    outline: none;
    border-color: var(--pink);
    box-shadow: 0 0 0 3px rgba(247, 168, 189, 0.16), 0 0 18px rgba(247, 168, 189, 0.25);
}

.clear-btn {
    position: absolute;
    right: 12px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(247, 168, 189, 0.22);
    color: var(--pink);
    font-size: 11px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease, transform 0.1s ease;
    z-index: 5;
}
.clear-btn:hover { background: var(--pink); color: var(--night); }
.clear-btn:active { transform: scale(0.85); }

.count-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid var(--cyan-soft);
    background: rgba(139, 233, 253, 0.06);
    font-family: var(--font-hud);
    color: var(--cyan);
    white-space: nowrap;
}
#songCount {
    font-size: 15px;
    font-weight: 700;
    min-width: 2.2em;
    text-align: right;
    text-shadow: 0 0 10px rgba(139, 233, 253, 0.6);
}
.count-unit { font-size: 10px; letter-spacing: 0.2em; opacity: 0.8; }

/* アーティスト候補ドロップダウン */
.custom-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(29, 26, 44, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--gold-soft);
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    flex-direction: column;
    padding: 8px 0 0;
    animation: fadeInDown 0.25s ease;
}

.dropdown-item {
    padding: 11px 22px;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
    transition: all 0.2s;
}
.dropdown-item:hover {
    background: linear-gradient(90deg, rgba(247, 168, 189, 0.16), transparent);
    color: var(--pink);
    padding-left: 28px;
}

.dropdown-close-btn {
    position: sticky;
    bottom: 0;
    background: var(--night-2);
    border-top: 1px solid var(--gold-faint);
    padding: 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--pink);
    cursor: pointer;
}
.dropdown-close-btn:active { background: #27223a; }

/* ---------- 曲リストとスクロールレールを並べる領域 ---------- */
.list-area {
    position: relative;
    z-index: 1;
    flex-grow: 1;
    min-height: 0; /* フレックス要素内でスクロールを有効化するために必須 */
}

/* ---------- 高速スクロール用のレール（右側） ---------- */
.scroll-rail {
    position: absolute;
    top: 64px;
    bottom: 24px;
    right: 10px;
    width: 28px;
    z-index: 100;
    cursor: pointer;
    user-select: none;
    touch-action: none; /* なぞる操作中にページがスクロールしないように */
    transition: opacity 0.3s ease;
}
.scroll-rail.inactive {
    opacity: 0;
    pointer-events: none;
}

/* 細いレール本体と、計器のような目盛り */
.rail-track {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(139, 233, 253, 0.18);
    border-radius: 2px;
}
.rail-track::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -5px;
    width: 12px;
    background: repeating-linear-gradient(to bottom, rgba(139, 233, 253, 0.35) 0 1px, transparent 1px 22px);
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

/* 進んだ分だけ光るゲージ */
.rail-fill {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 0;
    transform: translateX(-50%);
    border-radius: 2px;
    background: linear-gradient(to bottom, var(--gold), var(--pink));
    box-shadow: 0 0 8px rgba(247, 168, 189, 0.6);
}

/* つまみ */
.rail-thumb {
    position: absolute;
    top: 0;
    left: 50%;
    width: 14px;
    height: 34px;
    transform: translate(-50%, 0);
    box-sizing: border-box;
    border-radius: 999px;
    border: 1px solid var(--pink);
    background: rgba(20, 18, 31, 0.92);
    box-shadow: 0 0 10px rgba(247, 168, 189, 0.55);
    transition: width 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.rail-thumb::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    transform: translate(-50%, -50%) rotate(45deg);
    background: var(--gold);
    box-shadow: 0 0 6px var(--gold);
}

.scroll-rail:hover .rail-track::before,
.scroll-rail.scrubbing .rail-track::before { opacity: 1; }
.scroll-rail.scrubbing .rail-track { background: rgba(139, 233, 253, 0.35); }
.scroll-rail.scrubbing .rail-thumb {
    width: 18px;
    border-color: var(--cyan);
    box-shadow: 0 0 16px rgba(139, 233, 253, 0.8);
}

/* なぞっている位置のアーティストを中央に出すHUD */
.scroll-hud {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 500;
    width: 176px;
    height: 176px;
    box-sizing: border-box;
    padding: 0 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 18, 31, 0.95) 58%, rgba(20, 18, 31, 0.8));
    box-shadow: 0 0 0 1px var(--cyan-soft), 0 0 34px rgba(139, 233, 253, 0.22);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.3);
    pointer-events: none;
}
.scroll-hud.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.scroll-hud-ring {
    position: absolute;
    inset: -16px;
    width: calc(100% + 32px);
    height: calc(100% + 32px);
    color: var(--gold);
    opacity: 0.75;
    animation: spin 10s linear infinite;
}
.hud-label-sm {
    position: relative;
    font-family: var(--font-hud);
    font-size: 8px;
    letter-spacing: 0.3em;
    color: var(--gold);
    opacity: 0.8;
}
.hud-artist {
    position: relative;
    margin: 6px 0;
    max-width: 100%;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    color: #ffccd8;
    text-shadow: 0 2px 0 #c96f88, 0 0 18px rgba(247, 168, 189, 0.6);
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}
.hud-artist.pop { animation: hud-pop 0.28s ease-out; }
.hud-pos {
    position: relative;
    font-family: var(--font-hud);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(139, 233, 253, 0.7);
}

/* ---------- 曲リスト ---------- */
.table-container {
    position: relative;
    height: 100%;
    overflow-y: auto;
    padding: 10px 46px 24px 25px;
    box-sizing: border-box;
    /* scroll-behavior は指定しない：なぞり中は瞬時、タップ時だけなめらかに JS 側で切り替えるため */
    scrollbar-width: none; /* 標準のスクロールバーはレールと重複するので隠す */
}
.table-container::-webkit-scrollbar { display: none; }

.table-container::-webkit-scrollbar,
.custom-dropdown::-webkit-scrollbar { width: 8px; }
.table-container::-webkit-scrollbar-track,
.custom-dropdown::-webkit-scrollbar-track { background: transparent; }
.table-container::-webkit-scrollbar-thumb,
.custom-dropdown::-webkit-scrollbar-thumb { background-color: rgba(217, 181, 108, 0.35); border-radius: 10px; }

/* テーブルの崩れ防止固定レイアウト */
table {
    width: 100%;
    max-width: 1000px;
    margin: 6px auto 0;
    border-collapse: collapse;
    table-layout: fixed; /* 長い文字での崩れを防止 */
}

th {
    position: sticky;
    top: 0;
    z-index: 5;
    background-color: var(--night-2);
    text-align: left;
    padding: 11px 18px;
    font-size: 12px;
    font-weight: 700;
    color: var(--gold);
    border-bottom: 1px solid var(--gold-soft);
}
.th-en {
    font-family: var(--font-hud);
    font-size: 9px;
    letter-spacing: 0.25em;
    color: var(--cyan);
    margin-right: 10px;
    opacity: 0.8;
}

td {
    padding: 16px 18px;
    font-size: 14.5px;
    font-weight: 500;
    border-bottom: 1px solid var(--gold-faint);
    transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
}

/* 曲名・アーティスト名は2行まで折り返し、それでも収まらない場合のみ「…」で省略 */
.cell-text,
.artist-name-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
}

tbody tr { cursor: default; }
tbody tr:nth-child(even) td { background-color: rgba(255, 255, 255, 0.022); }

td:first-child { color: var(--text); }
td:last-child { color: var(--muted); }

/* ランタンの灯りがともるホバー */
tbody tr:hover td {
    background: linear-gradient(90deg, rgba(245, 160, 74, 0.16), rgba(245, 160, 74, 0.03));
}
tbody tr:hover td:first-child {
    color: #fff;
    box-shadow: inset 3px 0 0 var(--lantern);
    text-shadow: 0 0 14px rgba(245, 160, 74, 0.55);
}
tbody tr:hover td:last-child { color: var(--pink); }

.status-cell {
    text-align: center;
    padding: 48px 16px !important;
    color: var(--pink) !important;
}
.status-cell span { display: block; margin-top: 12px; }
.swirl-loader {
    width: 42px;
    height: 42px;
    animation: spin 1.4s linear infinite;
    filter: drop-shadow(0 0 10px rgba(247, 168, 189, 0.5));
}

/* アーティスト名 ＆ YouTubeボタンレイアウト */
.artist-cell-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}
.artist-name-text { flex: 1; min-width: 0; }

/* YouTubeボタン（位置・サイズ固定） */
.yt-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 8px;
    flex-shrink: 0; /* 文字が長くてもボタンが潰れないよう固定 */
    border-radius: 50%;
    border: 1px solid rgba(247, 168, 189, 0.55);
    background: transparent;
    color: var(--pink);
    font-size: 10px;
    padding: 0 0 0 2px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.yt-link-btn:hover {
    background-color: var(--pink);
    color: var(--night);
    transform: scale(1.12);
    box-shadow: 0 0 14px rgba(247, 168, 189, 0.65);
}
.yt-link-btn:active { transform: scale(0.9); }

/* ---------- スマホ用アーティスト検索パネル ---------- */
.artist-panel {
    position: fixed;
    inset: 0; /* 常に画面全体に固定（キーボードに合わせて位置を動かさない） */
    z-index: 20000;
    display: flex;
    flex-direction: column;
    /* 裏の曲リストが透けないよう完全に不透明。
       ランタンに上から照らされたような、暖かくふんわり明るい色 */
    background:
        radial-gradient(ellipse 120% 55% at 50% 0%, rgba(245, 160, 74, 0.34), transparent 70%),
        radial-gradient(ellipse 90% 40% at 50% 100%, rgba(247, 168, 189, 0.12), transparent 70%),
        linear-gradient(180deg, #4d3730 0%, #3e2d31 50%, #33262f 100%);
    animation: panel-in 0.15s ease;
}
/* パネル表示中は背面の曲一覧とレールを画面から外す。
   iPhone では慣性スクロール中の一覧がパネル越しに指を受け取り続けるため、
   スクロール禁止では足りず、一覧そのものを消して確実に止める */
body.panel-open .list-area { display: none; }
/* ページ自体も固定して、iPhone で画面全体がずれないようにする */
body.panel-open {
    position: fixed;
    inset: 0;
    width: 100%;
}
/* 裏で見えないHUDとアニメーションを止めて、パネル表示とキーボードの出現を軽くする */
body.panel-open .scroll-hud { display: none; }
body.panel-open .header-circle svg,
body.panel-open .logo::before,
body.panel-open .logo::after,
body.panel-open .header-container::after { animation-play-state: paused; }

.panel-head {
    touch-action: none; /* 上部をなぞってもページが動かないように */
    flex-shrink: 0;
    padding: 12px 14px 12px;
    background: rgba(60, 38, 28, 0.35);
    border-bottom: 1px solid rgba(245, 160, 74, 0.45);
    box-shadow: 0 8px 20px rgba(40, 20, 10, 0.3);
}
.panel-head .hud-label { color: #ffd9a8; }
.artist-panel .input-wrapper input {
    background-color: rgba(42, 28, 26, 0.7);
    border-color: rgba(245, 160, 74, 0.45);
}
.artist-panel .input-wrapper input::placeholder { color: #c9ab9a; }
.panel-head .hud-label { margin-bottom: 8px; }
.panel-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-input-row .input-wrapper { flex: 1; }
.panel-close {
    flex-shrink: 0;
    height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--gold-soft);
    background: transparent;
    color: var(--pink);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.panel-close:active { background: rgba(247, 168, 189, 0.15); }

.panel-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain; /* 端までスクロールしても背面に伝えない */
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
}
.panel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 214, 170, 0.14);
    cursor: pointer;
}
.panel-item:active {
    background: linear-gradient(90deg, rgba(245, 160, 74, 0.38), rgba(245, 160, 74, 0.06));
}
.panel-item:active .panel-name { color: #fff; }
.panel-name {
    min-width: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    overflow-wrap: anywhere;
}
.panel-count {
    flex-shrink: 0;
    font-family: var(--font-hud);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: #ffc58a;
}
.panel-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--pink);
}

/* ---------- アニメーション ---------- */
@keyframes panel-in { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes sweep {
    from { background-position: -100% 0; }
    to { background-position: 200% 0; }
}
@keyframes hud-pop {
    0% { transform: scale(1.35); opacity: 0.3; filter: blur(3px); text-shadow: 3px 0 0 var(--cyan), -3px 0 0 var(--pink-deep); }
    100% { transform: scale(1); opacity: 1; filter: none; }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes glitch-a {
    0%, 89%, 100% { opacity: 0; transform: none; clip-path: inset(0); }
    90% { opacity: 0.85; transform: translate(-3px, 0); clip-path: inset(15% 0 60% 0); }
    91.5% { opacity: 0.85; transform: translate(3px, 0); clip-path: inset(55% 0 15% 0); }
    93% { opacity: 0.85; transform: translate(-2px, 0); clip-path: inset(35% 0 40% 0); }
    94% { opacity: 0; }
}
@keyframes glitch-b {
    0%, 89%, 100% { opacity: 0; transform: none; clip-path: inset(0); }
    90% { opacity: 0.85; transform: translate(3px, 0); clip-path: inset(60% 0 10% 0); }
    91.5% { opacity: 0.85; transform: translate(-3px, 0); clip-path: inset(10% 0 65% 0); }
    93% { opacity: 0.85; transform: translate(2px, 0); clip-path: inset(45% 0 30% 0); }
    94% { opacity: 0; }
}

/* ---------- スマホ ---------- */
@media (max-width: 680px) {
    .header-container { padding: 20px 14px 14px; }
    .corner { width: 24px; height: 24px; }
    .corner.tl, .corner.tr { top: 7px; }
    .corner.bl, .corner.br { bottom: 7px; }
    .corner.tl, .corner.bl { left: 7px; }
    .corner.tr, .corner.br { right: 7px; }
    .title-block { margin-bottom: 12px; }
    .header-circle { width: 190px; height: 190px; }
    .hud-label { font-size: 9px; margin-bottom: 4px; }
    .subtitle { font-size: 12px; margin-top: 6px; letter-spacing: 0.2em; }
    /* 曲名検索は1行、アーティスト検索と曲数は横並び */
    .search-container { grid-template-columns: 1fr auto; gap: 8px; }
    .title-wrapper { grid-column: 1 / -1; }
    .input-wrapper input { padding: 11px 42px 11px 18px; font-size: 16px; } /* 16px未満だとiPhoneで自動ズームされる */
    .count-display { padding: 0 14px; }
    .table-container { padding: 0 38px 16px 10px; }
    .scroll-rail { right: 5px; top: 52px; }
    .scroll-hud { width: 160px; height: 160px; }
    .hud-artist { font-size: 16px; }
    td { padding: 14px 8px; font-size: 13.5px; }
    th { padding: 10px 8px; }
    .th-en { display: none; }
}

/* 動きを減らす設定の端末では、ぶれ・点滅や大きなスクロールだけ止める。
   その場で変化するだけの演出（星の瞬き・曲数・ゆっくり回る魔法陣）は残す */
@media (prefers-reduced-motion: reduce) {
    .logo::before,
    .logo::after { animation: none; }
}
