:root {
    --space-bg: linear-gradient(135deg, #09071b 0%, #1a1645 50%, #12122b 100%);
    --moon-glow: rgba(255, 255, 255, 0.15);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-hover: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent-blue: #00d2ff;
    --accent-purple: #9d50bb;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

body {
    background: var(--space-bg);
    /* background-attachment: fixed は iOS Safari/PWA でスクロール不可バグを引き起こすため削除 */
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    /* position: relative は iOS PWA でスクロール不可バグを引き起こすため削除 */
}

#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* PWA / iOS Safari スクロール対策 (※PWA時のposition:fixed不具合を避けるためheight固定を削除) */
@media (display-mode: standalone) {
    html, body {
        -webkit-overflow-scrolling: touch;
    }
}

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

/* Moon Simulator Styles */
.moon-simulator-card {
    background: linear-gradient(145deg, rgba(15, 12, 41, 0.9), rgba(48, 43, 99, 0.4)) !important;
    border: 1px solid rgba(0, 210, 255, 0.2) !important;
    border-radius: 24px;
}

.moon-display-container {
    position: relative;
    display: inline-block;
}

.simulator-moon-img {
    width: 200px;
    height: 200px;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
    transition: transform 0.1s ease-out;
}

.moon-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(0, 210, 255, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 1;
}

/* Custom Range Slider */
.custom-moon-range {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.custom-moon-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent-blue);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-blue);
    border: 2px solid white;
}

.custom-moon-range::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--accent-blue);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-blue);
    border: 2px solid white;
}

/* SNS Brand Colors */
.btn-x-share {
    background-color: #000000;
    color: #ffffff;
    border: none;
    transition: transform 0.2s, opacity 0.2s;
}

.btn-x-share:hover {
    color: #ffffff;
    opacity: 0.8;
    transform: translateY(-2px);
}

.btn-line-share {
    background-color: #06c755;
    color: #ffffff;
    border: none;
    transition: transform 0.2s, opacity 0.2s;
}

.btn-line-share:hover {
    color: #ffffff;
    opacity: 0.8;
    transform: translateY(-2px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered Entrance */
.calendar-day {
    animation: fadeIn 0.6s ease-out both;
}

.calendar-day:nth-child(7n+1) {
    animation-delay: 0.1s;
}

.calendar-day:nth-child(7n+2) {
    animation-delay: 0.15s;
}

.calendar-day:nth-child(7n+3) {
    animation-delay: 0.2s;
}

.calendar-day:nth-child(7n+4) {
    animation-delay: 0.25s;
}

.calendar-day:nth-child(7n+5) {
    animation-delay: 0.3s;
}

.calendar-day:nth-child(7n+6) {
    animation-delay: 0.35s;
}

.calendar-day:nth-child(7n+7) {
    animation-delay: 0.4s;
}

/* Calendar Grid Upgrade */
.calendar-container {
    padding: 2rem 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

.calendar-header {
    text-align: center;
    font-weight: 600;
    padding: 1rem 0;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.calendar-day {
    min-height: 120px;
    padding: 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (hover: hover) {
    .calendar-day:hover {
        transform: translateY(-8px);
        border-color: rgba(0, 210, 255, 0.4);
        background: var(--glass-bg-hover);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
        z-index: 10;
    }
}

.day-number {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.day-today {
    border: 2px solid var(--accent-blue) !important;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.3);
}

.day-today::after {
    content: 'TODAY';
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 0.6rem;
    color: var(--accent-blue);
    font-weight: 800;
}

.moon-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 5px;
}

/* Moon image styles (returning to stable individual images) */
.moon-display-container {
    padding: 0.5rem;
}

.moon-img-sm {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
    object-fit: contain;
}

/* Event Marker */
.event-marker {
    position: absolute;
    bottom: 8px;
    right: 8px;
    color: #ffcc00;
    font-size: 0.9rem;
    animation: eventPulse 2s infinite;
}

@keyframes eventPulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px rgba(255, 204, 0, 0.5));
    }

    50% {
        transform: scale(1.3);
        filter: drop-shadow(0 0 8px rgba(255, 204, 0, 0.8));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 2px rgba(255, 204, 0, 0.5));
    }
}

