:root {
    --bg-color: #020617;
    --grid-neon: rgba(56, 189, 248, 0.5);

    --lane-1: #16a34a;
    --lane-2: #ca8a04;
    --lane-3: #2563eb;
    --lane-4: #dc2626;

    --block-1: #dc2626;
    --block-2: #16a34a;
    --block-3: #eab308;
    --block-4: #2563eb;
    --block-5: #94a3b8;
    --block-6: #a855f7;
    --block-7: #ffffff;

    /* マルチ：1ブロック内に赤〜紫まで分かる円錐状の虹（アニメで色相が流れない） */
    --multi-rainbow: conic-gradient(
        from 200deg at 50% 52%,
        #dc2626 0deg,
        #ea580c 32deg,
        #f59e0b 58deg,
        #eab308 78deg,
        #84cc16 102deg,
        #16a34a 128deg,
        #0d9488 154deg,
        #0891b2 178deg,
        #2563eb 204deg,
        #4f46e5 230deg,
        #7c3aed 256deg,
        #a855f7 282deg,
        #c026d3 308deg,
        #e11d48 334deg,
        #dc2626 360deg
    );

    /* マルチ（低負荷）：conic の代わりに使う斜めの線形グラデ（タッチ端末・動き抑制時） */
    --multi-rainbow-simple: linear-gradient(
        125deg,
        #dc2626 0%,
        #ea580c 16%,
        #eab308 32%,
        #16a34a 48%,
        #2563eb 64%,
        #7c3aed 80%,
        #c026d3 100%
    );

    --block-shadow-1: 0 0 14px rgba(220, 38, 38, 0.6);
    --block-shadow-2: 0 0 14px rgba(22, 163, 74, 0.6);
    --block-shadow-3: 0 0 14px rgba(234, 179, 8, 0.6);
    --block-shadow-4: 0 0 14px rgba(37, 99, 235, 0.6);
    --block-shadow-5: 0 0 14px rgba(148, 163, 184, 0.6);
    --block-shadow-6: 0 0 14px rgba(168, 85, 247, 0.6);
    --block-shadow-7: 0 0 14px rgba(168, 85, 247, 0.55);
}

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

html,
body {
    width: 100%;
    height: 100%;
}

body {
    background-color: var(--bg-color);
    color: white;
    font-family: 'Outfit', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    padding:
        env(safe-area-inset-top)
        env(safe-area-inset-right)
        env(safe-area-inset-bottom)
        env(safe-area-inset-left);
}

#game-stage {
    position: relative;
    flex: 0 0 auto;
    overflow: hidden;
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 480px;
    height: 720px;
    background: #000;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    border: 4px solid #1e293b;
    border-radius: 12px;
    transform-origin: top left;
    will-change: transform;
    contain: layout paint;
}

#grid-perspective-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 480px;
    height: 720px;
    perspective: 1200px;
    perspective-origin: 50% 15%;
    transform-style: preserve-3d;
}

#grid-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 480px;
    height: 1800px;
    background: #0f172a;
    transform: rotateX(62deg);
    transform-origin: 50% 100%;
    transform-style: preserve-3d;
    /* `contain: paint` は新規スタッキングコンテキストを生むため preserve-3d を flat 化してしまう。
       平面ブロックの最上段がクリップ／圧縮されて見える原因となるので layout のみで止める。 */
    contain: layout;
}

.grid-line {
    position: absolute;
    background: var(--grid-neon);
    box-shadow: 0 0 10px var(--grid-neon);
}

.grid-line-v { width: 1px; height: 100%; }
.grid-line-h { width: 100%; height: 1px; }

#active-lane-highlight {
    position: absolute;
    top: 0;
    width: 120px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(56, 189, 248, 0.2));
    pointer-events: none;
    transition: left 0.1s ease;
    z-index: 1;
}

/* 対戦は #blocks-container-0 等のためセレクタを併記 */
#blocks-container,
[id^="blocks-container-"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    /* contain: paint は preserve-3d を破壊するため layout のみに留める */
    contain: layout;
}

.block {
    position: absolute;
    width: 120px;
    height: 140px;
    z-index: 10;
    transition: top 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: top;
    contain: layout;
}

.block::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.4), transparent);
    z-index: 2;
}

.block-1 { background-color: var(--block-1); box-shadow: inset 0 0 12px rgba(0,0,0,0.5), var(--block-shadow-1); }
.block-2 { background-color: var(--block-2); box-shadow: inset 0 0 12px rgba(0,0,0,0.5), var(--block-shadow-2); }
.block-3 { background-color: var(--block-3); box-shadow: inset 0 0 12px rgba(0,0,0,0.5), var(--block-shadow-3); }
.block-4 { background-color: var(--block-4); box-shadow: inset 0 0 12px rgba(0,0,0,0.5), var(--block-shadow-4); }
.block-5 { background-color: var(--block-5); box-shadow: inset 0 0 12px rgba(0,0,0,0.5), var(--block-shadow-5); }
.block-6 { background-color: var(--block-6); box-shadow: inset 0 0 12px rgba(0,0,0,0.5), var(--block-shadow-6); }
.block-7 {
    background: var(--multi-rainbow);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.12),
        inset 0 0 14px rgba(0, 0, 0, 0.28),
        var(--block-shadow-7);
}

/* 通常ブロックの強い白膜が虹を黄緑一色に潰すため、マルチだけ弱いグロスに差し替え */
.block-7::before {
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.14) 0%,
        transparent 42%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

.shooting-block { z-index: 30; filter: brightness(1.2); transition: none; }
.sucking-block { z-index: 50; filter: brightness(1.5); }
.held-block { z-index: 60; filter: brightness(1.3); }

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.score-panel {
    position: absolute;
    top: 0;
    left: 0;
    padding: 6px 8px;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
    background: none;
    border: none;
    box-shadow: none;
}

.score-label {
    font-size: 11px;
    opacity: 0.55;
    margin-bottom: 2px;
    letter-spacing: 2px;
}

.level-panel {
    margin-top: 8px;
}

.level-label {
    font-size: 11px;
    opacity: 0.55;
    margin-bottom: 2px;
    letter-spacing: 2px;
}

#level-value {
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 1px;
}

#game-container.obstacle-freeze #grid-perspective-container,
#game-container.obstacle-freeze #bottom-lanes,
#game-container.obstacle-freeze .versus-playfield .grid-perspective-container,
#game-container.obstacle-freeze .versus-playfield .bottom-lanes {
    filter: brightness(0.72);
}

#game-container.obstacle-freeze #ui-layer,
#game-container.obstacle-freeze #queue-panel {
    filter: none;
}

.controls-hint {
    position: absolute;
    bottom: 165px;
    left: 12px;
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    line-height: 1.7;
    pointer-events: none;
}

.techno-alert {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 46px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 6px;
    white-space: nowrap;
    text-shadow: 0 0 10px rgba(56,189,248,0.8), 0 0 20px rgba(56,189,248,0.8), 0 0 40px rgba(56,189,248,0.8);
    z-index: 200;
    pointer-events: none;
    animation: techno-pop 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes techno-pop {
    0% { transform: translate(-50%, -50%) scale(0.5) skewX(20deg); opacity: 0; filter: blur(10px); }
    15% { transform: translate(-50%, -50%) scale(1.2) skewX(0deg); opacity: 1; filter: blur(0px); }
    85% { transform: translate(-50%, -50%) scale(1) skewX(0deg); opacity: 1; filter: blur(0px); }
    100% { transform: translate(-50%, -70%) scale(1.5) skewX(-20deg); opacity: 0; filter: blur(10px); }
}

#bottom-lanes {
    position: absolute;
    bottom: 0px;
    left: 0px;
    width: 480px;
    height: 160px;
    display: flex;
    z-index: 110;
    pointer-events: auto;
    background: linear-gradient(to top, var(--current-glow-bg, transparent) 0%, transparent 50%);
    transition: background 0.3s;
}

.lanes-color-1 { --current-glow-bg: rgba(220, 38, 38, 0.85); }
.lanes-color-2 { --current-glow-bg: rgba(22, 163, 74, 0.85); }
.lanes-color-3 { --current-glow-bg: rgba(234, 179, 8, 0.85); }
.lanes-color-4 { --current-glow-bg: rgba(37, 99, 235, 0.85); }
.lanes-color-5 { --current-glow-bg: rgba(148, 163, 184, 0.85); }
.lanes-color-6 { --current-glow-bg: rgba(168, 85, 247, 0.85); }
.lanes-color-7 { --current-glow-bg: rgba(168, 85, 247, 0.75); }
.lanes-color-panel { --current-glow-bg: rgba(148, 163, 184, 0.45); }
.lanes-color-versus-pending { --current-glow-bg: rgba(30, 41, 59, 0.5); }

