:root {
    --primary-color: #1A2CA3;
    --accent-blue: #2980b9;
    --accent-green: #27ae60;
    --bg-color: #f4f6f8;
    --box-bg: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
}

body { font-family: "Helvetica Neue", Arial, sans-serif; background: var(--bg-color); color: var(--text-color); padding: 0; margin: 0; padding-bottom: 100px; scroll-behavior: smooth; }
.container { max-width: 900px; margin: 0 auto; padding: 0 20px 40px 20px; position: relative; }
.box { background: var(--box-bg); padding: 25px; margin-bottom: 25px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

/* ヘッダ */
.app-header-full {
    width: 100%; background-color: #0E21A0; color: #ffffff; padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); margin-bottom: 30px; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
}
.header-title-area { text-align: center; }
.header-title-area .subtitle { font-size: 13px; color: #e0e6ed; margin: 0 0 8px 0; font-weight: 500; letter-spacing: 1.5px; }
.header-title-area .title { color: #ffffff; font-size: 28px; margin: 0; font-weight: 700; letter-spacing: 2px; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }

.header-user-area { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 10px; font-size: 14px; }
.header-user-area .btn-auth { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4); color: white; padding: 6px 12px; border-radius: 4px; cursor: pointer; transition: 0.2s; font-weight:bold; }
.header-user-area .btn-auth:hover { background: rgba(255,255,255,0.3); }

.control-panel { margin-bottom: 25px; display: flex; justify-content: center; }
.case-selector {
    font-size: 16px;
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    background: #fff;
    cursor: pointer;
    animation: gentleGlow 3s infinite ease-in-out;
    outline: none;
}

/* --- ハイライト装飾の更新 --- */
.marker-paradox { background-color: #e1bee7; font-weight: bold; } /* 逆接:紫(薄め)に変更 */
.marker-free { background-color: #fff9c4; } /* フリーマーカー:黄(新設) */
.marker-tense { background-color: #bbdefb; font-weight: bold; } /* 時制:青 */
.marker-negative { background-color: #ffcdd2; font-weight: bold; } /* ネガティブ:赤 */

/* --- ツールバーのドット色の更新 --- */
.color-dot.purple { background: #9b59b6; } /* 逆接用 */
.color-dot.yellow { background: #f1c40f; } /* フリー用（以前は逆接用だったが明るめに調整） */

.marker-underline { text-decoration: underline; text-decoration-color: #7f8c8d; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.marker-user_tag { background-color: #d5f5e3; }

.tag-badge-user { background-color: var(--accent-green); color: white; font-size: 11px; font-weight: bold; padding: 2px 5px; border-radius: 4px; margin-left: 3px; vertical-align: super; display: inline-block; transform: translateY(-0.3em); }
.tag-badge-model { background-color: var(--accent-blue); color: white; font-size: 11px; font-weight: bold; padding: 2px 5px; border-radius: 4px; margin-left: 3px; vertical-align: super; display: inline-block; transform: translateY(-0.3em); }

.paragraph-num { background: #34495e; color: #fff; font-size: 12px; font-weight: bold; padding: 3px 6px; border-radius: 4px; margin-right: 8px; vertical-align: middle; }
.toc-anchor { display: block; position: relative; top: -30px; visibility: hidden; }

.extracted-clips { margin-bottom: 15px; }
.clip-item { padding: 10px 12px; margin-bottom: 8px; border-radius: 6px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; background: #fdfdfd; border: 1px solid var(--border-color); }
.clip-item.user-clip { border-left: 4px solid var(--accent-green); }
.clip-item.model-clip { border-left: 4px solid var(--accent-blue); }
.clip-delete { background: none; border: none; color: #e74c3c; font-weight: bold; cursor: pointer; font-size: 1.2em; padding: 0 5px; }

/* ======== UI再設計：枠なし・アコーディオン形式 ======== */
.model-answer-area { 
    display: none; 
    margin-top: 15px; 
    margin-bottom: 5px; 
    user-select: none; 
    -webkit-user-select: none;
}
.model-answer-block { background-color: #f8fbfe; border-left: 4px solid var(--accent-blue); padding: 15px 20px; margin-bottom: 15px; border-radius: 0 6px 6px 0; }
.model-answer-label { font-size: 13px; font-weight: bold; color: var(--accent-blue); margin-bottom: 8px; }
.model-answer-text { font-size: 15px; font-weight: bold; color: #2c3e50; line-height: 1.6; }

details.supplement-info { margin-bottom: 15px; background: transparent; }
details.supplement-info summary { font-size: 14.5px; color: #7f8c8d; cursor: pointer; padding: 8px 0; font-weight: bold; display: inline-flex; align-items: center; user-select: none; transition: color 0.2s; }
details.supplement-info summary:hover { color: var(--accent-blue); }
details.supplement-info summary::-webkit-details-marker { display: none; }
details.supplement-info summary::before { content: "▶"; font-size: 11px; margin-right: 8px; transition: transform 0.2s; }
details.supplement-info[open] summary::before { transform: rotate(90deg); }

.supplement-content { padding: 15px; margin-top: 5px; background-color: #fcfcfc; border: 1px solid #eee; border-radius: 6px; font-size: 14.5px; line-height: 1.6; color: #555; }
.marker-area { margin-top: 0px; }

/* ★追加：幻の追加問題の専用スタイル */
.additional-q-block {
    background-color: #fffdf5;
    border: 2px solid #f1c40f !important;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.1);
    position: relative;
}
.badge-additional {
    background-color: #f39c12;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 10px;
    vertical-align: middle;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
#btn-toggle-additional.active {
    background-color: #f39c12 !important;
    color: #fff !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

textarea { width: 100%; height: 100px; padding: 15px; font-size: 15px; border: 1px solid var(--border-color); border-radius: 6px; box-sizing: border-box; resize: vertical; margin-bottom: 10px; font-family: inherit; }

.req-textarea {
    height: 70px;
    background-color: #fcfcfc;
    border: 1px dashed var(--accent-blue);
    font-size: 14px;
    color: #2c3e50;
}
.req-textarea::placeholder { color: #95a5a6; }

button.action-btn { background: var(--primary-color); color: #fff; padding: 12px 24px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 14px; transition: background 0.2s; }
button.action-btn:hover { background: #122082; }

.feedback { background: #e8f4f8; padding: 20px; margin-top: 15px; border-radius: 6px; display: none; border-left: 4px solid var(--accent-blue); }
.char-count { font-weight: bold; color: var(--accent-green); }
.char-over { color: #e74c3c; }
::selection { background: #b2bec3; color: #000; }
.app-footer { text-align: center; padding: 20px; font-size: 13px; color: #7f8c8d; border-top: 1px solid var(--border-color); margin-top: 20px; }
.app-footer a { color: var(--accent-blue); text-decoration: none; margin: 0 10px; font-weight: bold; }
.app-footer a:hover { text-decoration: underline; }

/* ツールバーのアニメーション */
@keyframes gentleGlow {
    0% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), 0 0 5px rgba(41, 128, 185, 0.2); }
    50% { box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 0 20px rgba(41, 128, 185, 0.6); }
    100% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), 0 0 5px rgba(41, 128, 185, 0.2); }
}

.floating-toolbar {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 50px; display: flex; align-items: center; padding: 8px 15px;
    z-index: 1000; gap: 15px; transition: all 0.3s;
    animation: gentleGlow 3s infinite ease-in-out;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.toolbar-divider { width: 1px; height: 24px; background: #e0e0e0; }

.toolbar-disabled {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(100%);
    transition: all 0.2s;
}

.compact-toggle { display: flex; background: #f0f2f5; border-radius: 20px; overflow: hidden; }
.compact-toggle button {
    border: none; background: transparent; padding: 8px 16px; font-size: 13px;
    font-weight: bold; color: #555; cursor: pointer; transition: 0.2s;
    white-space: nowrap;
}
.compact-toggle button.active { background: var(--primary-color); color: white; }

.pen-tools-compact { display: flex; gap: 6px; }
.pen-icon-label {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; transition: 0.2s; position: relative;
}
.pen-icon-label:hover { background: #f0f2f5; }
.pen-icon-label input[type="radio"] { display: none; }
.pen-icon-label input[type="radio"]:checked + .color-dot {
    transform: scale(1.3); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--primary-color);
}
.pen-icon-label.filter-off {
    opacity: 0.3;
    filter: grayscale(100%);
    transition: all 0.2s;
}

.color-dot { width: 18px; height: 18px; border-radius: 50%; transition: 0.2s; border: 1px solid rgba(0,0,0,0.1); }
.color-dot.green { background: var(--accent-green); }
.color-dot.red { background: #ffcdd2; }
.color-dot.blue { background: #bbdefb; }
.color-dot.yellow { background: #fff9c4; }
.color-dot.white { background: #ffffff; border: 1px solid #95a5a6; }

.pen-tooltip {
    visibility: hidden; position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
    background: #333; color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 4px;
    white-space: nowrap; opacity: 0; transition: 0.2s; font-weight: normal; pointer-events: none;
}
.pen-icon-label:hover .pen-tooltip { visibility: visible; opacity: 1; }

.toolbar-action-btn {
    border: none; background: transparent; font-size: 13px; font-weight: bold;
    cursor: pointer; padding: 8px 12px; border-radius: 20px; transition: 0.2s;
    display: flex; align-items: center; gap: 5px; color: #555;
    white-space: nowrap;
}
.toolbar-action-btn:hover { background: #f0f2f5; }
.toolbar-action-btn.primary { background: var(--primary-color); color: white; }
.toolbar-action-btn.primary:hover { background: #122082; }

/* スマホ用目次メニュー（PCでは不要だが残しておく） */
.toc-menu {
    position: fixed; bottom: 85px; left: 50%; transform: translateX(-50%);
    background: white; border: 1px solid var(--border-color);
    border-radius: 8px; padding: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 1000; width: 220px; display: none;
}
.toc-menu.show { display: block; animation: slideUp 0.2s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toc-menu ul { list-style: none; padding: 0; margin: 0; max-height: 40vh; overflow-y: auto; }
.toc-menu li { margin-bottom: 8px; }
.toc-menu a { text-decoration: none; color: #555; font-size: 13px; font-weight: bold; display: block; padding: 6px 8px; border-radius: 4px; transition: 0.2s;}
.toc-menu a:hover { background: #f0f4f8; color: var(--accent-blue); }

/* モーダル等 */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9999; align-items: center; justify-content: center; }
.modal-content { background: #fff; padding: 25px; border-radius: 8px; width: 90%; max-width: 700px; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.modal-content.small-modal { max-width: 400px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: bold; color: #555; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(39, 174, 96, 0.9); color: white; padding: 12px 24px; border-radius: 30px; font-weight: bold; font-size: 14px; z-index: 10000; display: none; }

.clip-item > div:last-child { display: flex; align-items: center; gap: 5px; }
.clip-jump { background: none; border: none; color: var(--accent-blue); cursor: pointer; font-size: 1.3em; padding: 0 5px; transition: 0.2s; text-decoration: none; }
.clip-jump:hover { transform: translateY(-3px) scale(1.1); color: var(--primary-color); }
.highlight-anchor { display: inline-block; width: 0; height: 0; visibility: hidden; scroll-margin-top: 120px; }
.highlight-pulse { animation: pulseBg 2s ease-out; display: inline-block; border-radius: 4px; }
@keyframes pulseBg { 
    0% { background-color: rgba(241, 196, 15, 0.8); box-shadow: 0 0 10px rgba(241, 196, 15, 0.6); } 
    100% { background-color: transparent; box-shadow: none; } 
}

/* AIチャットボット (頭脳先生) のスタイル */
.chat-toggle-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1001; 
    transition: all 0.3s ease;
    display: none; 
}
.chat-toggle-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.chat-window {
    position: fixed;
    bottom: 85px; 
    right: 25px;
    width: 350px;
    height: 500px;
    max-height: 70vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    display: none;
    flex-direction: column;
    z-index: 1002;
    overflow: hidden;
    animation: slideUpChat 0.3s ease-out forwards;
    border: 1px solid var(--border-color);
}

@keyframes slideUpChat {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-header {
    background: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}
.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9fbfd;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 85%;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
}
.ai-message {
    background: #fff;
    border: 1px solid var(--border-color);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}
.user-message {
    background: var(--accent-blue);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-input-area {
    padding: 10px;
    background: #fff;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}
.chat-input-area textarea {
    flex: 1;
    height: 40px;
    min-height: 40px;
    margin-bottom: 0;
    padding: 10px;
    font-size: 13px;
    resize: none;
    border-radius: 20px;
}
.chat-send-btn {
    background: var(--accent-green);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0 15px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
.chat-send-btn:hover { background: #229954; }

/* ==========================================
   ディスカッション機能 (掲示板)
========================================== */
.discussion-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100%;
    background: #f8f9fa;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease-in-out;
    z-index: 1005;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
}
.discussion-sidebar.open {
    right: 0;
}
.sidebar-header {
    background: #fff;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.discussion-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}
.thread-card {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.thread-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border-color: var(--accent-blue);
}
.thread-title {
    font-size: 15px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
    line-height: 1.4;
}
.thread-meta {
    font-size: 12px;
    color: #7f8c8d;
    display: flex;
    justify-content: space-between;
}

/* ==========================================
   ディスカッション機能 (コメント・吹き出し)
========================================== */
.discussion-comment {
    background: #fff;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
    position: relative;
    max-width: 90%;
}
.discussion-comment.my-comment {
    background: #e8f4f8;
    border-color: #bee5eb;
    margin-left: auto;
}
.comment-meta {
    font-size: 12px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}
.comment-body {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

/* ==========================================
   レイアウト再構築 (PC/スマホ分岐)
========================================== */
/* --- PC用 UI (左側のスライド目次 ＆ 左右の縦タブ) --- */
.pc-side-panel {
    position: fixed;
    top: 0;
    left: -400px; /* 初期状態は画面左外に隠す */
    width: 300px;
    height: 100%;
    background: #f8f9fa;
    box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    transition: left 0.3s ease-in-out;
    z-index: 1005;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}
.pc-side-panel.open {
    left: 0; /* クラスが付いたら画面内に引き出す */
}
.pc-side-panel .toc-list {
    padding: 20px; margin: 0; list-style: none; overflow-y: auto; flex: 1;
}
.pc-side-panel .toc-list a {
    text-decoration: none; color: #555; font-size: 14px; font-weight: bold; 
    display: block; padding: 8px 10px; border-radius: 4px; transition: 0.2s;
}
.pc-side-panel .toc-list a:hover { background: #e8f4f8; color: var(--accent-blue); }

.pc-vertical-tabs {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 900;
}

/* ★追加：左側に配置する目次タブ専用のスタイル */
.pc-left-tabs {
    left: 0;
    right: auto;
}
.pc-left-tabs .v-tab {
    border-radius: 0 12px 12px 0; /* 右側だけ丸める */
    border-left: none;
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 2px 8px rgba(0,0,0,0.05);
}
.pc-left-tabs .v-tab:hover { transform: translateX(5px); }

.v-tab {
    background: #fff;
    border: 1px solid var(--border-color);
    border-right: none;
    padding: 15px 10px;
    border-radius: 12px 0 0 12px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    cursor: pointer;
    font-weight: bold;
    color: #555;
    box-shadow: -2px 2px 8px rgba(0,0,0,0.05);
    animation: gentleGlow 3s infinite ease-in-out; /* ★共通のアニメーションを適用 */
    transition: 0.2s;
    letter-spacing: 3px;
    display: flex; align-items: center; gap: 8px;
}
.v-tab:hover { background: #f0f4f8; transform: translateX(-5px); }
.v-tab.zunou-tab { color: var(--primary-color); }

/* スマホ用ボトムナビのデフォルト設定（PCでは隠す） */
.mobile-bottom-nav { display: none; }


/* ==========================================
   メディアクエリ (タブレット・スマホ対応)
========================================== */

@media (max-width: 1024px) {
    #passage-display { font-size: 19px !important; line-height: 2.4 !important; }
    .preface-area, .question-text-area { font-size: 18px !important; line-height: 1.6 !important; }
    textarea { font-size: 19px !important; }
    .clip-item { font-size: 19px !important; line-height: 1.6 !important; }
    .model-answer-area { font-size: 1.15em !important; }
    
    .case-selector { font-size: 19px !important; padding: 10px 14px !important; }
    .floating-toolbar { width: fit-content !important; max-width: 95% !important; flex-wrap: wrap; justify-content: center; border-radius: 24px; }
    .compact-toggle button, .toolbar-action-btn { white-space: nowrap !important; font-size: 16px !important; padding: 10px 16px !important; }
    .toc-menu { width: 260px !important; } 
    .toc-menu h4 { font-size: 17px !important; } 
    .toc-menu a { font-size: 16px !important; padding: 12px 10px !important; }
    .tag-badge-user, .tag-badge-model { font-size: 14px !important; padding: 4px 8px !important; }
}

/* ★スマホ版の分岐をここに一本化！ */
@media (max-width: 768px) {
    /* ヘッダー周り */
    .app-header-full { padding: 15px 10px; }
    .header-title-area .title { font-size: 20px; }
    .header-user-area { position: static; transform: none; margin-top: 15px; width: 100%; justify-content: center; }
    .control-panel > div { flex-direction: column; width: 100% !important; }
    
    /* ツールバー調整 */
    .floating-toolbar { 
        width: 98% !important; 
        padding: 8px !important; 
        gap: 6px !important; 
        border-radius: 16px !important; 
        justify-content: space-around !important; 
        flex-wrap: wrap !important; 
        /* ボトムナビの上に配置 */
        bottom: calc(65px + env(safe-area-inset-bottom, 0px)) !important; 
    }
    .toolbar-divider { display: none; }
    .compact-toggle button { padding: 6px 12px !important; font-size: 12px !important; }
    .pen-tools-compact { gap: 4px !important; }
    .pen-icon-label { width: 30px !important; height: 30px !important; }
    .toolbar-action-btn { padding: 6px 10px !important; font-size: 12px !important; }

    /* チャットウィンドウ、掲示板サイドバーの幅調整 */
    .chat-window { width: 90%; right: 5%; bottom: calc(75px + env(safe-area-inset-bottom, 0px)); }
    .discussion-sidebar { width: 100%; right: -100%; }

    /* PC専用UIを非表示 */
    .pc-side-panel, .pc-vertical-tabs, #zunou-sensei-btn { display: none !important; }
    
    /* ボトムナビの表示 */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #fff;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        animation: gentleGlow 3s infinite ease-in-out; /* ★共通のアニメーションを適用 */
        z-index: 1000;
        justify-content: space-around;
        padding: 8px 0;
        padding-bottom: env(safe-area-inset-bottom, 8px); 
    }
    .nav-item { text-align: center; cursor: pointer; flex: 1; color: #555; transition: 0.2s; }
    .nav-item:active { transform: scale(0.9); color: var(--primary-color); }
    .nav-icon { font-size: 20px; margin-bottom: 3px; }
    .nav-label { font-size: 10px; font-weight: bold; }

    /* スクロール時の余白確保 */
    body { padding-bottom: 200px !important; } 
}

/* PC等、画面幅が広い時に本文が左目次と被らないように少し右にズラす */
/* PC等、画面幅が広い時に本文を中央に配置 */
@media (min-width: 1100px) {
    .container { margin-left: auto; margin-right: auto; max-width: 800px; }
}