/* Responsive Layout Switch: Grid to List (Canceled for Compact View) */
@media (max-width: 768px) {
    .calendar-grid {
        gap: 4px; /* 極限まで詰める */
    }

    .calendar-header {
        display: block; /* 曜日を表示 */
        padding: 0.5rem 0;
        font-size: 0.6rem;
    }

    .calendar-day {
        min-height: 90px; /* 高さを少し広げて月の出入りが入るスペースを確保 */
        padding: 4px;
        border-radius: 8px;
    }

    .day-number {
        font-size: 0.8rem;
        margin-bottom: 2px;
        width: auto;
        border: none;
        margin-right: 0;
        text-align: left;
    }

    .moon-info {
        flex-direction: column;
        align-items: center;
        margin-top: 0;
    }

    .moon-img-sm {
        width: 24px;
        height: 24px;
        margin-right: 0;
    }

    .moon-age-text {
        font-size: 0.6rem;
        margin-top: 2px;
    }

    /* モバイルでも月の出入りを極小サイズで綺麗に表示 */
    .moon-details .text-secondary {
        display: flex !important;
        flex-direction: column !important;
        align-items: center;
        justify-content: center;
        gap: 2px !important;
        font-size: 0.55rem !important;
        margin-top: 2px;
    }

    .day-today::after {
        font-size: 0.5rem;
        top: 2px;
        right: 4px;
    }

    .event-marker {
        font-size: 0.7rem;
        bottom: 4px;
        right: 4px;
    }

    .photo-marker {
        top: 4px !important;
        right: 4px !important;
    }
}

/* Base Card & UI Refinement */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.card.text-dark {
    color: #212529;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-blue) !important;
}

.card-title {
    color: white !important;
    /* デフォルトは白 */
}

/* 明るい背景（text-dark/bg-light）がある場合は黒くする。
   ただし、明示的に .glass-panel などが指定されている場合は白を優先する */
.text-dark:not(.glass-panel):not(.auth-card) .card-title,
.bg-light:not(.glass-panel):not(.auth-card) .card-title,
.text-dark:not(.glass-panel):not(.auth-card) h3,
.text-dark:not(.glass-panel):not(.auth-card) h5 {
    color: #212529;
}

/* 認証カードおよびダークパネル内のテキスト強制確保 */
.auth-card, .glass-panel-dark, .auth-container {
    color: #ffffff !important;
}

.auth-card p, .auth-card span, .auth-card label,
.glass-panel-dark p, .glass-panel-dark span, .glass-panel-dark li {
    color: rgba(255, 255, 255, 0.9) !important;
}

.auth-card .text-secondary, .glass-panel-dark .text-secondary,
.auth-card .text-muted, .glass-panel-dark .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

.auth-card h1, .auth-card h2, .auth-card h3, .auth-card h4, .auth-card h5,
.glass-panel-dark h1, .glass-panel-dark h2, .glass-panel-dark h3 {
    color: #ffffff !important;
}

.card-text {
    color: var(--text-secondary);
}


.btn-outline-primary {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.btn-outline-primary:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #000;
}

.badge {
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Custom Badge Colors for Astro Events */
.badge-lunar-eclipse {
    background-color: #d63031 !important;
    color: #fff !important;
}

/* Blood Moon Red */
.badge-meteor-shower {
    background-color: #fdcb6e !important;
    color: #2d3436 !important;
}

/* Meteor Gold */
.badge-planetary {
    background-color: #0984e3 !important;
    color: #fff !important;
}

/* Planet Blue */
.badge-full-moon {
    background-color: #dfe6e9 !important;
    color: #2d3436 !important;
}

/* Moon Silver */
.badge-rare {
    background-color: #6c5ce7 !important;
    color: #fff !important;
}

/* Rare Purple */

footer {
    background: rgba(15, 12, 41, 0.9) !important;
    border-top: 1px solid var(--glass-border);
    margin-top: 4rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0f0c29;
}

::-webkit-scrollbar-thumb {
    background: #302b63;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #24243e;
}

/* Breadcrumbs */
.breadcrumb-item a {
    color: var(--accent-blue);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--text-secondary);
}

/* Tables */
.table {
    color: var(--text-primary);
}

.table-hover tbody tr:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

/* ハートポップアニメーション */
.heart-pop {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    font-size: 1.2rem;
    color: #ff4757;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
    animation: heartPopAnim 0.8s ease-out forwards;
    transform: translate(-50%, -50%);
}

@keyframes heartPopAnim {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -150px) scale(var(--random-scale, 1.2)) rotate(var(--random-rotate, 30deg));
        opacity: 0;
    }
}

/* ==========================================
   base.html から抽出した共通スタイル
   ========================================== */

html {
    overflow-x: visible;
}