.lane-guide {
    flex: 1;
    height: 100%;
    position: relative;
    cursor: pointer;
}

.lane-guide::before {
    content: '';
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    font-weight: bold;
}

.lane-guide:nth-child(1)::before { content: '1'; color: var(--lane-1); text-shadow: 0 0 10px var(--lane-1); }
.lane-guide:nth-child(2)::before { content: '2'; color: var(--lane-2); text-shadow: 0 0 10px var(--lane-2); }
.lane-guide:nth-child(3)::before { content: '3'; color: var(--lane-3); text-shadow: 0 0 10px var(--lane-3); }
.lane-guide:nth-child(4)::before { content: '4'; color: var(--lane-4); text-shadow: 0 0 10px var(--lane-4); }

#versus-p1 .lane-guide:nth-child(1)::before { content: '7'; }
#versus-p1 .lane-guide:nth-child(2)::before { content: '8'; }
#versus-p1 .lane-guide:nth-child(3)::before { content: '9'; }
#versus-p1 .lane-guide:nth-child(4)::before { content: '0'; }

.lane-guide:nth-child(1) { border-bottom: 8px solid var(--lane-1); }
.lane-guide:nth-child(2) { border-bottom: 8px solid var(--lane-2); }
.lane-guide:nth-child(3) { border-bottom: 8px solid var(--lane-3); }
.lane-guide:nth-child(4) { border-bottom: 8px solid var(--lane-4); }

#bottom-lanes.touch-controls-visible .lane-guide,
.versus-playfield .bottom-lanes.touch-controls-visible .lane-guide {
    background: linear-gradient(to top, rgba(148, 163, 184, 0.05), transparent 72%);
}

#bottom-lanes.touch-controls-visible .lane-guide::after,
.versus-playfield .bottom-lanes.touch-controls-visible .lane-guide::after {
    content: '';
    position: absolute;
    left: 6px;
    right: 6px;
    top: 10px;
    bottom: 22px;
    /* 消去時にマッチヒントと重なると眩しいため、強い黄枠は使わない */
    border: 1px solid rgba(100, 116, 139, 0.35);
    border-radius: 2px;
    pointer-events: none;
    box-sizing: border-box;
}

#bottom-lanes.touch-controls-visible .lane-guide:active::after,
.versus-playfield .bottom-lanes.touch-controls-visible .lane-guide:active::after {
    border-color: rgba(148, 163, 184, 0.55);
}

#bottom-lanes.touch-controls-visible .lane-guide:active,
.versus-playfield .bottom-lanes.touch-controls-visible .lane-guide:active {
    background: linear-gradient(to top, rgba(148, 163, 184, 0.12), transparent 72%);
}

.lane-guide {
    transition: background 0.2s, filter 0.2s;
}

.lane-active {
    background: linear-gradient(to top, rgba(56, 189, 248, 0.35), transparent) !important;
    border-top-color: rgba(56, 189, 248, 0.8) !important;
    transition: background 0.15s ease;
}

.lane-active::after {
    color: rgba(56, 189, 248, 0.9);
    animation: none;
    opacity: 1;
}

/* 消える瞬間：拡大・縮小・フェードのいずれもしない。
   最後の強光（block-flash-strong）が点いた状態から、1フレームで一気に非表示にする。
   → 「点滅 → パッと消える」のスッキリ感を出す。 */
.block-pop {
    opacity: 0 !important;
    z-index: 50;
}
.block-pop::before { animation: none !important; }

/* 揃った瞬間〜消えるまでの 5 フェーズ用の光。
   アニメーションを使わずに box-shadow / ::before の background を上書きするだけ →
   block-pop が同時に走っても光が消えず、「光ったまま消える」感を出せる。 */

/* Phase 1: かすかに光る */
.block-flash-soft {
    box-shadow:
        inset 0 0 12px rgba(0, 0, 0, 0.35),
        0 0 0 1.5px rgba(255, 255, 255, 0.7),
        0 0 18px rgba(255, 255, 255, 0.5) !important;
    z-index: 43 !important;
}
.block-flash-soft::before {
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.6),
        rgba(255, 255, 255, 0.2) 40%,
        transparent 70%
    ) !important;
}
/* Phase 3: 強く光る（block-pop が走っているあいだもこのまま光ってフェードアウト） */
.block-flash-strong {
    box-shadow:
        inset 0 0 18px rgba(255, 255, 255, 0.7),
        0 0 0 4px rgba(255, 255, 255, 1),
        0 0 38px rgba(255, 255, 255, 0.95),
        0 0 70px rgba(186, 230, 253, 0.55) !important;
    z-index: 47 !important;
}
.block-flash-strong::before {
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.9),
        rgba(255, 255, 255, 0.5) 40%,
        rgba(255, 255, 255, 0.18)
    ) !important;
}
.floating-score {
    position: absolute;
    color: #ffd700;
    font-size: 40px;
    font-weight: 900;
    text-shadow: 0 0 10px #ff8c00, 0 0 20px #ff8c00;
    transform: translate(-50%, -50%) translateZ(60px) rotateX(-60deg);
    animation: float-up 1.2s ease-out forwards;
    pointer-events: none;
    z-index: 200;
}

@keyframes float-up {
    0% { opacity: 1; transform: translate(-50%, -50%) translateZ(60px) rotateX(-60deg) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -150%) translateZ(120px) rotateX(-60deg) scale(1.5); }
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 8px;
    width: min(360px, 100%);
    margin: 18px auto 0;
}

.result-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.78);
}

.result-stat-label {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
}

.result-stat-value {
    color: #f8fafc;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
}

.chase-success {
    position: absolute;
    width: 120px;
    height: 140px;
    transform: translate(-50%, -50%) translateZ(72px) rotateX(-60deg);
    transform-style: preserve-3d;
    pointer-events: none;
    z-index: 210;
}

.chase-success-ring {
    position: absolute;
    inset: 9px;
    border: 4px solid rgba(125, 249, 255, 0.95);
    border-radius: 10px;
    box-shadow:
        0 0 18px rgba(56, 189, 248, 0.95),
        0 0 36px rgba(251, 191, 36, 0.6),
        inset 0 0 18px rgba(255, 255, 255, 0.35);
    animation: chase-ring-pop 0.72s ease-out forwards;
}

.chase-success-text {
    position: absolute;
    left: 50%;
    top: 45%;
    color: #fef08a;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 2px;
    white-space: nowrap;
    text-shadow:
        0 0 8px rgba(251, 191, 36, 1),
        0 0 18px rgba(56, 189, 248, 0.95),
        0 2px 0 rgba(0, 0, 0, 0.5);
    animation: chase-text-pop 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes chase-ring-pop {
    0% { opacity: 0; transform: scale(0.45); filter: blur(5px); }
    18% { opacity: 1; transform: scale(1.04); filter: blur(0); }
    100% { opacity: 0; transform: scale(1.7); filter: blur(6px); }
}

@keyframes chase-text-pop {
    0% { opacity: 0; transform: translate(-50%, 10%) scale(0.55); filter: blur(4px); }
    18% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); filter: blur(0); }
    70% { opacity: 1; transform: translate(-50%, -74%) scale(1); filter: blur(0); }
    100% { opacity: 0; transform: translate(-50%, -118%) scale(1.2); filter: blur(4px); }
}

.versus-garbage-alert {
    position: absolute;
    top: 90px;
    right: 42px;
    z-index: 240;
    color: #fef08a;
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 2px;
    white-space: nowrap;
    text-shadow:
        0 0 10px rgba(251, 191, 36, 1),
        0 0 22px rgba(56, 189, 248, 0.8),
        0 2px 0 rgba(0, 0, 0, 0.65);
    pointer-events: none;
    animation: versus-garbage-pop 1.05s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.queue-panel-versus.queue-garbage-hit {
    animation: queue-garbage-hit 0.48s ease-out;
}

@keyframes versus-garbage-pop {
    0% { opacity: 0; transform: translateY(14px) scale(0.7); filter: blur(6px); }
    18% { opacity: 1; transform: translateY(0) scale(1.08); filter: blur(0); }
    72% { opacity: 1; transform: translateY(-10px) scale(1); filter: blur(0); }
    100% { opacity: 0; transform: translateY(-34px) scale(1.18); filter: blur(5px); }
}

@keyframes queue-garbage-hit {
    0% { filter: brightness(1); transform: translateZ(0) scale(1); }
    35% {
        filter: brightness(1.45);
        transform: translateZ(0) scale(1.08);
        box-shadow:
            0 0 0 2px rgba(254, 240, 138, 0.9),
            0 0 24px rgba(251, 191, 36, 0.75),
            0 0 42px rgba(56, 189, 248, 0.45);
    }
    100% { filter: brightness(1); transform: translateZ(0) scale(1); }
}

.dead-line {
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8), inset 0 0 10px rgba(255,0,0,0.5) !important;
    background: rgba(255, 50, 50, 0.8) !important;
    height: 4px !important;
    z-index: 5;
}

