/* ==========================================
   脳トレ道場 (noutoredojo.com) - 公共样式表 (common.css)
   专为55+中老年长者设计的无障碍、高对比度、护眼排版
   ========================================== */

:root {
    --bg-primary: #faf8f5;      /* 温かみのある和風アイボリー・目に優しい紙色（参考222.png） */
    --bg-secondary: #ffffff;    /* 純白カード・高コントラスト背景 */
    --text-main: #1e293b;       /* 濃墨色、シニア向けの高視認性文字色 */
    --text-muted: #64748b;      /* 落ち着いたスレートグレー */
    --color-primary: #d94824;   /* 活気ある茜色・朱赤（日本の競品シニア媒体準拠） */
    --color-primary-hover: #b93815; /* 深みのある朱漆色 */
    --color-accent: #ea580c;    /* 暖かな柿色・アンバー */
    --color-accent-light: #fff7ed; /* 柔らかな茜淡色 */
    --color-warning: #f59e0b;   /* 山吹色・金色アクセント */
    --color-border: #e2e8f0;    /* 清潔感のある淡い境界線 */
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.08);
    --font-family: "Hiragino Kaku Gothic ProN", "Meiryo", "BIZ UDPGothic", "Yu Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 黑暗模式变量 */
body.dark-theme {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --color-primary: #f97316;
    --color-primary-hover: #fb923c;
    --color-accent: #fb923c;
    --color-accent-light: #431407;
    --color-border: #334155;
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.4);
}

/* 严格不支持打印机打印 */
@media print {
    body {
        display: none !important;
    }
}

/* 基础样式重置与排版 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-size: 20px; /* 大字号，方便长辈阅读 */
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
    transition: font-size 0.3s ease;
    overflow-x: hidden;
}

/* `clip` 不会像 `hidden` 那样创建额外滚动容器，避免破坏页面内的 sticky 元素。 */
@supports (overflow: clip) {
    html,
    body {
        overflow-x: clip;
    }
}

