body {
    margin: 0;
    font-family: "Helvetica Neue", "Arial", "Hiragino Kaku Gothic ProN",
        "Hiragino Sans", "Meiryo", sans-serif;
    background-color: #f0f2f5;
}

/* Header */
/* ===== ヘ/* ===== ヘッダー全体 ===== */
.site-header {
    background: #9ed7ef;
    padding: 0;
}

.header-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 16px;
    height: 80px;
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* 左・中央・右 */
    align-items: center;
    position: relative;
    z-index: 10;
}

/* ===== 中央ロゴ ===== */
.brand {
    text-align: center;
    text-decoration: none;
}
.brand h1 {
    font-size: clamp(28px, 4.5vw, 48px);
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.06em;
    margin: 0;
    -webkit-text-stroke: 2px #000;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

/* ===== ハンバーガーメニュー ===== */

/* チェックボックスは非表示 */
.nav-toggle {
    display: none;
}

/* ボタン本体 */
.menu-btn {
    justify-self: end;
    width: 44px;
    height: 44px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
    z-index: 1003; /* 最前面 */
}
.menu-btn:hover {
    background: rgba(0, 0, 0, 0.12);
}

/* 3本線 */
.menu-btn span {
    display: block;
    width: 26px;
    height: 3px;
    border-radius: 2px;
    background: #fff;
    transition: transform 0.25s ease, opacity 0.2s ease, width 0.25s ease;
}

/* チェック時にX型に変形 */
.nav-toggle:checked + .menu-btn span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.nav-toggle:checked + .menu-btn span:nth-child(2) {
    opacity: 0;
    width: 0;
}
.nav-toggle:checked + .menu-btn span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ===== ナビゲーションメニュー ===== */
.site-nav {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 80px; /* ヘッダー直下 */
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    padding: 8px 10px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.2s ease;
    z-index: 1002; /* オーバーレイより上 */
}

.site-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 6px 0;
}
.site-nav a {
    display: block;
    color: #202327;
    text-decoration: none;
    font-weight: 600;
    padding: 12px 10px;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.site-nav a:hover {
    background: rgba(2, 12, 27, 0.06);
}

/* 開いたとき */
.nav-toggle:checked ~ .site-nav {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* ===== オーバーレイ ===== */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1001; /* メニューより下 */
    cursor: pointer;
}
.nav-toggle:checked ~ .nav-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* ===== スマホ微調整 ===== */
@media (max-width: 480px) {
    .header-container {
        height: 64px;
    }
    .brand h1 {
        font-size: 28px;
        -webkit-text-stroke: 1.5px #000;
    }
    .site-nav {
        top: 64px;
    }
}

/* Main Content Area */
main {
    padding: 15px;
    max-width: 800px;
    margin: 0 auto;
}

h3 {
    text-align: center !important;
}
/* Search Bar */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-container input {
    width: 100%;
    padding: 12px 40px 12px 15px; /* Make space for the icon */
    border: 1px solid #ccc;
    border-radius: 25px; /* Rounded corners */
    box-sizing: border-box; /* Ensures padding doesn't affect total width */
    font-size: 1em;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}

/* Image Grid */
.grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Two-column layout */
    gap: 15px; /* Space between grid items */
}

.grid-item {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden; /* Ensures image corners are rounded */
    text-align: center;
    padding-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.grid-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3; /* Maintain a consistent aspect ratio */
    object-fit: cover; /* Cover the area without distortion */
    display: block;
}

.grid-item p {
    margin: 10px 0 0 0;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}
/* Link Styling for Grid Items */
.grid-link {
    text-decoration: none;
    color: inherit;
}
.header-link {
    text-decoration: none;
    color: inherit;
}
/* 詳細ページ用の中央揃えスタイル */
.detail-page main {
    display: flex;
    flex-direction: column;
    align-items: center;
}
h2 {
    text-align: center;
}
/* 以前と同じ 550px 幅で中央寄せ（全ページ共通） */

/* PCでは中央寄せ＋550px固定 */
/* PC表示（768px以上） */
@media (min-width: 768px) {
    .twitter-embed {
        width: 550px !important;
        max-width: 550px !important;
        height: 600px !important; /* 高さ固定 */
        min-height: 600px !important; /* 最低高さも固定 */
        display: block;
        margin: 10px auto;
        border: none;
    }
}