@keyframes shake {
    0%, 100% { transform: rotateX(60deg) translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: rotateX(60deg) translate(-5px, 0); }
    20%, 40%, 60%, 80% { transform: rotateX(60deg) translate(5px, 0); }
}
.shake { animation: shake 0.3s; }

/* ============================================================
 * NEXT / NOW のキューブロック
 * グリッド内 .block と同じ「平面 + 内側影 + 上方シェーン + 外側カラーグロー」で統一。
 * 3D 風の border-bottom や 50% 白ハイライトは廃止。
 * ============================================================ */

/* NEXT 用ミニブロック */
.mini-block {
    width: 36px;
    height: 24px;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.mini-block::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4), transparent);
    pointer-events: none;
}

.mini-block-1 { background-color: var(--block-1); box-shadow: inset 0 0 8px rgba(0,0,0,0.5), var(--block-shadow-1); }
.mini-block-2 { background-color: var(--block-2); box-shadow: inset 0 0 8px rgba(0,0,0,0.5), var(--block-shadow-2); }
.mini-block-3 { background-color: var(--block-3); box-shadow: inset 0 0 8px rgba(0,0,0,0.5), var(--block-shadow-3); }
.mini-block-4 { background-color: var(--block-4); box-shadow: inset 0 0 8px rgba(0,0,0,0.5), var(--block-shadow-4); }
.mini-block-5 { background-color: var(--block-5); box-shadow: inset 0 0 8px rgba(0,0,0,0.5), var(--block-shadow-5); }
.mini-block-6 { background-color: var(--block-6); box-shadow: inset 0 0 8px rgba(0,0,0,0.5), var(--block-shadow-6); }
.mini-block-7 {
    background: var(--multi-rainbow);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.12),
        inset 0 0 10px rgba(0, 0, 0, 0.28),
        var(--block-shadow-7);
}

.mini-block-7::before {
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.14) 0%,
        transparent 42%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

.mini-block-panel {
    --pin: transparent;
    background-color: #14141c;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.18),
        inset 0 0 8px rgba(0, 0, 0, 0.7),
        0 0 8px rgba(148, 163, 184, 0.3);
}

.mini-block-panel::before {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.22), transparent 60%);
}

.mini-block-panel[data-panel-hint='1'] { --pin: var(--block-1); }
.mini-block-panel[data-panel-hint='2'] { --pin: var(--block-2); }
.mini-block-panel[data-panel-hint='3'] { --pin: var(--block-3); }
.mini-block-panel[data-panel-hint='4'] { --pin: var(--block-4); }
.mini-block-panel[data-panel-hint='5'] { --pin: var(--block-5); }
.mini-block-panel[data-panel-hint='6'] { --pin: var(--block-6); }

.mini-block-panel[data-panel-hint] {
    background:
        radial-gradient(ellipse 130% 95% at 50% 18%, transparent 0%, transparent 22%, rgba(6, 6, 10, 0.96) 48%, #0e0e14 100%),
        radial-gradient(ellipse 120% 88% at 50% 16%, color-mix(in srgb, var(--pin) 90%, #fff) 0%, color-mix(in srgb, var(--pin) 38%, #020617) 42%, transparent 66%),
        linear-gradient(155deg, #1c1c26 0%, #090910 48%, #12121a 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.2),
        inset 0 0 8px rgba(0, 0, 0, 0.72),
        0 0 10px color-mix(in srgb, var(--pin) 35%, transparent);
}

/* NOW 用ビッグブロック（mini と同設計でサイズだけ拡張） */
.big-block {
    width: 54px;
    height: 36px;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.big-block::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4), transparent);
    pointer-events: none;
}

.big-block-1 { background-color: var(--block-1); box-shadow: inset 0 0 10px rgba(0,0,0,0.5), var(--block-shadow-1); }
.big-block-2 { background-color: var(--block-2); box-shadow: inset 0 0 10px rgba(0,0,0,0.5), var(--block-shadow-2); }
.big-block-3 { background-color: var(--block-3); box-shadow: inset 0 0 10px rgba(0,0,0,0.5), var(--block-shadow-3); }
.big-block-4 { background-color: var(--block-4); box-shadow: inset 0 0 10px rgba(0,0,0,0.5), var(--block-shadow-4); }
.big-block-5 { background-color: var(--block-5); box-shadow: inset 0 0 10px rgba(0,0,0,0.5), var(--block-shadow-5); }
.big-block-6 { background-color: var(--block-6); box-shadow: inset 0 0 10px rgba(0,0,0,0.5), var(--block-shadow-6); }
.big-block-7 {
    background: var(--multi-rainbow);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.12),
        inset 0 0 12px rgba(0, 0, 0, 0.28),
        var(--block-shadow-7);
}

.big-block-7::before {
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.14) 0%,
        transparent 42%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

.big-block-panel {
    --pin: transparent;
    background-color: #14141c;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.22),
        inset 0 0 10px rgba(0, 0, 0, 0.7),
        0 0 10px rgba(148, 163, 184, 0.3);
}

.big-block-panel::before {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.22), transparent 60%);
}

.big-block-panel[data-panel-hint='1'] { --pin: var(--block-1); }
.big-block-panel[data-panel-hint='2'] { --pin: var(--block-2); }
.big-block-panel[data-panel-hint='3'] { --pin: var(--block-3); }
.big-block-panel[data-panel-hint='4'] { --pin: var(--block-4); }
.big-block-panel[data-panel-hint='5'] { --pin: var(--block-5); }
.big-block-panel[data-panel-hint='6'] { --pin: var(--block-6); }

.big-block-panel[data-panel-hint] {
    background:
        radial-gradient(ellipse 130% 95% at 50% 18%, transparent 0%, transparent 22%, rgba(6, 6, 10, 0.96) 48%, #0e0e14 100%),
        radial-gradient(ellipse 120% 88% at 50% 16%, color-mix(in srgb, var(--pin) 90%, #fff) 0%, color-mix(in srgb, var(--pin) 38%, #020617) 42%, transparent 66%),
        linear-gradient(155deg, #1c1c26 0%, #090910 48%, #12121a 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.22),
        inset 0 0 10px rgba(0, 0, 0, 0.72),
        0 0 12px color-mix(in srgb, var(--pin) 38%, transparent);
}

#queue-panel {
    position: absolute;
    top: 0;
    right: 0;
    padding: 6px 10px 10px 10px;
    z-index: 120;
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.45) 0%, rgba(15, 23, 42, 0.12) 100%);
    border-left: 1px solid rgba(148, 163, 184, 0.18);
    border-bottom-left-radius: 10px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#queue-panel .queue-heading {
    font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 3px;
    color: rgba(226, 232, 240, 0.85);
    text-shadow: 0 0 6px rgba(56, 189, 248, 0.35);
    margin-bottom: 0;
}

#queue-panel #queue-blocks {
    align-items: center !important;
}

#queue-panel #now-block {
    margin-top: 4px;
}

#chain-alert {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 72px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #fff;
    text-shadow:
        0 0 12px rgba(251, 191, 36, 0.95),
        0 0 28px rgba(251, 191, 36, 0.85),
        0 0 56px rgba(245, 158, 11, 0.65);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55);
    z-index: 220;
    pointer-events: none;
    white-space: nowrap;
}

#chain-alert.chain-show {
    animation: combo-center-pop 1.15s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes combo-center-pop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.55); filter: blur(10px); }
    18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); filter: blur(0); }
    72% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); }
    100% { opacity: 0; transform: translate(-50%, -58%) scale(1.12); filter: blur(8px); }
}

.ghost-block {
    position: absolute;
    width: 120px;
    height: 140px;
    opacity: 0.4;
    border: 2px dashed rgba(255, 255, 255, 0.55);
    border-radius: 6px;
    pointer-events: none;
    z-index: 12;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.12),
        0 0 12px rgba(0, 0, 0, 0.35);
    animation: ghost-faint-breathe 2.4s ease-in-out infinite;
}