/* 网页整体容器 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 页头导航栏适配 (PC端高质感60px高精炼通栏，内嵌核心分类导航) */
header {
    background-color: var(--bg-secondary);
    border-bottom: 2px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* 大屏时让 container 往两侧延伸 */
@media (min-width: 1200px) {
    header .container {
        max-width: 1400px;
        padding-left: 32px;
        padding-right: 32px;
    }
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    position: relative;
    gap: 16px;
}

/* LOGO 区域：在60px高通栏内小巧精致、大字醒目 */
.logo-area {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 10px;
    flex-shrink: 0;
}

.logo-icon {
    background: linear-gradient(135deg, var(--color-primary) 0%, #ea580c 100%);
    color: #ffffff;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(217, 72, 36, 0.22);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.logo-area:hover .logo-icon {
    transform: scale(1.05);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo-title {
    font-size: 21px;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: -0.4px;
    line-height: 1.1;
}

.logo-title-accent {
    color: var(--color-primary);
}

body.dark-theme .logo-title-accent {
    color: #fb923c;
}

.logo-subtitle {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    letter-spacing: 0.3px;
    line-height: 1.1;
    margin-top: 1px;
    display: block !important;
}

/* 顶部通栏核心分类导航（挪到通栏区域内） */
.header-nav {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.header-nav-list {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.header-nav-item:hover {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
}

.header-nav-item.active-nav {
    background-color: var(--color-primary);
    color: #ffffff;
}

.header-nav-item svg {
    width: 16px;
    height: 16px;
}

.header-nav-item.active-nav svg {
    color: #ffffff !important;
}

/* 右侧功能控制区（已按要求彻底去除 menu-btn，仅保留主题切换） */
.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.control-icon-btn {
    background-color: #f1f5f9;
    border: 1px solid var(--color-border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-icon-btn svg {
    width: 18px;
    height: 18px;
}

body.dark-theme .control-icon-btn {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.control-icon-btn:hover {
    background-color: var(--color-accent-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* 隐藏已废弃的元素：顶部公告栏、旧版条带 */
.top-notice-bar,
.nav-category-ribbon {
    display: none !important;
}

/* PC端默认规则：隐藏移动端汉堡菜单按钮与下拉栏，核心分类导航平铺居中显示 */
.menu-selector,
.menu-btn {
    display: none !important;
}

.menu-dropdown-bar {
    display: none;
}

/* 平板与移动端断点：隐藏横向分类，避免日文分类名在窄屏拥挤 */
@media (max-width: 1100px) {
    .nav-wrapper {
        height: 60px;
        justify-content: space-between;
    }

    /* 移动端绝不平铺分类，彻底隐藏 header-nav */
    .header-nav {
        display: none !important;
    }

    /* 移动端恢复显示菜单按钮图标 */
    .menu-selector,
    .menu-btn {
        display: inline-flex !important;
    }

    /* 移动端菜单抽屉样式：支持点击展开收起，网格清晰大字号，适老点击 */
    .menu-dropdown-bar {
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background-color: var(--bg-secondary);
        border-bottom: 2px solid var(--color-border);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
        z-index: 1000;
        padding: 12px 0 16px 0;
        animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .menu-dropdown-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 0 16px;
    }

    @media (max-width: 480px) {
        .menu-dropdown-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 8px;
        }
    }

    .menu-nav-link {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 15px;
        font-weight: 800;
        color: var(--text-main);
        text-decoration: none;
        background-color: #f8fafc;
        border: 1px solid var(--color-border);
        border-radius: 10px;
        padding: 10px 8px;
        text-align: center;
        transition: all 0.2s ease;
    }

    body.dark-theme .menu-nav-link {
        background-color: #1e293b;
        border-color: #334155;
        color: #f1f5f9;
    }

    .menu-nav-link:hover {
        background-color: var(--color-accent-light);
        border-color: var(--color-primary);
        color: var(--color-primary);
    }

    .menu-nav-link.active,
    .menu-nav-link.active-nav {
        background-color: var(--color-primary);
        border-color: var(--color-primary);
        color: #ffffff !important;
    }

    .menu-nav-link.active svg,
    .menu-nav-link.active-nav svg {
        color: #ffffff !important;
    }

    .menu-nav-link svg {
        width: 17px;
        height: 17px;
        flex-shrink: 0;
    }

    .logo-subtitle {
        display: none !important;
    }
}

/* 多语言下拉框 */
.lang-selector {
    position: relative;
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: 56px;
    right: 0;
    background-color: var(--bg-secondary);
    border: 3px solid var(--color-border);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    width: 160px;
    z-index: 110;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.lang-item {
    display: block;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-main);
    text-decoration: none;
    text-align: left;
    transition: background-color 0.2s;
}

.lang-item:hover {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
}

.lang-item.active {
    background-color: var(--color-primary);
    color: #ffffff;
}

/* 导航下拉栏 - 绝对定位遮盖 */
.menu-dropdown-bar {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border-bottom: 3px solid var(--color-border);
    box-shadow: var(--shadow-md);
    z-index: 90;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-dropdown-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 32px;
    height: 70px;
}

.menu-nav-link {
    color: var(--text-main);
    text-decoration: none;
    font-size: 19px;
    font-weight: 800;
    padding: 8px 18px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.menu-nav-link:hover {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
}

.menu-nav-link.active {
    background-color: var(--color-primary);
    color: #ffffff;
}

/* 通用按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: #ffffff;
    font-weight: 900;
    font-size: 21px;
    padding: 16px 40px;
    border-radius: 24px;
    text-decoration: none;
    box-shadow: 0 10px 25px rgba(30, 64, 175, 0.25);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(30, 64, 175, 0.35);
}

.btn:active {
    transform: translateY(-1px);
}

/* 页脚 - 结构规整、高对比度、日式媒体排版 */
footer {
    background-color: #0f172a;
    color: #e2e8f0;
    padding: 60px 0 36px 0;
    border-top: 5px solid var(--color-primary);
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 48px;
    align-items: start;
    margin-bottom: 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding-bottom: 36px;
}

.footer-brand {
    max-width: 540px;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    font-size: 26px;
    font-weight: 900;
    text-decoration: none;
    margin-bottom: 14px;
}

.footer-logo-icon {
    background-color: var(--color-primary);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.footer-logo-icon svg {
    width: 26px;
    height: 26px;
}

.footer-logo small {
    margin-left: 4px;
    color: #94a3b8;
    font-size: 15px;
    font-weight: 700;
}

.footer-desc {
    font-size: 15px;
    line-height: 1.8;
    color: #94a3b8;
    margin: 0;
}

.footer-links-wrapper {
    display: flex;
    flex-direction: column;
}

.footer-links-title {
    font-size: 16px;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
}

.footer-links-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-links-grid a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.footer-links-grid a:hover {
    color: #60a5fa;
}

.footer-links-grid svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* 页脚底部法律条款通栏 */
.footer-legal-bar {
    text-align: center;
    padding: 16px 0;
    margin-bottom: 12px;
}

.footer-legal-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.footer-legal-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: color 0.2s;
}

.footer-legal-links a:hover {
    color: #ffffff;
}

.footer-dot {
    color: #475569;
    font-size: 12px;
}

.footer-copyright {
    text-align: center;
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

/* 末尾覆盖：确保平板与手机上的分类抽屉不被桌面规则重新覆盖。 */
@media (max-width: 1100px) {
    .header-nav {
        display: none !important;
    }

    .menu-selector,
    .menu-btn {
        display: inline-flex !important;
    }

    .menu-dropdown-bar {
        top: 60px;
        padding: 12px 0 16px;
    }

    .menu-dropdown-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        height: auto;
        padding: 0 16px;
    }

    .menu-nav-link {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-height: 48px;
        padding: 9px 8px;
        font-size: 15px;
        line-height: 1.35;
        text-align: center;
        background-color: #f8fafc;
        border: 1px solid var(--color-border);
        border-radius: 10px;
    }

    body.dark-theme .menu-nav-link {
        background-color: #1e293b;
    }
}

@media (max-width: 480px) {
    .menu-dropdown-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 通用法律条款弹窗 (Modal) 样式 */
.legal-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    z-index: 999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.legal-modal-content {
    background-color: var(--bg-secondary);
    color: var(--text-main);
    border: 3px solid var(--color-border);
    border-radius: 16px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.25s ease-out;
}

.legal-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.legal-modal-title {
    font-size: 24px;
    font-weight: 900;
    color: var(--color-primary);
    margin: 0;
}

.legal-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 8px;
}

.legal-modal-close:hover {
    background-color: var(--color-accent-light);
    color: var(--color-primary);
}

.legal-modal-body {
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-main);
}

.legal-modal-body h4 {
    font-size: 18px;
    font-weight: bold;
    margin: 18px 0 8px 0;
    color: var(--text-main);
}

.legal-modal-body p {
    margin-bottom: 12px;
}

/* 动画定义 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Standalone Legal Page Styles */
.legal-page-container {
    padding: 40px 0 60px 0;
    max-width: 920px;
    margin: 0 auto;
}

.legal-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 40px 48px;
    box-shadow: var(--shadow-sm);
}

.legal-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.legal-meta {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--color-border);
}

.legal-content h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    margin: 28px 0 12px 0;
}

.legal-content p {
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-main);
    margin-bottom: 16px;
}

.legal-content ul, .legal-content ol {
    margin: 12px 0 20px 24px;
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-main);
}

.legal-content li {
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .legal-card {
        padding: 24px 20px;
    }
    .legal-title {
        font-size: 26px;
    }
}

/* ==========================================
   移动端响应式无障碍适配 (max-width: 768px)
   ========================================== */
@media (max-width: 768px) {
    body {
        font-size: 18px; /* 移动端字号微调 */
    }

    img,
    video,
    iframe {
        max-width: 100%;
    }

    table,
    pre {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .legal-card,
    .legal-content,
    .article-section {
        overflow-wrap: anywhere;
    }

    .container {
        padding: 0 16px;
    }

    /* 顶通通栏高度与弹性排版适配 (保持60px通栏，紧凑不遮挡视野) */
    .nav-wrapper {
        height: 60px;
    }

    /* logo 区域紧凑化 */
    .logo-area {
        gap: 8px;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        border-radius: 9px;
    }

    .logo-icon i,
    .logo-icon svg {
        width: 20px !important;
        height: 20px !important;
    }

    .logo-title {
        font-size: 19px;
    }

    .logo-subtitle {
        display: none !important;
    }

    /* 顶通右侧功能区紧凑化 */
    .header-controls {
        gap: 6px;
    }

    .control-icon-btn {
        width: 36px;
        height: 36px;
    }

    .control-icon-btn i,
    .control-icon-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    /* 展开的语言菜单 */
    .lang-dropdown {
        top: 48px;
        width: 130px;
        border-radius: 14px;
    }

    .lang-item {
        padding: 10px 14px;
        font-size: 14px;
    }

    /* 按钮在移动端的表现 */
    .btn {
        font-size: 18px;
        padding: 12px 28px;
        border-radius: 18px;
    }

    /* 页脚排版重构 */
    footer {
        padding: 40px 0 30px 0;
    }

    .footer-grid {
        flex-direction: column;
        align-items: center;
        gap: 24px;
        margin-bottom: 24px;
        padding-bottom: 24px;
        text-align: center;
    }

    .footer-brand {
        max-width: 100%;
    }

    .footer-logo {
        justify-content: center;
        font-size: 22px;
    }

    .footer-desc {
        font-size: 15px;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px 24px;
    }

    .footer-links a {
        font-size: 16px;
    }

    .footer-logo {
        max-width: 100%;
        align-items: flex-start;
    }
}

.page-result .result-recommend-heading {
    margin: 40px 0 24px;
    text-align: left;
}

.page-result .result-recommend-heading .section-title {
    margin: 0;
    font-size: 26px;
}