/* スマホ・タブレット（767px以下） */
@media (max-width: 767px) {
    .twitter-embed {
        width: 100% !important;
        max-width: 100% !important;
        height: 50vh !important; /* 画面高の50% */
        min-height: 50vh !important; /* 最低高さも画面高の90% */
        display: block;
        margin: 0 auto 10px auto;
        border: none;
    }
}

/* ===========================
   プライバシーポリシー用 追加
   =========================== */

/* 見出しとメタ */
.policy-page .page-title {
    margin: 10px 0 6px;
}
.policy-page .page-title h2 {
    text-align: left;
    font-size: 1.8em;
    margin: 0 0 4px;
}
.policy-page .page-title .meta {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

/* 目次：既存トーンに合わせた白カード */
.toc {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    padding: 12px 14px;
    margin: 10px 0 16px;
}
.toc ol {
    margin: 0;
    padding-left: 1.2em;
}
.toc a {
    color: #0b63c8;
    text-decoration: none;
}
.toc a:hover {
    text-decoration: underline;
}

/* 本文内の見出し */
.policy h3 {
    margin: 0 0 6px;
    font-size: 1.2em;
}
.policy h4 {
    margin: 8px 0 4px;
    font-size: 1.05em;
}

/* 運営者情報 */
.operator h4 {
    margin: 8px 0 4px;
}
.operator p {
    margin: 0;
    white-space: pre-line;
}

/* 戻るボタン */
.back {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

/* アンカーのスクロール余白（固定ヘッダー対策を軽く） */
.policy [id] {
    scroll-margin-top: 70px;
}
/* ===== お問い合わせページ用の最小追加 ===== */
.contact-page main {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

.page-title {
    margin: 16px 0 8px;
}
.page-title h2 {
    font-size: 1.8em;
    margin: 0 0 4px;
}
.page-title .meta {
    color: #666;
    font-size: 0.9em;
    margin: 0;
}

.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    padding: 16px 18px;
    margin: 12px 0;
}

.btn {
    display: inline-block;
    background: #202327;
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}
.btn:hover {
    opacity: 0.9;
}

.back {
    display: flex;
    justify-content: center;
    gap: 12px;
}
.site-footer {
    max-width: 800px;
    margin: 20px auto 30px;
    padding: 8px 15px 0;
    border-top: 1px solid #ddd;
    color: #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.site-footer a {
    color: #0b63c8;
    text-decoration: none;
}
.contact textarea {
    min-height: 300px;
    width: 99%;
    font-size: 1rem;
    padding: 12px;
    line-height: 1.6;
    resize: vertical; /* 高さだけ変更可能 */
}
/* ページャ全体 */
/* ページ本体は非表示を基本に */
.tweet-page {
    display: none;
}

/* :target になっているページだけ表示 */
.tweet-page:target {
    display: block;
}

/* ハッシュが無い初期表示は page1 を表示 */
/* :target が存在しない場合のフォールバック */
body:not(:has(.tweet-page:target)) #page1 {
    display: block;
}

/* ページャ */
.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 18px 0 8px;
}
.pager a,
.pager span {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    text-decoration: none;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    font-weight: 700;
    color: #202327;
}
.pager a:hover {
    background: rgba(2, 12, 27, 0.06);
}

/* 現在ページの見た目（該当番号リンクをspanで置換） */
.pager .current {
    background: #202327;
    color: #fff;
    border-color: #202327;
    pointer-events: none;
}

/* 前/次を薄くする（必要に応じて） */
.pager .disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* ツイート群を中央寄せ（既存レイアウトと整合） */
.tweet-list {
    display: flex;
    flex-direction: column;
    align-items: center;
}
/* 1) 横はみ出しを根絶（保険） */
*,
*::before,
*::after {
    box-sizing: border-box;
}
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* 横スクロールを封じる */
}

/* 2) 画像とツイートを必ず親幅にフィットさせる */
.featured-meme img {
    display: block;
    max-width: 100%;
    width: 100%;
    height: auto;
    margin: 0 auto;
}

/* 3)（使っていれば）拡大ラッパーはスマホで無効化 */
@media (max-width: 600px) {
    .tweet-zoom {
        transform: none !important;
        width: 100% !important;
    }
    .tweet-zoom > .twitter-embed {
        max-width: 100% !important;
    }
}

/* 4) 影や境界での0.5pxオーバー対策（念のため） */

.site-nav,
.featured-meme,
.tweet-page {
    contain: layout paint;
}