@keyframes ghost-faint-breathe {
    0%, 100% {
        border-color: rgba(255, 255, 255, 0.42);
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, 0.1),
            0 0 8px rgba(0, 0, 0, 0.28);
    }
    50% {
        border-color: rgba(255, 255, 255, 0.62);
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, 0.16),
            0 0 12px rgba(255, 255, 255, 0.08);
    }
}

.ghost-block-1 { background: rgba(220, 38, 38, 0.42); }
.ghost-block-2 { background: rgba(22, 163, 74, 0.42); }
.ghost-block-3 { background: rgba(234, 179, 8, 0.42); }
.ghost-block-4 { background: rgba(37, 99, 235, 0.42); }
.ghost-block-5 { background: rgba(148, 163, 184, 0.42); }
.ghost-block-6 { background: rgba(168, 85, 247, 0.42); }
.ghost-block-7 {
    background: conic-gradient(
        from 200deg at 50% 52%,
        rgba(220, 38, 38, 0.48) 0deg,
        rgba(234, 88, 12, 0.48) 60deg,
        rgba(234, 179, 8, 0.48) 120deg,
        rgba(22, 163, 74, 0.48) 180deg,
        rgba(37, 99, 235, 0.48) 240deg,
        rgba(124, 58, 237, 0.48) 300deg,
        rgba(220, 38, 38, 0.48) 360deg
    );
}

/* ここに置くと揃う列：盤上ゴーストを発光（filter は外し box-shadow のみで脈打ち／合成負荷を抑える） */
.ghost-match {
    animation: ghost-match-glow 1.15s ease-in-out infinite;
    opacity: 0.78;
    border-style: solid;
    border-width: 2px;
    border-color: rgba(56, 189, 248, 0.88);
}

@keyframes ghost-match-glow {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(253, 224, 71, 0.45),
            0 0 14px rgba(34, 211, 238, 0.32),
            0 0 22px rgba(56, 189, 248, 0.22),
            inset 0 0 14px rgba(56, 189, 248, 0.12);
    }
    50% {
        box-shadow:
            0 0 0 2px rgba(253, 224, 71, 0.6),
            0 0 20px rgba(56, 189, 248, 0.42),
            0 0 28px rgba(250, 204, 21, 0.22),
            inset 0 0 16px rgba(253, 224, 71, 0.08);
    }
}

#queue-panel.queue-flash {
    filter: brightness(1.08);
}

.lane-risk-1 { box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.25); }
.lane-risk-2 { box-shadow: inset 0 0 0 2px rgba(251, 146, 60, 0.35); }
.lane-risk-3 { box-shadow: inset 0 0 0 2px rgba(248, 113, 113, 0.45); }
.lane-critical {
    animation: lane-blink 0.8s ease-in-out infinite;
    box-shadow: inset 0 0 0 3px rgba(248, 113, 113, 0.8);
}

@keyframes lane-blink {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.35); }
}

/* マッチアシスト：置けば揃うレーン（lane-risk / lane-critical より後で上書き） */
.lane-guide.lane-match-hint {
    background: linear-gradient(
        to top,
        rgba(253, 224, 71, 0.32) 0%,
        rgba(56, 189, 248, 0.26) 45%,
        transparent 88%
    ) !important;
    animation: lane-match-hint-pulse 1.15s ease-in-out infinite;
    box-shadow:
        inset 0 0 20px rgba(56, 189, 248, 0.32),
        inset 0 0 0 1px rgba(253, 224, 71, 0.48) !important;
}

@keyframes lane-match-hint-pulse {
    0%, 100% {
        box-shadow:
            inset 0 0 18px rgba(56, 189, 248, 0.28),
            inset 0 0 0 1px rgba(253, 224, 71, 0.42) !important;
    }
    50% {
        box-shadow:
            inset 0 0 26px rgba(253, 224, 71, 0.36),
            inset 0 0 0 2px rgba(56, 189, 248, 0.48) !important;
    }
}

/* 射出中のレーン強調はアシストより優先 */
.lane-guide.lane-active.lane-match-hint {
    animation: none;
    background: linear-gradient(to top, rgba(56, 189, 248, 0.48), rgba(253, 224, 71, 0.16), transparent 82%) !important;
    box-shadow: inset 0 0 28px rgba(56, 189, 248, 0.55) !important;
}

.dead-line-hot {
    box-shadow: 0 0 28px rgba(255, 0, 0, 1), inset 0 0 14px rgba(255, 0, 0, 0.8) !important;
    background: rgba(255, 80, 80, 1) !important;
}

.block-kind-stone {
    background: linear-gradient(180deg, #64748b 0%, #334155 100%) !important;
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.55), 0 0 12px rgba(148, 163, 184, 0.45) !important;
}

.block-kind-panel {
    --pin: transparent;
    background:
        linear-gradient(145deg, #2a2a34 0%, #0b0b10 42%, #14141c 100%) !important;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.42),
        inset 0 0 14px rgba(255, 255, 255, 0.08),
        inset 0 2px 18px rgba(255, 255, 255, 0.12),
        inset 0 -10px 20px rgba(0, 0, 0, 0.65),
        0 0 16px rgba(148, 163, 184, 0.35) !important;
}

.block-kind-panel[data-panel-hint='1'] { --pin: var(--block-1); }
.block-kind-panel[data-panel-hint='2'] { --pin: var(--block-2); }
.block-kind-panel[data-panel-hint='3'] { --pin: var(--block-3); }
.block-kind-panel[data-panel-hint='4'] { --pin: var(--block-4); }
.block-kind-panel[data-panel-hint='5'] { --pin: var(--block-5); }
.block-kind-panel[data-panel-hint='6'] { --pin: var(--block-6); }

.block-kind-panel[data-panel-hint] {
    background:
        radial-gradient(ellipse 130% 95% at 50% 14%, transparent 0%, transparent 20%, rgba(5, 5, 8, 0.97) 46%, #0a0a10 100%),
        radial-gradient(ellipse 118% 82% at 50% 12%, color-mix(in srgb, var(--pin) 88%, #fff) 0%, color-mix(in srgb, var(--pin) 32%, #020617) 40%, transparent 64%),
        linear-gradient(145deg, #24242e 0%, #0b0b10 44%, #13131a 100%) !important;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.4),
        inset 0 0 14px rgba(255, 255, 255, 0.06),
        inset 0 2px 16px rgba(255, 255, 255, 0.1),
        inset 0 -10px 20px rgba(0, 0, 0, 0.62),
        0 0 18px color-mix(in srgb, var(--pin) 32%, rgba(148, 163, 184, 0.35)) !important;
}

.block-kind-panel::before {
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.08) 28%, transparent 58%),
        linear-gradient(to right, rgba(255, 255, 255, 0.2), transparent 20%, transparent 80%, rgba(255, 255, 255, 0.18)) !important;
}

.block-kind-ice {
    outline: 2px solid rgba(191, 219, 254, 0.8);
}

.ice-stage-2::before {
    background: linear-gradient(to bottom, rgba(191, 219, 254, 0.75), transparent) !important;
}

.ice-stage-1::before {
    background: linear-gradient(to bottom, rgba(191, 219, 254, 0.35), transparent) !important;
}

.core-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fde68a;
    font-size: 28px;
    text-shadow: 0 0 10px rgba(253, 224, 71, 0.9);
    z-index: 5;
    pointer-events: none;
}

.block-kind-burst {
    outline: 2px dashed rgba(250, 204, 21, 0.9);
}

.game-over-tone #blocks-container .block,
.game-over-tone [id^="blocks-container-"] .block {
    filter: saturate(0.35) brightness(0.7);
}

#grid-perspective-container.shake {
    animation: shake 0.35s;
}

.title-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(10px);
    background: rgba(2, 6, 23, 0.55);
}

.title-card {
    width: min(420px, 92%);
    padding: 28px 24px;
    border-radius: 20px;
    border: 2px solid #38bdf8;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(15px);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.title-logo {
    max-width: 280px;
    margin: 0 auto 16px;
    height: auto;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.4));
}

.title-card .title-sub {
    color: #94a3b8;
    margin-bottom: 20px;
    font-size: 14px;
}