body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* グローバル：グラスモーフィズム共通クラス */
.glass-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-panel-dark {
    background: linear-gradient(135deg, rgba(20, 20, 25, 0.6) 0%, rgba(10, 10, 15, 0.5) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

/* レスポンシブ拡張用ユーティリティ */
.responsive-text-sm {
    font-size: clamp(0.75rem, 1vw + 0.5rem, 0.85rem);
}

.responsive-text-md {
    font-size: clamp(0.9rem, 1.2vw + 0.6rem, 1.1rem);
}

.responsive-text-lg {
    font-size: clamp(1.2rem, 2vw + 1rem, 1.75rem);
}

/* モバイル時のゆとり確保 */
@media (max-width: 768px) {
    .mobile-safe-padding {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    .mobile-stack-gap {
        margin-bottom: 1.5rem !important;
    }
}

/* PWA: ステータスバー（電池残量等）との重なり防止 */
header.sticky-top {
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(9, 7, 27, 0.8) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

:root {
    --border-fine: rgba(255, 255, 255, 0.1);
    --bg-solid: rgba(10, 12, 20, 0.95);
    --text-gold: #ffca28;
    --text-silver: rgba(255, 255, 255, 0.7);
}

/* 共通：都道府県セレクタ */
.pref-selector {
    display: inline-block;
    position: relative;
}

.pref-selector-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.pref-selector-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.pref-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 280px;
    max-height: 400px;
    background: rgba(15, 15, 25, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    overflow: hidden;
    margin-top: 8px;
}

.pref-selector.open .pref-dropdown {
    display: block;
    animation: prefFadeIn 0.2s ease;
}

@keyframes prefFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.95);
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pref-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pref-search {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 0.85rem;
    width: 100%;
}

.pref-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.pref-option {
    padding: 8px 16px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    transition: background 0.15s;
}

.pref-option:hover {
    background: rgba(13, 110, 253, 0.15);
    color: #fff;
}

.pref-option.active {
    background: rgba(13, 110, 253, 0.25);
    color: #ffca28;
    font-weight: 600;
}

.pref-option.hidden {
    display: none;
}

.nav-link.active {
    color: #ffca28 !important;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(255, 202, 40, 0.4);
}

/* === ドロップダウンメニューのグラスモーフィズム化とアニメーション === */
.navbar-nav .dropdown-menu {
    background: rgba(15, 17, 28, 0.96) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    padding: 8px;
    margin-top: 5px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: block;
    visibility: hidden;
    pointer-events: none;
}

/* PC表示時：タブからメニューへマウスを動かした際にホバーが切れないようにする透明ブリッジ */
@media (min-width: 992px) {
    .navbar-nav .dropdown-menu::before {
        content: '';
        position: absolute;
        top: -25px; /* メニューの上部に25px分、透明なホバー判定領域を伸ばす */
        left: 0;
        right: 0;
        height: 25px;
        background: transparent;
        z-index: -1; /* メニュー内のクリックを妨げないように背面に配置 */
    }
}

/* PC表示時はホバーでスムーズにフェードイン展開（UX向上） */
@media (min-width: 992px) {
    .navbar-nav .nav-item.dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }
}

/* モバイル折りたたみ時はクリックによるアコーディオン展開に切り替え */
@media (max-width: 991.98px) {
    .navbar-nav .dropdown-menu {
        display: none;
        position: static !important;
        background: rgba(255, 255, 255, 0.03) !important;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none !important;
        box-shadow: none;
        padding-left: 15px;
        margin-top: 0;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        transition: none;
    }
    .navbar-nav .dropdown-menu.show {
        display: block;
    }
}

.navbar-nav .dropdown-item {
    color: rgba(255, 255, 255, 0.75) !important;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.navbar-nav .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffca28 !important;
    transform: translateX(4px);
}

.navbar-nav .dropdown-item.active {
    background: rgba(13, 110, 253, 0.25) !important;
    color: #ffca28 !important;
    font-weight: 600;
}

.navbar-nav .dropdown-toggle::after {
    transition: transform 0.2s ease;
}

@media (min-width: 992px) {
    .navbar-nav .nav-item.dropdown:hover .dropdown-toggle::after {
        transform: rotate(180deg);
    }
}

/* === ボトムナビゲーションの微小アニメーション（iOSネイティブ風） === */
.mobile-bottom-nav .nav-item {
    transform: scale(1);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.mobile-bottom-nav .nav-item:active {
    transform: scale(0.92) !important;
}

/* === 全画面地図ページ用の下部余白解除処理 === */
@media (max-width: 991.98px) {
    body.map-page {
        padding-bottom: 0 !important;
    }
}

/* === モバイルボトムナビゲーションの詳細スタイル === */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 20, 28, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 1040;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
}
.mobile-bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 64px;
    position: relative;
}
.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    flex: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding-top: 4px;
}
.mobile-bottom-nav .nav-item i {
    font-size: 1.3rem;
    margin-bottom: 5px;
    transition: transform 0.3s ease;
}
.mobile-bottom-nav .nav-item.active {
    color: #00d2ff;
    text-shadow: 0 0 15px rgba(0, 210, 255, 0.5);
}
/* アクティブインジケーター（アイコンの上のバー） */
.mobile-bottom-nav .nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    width: 20px;
    height: 3px;
    background: #00d2ff;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 10px rgba(0, 210, 255, 0.8);
}
.mobile-bottom-nav .nav-item:active i {
    transform: scale(0.9);
}
.mobile-bottom-nav .nav-item.active i {
    transform: translateY(-2px);
}

