:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.2);
    --primary-color: #fbbf24;
    --secondary-color: #38bdf8;
    --accent-color: #f43f5e;
}

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

body {
    font-family: 'M PLUS Rounded 1c', 'Inter', sans-serif;
    /* プレミアムで深みのあるリッチグラデーションと微かなテクスチャ */
    background: radial-gradient(circle at 50% 30%, #1e293b 0%, #0f172a 70%, #020617 100%);
    background-attachment: fixed;
    color: var(--text-color);
    overflow: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

@keyframes moveStars {
    from { background-position: 0 0, 20px 20px; }
    to { background-position: 100px 100px, 120px 120px; }
}

/* プレミアムな背景装飾レイヤー（星空のようなかすかなオーブ粒子） */
body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        radial-gradient(rgba(56, 189, 248, 0.05) 1px, transparent 1px),
        radial-gradient(rgba(244, 63, 94, 0.05) 1px, transparent 1px);
    background-size: 50px 50px, 40px 40px;
    background-position: 0 0, 20px 20px;
    pointer-events: none;
    z-index: 1;
    animation: moveStars 40s linear infinite;
}

header {
    position: relative; /* absoluteから変更し、上のコンテンツとして押し出す */
    width: 100%;
    padding: 30px 40px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    flex-wrap: wrap;
    gap: 20px;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.9), transparent);
    pointer-events: none; /* 全体がクリックを奪わないように */
}

.header-content {
    flex: 1;
    min-width: 300px;
    pointer-events: auto; /* ここはクリック可能 */
}

header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #f43f5e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
    letter-spacing: 3px;
    position: relative;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 2px;
}

header p {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-top: 8px;
    letter-spacing: 0.5px;
}

/* 検索ボックス */
.search-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 5px 5px 5px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 400px;
    pointer-events: auto; /* 検索窓はクリック可能 */
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#search-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

#search-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

#toggle-gravity-btn {
    background: linear-gradient(135deg, var(--secondary-color), #0284c7);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#toggle-gravity-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6);
}

main {
    flex: 1;
    display: flex;
    flex-direction: row;
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    align-items: flex-start;
}

#canvas-container {
    flex: 1;
    position: relative;
    padding-top: 40px;
    padding-bottom: 50px;
    display: flex;
    justify-content: center;
    overflow: visible;
}

/* アバウトパネル (左側の空きスペースに配置) */
.about-panel {
    position: relative;
    top: 15px;
    flex-shrink: 0;
    width: 320px;
    margin-right: 20px;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 25px;
    color: #e2e8f0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 5;
}

.about-panel h2 {
    font-size: 1.3rem;
    color: #fbbf24;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.about-panel p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 15px;
    color: #cbd5e1;
}

/* プレミアムなスタッツ表示 */
.quick-stats {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    margin-bottom: 25px;
}

.stat-item {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.2));
    padding: 12px 8px;
    border-radius: 12px;
    text-align: center;
    flex: 1;
    font-size: 0.75rem;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-3px);
    border-color: rgba(251, 191, 36, 0.3);
}

.stat-item span {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 2px;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

/* 注目キーワードセクション */
.trending-keywords {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.trending-title {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.keyword-tag {
    font-size: 0.75rem;
    background: rgba(56, 189, 248, 0.1);
    color: var(--secondary-color);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(56, 189, 248, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.keyword-tag:hover {
    background: var(--secondary-color);
    color: #0f172a;
    transform: scale(1.05);
}

/* Modal / Glassmorphism Card */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 20;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
}

.modal-content {
    background: rgba(15, 23, 42, 0.85); /* 深いネイビーのグラスモーフィズム */
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 20px 0 0 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 500px;
    height: 100vh;
    padding: 0; /* ヘッダー用にパディングを調整 */
    text-align: left;
    position: absolute;
    right: 0;
    top: 0;
    transform: translateX(100%);
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes slideInRight {
    to { transform: translateX(0); }
}

.modal-header {
    padding: 30px 40px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
}

.modal-header h2 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 40px 40px;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 44px; /* タップしやすいように大きく（Apple推奨サイズ） */
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #cbd5e1;
    font-size: 1.6rem; /* バツ印を大きく */
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50; /* 他のテキストなどに邪魔されないように最前面へ */
}

.close-btn:hover {
    color: #fff;
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.5);
}

.modal-header h2::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.4) 0%, transparent 100%);
}