.title-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.title-menu-btn {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.title-menu-btn:hover:not(:disabled) {
    border-color: #38bdf8;
    background: #172554;
}

.title-menu-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.title-menu-btn-primary {
    border-color: #38bdf8;
    background: #38bdf8;
    color: #000;
}

.title-menu-btn-primary:hover:not(:disabled) {
    background: #7dd3fc;
}

.title-menu-note {
    margin-top: 12px;
    min-height: 1.2em;
    color: #fbbf24;
    font-size: 13px;
}

.title-card-footer {
    margin-top: auto;
    padding-top: 16px;
    color: rgba(148, 163, 184, 0.7);
    font-size: 11px;
    letter-spacing: 0.06em;
}

.title-sub-solo {
    font-size: 18px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 16px;
}

.title-card-puzzle-select {
    width: min(440px, 94%);
    max-height: min(90vh, 640px);
    overflow-y: auto;
}

.puzzle-select-note {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 14px;
}

.puzzle-stage-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.puzzle-stage-btn {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.puzzle-stage-btn:hover:not(:disabled) {
    border-color: #38bdf8;
    background: #172554;
}

.puzzle-stage-btn.puzzle-stage-done {
    border-color: #4ade80;
    color: #4ade80;
}

.puzzle-stage-btn.puzzle-stage-locked,
.puzzle-stage-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.puzzle-select-actions {
    margin-top: 4px;
}

.puzzle-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    margin-top: 6px;
}

.puzzle-panel .puzzle-moves-label {
    margin-left: 8px;
}

.puzzle-hint-banner {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 168px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(56, 189, 248, 0.45);
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
    z-index: 30;
    pointer-events: none;
}

#game-container.puzzle-active .score-panel {
    flex-wrap: wrap;
}

.loading-card {
    width: min(360px, 86%);
    padding: 34px 24px;
    border-radius: 20px;
    border: 2px solid rgba(56, 189, 248, 0.86);
    background: rgba(0, 0, 0, 0.95);
    text-align: center;
    box-shadow:
        0 0 24px rgba(56, 189, 248, 0.18),
        inset 0 0 24px rgba(56, 189, 248, 0.06);
}

.loading-spinner {
    width: 54px;
    height: 54px;
    margin: 0 auto 18px;
    border: 4px solid rgba(148, 163, 184, 0.28);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: loading-spin 0.82s linear infinite;
}

.loading-title {
    color: #f8fafc;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 4px;
}

.loading-sub {
    margin-top: 10px;
    color: #94a3b8;
    font-size: 13px;
    letter-spacing: 0.04em;
}

.loading-card-error .title-menu-btn {
    margin-top: 18px;
}

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

body.site-page {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 24px 16px 40px;
}

html:has(body.site-page) {
    height: auto;
    min-height: 100%;
}

.site-shell {
    width: min(720px, 100%);
    margin: 0 auto;
}

.site-card {
    padding: 28px 24px;
    border-radius: 16px;
    border: 1px solid #334155;
    background: rgba(15, 23, 42, 0.92);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
}

.site-card h1 {
    font-size: 28px;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.site-card h2 {
    font-size: 18px;
    margin: 22px 0 10px;
    color: #7dd3fc;
}

.puzzle-editor-shell {
    width: min(1320px, 100%);
}

.puzzle-editor-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.puzzle-editor-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.puzzle-editor-sub {
    color: #94a3b8;
    margin-top: 6px;
    font-size: 13px;
}

.puzzle-editor-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.puzzle-editor-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
}

.puzzle-editor-sidebar,
.puzzle-editor-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.puzzle-editor-panel {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #334155;
    background: rgba(2, 6, 23, 0.68);
}

.puzzle-editor-panel-title {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 10px;
    letter-spacing: 0.06em;
}

.editor-panel-help {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 10px;
}

.editor-stage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 420px;
    overflow: auto;
}

.editor-stage-item {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #e2e8f0;
    cursor: pointer;
}

.editor-stage-item.active {
    border-color: #38bdf8;
    background: #172554;
}

.editor-stage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.editor-stage-actions .title-menu-btn {
    width: auto;
}

.editor-palette {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.editor-palette-btn,
.editor-grid-cell,
.editor-shot-delete {
    border-radius: 8px;
    border: 1px solid #334155;
    color: #e2e8f0;
    cursor: pointer;
}

.editor-palette-btn {
    min-height: 44px;
    font-weight: 700;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px;
}

.editor-palette-chip {
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
}

.editor-palette-label {
    font-size: 11px;
    line-height: 1;
}

.editor-panel-hint {
    min-width: 34px;
    height: 18px;
    border-radius: 999px;
    margin-top: 3px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.editor-palette-btn.active,
#editor-erase-btn.active {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.puzzle-editor-meta {
    display: grid;
    grid-template-columns: 1.2fr 1.6fr 120px;
    gap: 12px;
}

.editor-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.editor-field span {
    color: #94a3b8;
    font-size: 12px;
}

.editor-field input {
    height: 42px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #020617;
    color: #e2e8f0;
    padding: 0 12px;
}

.editor-readonly-value {
    height: 42px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #020617;
    color: #e2e8f0;
    padding: 0 12px;
    display: flex;
    align-items: center;
    font-weight: 700;
}

.puzzle-editor-workbench {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 16px;
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(4, 70px);
    gap: 6px;
    justify-content: start;
}

.editor-grid-cell {
    width: 70px;
    height: 56px;
    font-weight: 700;
    background: #0f172a;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.editor-grid-token,
.editor-grid-sub {
    display: block;
}

.editor-grid-token {
    font-size: 15px;
    font-weight: 900;
    line-height: 1.1;
}

.editor-grid-sub {
    width: fit-content;
    max-width: 100%;
    margin: 4px auto 0;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    color: #e5e7eb;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.editor-token-empty { background: #020617; }
.editor-token-R { background: rgba(220, 38, 38, 0.85); }
.editor-token-G { background: rgba(22, 163, 74, 0.85); }
.editor-token-Y { background: rgba(234, 179, 8, 0.85); color: #111827; }
.editor-token-B { background: rgba(37, 99, 235, 0.85); }
.editor-token-P { background: rgba(148, 163, 184, 0.85); color: #111827; }
.editor-token-V { background: rgba(168, 85, 247, 0.9); }
.editor-token-M {
    background: linear-gradient(135deg, #ef4444, #f59e0b, #22c55e, #3b82f6, #a855f7);
}
.editor-token-panel {
    background: linear-gradient(135deg, #111827, #334155);
}

.editor-token-panel .editor-grid-sub {
    background: rgba(2, 6, 23, 0.92);
}

.editor-shots {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.editor-shot-item {
    display: grid;
    grid-template-columns: 1fr 36px;
    gap: 8px;
    align-items: start;
}

.editor-shot-main {
    min-height: 56px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 8px 10px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "order order"
        "token label";
    align-items: center;
    column-gap: 10px;
    row-gap: 4px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.editor-shot-order {
    grid-area: order;
    font-size: 11px;
    font-weight: 700;
    opacity: 0.9;
}

.editor-shot-token {
    grid-area: token;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.editor-shot-label {
    grid-area: label;
    font-size: 13px;
    font-weight: 800;
}

.editor-shot-picker {
    grid-column: 1 / 2;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.editor-shot-swatch {
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f8fafc;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.editor-shot-swatch.active {
    border-color: #e0f2fe;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.28);
}

.editor-shot-delete {
    background: #7f1d1d;
    align-self: stretch;
}

.editor-preview {
    width: 100%;
    min-height: 300px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #020617;
    color: #e2e8f0;
    padding: 12px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 980px) {
    .puzzle-editor-layout,
    .puzzle-editor-workbench,
    .puzzle-editor-meta {
        grid-template-columns: 1fr;
    }
}

.site-card p,
.site-card li {
    color: #cbd5e1;
    line-height: 1.75;
    font-size: 15px;
}

.site-card ul {
    padding-left: 1.2em;
}

.site-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.site-link-btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid #38bdf8;
    background: #38bdf8;
    color: #000;
    font-weight: 700;
    text-decoration: none;
}

.site-link-btn-secondary {
    border-color: #334155;
    background: #0f172a;
    color: #e2e8f0;
}

.ranking-score {
    margin-top: 12px;
    font-size: 42px;
    font-weight: 800;
    color: #fbbf24;
    letter-spacing: 1px;
}

.ranking-empty {
    color: #94a3b8;
    font-size: 15px;
}

.ranking-tabs {
    display: flex;
    gap: 8px;
    margin: 18px 0 14px;
}

.ranking-tab {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.ranking-tab-active {
    border-color: #38bdf8;
    background: #38bdf8;
    color: #000;
}

.ranking-board {
    margin-top: 8px;
}

.ranking-header,
.ranking-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 88px 56px 56px;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
}

.ranking-header {
    color: #7dd3fc;
    font-size: 13px;
    font-weight: 700;
    border-bottom: 1px solid #334155;
}

.ranking-row {
    color: #e2e8f0;
    font-size: 14px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.55);
}

.ranking-rank {
    color: #fbbf24;
    font-weight: 800;
}

.ranking-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-score-cell {
    text-align: right;
    font-weight: 700;
}

.ranking-chain-cell,
.ranking-clear-cell {
    text-align: right;
    color: #94a3b8;
}

.ranking-status {
    margin-top: 12px;
    color: #fbbf24;
    font-size: 14px;
}

.result-ranking-section {
    width: min(360px, 100%);
    margin: 0 auto 20px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #334155;
    background: rgba(15, 23, 42, 0.85);
}

.result-ranking-label {
    display: block;
    margin-bottom: 8px;
    color: #cbd5e1;
    font-size: 14px;
    text-align: left;
}

.result-ranking-input {
    width: 100%;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
}

.result-ranking-submit {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: #38bdf8;
    color: #000;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.result-ranking-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.result-ranking-msg {
    min-height: 1.2em;
    margin-top: 10px;
    color: #fbbf24;
    font-size: 13px;
    line-height: 1.5;
}

.result-ranking-preview {
    margin-top: 12px;
    text-align: left;
}

.result-ranking-preview .ranking-header,
.result-ranking-preview .ranking-row {
    grid-template-columns: 40px minmax(0, 1fr) 72px 44px 44px;
    font-size: 12px;
}

/* ===== 二人対戦：論理 960×720（各フィールド 480×720＝ソロと同じ透視・レーン 160px オーバーレイ） ===== */
#game-container.versus-active {
    width: 960px;
    height: 720px;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    border: none;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.75);
}

#game-container.versus-active #solo-play-root {
    display: none;
}

/* 対戦中はソロ用レーンを二重表示しない（ID のみの #bottom-lanes は .bottom-lanes 未付与のため別要素） */
#game-container.versus-active #bottom-lanes {
    display: none !important;
    pointer-events: none !important;
}

/* ソロ用 #queue-panel は #solo-play-root の外にあるため、対戦 960px 時に右端へ重なり 2P 領域に映り込む → 非表示 */
#game-container.versus-active #queue-panel {
    display: none !important;
}

.versus-split-root {
    display: flex;
    flex-direction: row;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 720px;
    align-items: stretch;
    gap: 0;
    padding: 0;
    box-sizing: border-box;
    min-width: 0;
}

.versus-split-root.hidden {
    display: none !important;
}

.versus-playfield {
    flex: 0 0 480px;
    width: 480px;
    max-width: 480px;
    min-width: 480px;
    /* 子がすべて absolute のため % 高さは潰れる。論理 720px で固定し bottom-lanes を下端へ */
    height: 720px;
    min-height: 720px;
    position: relative;
    overflow: hidden;
    background: #020617;
    border: 1px solid #334155;
    border-radius: 0;
}

.versus-playfield:first-child {
    border-radius: 8px 0 0 8px;
}

.versus-playfield:last-child {
    border-radius: 0 8px 8px 0;
}

.versus-label {
    position: absolute;
    top: 4px;
    left: 6px;
    z-index: 50;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.55);
}

.versus-playfield .grid-perspective-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 480px;
    height: 720px;
    z-index: 1;
    perspective: 1200px;
    perspective-origin: 50% 15%;
    transform-style: preserve-3d;
}

.versus-playfield .grid-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 480px;
    height: 1800px;
    background: #0f172a;
    transform: rotateX(62deg);
    transform-origin: 50% 100%;
    transform-style: preserve-3d;
    /* contain: paint は preserve-3d を破壊するので layout のみに留める */
    contain: layout;
}

/* 手前の発射レーン：画面下端・4 列横並び（グリッドの手前＝プレイヤー側） */
.versus-playfield .bottom-lanes {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 480px;
    height: 160px;
    display: flex;
    flex-direction: row;
    z-index: 200;
    pointer-events: auto;
    background: linear-gradient(to top, var(--current-glow-bg, transparent) 0%, transparent 50%);
    transition: background 0.3s;
}

.queue-panel-versus {
    position: absolute;
    top: 6px;
    right: 6px;
    left: auto;
    z-index: 60;
    min-width: 60px;
    padding: 4px 6px 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.45) 0%, rgba(15, 23, 42, 0.1) 100%);
    border-right: 1px solid rgba(148, 163, 184, 0.22);
    border-bottom-right-radius: 8px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.queue-panel-versus .queue-heading {
    font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 3px;
    color: rgba(226, 232, 240, 0.85);
    text-shadow: 0 0 6px rgba(56, 189, 248, 0.35);
}

.queue-panel-versus [id^="queue-blocks-"] {
    align-items: center !important;
}

/* 対戦：黒パネルも NEXT に表示（内色ヒントは data-panel-hint）。NOW はソロ同様 big-block-panel。 */
.queue-panel-versus .big-block-versus-pending {
    width: 54px;
    height: 36px;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
    border: 1px dashed rgba(148, 163, 184, 0.42);
    background: rgba(15, 23, 42, 0.72);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.45);
}

