/* Apple風デザインシステム準拠（WebBLE と同じ見た目） */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 16px;
    background: #F5F5F7;
    min-height: 100vh;
    color: #1D1D1F;
    line-height: 1.5;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.app-layout {
    width: 100%;
    max-width: 1540px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    box-sizing: border-box;
}

.content-row {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 24px;
    box-sizing: border-box;
}

.container {
    background: #FFFFFF;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    flex: 1;
    max-width: 900px;
    min-width: 0;
    box-sizing: border-box;
}

.hero {
    text-align: center;
    margin-bottom: 32px;
}

.hero h1 {
    color: #000000;
    margin: 0 0 8px;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.2;
}

.hero p {
    color: #666666;
    margin: 0;
    font-size: 17px;
}

/* ツールカード */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    border-radius: 16px;
    background: #F5F5F7;
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tool-card:hover,
.tool-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.tool-icon {
    font-size: 32px;
    line-height: 1;
}

.tool-card h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #000000;
}

.tool-card p {
    margin: 0;
    flex: 1;
    font-size: 14px;
    color: #666666;
}

.tool-link {
    font-size: 14px;
    font-weight: 600;
    color: #0066CC;
}

/* 広告共通スタイル */
.ad-card {
    background: #FFFFFF;
    padding: 16px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
}

/* 左右サイドバー広告 */
.ad-sidebar {
    width: 250px;
    min-width: 200px;
    max-width: 280px;
    min-height: 600px;
    flex-shrink: 0;
    position: sticky;
    top: 24px;
}

/* ボトム広告 */
.ad-bottom {
    width: 100%;
    max-width: 900px;
    min-height: 120px;
    margin: 0 auto;
}

/* 広告フォールバック表示 */
.ad-fallback {
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
    padding: 20px 16px;
    background: #ffffff;
    text-align: center;
}

.ad-fallback-title {
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
}

.ad-fallback-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 10px;
}

.ad-fallback-link {
    font-size: 12px;
    color: #2563eb;
    text-decoration: underline;
}

/* レスポンシブ対応 */
@media (min-width: 1024px) and (max-width: 1299px) {
    .ad-sidebar {
        width: 180px;
        min-width: 160px;
    }
}

@media (max-width: 1023px) {
    .content-row {
        flex-direction: column;
        align-items: center;
    }

    .container {
        order: 1;
        width: 100%;
        max-width: 900px;
    }

    .ad-sidebar {
        width: 100%;
        max-width: 900px;
        min-width: auto;
        min-height: auto;
        position: static;
    }

    .ad-sidebar.ad-left {
        order: 2;
    }

    .ad-sidebar.ad-right {
        order: 3;
    }

    .ad-bottom {
        order: 4;
        width: 100%;
        max-width: 900px;
    }
}

@media (max-width: 767px) {
    body {
        padding: 16px;
    }

    .app-layout {
        gap: 16px;
    }

    .container {
        padding: 16px;
    }

    .hero h1 {
        font-size: 28px;
    }
}

/* ツールバー（お気に入り登録・言語切り替え） */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    background: #F5F5F7;
    color: #0066CC;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.btn-secondary:hover {
    background: #E8E8ED;
}

.lang-switch {
    display: inline-flex;
    background: #F5F5F7;
    border-radius: 10px;
    padding: 2px;
}

.lang-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #666666;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.lang-btn[aria-pressed="true"] {
    background: #FFFFFF;
    color: #000000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.fav-msg {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #EEF4FF;
    color: #1D1D1F;
    font-size: 14px;
}

.fav-msg[hidden] {
    display: none;
}
