:root {
    --bg-color: #f4f6f9;
    --text-main: #2d3748;
    --text-sub: #718096;
    --card-bg: #ffffff;
}

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

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    color: #1a202c;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-sub);
    font-size: 1rem;
    letter-spacing: 0.1em;
}

/* リンクスイッチを並べるグリッドレイアウト（基本設定） */
.switch-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.8rem;
    width: 100%;
    max-width: 1050px;
}

/* カード型リンクスイッチのスタイル */
.switch-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* カード上部のテーマカラーライン */
.switch-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    transition: height 0.3s ease;
}

/* テーマ別カラー設定（花・バー・自然） */
.theme-flower::before { background: linear-gradient(90deg, #ff758c, #ff7eb3); }
.theme-bar::before    { background: linear-gradient(90deg, #2c3e50, #d4af37); }
.theme-nature::before { background: linear-gradient(90deg, #11998e, #38ef7d); }

/* ホバー（マウスオーバー）時のアニメーション */
.switch-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.12);
}

.switch-card:hover::before {
    height: 10px;
}

/* クリック時の押し込み感 */
.switch-card:active {
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.category-badge {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    background: #edf2f7;
    color: #4a5568;
}

.theme-flower .category-badge { background: #fff0f3; color: #d6336c; }
.theme-bar .category-badge    { background: #2d3748; color: #f6e05e; }
.theme-nature .category-badge { background: #e6fffa; color: #2c7a7b; }

.card-icon {
    font-size: 2rem;
    transition: transform 0.3s ease;
}

.switch-card:hover .card-icon {
    transform: scale(1.2) rotate(5deg);
}

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: #1a202c;
}

.card-subtitle {
    font-size: 0.9rem;
    color: var(--text-sub);
    margin-bottom: 1.5rem;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 700;
    color: #4a5568;
    border-top: 1px solid #edf2f7;
    padding-top: 1rem;
}

.arrow {
    display: inline-block;
    transition: transform 0.3s ease;
}

.switch-card:hover .arrow {
    transform: translateX(6px);
}

footer {
    margin-top: 4rem;
    font-size: 0.85rem;
    color: var(--text-sub);
    text-align: center;
}

/* ===================================================
   デバイス幅別のレスポンシブ調整（9段階ブレイクポイント）
=================================================== */

/* PC・大型タブレット横向き (1024px以上)：ゆったり3列表示 */
@media screen and (min-width: 1024px) {
    .switch-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 1050px;
        gap: 1.8rem;
    }
}

/* iPad Pro 11 / タブレット横向き (835px - 1023px)：コンパクト3列表示 */
@media (min-width: 835px) and (max-width: 1023px) {
    body { padding: 2rem 1.5rem; }
    header h1 { font-size: 2.5rem; }
    .switch-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.3rem;
    }
    .switch-card { padding: 1.6rem; }
    .card-title { font-size: 1.2rem; }
}

/* iPad mini / タブレット縦向き (744px - 834px)：ゆとりある2列表示 */
@media (min-width: 744px) and (max-width: 834px) {
    body { padding: 2.5rem 2rem; }
    header { margin-bottom: 2.5rem; }
    header h1 { font-size: 2.4rem; }
    .switch-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    .switch-card { padding: 1.8rem; }
}

/* 小型タブレット / 大型スマホ横向き (541px - 743px)：コンパクト2列表示 */
@media (min-width: 541px) and (max-width: 743px) {
    body { padding: 2rem 1.2rem; }
    header { margin-bottom: 2rem; }
    header h1 { font-size: 2.1rem; }
    .switch-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.1rem;
    }
    .switch-card { padding: 1.4rem; }
    .card-icon { font-size: 1.7rem; }
    .card-title { font-size: 1.15rem; }
    .card-subtitle { font-size: 0.85rem; }
}

/* ファブレット / 大型スマホ縦向き (441px - 540px)：ゆったり1列表示 */
@media (min-width: 441px) and (max-width: 540px) {
    body { padding: 2rem 1.2rem; }
    header { margin-bottom: 2rem; }
    header h1 { font-size: 2rem; }
    header p { font-size: 0.92rem; }
    .switch-grid {
        grid-template-columns: 1fr;
        gap: 1.3rem;
    }
    .switch-card { padding: 1.7rem; }
    footer { margin-top: 3rem; }
}

/* iPhone Pro Max / Plus 等 (391px - 440px)：標準1列表示 */
@media (min-width: 391px) and (max-width: 440px) {
    body { padding: 1.8rem 1rem; }
    header { margin-bottom: 1.8rem; }
    header h1 { font-size: 1.85rem; }
    header p { font-size: 0.88rem; }
    .switch-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    .switch-card { padding: 1.5rem; }
    .card-title { font-size: 1.25rem; }
    footer { margin-top: 2.5rem; }
}

/* iPhone 12 / 13 / 14 / 15 / 16 標準 (381px - 390px) */
@media (min-width: 381px) and (max-width: 390px) {
    body { padding: 1.6rem 0.9rem; }
    header { margin-bottom: 1.6rem; }
    header h1 { font-size: 1.75rem; }
    header p { font-size: 0.85rem; letter-spacing: 0.05em; }
    .switch-grid {
        grid-template-columns: 1fr;
        gap: 1.1rem;
    }
    .switch-card { padding: 1.4rem; }
    .card-icon { font-size: 1.75rem; }
    .card-title { font-size: 1.2rem; }
    .card-subtitle { font-size: 0.85rem; margin-bottom: 1.2rem; }
    footer { margin-top: 2.2rem; font-size: 0.8rem; }
}

/* iPhone SE (第2・第3世代) / mini (375px - 380px) */
@media (min-width: 375px) and (max-width: 380px) {
    body { padding: 1.5rem 0.85rem; }
    header { margin-bottom: 1.5rem; }
    header h1 { font-size: 1.65rem; }
    header p { font-size: 0.82rem; letter-spacing: 0.04em; }
    .switch-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .switch-card { padding: 1.3rem; border-radius: 14px; }
    .card-header { margin-bottom: 0.9rem; }
    .card-icon { font-size: 1.65rem; }
    .card-title { font-size: 1.15rem; }
    .card-subtitle { font-size: 0.82rem; margin-bottom: 1.1rem; }
    .card-footer { padding-top: 0.8rem; font-size: 0.8rem; }
    footer { margin-top: 2rem; font-size: 0.78rem; }
}

/* 超小型端末・古い端末 (374px以下)：はみ出し防止のコンパクト設計 */
@media (max-width: 374px) {
    body { padding: 1.2rem 0.75rem; }
    header { margin-bottom: 1.3rem; }
    header h1 { font-size: 1.45rem; }
    header p { font-size: 0.78rem; letter-spacing: 0.02em; }
    .switch-grid {
        grid-template-columns: 1fr;
        gap: 0.9rem;
    }
    .switch-card { padding: 1.15rem; border-radius: 12px; }
    .card-header { margin-bottom: 0.8rem; }
    .category-badge { font-size: 0.68rem; padding: 0.25rem 0.65rem; }
    .card-icon { font-size: 1.5rem; }
    .card-title { font-size: 1.08rem; }
    .card-subtitle { font-size: 0.78rem; margin-bottom: 1rem; }
    .card-footer { padding-top: 0.75rem; font-size: 0.78rem; }
    footer { margin-top: 1.8rem; font-size: 0.72rem; }
}