.queue-panel-versus .big-block-versus-pending::after {
    content: '自動';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: rgba(203, 213, 225, 0.95);
    pointer-events: none;
}

.versus-score {
    position: absolute;
    top: 22px;
    left: 8px;
    right: auto;
    z-index: 70;
    font-size: 22px;
    font-weight: 800;
    color: #f8fafc;
    line-height: 1.15;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.versus-score::before {
    content: 'SCORE';
    display: block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(148, 163, 184, 0.95);
    margin-bottom: 2px;
}

.hidden {
    display: none !important;
}

/* ===== 対戦終了：盤面を残したまま暗転し、勝者の盤上に「WIN!」を表示 ===== */
#game-container.versus-game-over .versus-playfield .bottom-lanes,
#game-container.versus-game-over .versus-playfield .bottom-lanes * {
    pointer-events: none !important;
}

.versus-result-overlay {
    position: absolute;
    inset: 0;
    z-index: 220;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.55);
    animation: versus-result-fade 0.45s ease-out forwards;
}

@keyframes versus-result-fade {
    from { background: rgba(0, 0, 0, 0); }
    to   { background: rgba(0, 0, 0, 0.55); }
}

.versus-result-overlay .versus-result-spotlight {
    position: absolute;
    top: 0;
    width: 480px;
    height: 720px;
    background: radial-gradient(ellipse at 50% 30%, rgba(253, 224, 71, 0.18) 0%, rgba(253, 224, 71, 0.05) 35%, rgba(0, 0, 0, 0) 65%);
    pointer-events: none;
}

.versus-result-overlay .versus-result-spotlight.p0 { left: 0; }
.versus-result-overlay .versus-result-spotlight.p1 { left: 480px; }

.versus-win-banner {
    position: absolute;
    top: 130px;
    width: 480px;
    text-align: center;
    pointer-events: none;
    z-index: 230;
    /* バナー全体は揺らさず、内側の inner に対して脈動を当てる */
}

.versus-win-banner.p0 { left: 0; }
.versus-win-banner.p1 { left: 480px; }

.versus-win-banner-inner {
    display: inline-block;
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 130px;
    font-weight: 900;
    letter-spacing: 14px;
    color: #fde047;
    line-height: 1;
    animation: versus-win-pulse 1.4s ease-in-out 0.9s infinite;
}

.versus-win-letter {
    display: inline-block;
    color: #fde047;
    text-shadow:
        0 0 18px rgba(253, 224, 71, 0.95),
        0 0 40px rgba(253, 224, 71, 0.65),
        0 0 80px rgba(250, 204, 21, 0.5),
        0 6px 0 rgba(120, 53, 15, 0.7);
    opacity: 0;
    transform: translateY(-110px) scale(0.2) rotate(-30deg);
    /* 1 文字ずつ 110ms ずつずらして降ってきて弾ける */
    animation:
        versus-win-letter-drop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) calc(var(--i) * 0.11s) forwards,
        versus-win-letter-float 2.2s ease-in-out calc(1.2s + var(--i) * 0.18s) infinite;
}

@keyframes versus-win-letter-drop {
    0%   { opacity: 0; transform: translateY(-110px) scale(0.2) rotate(-30deg); filter: blur(8px); }
    60%  { opacity: 1; transform: translateY(18px)  scale(1.25) rotate(8deg);  filter: blur(0); }
    78%  { opacity: 1; transform: translateY(-6px)  scale(0.92) rotate(-4deg); }
    100% { opacity: 1; transform: translateY(0)     scale(1)    rotate(0);    }
}

/* ポップ後、文字単位で軽くフワッと上下するアイドルアニメ */
@keyframes versus-win-letter-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-10px) scale(1.06); }
}