.modal-body h3.category-header {
    font-size: 1rem;
    color: #94a3b8;
    margin-top: 25px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.modal-body h3.category-header:first-of-type {
    margin-top: 10px;
}

/* グルメグリッドとアフィリエイトUI */
.gourmet-list-section {
    margin-bottom: 30px;
}

.gourmet-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.gourmet-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.gourmet-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.gourmet-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.gourmet-rank {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #111;
    font-weight: 900;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.gourmet-titles {
    display: flex;
    flex-direction: column;
}

.shop-name {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0 0 2px 0;
    font-weight: 600;
}

.gourmet-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.gourmet-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.meta-tag {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.special-badge {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(244, 63, 94, 0.1));
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.4);
    font-weight: 700;
}

.category-tag {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.alcohol-tag {
    background: rgba(168, 85, 247, 0.15);
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.gourmet-desc {
    font-size: 0.9rem;
    color: #cbd5e1;
    line-height: 1.5;
    margin-bottom: 12px;
}

.gourmet-action {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
}

.action-label {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 8px;
}

.affiliate-links {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.affiliate-btn {
    flex: 1;
    padding: 8px 0;
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    color: white;
    transition: opacity 0.2s ease;
}

.affiliate-btn:hover {
    opacity: 0.85;
}

.btn-rakuten {
    background: linear-gradient(135deg, #bf0000 0%, #ff3b3b 100%);
    box-shadow: 0 2px 4px rgba(191, 0, 0, 0.3);
}

.btn-amazon {
    background: linear-gradient(135deg, #f90 0%, #ffb84d 100%);
    color: #111;
    box-shadow: 0 2px 4px rgba(255, 153, 0, 0.3);
}

.desc-section, .trivia-section, .quiz-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    color: #e2e8f0;
    font-size: 1rem;
    line-height: 1.6;
}

.quiz-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    color: white;
    font-family: inherit;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 8px;
    margin-top: 15px;
    cursor: pointer;
    transition: filter 0.2s;
}
.quiz-btn:hover { filter: brightness(1.1); }

.highlight-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255,255,255,0.2);
}

p#description, p#trivia, p#quiz-q {
    color: #cbd5e1;
    line-height: 1.6;
    font-size: 0.95rem;
}

#show-answer-btn {
    margin-top: 10px;
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#show-answer-btn:hover {
    background: var(--accent-color);
    color: white;
}

#quiz-a {
    margin-top: 10px;
    padding: 10px;
    background: rgba(244, 63, 94, 0.1);
    border-left: 4px solid var(--accent-color);
    border-radius: 4px;
    color: #fff;
    font-weight: bold;
}

.hidden {
    display: none !important;
}

/* responsive */
@media (max-width: 800px) {
    body {
        overflow-y: auto !important; /* スマホでは確実にスクロール可能に */
        height: auto;
    }
    main {
        display: flex;
        flex-direction: column;
    }
    #canvas-container {
        justify-content: center;
        padding-top: 10px;
        order: 1; /* スマホでは地図を一番上に！ */
    }
    .about-panel {
        position: relative;
        top: 0;
        left: 0;
        width: 92%;
        margin: 20px auto 40px auto;
        order: 2; /* アバウトパネルは地図の下に移動（隠しちゃうのを防ぐ） */
    }
    header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 20px;
    }
    header p {
        margin-left: 0;
        margin-top: 5px;
        margin-bottom: 15px;
    }
}

/* 都道府県ブロックのアニメーションとホバー */
.pref-block {
    transition: top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s ease, box-shadow 0.3s ease !important;
}

.pref-block:hover {
    transform: scale(1.15) !important;
    z-index: 10 !important;
    filter: brightness(1.2) contrast(1.1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.6) !important;
}

/* 今日のピックアップ セクション */
.pickup-section {
    margin-top: 25px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
}

.pickup-title {
    font-size: 1.05rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pickup-card {
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(0,0,0,0.2));
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.05);
    position: relative;
    overflow: hidden;
}

.pickup-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.1), transparent);
    transform: skewX(-25deg);
    transition: all 0.5s ease;
}

.pickup-card:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    border-color: rgba(255,255,255,0.2);
}

.pickup-card:hover::before {
    left: 200%;
}

.pickup-pref {
    font-size: 0.75rem;
    color: var(--secondary-color);
    margin-bottom: 6px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.pickup-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.3;
}

.pickup-shop {
    font-size: 0.85rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 都道府県個別詳細ページへのリンクボタン */
.detail-link-btn {
    display: block;
    text-align: center;
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    color: #0f172a;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
    transition: all 0.3s ease;
}

.detail-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.5);
    filter: brightness(1.1);
}

/* Xシェアボタン */
.share-btn-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #0f1419;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.share-btn-x:hover {
    background: #272c30;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.1);
}