/* モバイル時のみ、最下部のコンテンツがナビに隠れないように余白を追加 */
@media (max-width: 991.98px) {
    body {
        padding-bottom: calc(74px + env(safe-area-inset-bottom)) !important;
    }
}

/* === PWA Install Banner のスタイル === */
.pwa-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(26, 31, 38, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    z-index: 9999;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.pwa-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}
.pwa-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: contain;
    background: #05070a;
    padding: 4px;
}
@keyframes slideUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@media (min-width: 768px) {
    .pwa-banner {
        left: initial;
        right: 30px;
        width: 400px;
        bottom: 30px;
    }
}

/* ==========================================
   Pull-to-refresh & Page Transition Loader Styles
   ========================================== */

/* 1. Pull-to-refresh UI */
.ptr-loader {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 12px); /* ステータスバー下部に微調整 */
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    pointer-events: none;
    transform: translateY(-80px);
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease-out;
    opacity: 0;
}

.ptr-loader.ptr-dragging {
    transition: none; /* ドラッグ中はリアルタイムに追従させる */
}

.ptr-spinner-wrap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45) !important;
}

.ptr-spinner {
    width: 28px;
    height: 28px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ptr-path {
    stroke: var(--text-gold, #ffca28);
    stroke-linecap: round;
}

/* スワイプ中の下向き矢印 */
.ptr-arrow {
    position: absolute;
    color: var(--text-gold, #ffca28);
    font-size: 1rem;
    transition: transform 0.2s ease, opacity 0.15s ease;
    opacity: 1;
}

/* しきい値到達時：矢印が半回転 */
.ptr-loader.ptr-release .ptr-arrow {
    transform: rotate(180deg);
}

/* 更新ローディング中：矢印を隠し、スピナーを回転 */
.ptr-loader.ptr-loading .ptr-arrow {
    opacity: 0;
    transform: scale(0.5);
}

.ptr-loader.ptr-loading .ptr-spinner {
    opacity: 1;
    animation: ptr-rotate 1.4s linear infinite;
}

.ptr-loader.ptr-loading .ptr-path {
    animation: ptr-dash 1.4s ease-in-out infinite;
}

/* 2. Global Transition Loader Overlay */
.global-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 9, 20, 0.6) !important; /* 美しいダークSF宇宙空間の影 */
    backdrop-filter: blur(10px) saturate(140%) !important; /* 画面全体を磨りガラス風にぼかす */
    -webkit-backdrop-filter: blur(10px) saturate(140%) !important;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000; /* 全要素の最前面に */
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.global-loader-overlay.show {
    opacity: 1;
}

.global-loader-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* アニメーション共通定義 */
@keyframes ptr-rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes ptr-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}


/* Scroll-to-top Button */
.scroll-top-btn {
    position: fixed;
    right: 20px;
    bottom: calc(85px + env(safe-area-inset-bottom));
    width: 44px;
    height: 44px;
    background: rgba(13, 110, 253, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:active {
    transform: scale(0.9);
}

@media (min-width: 992px) {
    .scroll-top-btn {
        bottom: 30px;
        right: 30px;
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    .scroll-top-btn:hover {
        background: #0d6efd;
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
    }
}

/* === PWA Update Banner のスタイル === */
.pwa-update-banner {
    position: fixed;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    width: 92%;
    max-width: 420px;
    z-index: 1055;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 210, 255, 0.2);
    padding: 0;
}

.pwa-update-banner.show {
    transform: translateX(-50%) translateY(0);
}

.pwa-update-icon-wrapper {
    background: rgba(0, 210, 255, 0.15);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