/* バナー全体の発光が脈動 */
@keyframes versus-win-pulse {
    0%, 100% {
        filter:
            drop-shadow(0 0 18px rgba(253, 224, 71, 0.65))
            drop-shadow(0 0 36px rgba(250, 204, 21, 0.45));
    }
    50% {
        filter:
            drop-shadow(0 0 30px rgba(253, 224, 71, 0.95))
            drop-shadow(0 0 70px rgba(250, 204, 21, 0.8));
    }
}

/* 紙吹雪：勝者側の上空からひらひら降る色付き矩形 */
.versus-result-confetti {
    position: absolute;
    top: 0;
    width: 480px;
    height: 720px;
    pointer-events: none;
    overflow: hidden;
    z-index: 225;
}

.versus-result-confetti.p0 { left: 0; }
.versus-result-confetti.p1 { left: 480px; }

.versus-result-confetti span {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 16px;
    border-radius: 2px;
    opacity: 0.92;
    animation: versus-confetti-fall 3.2s linear infinite;
}

/* 12 個に色と開始位置と遅延を割り振る */
.versus-result-confetti span:nth-child(1)  { left:  6%; background: #ef4444; animation-delay: 0.0s;  animation-duration: 2.8s; }
.versus-result-confetti span:nth-child(2)  { left: 14%; background: #f59e0b; animation-delay: 0.3s;  animation-duration: 3.2s; }
.versus-result-confetti span:nth-child(3)  { left: 22%; background: #facc15; animation-delay: 0.6s;  animation-duration: 2.6s; }
.versus-result-confetti span:nth-child(4)  { left: 30%; background: #10b981; animation-delay: 0.9s;  animation-duration: 3.0s; }
.versus-result-confetti span:nth-child(5)  { left: 38%; background: #06b6d4; animation-delay: 1.2s;  animation-duration: 3.4s; }
.versus-result-confetti span:nth-child(6)  { left: 46%; background: #3b82f6; animation-delay: 0.2s;  animation-duration: 2.9s; }
.versus-result-confetti span:nth-child(7)  { left: 54%; background: #a855f7; animation-delay: 0.5s;  animation-duration: 3.1s; }
.versus-result-confetti span:nth-child(8)  { left: 62%; background: #ec4899; animation-delay: 0.8s;  animation-duration: 2.7s; }
.versus-result-confetti span:nth-child(9)  { left: 70%; background: #fde047; animation-delay: 1.1s;  animation-duration: 3.3s; }
.versus-result-confetti span:nth-child(10) { left: 78%; background: #f97316; animation-delay: 0.4s;  animation-duration: 2.8s; }
.versus-result-confetti span:nth-child(11) { left: 86%; background: #22d3ee; animation-delay: 0.7s;  animation-duration: 3.0s; }
.versus-result-confetti span:nth-child(12) { left: 92%; background: #f43f5e; animation-delay: 1.0s;  animation-duration: 3.2s; }

@keyframes versus-confetti-fall {
    0%   { transform: translateY(-30px) rotate(0deg);   opacity: 0; }
    10%  { opacity: 0.92; }
    100% { transform: translateY(760px) rotate(720deg); opacity: 0.92; }
}

.versus-lose-banner {
    position: absolute;
    top: 200px;
    width: 480px;
    text-align: center;
    font-family: 'Impact', 'Arial Black', sans-serif;
    font-size: 64px;
    font-weight: 900;
    color: rgba(148, 163, 184, 0.55);
    letter-spacing: 10px;
    text-shadow: 0 0 12px rgba(15, 23, 42, 0.9);
    pointer-events: none;
    z-index: 230;
    opacity: 0;
    animation: versus-lose-fade 0.8s ease-out 0.3s forwards;
}

.versus-lose-banner.p0 { left: 0; }
.versus-lose-banner.p1 { left: 480px; }

@keyframes versus-lose-fade {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

.versus-result-stats {
    position: absolute;
    left: 50%;
    bottom: 104px;
    width: 760px;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: 1.18fr 0.82fr 0.82fr 1.18fr 0.82fr 0.82fr;
    gap: 1px;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 10px;
    background: rgba(2, 6, 23, 0.78);
    box-shadow:
        0 16px 50px rgba(0, 0, 0, 0.45),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 238;
}

.versus-stat-head,
.versus-stat-player,
.versus-stat-label,
.versus-stat-value {
    min-height: 20px;
    display: flex;
    align-items: center;
    padding: 2px 7px;
    background: rgba(15, 23, 42, 0.76);
}

.versus-stat-player {
    justify-content: center;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;
}

.versus-stat-player.winner {
    color: #fef08a;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.9);
}

.versus-stat-label {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 800;
}

.versus-stat-value {
    justify-content: center;
    color: #f8fafc;
    font-size: 15px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.versus-stat-label.empty,
.versus-stat-value.empty {
    visibility: hidden;
}

.versus-result-retry {
    position: absolute;
    bottom: 36px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 16px;
    z-index: 240;
}

.versus-result-retry button {
    padding: 14px 36px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #0f172a;
    background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
    border: 2px solid #fbbf24;
    border-radius: 12px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.versus-result-retry button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(251, 191, 36, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.versus-result-retry button:active {
    transform: translateY(0);
    box-shadow: 0 4px 14px rgba(251, 191, 36, 0.45);
}

/* ============================================================
 * 描画負荷軽減：OS の「動きを減らす」ではゴースト等のアニメを止める
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .ghost-block {
        animation: none;
        border-color: rgba(255, 255, 255, 0.5);
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, 0.12),
            0 0 10px rgba(0, 0, 0, 0.3);
    }

    .ghost-match {
        animation: none;
        box-shadow:
            0 0 0 2px rgba(253, 224, 71, 0.55),
            0 0 16px rgba(34, 211, 238, 0.35),
            inset 0 0 14px rgba(56, 189, 248, 0.14);
    }

    .lane-guide.lane-match-hint {
        animation: none !important;
        box-shadow:
            inset 0 0 18px rgba(56, 189, 248, 0.3),
            inset 0 0 0 1px rgba(253, 224, 71, 0.45) !important;
    }

    .lane-critical {
        animation: none;
    }
}

/* ============================================================
 * タッチ主操作端末・動き抑制時：虹は線形グラデ、backdrop-filter を外す
 * （GPU の合成負荷を抑える）
 * ============================================================ */
@media (hover: none) and (pointer: coarse), (prefers-reduced-motion: reduce) {
    .block-7,
    .mini-block-7,
    .big-block-7 {
        background: var(--multi-rainbow-simple);
    }

    .ghost-block-7 {
        background: linear-gradient(
            125deg,
            rgba(220, 38, 38, 0.48) 0%,
            rgba(234, 179, 8, 0.48) 33%,
            rgba(37, 99, 235, 0.48) 66%,
            rgba(124, 58, 237, 0.48) 100%
        );
    }

    #queue-panel {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.82) 100%);
    }

    .queue-panel-versus {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.78) 100%);
    }

    .title-overlay {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(2, 6, 23, 0.88);
    }

    .title-card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* ============================================================
 * 軽量描画モード：対戦時は常時、スマホ・低スペック端末はソロでも有効。
 * 広い発光影、ぼかし、常時点滅を抑えて描画コストを下げる。
 * ============================================================ */
#game-container.perf-lite {
    box-shadow: none;
}

#game-container.perf-lite .grid-line {
    box-shadow: none;
}

#game-container.perf-lite .block {
    transition: none !important;
}

#game-container.perf-lite .block::before {
    display: none !important;
}

#game-container.perf-lite .block-1,
#game-container.perf-lite .block-2,
#game-container.perf-lite .block-3,
#game-container.perf-lite .block-4,
#game-container.perf-lite .block-5,
#game-container.perf-lite .block-6,
#game-container.perf-lite .block-7 {
    box-shadow: none !important;
}

#game-container.perf-lite .mini-block-1,
#game-container.perf-lite .mini-block-2,
#game-container.perf-lite .mini-block-3,
#game-container.perf-lite .mini-block-4,
#game-container.perf-lite .mini-block-5,
#game-container.perf-lite .mini-block-6,
#game-container.perf-lite .mini-block-7,
#game-container.perf-lite .big-block-1,
#game-container.perf-lite .big-block-2,
#game-container.perf-lite .big-block-3,
#game-container.perf-lite .big-block-4,
#game-container.perf-lite .big-block-5,
#game-container.perf-lite .big-block-6,
#game-container.perf-lite .big-block-7 {
    box-shadow: none !important;
}

#game-container.perf-lite .block-7,
#game-container.perf-lite .mini-block-7,
#game-container.perf-lite .big-block-7 {
    background: var(--multi-rainbow-simple);
}

#game-container.perf-lite .block-flash-soft,
#game-container.perf-lite .block-flash-strong {
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85) !important;
}

#game-container.perf-lite .block-flash-soft::before,
#game-container.perf-lite .block-flash-strong::before {
    background: rgba(255, 255, 255, 0.32) !important;
}

#game-container.perf-lite .floating-score,
#game-container.perf-lite #chain-alert,
#game-container.perf-lite .techno-alert,
#game-container.perf-lite .chase-success-ring,
#game-container.perf-lite .chase-success-text,
#game-container.perf-lite .versus-garbage-alert,
#game-container.perf-lite .queue-panel-versus.queue-garbage-hit {
    filter: none !important;
}

#game-container.perf-lite .ghost-block,
#game-container.perf-lite .ghost-match,
#game-container.perf-lite .lane-critical,
#game-container.perf-lite .lane-guide.lane-match-hint {
    animation: none !important;
}

#game-container.perf-lite .lane-risk-1,
#game-container.perf-lite .lane-risk-2,
#game-container.perf-lite .lane-risk-3,
#game-container.perf-lite .lane-critical,
#game-container.perf-lite .lane-guide.lane-match-hint {
    box-shadow: none !important;
}

#game-container.perf-lite .queue-panel-versus,
#game-container.perf-lite #queue-panel,
#game-container.perf-lite .versus-result-stats {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#game-container.perf-lite .versus-result-confetti {
    display: none;
}

#game-container.perf-lite .versus-win-banner-inner {
    animation: none;
}

/* ==========================================
   連鎖フィニッシュ演出（テクノ調・スライド）
   ========================================== */
.chain-finish-alert {
    position: absolute;
    top: 45%;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: center;
    pointer-events: none;
    z-index: 250;
    opacity: 0;
}

.chain-finish-alert.slide-from-left {
    animation: techno-slide-left-to-right 1.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.chain-finish-alert.slide-from-right {
    animation: techno-slide-right-to-left 1.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.chain-finish-alert .finish-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 5px;
    color: #38bdf8;
    text-shadow: 0 0 8px rgba(56,189,248,0.8);
    margin-bottom: 2px;
}

.chain-finish-alert .finish-chain {
    font-size: 42px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 
        0 0 10px rgba(251,191,36,0.95), 
        0 0 25px rgba(245,158,11,0.85);
}

/* 左から入って、中央で止まり、右へ抜ける */
@keyframes techno-slide-left-to-right {
    0% { left: -50%; transform: translate(-50%, -50%); opacity: 0; }
    15% { left: 50%; transform: translate(-50%, -50%); opacity: 1; }
    80% { left: 50%; transform: translate(-50%, -50%); opacity: 1; }
    100% { left: 150%; transform: translate(-50%, -50%); opacity: 0; }
}

/* 右から入って、中央で止まり、左へ抜ける */
@keyframes techno-slide-right-to-left {
    0% { left: 150%; transform: translate(-50%, -50%); opacity: 0; }
    15% { left: 50%; transform: translate(-50%, -50%); opacity: 1; }
    80% { left: 50%; transform: translate(-50%, -50%); opacity: 1; }
    100% { left: -50%; transform: translate(-50%, -50%); opacity: 0; }
}

/* perf-lite モード時の簡素化 */
#game-container.perf-lite .chain-finish-alert .finish-title,
#game-container.perf-lite .chain-finish-alert .finish-chain {
    text-shadow: none !important;
}

/* ==========================================
   テクノ調・追加演出（1P・2P共通）
   ========================================== */

/* 1. グリッドラインの「ビート・ネオンパルス」 */
.grid-line {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 通常パルス（コンボなしのときはアニメーションなし、またはごく穏やか） */
/* コンボレベル2 (水色) */
.combo-level-2 .grid-line {
    border-color: rgba(34, 211, 238, 0.75) !important;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.5) !important;
    animation: grid-neon-pulse-cyan 0.8s ease-in-out infinite alternate;
}
/* コンボレベル3 (マゼンタ) */
.combo-level-3 .grid-line {
    border-color: rgba(236, 72, 153, 0.85) !important;
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.6) !important;
    animation: grid-neon-pulse-magenta 0.6s ease-in-out infinite alternate;
}
/* コンボレベル4以上 (ネオンイエロー) */
.combo-level-4 .grid-line {
    border-color: rgba(253, 224, 71, 0.95) !important;
    box-shadow: 0 0 15px rgba(253, 224, 71, 0.7) !important;
    animation: grid-neon-pulse-yellow 0.4s ease-in-out infinite alternate;
}

@keyframes grid-neon-pulse-cyan {
    0% { opacity: 0.4; }
    100% { opacity: 1; filter: brightness(1.2); }
}
@keyframes grid-neon-pulse-magenta {
    0% { opacity: 0.5; }
    100% { opacity: 1; filter: brightness(1.3); }
}
@keyframes grid-neon-pulse-yellow {
    0% { opacity: 0.6; }
    100% { opacity: 1; filter: brightness(1.5); }
}

/* perf-lite モード時の簡素化 (box-shadowを排除、アニメーション速度を抑えるか無効化) */
#game-container.perf-lite .combo-level-2 .grid-line,
.perf-lite .combo-level-2 .grid-line {
    border-color: rgba(34, 211, 238, 0.6) !important;
    box-shadow: none !important;
    animation: none !important;
}
#game-container.perf-lite .combo-level-3 .grid-line,
.perf-lite .combo-level-3 .grid-line {
    border-color: rgba(236, 72, 153, 0.7) !important;
    box-shadow: none !important;
    animation: none !important;
}
#game-container.perf-lite .combo-level-4 .grid-line,
.perf-lite .combo-level-4 .grid-line {
    border-color: rgba(253, 224, 71, 0.8) !important;
    box-shadow: none !important;
    animation: none !important;
}

/* 2. 設置時の「放射状・共鳴波紋フラッシュ」 */
.block-radial-flash {
    /* JS側で動的に上書きされるデフォルト値 */
    --flash-bright: 1.25;
    --flash-contrast: 1.05;
    --flash-shadow-size: 6px;
    animation: radial-flash 0.35s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes radial-flash {
    0% {
        filter: brightness(1);
    }
    30% {
        /* 白飛びを防ぐため明るさを抑え、box-shadowは上品に細く。CSS変数で動的減衰 */
        filter: brightness(var(--flash-bright)) contrast(var(--flash-contrast));
        box-shadow: 0 0 var(--flash-shadow-size) currentColor;
    }
    100% {
        filter: brightness(1);
    }
}
#game-container.perf-lite .block-radial-flash,
.perf-lite .block-radial-flash {
    --flash-bright-lite: 1.15;
    animation: radial-flash-lite 0.3s ease-out forwards;
}
@keyframes radial-flash-lite {
    0% { filter: brightness(1); }
    30% { filter: brightness(var(--flash-bright-lite)); }
    100% { filter: brightness(1); }
}

/* 3. 落下詰まり時の「カチッ（クッション＆光）ロック演出」 */
.block-land-lock {
    animation: land-lock-bounce 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes land-lock-bounce {
    0% {
        transform: scaleY(1);
        filter: brightness(1.15); /* 白飛び防止のため明るさを抑える */
    }
    40% {
        transform: scaleY(0.82) translateY(2px);
        filter: brightness(1.08);
    }
    70% {
        transform: scaleY(1.08) translateY(-1px);
        filter: brightness(1.03);
    }
    100% {
        transform: scaleY(1);
        filter: brightness(1);
    }
}
/* perf-lite モード時は transform 変形のみ、明るさ変化は抑える */
#game-container.perf-lite .block-land-lock,
.perf-lite .block-land-lock {
    animation: land-lock-bounce-lite 0.25s ease-out forwards;
}
@keyframes land-lock-bounce-lite {
    0% { transform: scaleY(1); }
    40% { transform: scaleY(0.85); }
    100% { transform: scaleY(1); }
}

/* 4. 4連鎖以上のフィニッシュ時「盤面・斜め電流ウェーブ」 */
.block-wave-flash {
    animation: wave-flash 0.45s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes wave-flash {
    0% {
        filter: brightness(1);
    }
    25% {
        /* 白飛び防止のため明るさを最大1.3倍に抑え、強すぎる白影は排除して上品なカラーシャドウにする */
        filter: brightness(1.3) contrast(1.1);
        box-shadow: 0 0 10px currentColor;
    }
    100% {
        filter: brightness(1);
    }
}
#game-container.perf-lite .block-wave-flash,
.perf-lite .block-wave-flash {
    animation: wave-flash-lite 0.35s ease-out forwards;
}
@keyframes wave-flash-lite {
    0% { filter: brightness(1); }
    25% { filter: brightness(1.2); }
    100% { filter: brightness(1); }
}

