/* ==================================================
   Recipi 共通スタイル（カフェ風デザイン）

   目次（Ctrl + F で「== 番号.」を検索すると、その章に飛べる）
   == 1.  基本設定（色・文字・大きさの変数）
   == 2.  全体（body・見出し・リンク・アイコン）
   == 3.  ページの枠（入れ物・ページの見出し・戻るリンク）
   == 4.  ボタン
   == 5.  入力欄・フォームの部品
   == 6.  表
   == 7.  小さな部品（カード・チップ・ラベル・お知らせ・タブ・アバター）
   == 8.  ヘッダー（スマホでは画面下のメニュー）
   == 9.  ログイン・新規登録
   == 10. ホーム（ヒーロー・検索・カテゴリ・並び順）
   == 11. レシピカード
   == 12. ランキング
   == 13. レシピ詳細（材料・作り方・メモ・投稿者・つくれぽ・コメント）
   == 14. レシピ投稿フォーム
   == 15. マイページ・プロフィール
   == 16. 料理ランク（レベル・今週の目標・称号・枠・エンブレム）
   == 17. 献立
   == 18. 食材管理（一覧・作れるレシピ・在庫に追加）
   == 19. 買い物リスト
   == 20. 調理中モード
   == 21. AI（会話の表示・献立の登録）
   == 22. 一覧のいいね・カテゴリの写真・写真が全面のレシピカード
   == 23. 称号・料理レベル・プロフィールの枠（つやのある金属・光の演出）

   スマホ用の調整（画面の幅が 768px 未満）は、それぞれの章の最後に書いている
   ================================================== */


/* ==================================================
   == 1. 基本設定
   --名前 は CSS変数。色を変えたいときはここだけ直せば、全画面に反映される
   ================================================== */
:root {
    /* 背景・面 */
    --bg: #f7efe4;              /* ページの背景（クリーム） */
    --surface: #fffaf3;         /* カードなどの面 */
    --surface-2: #f1e5d4;       /* 表の見出し・控えめな面 */

    /* 文字 */
    --text: #3d2a1e;            /* 本文（こげ茶） */
    --text-muted: #8b7462;      /* 補足の文字 */

    /* メインの色（コーヒーブラウン） */
    --primary: #7b4a2c;
    --primary-dark: #5c351e;
    --primary-light: #f3e3d1;   /* 選択中・ホバーの薄い茶色 */

    /* 線・影 */
    --border: #e4d4bf;
    --shadow: 0 2px 10px rgba(92, 53, 30, 0.08);
    --shadow-strong: 0 8px 24px rgba(92, 53, 30, 0.16);

    /* 状態の色 */
    --danger: #c0533a;          /* 期限切れ・エラー */
    --danger-bg: #fbe8e2;
    --warning: #c97a17;         /* 期限間近 */
    --warning-bg: #fdf1dc;
    --success: #5a8a47;         /* 完了 */
    --success-bg: #e9f2e2;

    /* 料理ランクの色（Apex のランクの色をイメージ） */
    --rank-rookie:   #8a7966;
    --rank-bronze:   #b0703f;
    --rank-silver:   #aab4be;
    --rank-gold:     #e1b13a;
    --rank-platinum: #47b5b8;
    --rank-diamond:  #3f8fe8;
    --rank-master:   #9a55d6;
    --rank-predator: #e0302f;

    /* 形 */
    --radius: 14px;
    --radius-sm: 8px;
    --radius-pill: 999px;

    /* 文字の種類 */
    --font-base: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
    --font-hand: "Klee One", var(--font-base);

    /* ヘッダー・下部メニューの高さ */
    --header-height: 60px;
    --bottom-nav-height: 64px;
}


/* ==================================================
   == 2. 全体
   ================================================== */

/* 余白の計算に枠線も含める（幅の指定どおりの大きさになる） */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-base);
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    /* 区切りのない長い英数字（URL など）も、枠からはみ出さずに折り返す */
    overflow-wrap: anywhere;
}

h1, h2, h3 {
    color: var(--primary-dark);
    line-height: 1.4;
    font-weight: 700;
}

h1 {
    font-size: 1.6rem;
    margin: 24px auto 16px;
}

h2 {
    font-size: 1.25rem;
    margin: 28px auto 12px;
}

h3 {
    font-size: 1.05rem;
    margin: 20px auto 8px;
}

a {
    color: var(--primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--primary-dark);
}

hr {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 20px 0;
}

img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

small {
    color: var(--text-muted);
}

/* アイコン（Material Symbols）の大きさと位置をそろえる */
.material-symbols-rounded {
    font-size: 1.25em;
    line-height: 1;
    vertical-align: -0.2em;
    user-select: none;
}

/* アイコンを塗りつぶしの形にする（Material Symbols の機能） */
.material-symbols-rounded.is-filled { font-variation-settings: "FILL" 1; }

/* class="is-hidden" を付けると隠れる（JavaScriptで付けたり外したりする） */
.is-hidden { display: none !important; }

/* 画面には見えないが、存在はしている（クリックやファイル選択は動く） */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ----- 文字の色 ----- */
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }

@media (max-width: 767px) {
    body {
        font-size: 14px;
        /* 画面下のメニューに中身が隠れないよう、下に余白を空ける */
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    }

    h1 {
        font-size: 1.35rem;
    }
}


/* ==================================================
   == 3. ページの枠
   ================================================== */

/* ページの中身の入れ物（画面は <main class="container"> で囲む） */
.container {
    max-width: 1080px;
    margin: 0 auto;              /* 左右の余白を自動にして、中央に置く */
    padding: 0 16px 48px;
}

/* 読み物の画面は少しせまく */
.container--narrow { max-width: 760px; }

/* 献立は7列並べるので、ほかの画面より広く */
.container--wide { max-width: 1200px; }

/*
   <main> で囲んでいない画面のための予備：
   ヘッダー以外の「body の直下の要素」を中央寄せにする
*/
body > :not(.site-header):not(script):not(.hero):not(main) {
    max-width: 1080px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 16px;
    padding-right: 16px;
}

/* body 直下の表は、内側の余白を付けず、左右16pxずつ空けた幅にする
   （:not(.site-header) を付けているのは、上のルールより優先させるため） */
body > table:not(.site-header) {
    padding: 0;
    width: calc(100% - 32px);
    max-width: calc(1080px - 32px);
}

/* body 直下のリンクは、1行の大きさにして左端をそろえる */
body > a:not(.site-header) {
    display: block;
    width: fit-content;
    max-width: none;
    margin-left: max(16px, calc((100% - 1080px) / 2 + 16px));
    padding: 0;
}

/* ページの見出し（アイコン＋文字） */
.page-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 24px 0 16px;
    font-size: 1.5rem;
}

.page-title .material-symbols-rounded { font-size: 1.6rem; }

/* 見出しの帯（左に戻るリンクや見出し、右にボタン） */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 20px 0 16px;
}

/* ボタンが2つ以上並ぶ見出し */
.page-head__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-weight: 700;
    text-decoration: none;
}

/* 見出しの行（左にタイトル、右にリンク） */
.section-head {
    display: flex;
    flex-wrap: wrap;                  /* 狭い画面で1行に入らないときは、右側のボタンを次の行に送る */
    align-items: center;
    justify-content: space-between;   /* 左右の端に分ける */
    gap: 8px 12px;
    margin: 28px 0 12px;
}

/* 見出しの右側のボタン・リンクは、文字を折り返さない */
.section-head > .btn,
.section-head > button,
.section-head > a {
    white-space: nowrap;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 1.15rem;
    color: var(--primary-dark);
}

.section-title .material-symbols-rounded { color: var(--primary); }

/* 見出しが長いとき（長い検索語など）は、見出しの方を「…」で切って同じ行に収める */
.section-head .section-title {
    min-width: 0;
}

.section-head .section-title > span:not(.material-symbols-rounded) {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 開閉できる見出し（<details>）は、押せるように */
details > summary.section-title { cursor: pointer; }

.section-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

/* カードどうしの間隔 */
.section-card { margin: 20px 0; }

/* 補足の文字 */
.note {
    margin: 8px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}


/* ==================================================
   == 4. ボタン
   <button> はすべてこの見た目になる。リンクをボタンに見せたいときは class="btn"
   ================================================== */
button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 18px;
    border: 1px solid var(--primary);
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}

button:hover,
.btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

/* 押した瞬間に少し沈む */
button:active,
.btn:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 枠線だけのボタン（キャンセル・サブの操作） */
.btn--outline {
    background: var(--surface);
    color: var(--primary);
}

.btn--outline:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* 削除などの危ない操作 */
.btn--danger {
    background: var(--surface);
    border-color: var(--danger);
    color: var(--danger);
}

.btn--danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* ヘッダーなど、茶色い背景の上に置く白いボタン */
.btn--light {
    background: #fff;
    border-color: #fff;
    color: var(--primary-dark);
}

.btn--light:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--primary-dark);
}

/* 大きさの違い */
.btn--sm {
    padding: 4px 12px;
    font-size: 0.82rem;
}

.btn--wide { min-width: 200px; padding: 12px 28px; font-size: 1rem; }

/* 横幅いっぱいのボタン */
.btn--block {
    width: 100%;
    padding: 12px 18px;
    font-size: 1rem;
}

/* 「＋ 材料を追加」など */
.btn--add { margin: 10px 0 4px; }

/* アイコンだけの丸いボタン（削除など） */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
}

.icon-btn:hover { background: var(--primary-light); color: var(--primary-dark); }
.icon-btn--danger:hover { background: var(--danger-bg); color: var(--danger); }


/* ==================================================
   == 5. 入力欄・フォームの部品
   ================================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="file"],
select,
textarea {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 100%;
}

textarea {
    width: 100%;
    resize: vertical;
}

/* 選択中の入力欄に、薄い茶色の枠を出す */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

input::placeholder,
textarea::placeholder {
    color: #b9a593;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);   /* チェックの色 */
    vertical-align: -3px;
}

/* ----- 入力欄＋説明のまとまり ----- */
.form-field {
    margin-bottom: 18px;
}

.form-field > label,
.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    color: var(--primary-dark);
}

/* .form-field の中の入力欄は横いっぱい */
.form-field input[type="text"],
.form-field input[type="email"], 
.form-field input[type="password"],
.form-field input[type="search"],
.form-field input[type="date"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
    width: 100%;
}

/* 短い入力欄（何人分など）。上の「横いっぱい」より後に書いて、こちらを優先させる */
.form-field input.input-short { width: 90px; }

/* 入力欄の下の小さな説明 */
.field-hint {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* 入力欄と文字を横に並べる（[ 2 ] 人分 など） */
.inline-field { display: flex; align-items: center; gap: 8px; }

/* 入力欄を2つ横に並べる */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* 「材料」「作り方」などの見出し：下に線を引いて区切る */
.form-section-title {
    margin: 28px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-size: 1.05rem;
}

/* 保存・キャンセルのボタンを中央に並べる */
.form-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

/* チェックボックス＋文字 */
.check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

/* エラーの一覧 */
.alert__list { margin: 0; padding-left: 1.2em; }

/* ----- セグメント（ラジオボタンを、つながったボタンの見た目にする） ----- */
.segmented {
    display: inline-flex;
    padding: 4px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
}

.segmented label {
    margin: 0;
    cursor: pointer;
}

/* 本物の丸いラジオボタンは隠す（クリックは label が受け取るので、隠しても選べる） */
.segmented input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented label > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-weight: 700;
    transition: background 0.15s, color 0.15s;
}

/* チェックされたラジオの「すぐ後ろ」の span を茶色にする（+ は「すぐ隣の要素」という意味） */
.segmented input[type="radio"]:checked + span {
    background: var(--primary);
    color: #fff;
}

/* キーボードで選んでいるときも、どこにいるかわかるように */
.segmented input[type="radio"]:focus-visible + span {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    .form-row { grid-template-columns: 1fr; gap: 0; }
}


/* ==================================================
   == 6. 表
   HTML に border="1" が付いていても、ここで上書きして角丸のカード風にする
   ================================================== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin: 12px auto 24px;
}

th,
td {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-2);
    color: var(--primary-dark);
    font-size: 0.88rem;
    white-space: nowrap;
}

/* 最後の行は下線なし */
tbody tr:last-child td,
tbody tr:last-child th {
    border-bottom: none;
}

tbody tr:hover {
    background: #fffdf8;
}

/* 表の中のフォーム（削除ボタンなど）は横に並べる */
td form {
    display: inline;
}

/* 表の中のボタンは小さめに */
td button,
td .btn {
    padding: 4px 12px;
    font-size: 0.82rem;
}

/* 表の中の写真 */
td img {
    display: block;
    object-fit: cover;
    aspect-ratio: 4 / 3;
}

/* 表がはみ出すときは、表だけ横にスクロールさせる（ページ全体は横にずれない） */
.table-wrap {
    overflow-x: auto;
    margin: 12px 0;
}

/* 入れ物の中の表は、入れ物の余白だけにする（下に余白が二重にできないように） */
.table-wrap table { margin: 0; }

@media (max-width: 767px) {
    /* 表がはみ出すときは、表を .table-wrap で囲み、その中だけ横にスクロールさせる。
       （table を display: block にすると、中身が短いときに表の右側が空白になるため使わない） */
    th,
    td {
        padding: 8px;
        white-space: nowrap;
    }

    /* 1列目（材料名など）だけは折り返してよい。名前が長くても、ほかの列が画面に入るように */
    th:first-child,
    td:first-child {
        white-space: normal;
    }

    /* 1列目が細くなりすぎないように、幅 6em・高さ 0 の見えない部品を入れて最低幅にする
       （表のマスには min-width や width が効かず、1文字ずつ折り返すほど細くなってしまうため） */
    th:first-child::before,
    td:first-child::before {
        content: "";
        display: block;
        width: 6em;
    }
}


/* ==================================================
   == 7. 小さな部品
   ================================================== */

/* ----- カード（白っぽい面に角丸と影） ----- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

/* ----- チップ（カテゴリなどの小さなラベル） ----- */
.chip {
    display: inline-block;
    padding: 2px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
}

.chip--active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.chip--soft {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.chip--success {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e6f0de;
    border-color: #e6f0de;
    color: var(--success);
}

/* チップを折り返して並べる */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

/* ----- ラベル（何人分・カテゴリ・足りない材料） ----- */
/* 丸いラベル：うすいベージュの背景に、アイコンと文字を横並び */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;                /* 枠より長いときは、はみ出さずに折り返す */
    padding: 3px 10px 3px 8px;
    border-radius: var(--radius-pill);
    background: #f3e6d6;
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 700;
}

.tag .material-symbols-rounded {
    font-size: 1rem;
    font-variation-settings: "FILL" 1;   /* アイコンを塗りつぶしの形にする */
}

/* オレンジのラベル（足りない材料） */
.tag--warn {
    background: #fdebd5;
    color: var(--warning);
}

/* ----- お知らせ（エラー・完了など） ----- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    margin: 12px 0;
}

.alert--error {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert--warning {
    background: var(--warning-bg);
    color: #8a5309;
}

.alert--success {
    background: var(--success-bg);
    color: #3f6a2f;
}

.alert--info {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ----- 何も無いときの表示 ----- */
.empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
}

.empty.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.empty__icon {
    font-size: 3rem;
    opacity: 0.6;
}

/* ----- タブ（ランキングの期間など） ----- */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
}

.tabs a {
    padding: 6px 18px;
    border-radius: var(--radius-pill);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    white-space: nowrap;
}

.tabs a.is-active {
    background: var(--primary);
    color: #fff;
}

/* ----- 点線区切りのリスト ----- */
.simple-list {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
}

.simple-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

.simple-list li:last-child { border-bottom: none; }

/* ----- 写真が無いときの絵文字 ----- */
.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f3e3d1, #ead6bf);
    font-size: 2.6rem;
}

/* ----- 小さな投稿者名・いいね数（アイコン＋文字） ----- */
.mini-user,
.like-mini {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.mini-user .material-symbols-rounded,
.like-mini .material-symbols-rounded {
    font-size: 1.05rem;
}

.like-mini { color: #d0604a; }

/* いいね数（ランキングなど） */
.like-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #c0533a;
    font-weight: 700;
    white-space: nowrap;
}

/* ----- アバター（丸いプロフィール写真） ----- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;              /* 横に並べたとき、つぶれないようにする */
    overflow: hidden;            /* 丸からはみ出た写真を隠す */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f6e7d6;
    color: var(--primary);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar .material-symbols-rounded {
    font-size: 1.5rem;
    vertical-align: 0;
    font-variation-settings: "FILL" 1;
}

/* 大きさの違い */
.avatar--sm { width: 24px; height: 24px; }
.avatar--sm .material-symbols-rounded { font-size: 1rem; }

.avatar--md { width: 48px; height: 48px; }
.avatar--md .material-symbols-rounded { font-size: 2rem; }

.avatar--xl {
    width: 112px;
    height: 112px;
    background: #e7ddd2;
    color: #a8968a;
}
.avatar--xl .material-symbols-rounded { font-size: 4.5rem; }

@media (max-width: 767px) {
    .tag {
        padding: 2px 8px 2px 6px;
        font-size: 0.72rem;
    }
    .tag .material-symbols-rounded { font-size: 0.9rem; }
}


/* ==================================================
   == 8. ヘッダー
   ================================================== */
.site-header {
    position: sticky;            /* スクロールしても上に残る */
    top: 0;
    z-index: 100;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1080px;
    height: var(--header-height);
    margin: 0 auto;
    padding: 0 16px;
}

/* ----- ロゴ ----- */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    white-space: nowrap;
}

.brand:hover {
    color: #fff;
}

.brand .material-symbols-rounded {
    font-size: 1.6rem;
    font-variation-settings: "FILL" 1;   /* 塗りつぶしのアイコン */
}

/* ----- メニュー ----- */
.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;           /* ロゴ以外を右に寄せる */
}

/* バッジを、メニューの文字の右上に重ねるための基準 */
.site-nav a {
    position: relative;
}

.site-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    color: #f6e7d6;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.site-nav__link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* 今開いているページのメニュー */
.site-nav__link.is-active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 700;
}

/* 期限が近い食材の数のバッジ */
.nav-badge {
    position: absolute;
    top: 2px;
    right: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;               /* 1桁でも丸く、2桁以上は横に伸びる */
    height: 18px;
    padding: 0 5px;
    border: 2px solid var(--primary-dark);   /* ヘッダーの色で縁取りして、浮いて見えるように */
    border-radius: var(--radius-pill);
    background: #e0533c;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
}

/* タブレットくらいの幅（768〜1023px）では、メニューの左右の余白を詰めて1行に収める */
@media (min-width: 768px) and (max-width: 1023px) {
    .site-header__inner { gap: 10px; }
    .site-nav__link { padding: 6px 8px; }
}

/* ----- 右側（投稿ボタン・ユーザー） ----- */
.site-header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-header__text-link {
    color: #f6e7d6;
    font-size: 0.88rem;
    white-space: nowrap;
}

.site-header__text-link:hover {
    color: #fff;
}

/* ----- ユーザーメニュー（アイコンを押すと開く） -----
   <details> を使っているので JavaScript 不要 */
.user-menu {
    position: relative;
}

.user-menu > summary {
    list-style: none;            /* ▶ の印を消す */
    cursor: pointer;
}

.user-menu > summary::-webkit-details-marker {
    display: none;
}

/* ヘッダーのアバターは白い縁取り */
.user-menu .avatar { border: 2px solid rgba(255, 255, 255, 0.7); }

.user-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 180px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-strong);
    color: var(--text);
}

.user-menu__name {
    margin: 4px 8px 8px;
    font-weight: 700;
    color: var(--primary-dark);
}

.user-menu__panel a,
.user-menu__panel button {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    text-align: left;
}

.user-menu__panel a:hover,
.user-menu__panel button:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

@media (max-width: 767px) {
    /* ----- メニューを画面の下に移動 ----- */
    .site-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        justify-content: space-around;
        gap: 0;
        height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);   /* iPhone の画面下の余白 */
        margin: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 10px rgba(92, 53, 30, 0.08);
    }

    /* アイコンを上、文字を下に */
    .site-nav__link {
        flex: 1;
        flex-direction: column;
        gap: 0;
        padding: 6px 0;
        border-radius: 0;
        color: var(--text-muted);
        font-size: 0.68rem;
    }

    .site-nav__link .material-symbols-rounded {
        font-size: 1.6rem;
        vertical-align: 0;
    }

    .site-nav__link:hover {
        background: none;
        color: var(--primary);
    }

    .site-nav__link.is-active {
        background: none;
        color: var(--primary);
    }

    .site-nav__link.is-active .material-symbols-rounded {
        font-variation-settings: "FILL" 1;
    }

    /* バッジは、画面の下のメニューのアイコンの右上に出す */
    .nav-badge {
        top: 0;
        right: calc(50% - 22px);   /* 真ん中のアイコンの、少し右 */
        border-color: var(--surface);
    }

    /* ヘッダーは ロゴ | 右側 だけ */
    .site-header__actions {
        margin-left: auto;
    }
}


/* ==================================================
   == 9. ログイン・新規登録
   ================================================== */
.auth-page {
    display: flex;
    flex-direction: column;   /* カードの下にフッターを並べる */
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 16px;
    /* 料理写真の上に、クリーム色を半透明で重ねる。写真が無くても背景色で表示される */
    background:
        linear-gradient(rgba(247, 239, 228, 0.55), rgba(247, 239, 228, 0.55)),
        url("../images/background.jpg") center / cover no-repeat,
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 36px 32px 28px;
    border-radius: 20px;
    background: rgba(255, 250, 243, 0.96);
    box-shadow: var(--shadow-strong);
    text-align: center;
}

/* ログイン画面は body 直下の幅の設定を使わない */
body.auth-page > .auth-card {
    padding-left: 32px;
    padding-right: 32px;
    margin: 0;
}

/* 茶色の大きなロゴ */
.brand--large {
    color: var(--primary-dark);
    font-size: 2rem;
}

.brand--large:hover {
    color: var(--primary-dark);
}

.brand--large .material-symbols-rounded {
    font-size: 2.4rem;
}

.auth-card__lead {
    margin: 4px 0 20px;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    text-align: left;
}

/* アイコン付きの入力欄 */
.input-icon {
    position: relative;
    display: block;
}

.input-icon .material-symbols-rounded {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    vertical-align: 0;
}

.input-icon input {
    width: 100%;
    padding: 11px 12px 11px 42px;
}

.auth-card__link {
    display: block;
    margin-top: 8px;
    font-size: 0.88rem;
}

@media (max-width: 767px) {
    .auth-card {
        padding: 28px 20px 20px;
    }

    body.auth-page > .auth-card {
        padding-left: 20px;
        padding-right: 20px;
    }
}


/* ==================================================
   == 10. ホーム
   ================================================== */

/* ----- ヒーロー（写真の背景＋検索欄） ----- */
.hero {
    /* 背景は3枚重ね。上に書いたものほど手前に来る
       1枚目：左側をクリーム色で隠すグラデーション（文字を読みやすくする）
              幕が消える位置は、割合ではなく「文字と検索欄が並ぶ範囲」に合わせる。
              割合だと、画面を狭めたときに幕の範囲も縮み、右寄せの写真（オムライス）に幕がかかってしまう。
              max(380px, calc(50% - 160px))：狭い画面では左から380px、広い画面では中央より少し左まで
       2枚目：料理写真（右寄せで、エリアいっぱいに広げる）
       3枚目：写真が無いときの予備の色 */
    background:
        linear-gradient(90deg,
            rgba(247, 239, 228, 0.97) 0%,
            rgba(247, 239, 228, 0.85) max(380px, calc(50% - 160px)),
            rgba(247, 239, 228, 0) max(700px, calc(50% + 160px))),
        url("../images/hero.jpg") right center / cover no-repeat,
        linear-gradient(135deg, #f7efe4, #ead6bf);
}

/* 中身はほかのページと同じ幅で中央に置く */
.hero__inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 48px 16px 40px;
}

.hero__title {
    margin: 0;
    font-family: var(--font-hand);   /* 手書き風のフォント */
    font-size: 2.3rem;
    font-weight: 600;
    line-height: 1.5;
}

/* キャッチコピーの下の、手書き風の線 */
.hero__line {
    display: block;
    width: 220px;
    height: 10px;
    margin: 6px 0 12px;
    border-bottom: 3px solid #d39a5c;
    border-radius: 0 0 60% 40% / 0 0 100% 100%;
}

.hero__lead {
    margin: 0 0 24px;
    font-size: 0.95rem;
}

/* ----- 検索バー：白い丸い入れ物の中に、アイコン・入力欄・ボタンを横に並べる ----- */
.search-bar {
    display: flex;            /* 中身を横並びにする */
    align-items: center;      /* 縦の位置を真ん中にそろえる */
    gap: 8px;
    max-width: 560px;
    padding: 6px 6px 6px 18px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-strong);
}

.search-bar > .material-symbols-rounded {
    color: var(--text-muted);
}

/* 入力欄は残りの幅いっぱいに広げ、枠線は消す（白い入れ物の枠を使う） */
.search-bar input[type="search"] {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    font-size: 1rem;
}

.search-bar button {
    padding: 10px 24px;
    white-space: nowrap;      /* 「検索」が縦に折り返さないように */
}

/* ----- カテゴリのカード ----- */
/* grid：カードを格子状に並べる。
   auto-fill + minmax(96px, 1fr)：1枚96px以上で、入るだけ横に並べて幅を均等に広げる */
.category-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 12px;
}

.category-card {
    display: flex;
    flex-direction: column;   /* アイコンと名前を縦に並べる */
    align-items: center;
    gap: 6px;
    padding: 14px 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;   /* ふわっと動かす */
}

/* マウスを乗せると少し浮く */
.category-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
}

/* 絵文字を丸の中に入れる */
.category-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f6e6d3;
    font-size: 2rem;
}

/* 選んでいるカテゴリ */
.category-card.is-active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px var(--primary);
}

/* ----- レシピ一覧の並び順（新着順・人気順） ----- */
.sort-select {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;              /* 見出しが長くても、プルダウンは縮ませない */
    color: var(--text-muted);
}

.sort-select select {
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    font-weight: 700;
}

@media (max-width: 767px) {
    /* 文字が並ぶ左側だけ濃く、右へ行くほど薄くして、右側の写真（オムライス）が見えるようにする。
       写真も少し右寄せ（70%）にして、料理が右側に来るようにする */
    .hero {
        background:
            linear-gradient(90deg,
                rgba(247, 239, 228, 0.92) 0%,
                rgba(247, 239, 228, 0.7) 55%,
                rgba(247, 239, 228, 0.15) 100%),
            url("../images/hero.jpg") 70% center / cover no-repeat,
            var(--bg);
    }
    .hero__inner { padding: 28px 16px 24px; }
    .hero__title { font-size: 1.7rem; }
    .search-bar button { padding: 8px 16px; }

    /* カテゴリのカードを横1列にして、指で横にスクロールできるようにする */
    .category-cards {
        display: flex;
        overflow-x: auto;
        /* overflow を付けると、はみ出した部分（選んだカードの枠・浮く動き）が切れるので、
           内側に余白を空けてその場所を作る。左右はマイナスの margin で戻して、位置をそろえる */
        padding: 4px 4px 10px;
        margin: 0 -4px;
    }
    .category-card { flex: 0 0 84px; }   /* 縮ませず、幅84pxに固定する */
    .category-card__icon {
        width: 48px;
        height: 48px;
        font-size: 1.6rem;
    }
}


/* ==================================================
   == 11. レシピカード
   ================================================== */

/* 1枚220px以上で、入るだけ横に並べる（PCなら4列くらい） */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 40px;
}

.recipe-card {
    overflow: hidden;              /* 角丸からはみ出た写真を隠す */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}

.recipe-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-strong);
}

.recipe-card__link {
    display: block;
    color: inherit;                /* リンクの色にしない（親の文字色のまま） */
    text-decoration: none;
}

/* 写真の枠：position: relative にすると、中のカテゴリを枠の左上に重ねられる */
.recipe-card__photo {
    position: relative;
    aspect-ratio: 4 / 3;           /* 横4：縦3 の大きさにそろえる */
    background: var(--surface-2);
}

.recipe-card__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;             /* 縦横の比率を保ったまま、枠いっぱいに切り抜く */
    display: block;
}

/* position: absolute：写真の枠（relative）を基準に、左上から10pxの位置に置く */
.recipe-card__chip {
    position: absolute;
    left: 10px;
    top: 10px;
    background: rgba(255, 250, 243, 0.92);
}

.recipe-card__body {
    padding: 12px 14px 14px;
}

/* タイトルが長いときは2行で「…」にする */
.recipe-card__title {
    margin: 0 0 8px;
    font-size: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* カードの一言：長い説明は2行で「…」にして、カードの高さがバラバラにならないようにする */
.recipe-card__desc {
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;          /* 2行まで */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 何人分・カテゴリのラベル */
.recipe-card__tags {
    display: flex;
    flex-wrap: wrap;            /* 入りきらなければ次の行へ */
    gap: 6px;
    margin: 0 0 10px;
}

/* 下の段：投稿者（左）といいね数（右） */
.recipe-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* 下の段はリンクの外に出したので、余白をここで付ける */
.recipe-card .recipe-card__meta {
    padding: 0 14px 12px;
}

/* 投稿者名のリンク：普段は灰色、マウスを乗せると下線 */
.recipe-card a.mini-user {
    color: var(--text-muted);
    text-decoration: none;
    min-width: 0;
}

.recipe-card a.mini-user:hover { text-decoration: underline; }

/* 名前が長いときは「…」 */
.recipe-card a.mini-user > span:last-child {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* スマホ：2列に固定し、文字を小さく、一言は1行に */
@media (max-width: 767px) {
    .recipe-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .recipe-card__body { padding: 10px; }
    .recipe-card__title { font-size: 0.9rem; }
    .recipe-card__desc {
        font-size: 0.78rem;
        -webkit-line-clamp: 1;
        line-clamp: 1;
    }
    .recipe-card .recipe-card__meta { padding: 0 10px 10px; }
}


/* ==================================================
   == 12. ランキング
   ================================================== */

/* 期間のタブを3等分して、中央に置く */
.tabs--wide {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    max-width: 480px;
    margin: 0 auto 20px;
}

.tabs--wide a { text-align: center; }

.ranking-list {
    list-style: none;            /* ol の「1. 2. 3.」を消す（自分でバッジを付けるので） */
    margin: 0;
    padding: 6px 0;
}

/* 1行 ＝ 順位 | 写真 | レシピ名 | いいね数 の4列 */
.ranking-item {
    display: grid;
    grid-template-columns: 52px 96px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border);
}

.ranking-item:last-child { border-bottom: none; }

/* 1〜3位は背景を少し明るく */
.ranking-item.is-top { background: #fff6e8; }

/* 順位のバッジ：王冠（後ろ）と数字（前）を重ねる */
.rank-badge {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 40px;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1.1rem;
}

.rank-badge__crown {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.rank-badge__num { position: relative; }   /* relative を付けると王冠より手前に出る */

/* 王冠の上の数字は、白くして少し上にずらす */
.is-top .rank-badge__num {
    margin-top: 10px;
    color: #fff;
    font-size: 0.95rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.rank-1 .rank-badge__crown { color: #e5b72c; }   /* 金 */
.rank-2 .rank-badge__crown { color: #a9b1bb; }   /* 銀 */
.rank-3 .rank-badge__crown { color: #c98a52; }   /* 銅 */

/* 写真 */
.ranking-item__photo {
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.ranking-item__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ranking-item__photo .photo-placeholder { font-size: 1.8rem; }

/* レシピ名（長ければ1行で「…」） */
.ranking-item__body {
    display: flex;
    flex-direction: column;
    min-width: 0;                /* これが無いと「…」が効かず、はみ出す */
}

.ranking-item__title {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

@media (max-width: 767px) {
    .ranking-item {
        grid-template-columns: 40px 72px minmax(0, 1fr) auto;
        gap: 10px;
        padding: 10px 12px;
    }
}


/* ==================================================
   == 13. レシピ詳細
   ================================================== */

/* 写真（左）と情報（右）を同じ幅の2列に */
.recipe-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.recipe-detail__photo {
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    box-shadow: var(--shadow-strong);
    background: var(--surface-2);
    /* sticky：スクロールしても、ヘッダーのすぐ下で写真が止まって見え続ける（PC） */
    position: sticky;
    top: calc(var(--header-height) + 16px);
}

.recipe-detail__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.recipe-detail__photo .photo-placeholder { font-size: 5rem; }

.recipe-detail__title {
    margin: 0 0 4px;
    font-size: 1.7rem;
}

/* pre-line：説明に入っている改行を、そのまま改行として表示する */
.recipe-detail__desc {
    margin: 8px 0 16px;
    white-space: pre-line;
}

/* ----- 投稿者：写真＋名前（左）、投稿・更新の日時（右の端） ----- */
.author-row {
    display: flex;
    align-items: center;
    justify-content: space-between;   /* 左右の端に分ける */
    flex-wrap: wrap;                  /* せまい画面では日時が下の行に回る */
    gap: 8px 16px;
}

.author-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}

.author-link:hover strong { text-decoration: underline; }

/* 投稿・更新を横に並べる。文字の大きさはふつう、色は少し薄く */
.author-row__dates {
    display: flex;
    flex-wrap: wrap;               /* せまい画面では、更新が下の行に回る */
    justify-content: flex-end;     /* 右に寄せる */
    gap: 4px 16px;                 /* 投稿と更新の間をあける */
    color: var(--text-muted);
}

/* ----- 材料 ----- */
.ingredients-box { margin: 16px 0; }

.ingredients-box__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

/* 材料の一覧：名前は左、分量は右、点線で区切る */
.ingredient-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ingredient-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 4px;
    border-bottom: 1px dashed var(--border);
}

.ingredient-list li span:last-child {   /* 分量（2つ目の span）を太字に */
    font-weight: 700;
    white-space: nowrap;
}

/* 人数の −［2］＋ */
.stepper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stepper input[type="number"] {
    width: 56px;
    padding: 4px 6px;
    text-align: center;
}

.stepper__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary);
    text-decoration: none;
}

.stepper__btn:hover { background: var(--primary-light); }

/* ----- いいね・献立に追加を横に2つ並べる ----- */
.recipe-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0 8px;
}

/* 編集・削除は右寄せ */
.owner-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

/* ----- 作り方：丸い番号付きのリスト ----- */
.steps {
    list-style: none;          /* ol のもとの「1.」は消して、自分で丸い番号を描く */
    counter-reset: step;       /* 「step」という数える変数を 0 にする */
    margin: 0;
    padding: 0;
}

.steps li {
    counter-increment: step;   /* li が1つ出るたびに step を1増やす */
    position: relative;
    padding: 10px 0 10px 44px; /* 左を空けて、番号の丸を置く場所を作る */
    border-bottom: 1px dashed var(--border);
}

.steps li:last-child { border-bottom: none; }

/* ::before：li の文字の前に飾りを足す。content: counter(step) で今の番号を表示 */
.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ----- メモ（付箋のような色で、作り方と区別する） ----- */
.recipe-memo {
    background: #fff8e6;
    border-color: #f0dfb4;
}

.recipe-memo__text {
    margin: 0;
    white-space: pre-line;      /* 入力された改行をそのまま表示 */
    overflow-wrap: anywhere;    /* 長いURLなどもはみ出さずに折り返す */
}

/* ----- つくれぽ ----- */
/* 見出しの横の「〇人が作りました」 */
.report-count {
    margin-left: 4px;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: #fff3e2;
    color: #c0533a;
    font-size: 0.8rem;
    font-weight: 700;
}

/* 写真付きのつくれぽを横に並べる（入りきらなければ横にスクロール） */
.report-gallery {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
}

.report-card {
    flex: 0 0 160px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    scroll-snap-align: start;
    transition: transform 0.15s, box-shadow 0.15s;
}

.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-strong); }

.report-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.report-card__user {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

/* ----- コメント ----- */
/* 1件ずつを点線で区切る */
.comment {
    padding: 12px 0;
    border-bottom: 1px dashed var(--border);
}

.comment__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.comment__user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    text-decoration: none;
}

.comment__user:hover strong { text-decoration: underline; }
.comment__action { font-size: 0.85rem; }

/* pre-line：入力された改行をそのまま表示。anywhere：長い英数字でもはみ出さずに折り返す */
.comment__text {
    margin-top: 4px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

/* コメントの写真 */
.comment__photo {
    display: block;
    width: 100%;
    max-width: 280px;
    margin-top: 8px;
    border-radius: var(--radius-sm);
}

/* つくれぽのコメントは、うすいオレンジの背景で目立たせる */
.comment.is-report {
    margin: 4px -12px;
    padding: 12px;
    border-bottom: none;
    border-radius: var(--radius);
    background: #fff8ee;
}

/* 「作りました」のラベル */
.report-badge {
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: #fde3c8;
    color: #b8562f;
    font-size: 0.75rem;
    font-weight: 700;
}

/* 投稿フォーム：入力欄は横いっぱい、ボタンは右寄せ */
.comment-form {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.comment-form textarea { width: 100%; }

/* 「作りました」と「写真を付ける」 */
.comment-form__options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.report-check { margin-top: 0; font-weight: 700; }

/* 選んだ写真の小さなプレビュー */
.comment-form__preview {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

/* スマホ：写真を上、情報を下の1列にする */
@media (max-width: 767px) {
    .recipe-detail {
        /* minmax(0, 1fr)：中の表などが広くても、列が画面の幅より広がらないようにする
           （1fr だけだと、中身の幅に合わせて列が広がり、ページ全体が横にはみ出す） */
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
    .recipe-detail__photo { position: static; }   /* スマホでは写真を止めない */
    .recipe-detail__title { font-size: 1.4rem; }
}


/* ==================================================
   == 14. レシピ投稿フォーム
   ================================================== */

/* 上の段：写真 280px ＋ 残り全部 */
.recipe-form__top {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
}

/* ----- 写真の選択枠（点線の四角） ----- */
.photo-drop {
    position: relative;          /* 中の透明な input を、この枠に重ねるため */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    aspect-ratio: 1 / 1;         /* 正方形 */
    border: 2px dashed #d5c2ab;
    border-radius: var(--radius);
    background: #fffdf9;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.photo-drop:hover { border-color: var(--primary); background: var(--primary-light); }

.photo-drop img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-drop__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
}

.photo-drop__placeholder .material-symbols-rounded { font-size: 2.6rem; }

/* 本物のファイル選択欄：枠いっぱいに広げて透明にする（クリックもドロップもここが受け取る） */
.photo-drop input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* ----- 材料の行：名前（残り全部）・分量 90px・単位 90px・削除 36px ----- */
.ingredient-rows { display: flex; flex-direction: column; gap: 8px; }

.ingredient-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px 90px 36px;
    gap: 8px;
    align-items: center;
}

.ingredient-row input { width: 100%; }

/* ----- 作り方の行：丸い番号・入力欄・削除。番号はレシピ詳細と同じCSSカウンター ----- */
.step-rows {
    list-style: none;
    counter-reset: step;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.step-row {
    counter-increment: step;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 36px;
    gap: 8px;
    align-items: center;
}

.step-row textarea { width: 100%; }

/* 行を足したり消したりしても、CSSが数え直すので番号は自動で 1, 2, 3… になる */
.step-row::before {
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.85rem;
}

/* スマホ：写真を上、入力欄を下の1列に。材料の列はせまく */
@media (max-width: 767px) {
    .recipe-form__top { grid-template-columns: 1fr; }
    .photo-drop { aspect-ratio: 4 / 3; }
    .ingredient-row {
        grid-template-columns: minmax(0, 1fr) 64px 64px 32px;
        gap: 6px;
    }
}


/* ==================================================
   == 15. マイページ・プロフィール
   ================================================== */

/* プロフィール 260px ＋ 数字のまとめ（残り全部） */
.mypage-top {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;
}

/* ----- プロフィールのカード ----- */
.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    /* 称号と2つのボタンを同じ幅・同じ高さにする（数字を変えるときは、ここだけ変えればよい） */
    --profile-btn-width: 220px;
    --profile-btn-height: 44px;
}

.profile-card__name { margin: 6px 0 0; font-size: 1.15rem; font-weight: 700; }
.profile-card__id { margin: 0 0 6px; color: var(--text-muted); font-size: 0.82rem; }

.profile-card .btn,
.profile-card .reward-badge {
    box-sizing: border-box;              /* 枠線の太さも含めて、幅と高さをそろえる */
    width: var(--profile-btn-width);
    height: var(--profile-btn-height);
    padding: 0 16px;                     /* 高さは height で決めるので、上下の余白は 0 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius-pill);
    font-size: 0.95rem;
    line-height: 1;
}

/* ボタンのアイコン */
.profile-card .btn .material-symbols-rounded {
    font-size: 1.25rem;
}

/* ----- アイコンを押すと写真を拡大 ----- */
/* ボタンの見た目を消して、写真だけに見せる */
.avatar-zoom {
    padding: 0;
    border: none;
    border-radius: 50%;
    background: none;
    cursor: zoom-in;                 /* マウスが虫めがねの形になる */
    transition: transform 0.15s;
}

.avatar-zoom:hover { transform: scale(1.04); }

/* 拡大表示のダイアログ */
.photo-dialog {
    position: relative;
    padding: 0;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    max-width: min(90vw, 560px);     /* 画面の90%か560pxの、小さいほう */
    overflow: visible;
}

/* ::backdrop：ダイアログの後ろ（画面全体）を暗くする部分 */
.photo-dialog::backdrop {
    background: rgba(40, 25, 15, 0.7);
}

.photo-dialog img {
    display: block;
    width: 100%;
    max-height: 80vh;                /* 縦長の写真でも、画面からはみ出さない */
    object-fit: contain;             /* 切り抜かずに、写真全体を表示する */
    border-radius: var(--radius);
    box-shadow: var(--shadow-strong);
}

/* 右上の × ボタン */
.photo-dialog__close {
    position: absolute;
    top: -14px;
    right: -14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow);
}

/* ----- 数字のまとめ（投稿・いいね・コメント） ----- */
.stats-card__title { margin: 0 0 14px; font-size: 1.05rem; }

/* 3つの数字を、縦線で区切って横に並べる */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 16px 0;
    border-radius: var(--radius);
    background: #fff;
}

/* 数字が2つのとき（投稿者のページ） */
.stats--2 { grid-template-columns: repeat(2, 1fr); }

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border-right: 1px solid var(--border);
}

.stat:last-child { border-right: none; }   /* 最後の数字の右には線を引かない */

.stat .material-symbols-rounded { color: var(--primary); font-size: 1.6rem; }
.stat__label { color: var(--text-muted); font-size: 0.82rem; }
.stat__value { font-size: 1.8rem; line-height: 1.2; }

/* ----- 一覧の切り替え（ボタンの形のタブを3つ並べる） ----- */
.mypage-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 20px 0;
}

.mypage-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--primary-dark);
    font-weight: 700;
    text-decoration: none;
}

.mypage-tab .material-symbols-rounded {
    color: var(--primary);
    font-variation-settings: "FILL" 1;
}

/* 選んでいるタブは茶色に塗りつぶす */
.mypage-tab.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.mypage-tab.is-active .material-symbols-rounded { color: #fff; }

/* ----- プロフィール編集 ----- */
/* 写真とボタンを縦に並べて中央に */
.profile-form__avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

/* 下の「パスワードを変更する」 */
.profile-form__password {
    margin: 20px 0 0;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
    text-align: center;
}

.profile-form__password a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
}

/* スマホ：プロフィールと数字を縦に、タブも縦に並べる */
@media (max-width: 767px) {
    .mypage-top { grid-template-columns: 1fr; }
    .mypage-tabs { grid-template-columns: 1fr; gap: 8px; }
    .mypage-tab { padding: 10px 14px; }
    .stat__value { font-size: 1.4rem; }
}


/* ==================================================
   == 16. 料理ランク
   ================================================== */

/* ----- ランクの色 -----
    ランクごとに「色」だけを変数で決めておき、枠・ラベル・バーはその変数を使う。
    こうすると、ランクが8つあっても、色の指定は1ランク1行で済む（色そのものは 1. 基本設定）
*/
.rank--rookie,   .frame--rookie   { --rank-color: var(--rank-rookie); }
.rank--bronze,   .frame--bronze   { --rank-color: var(--rank-bronze); }
.rank--silver,   .frame--silver   { --rank-color: var(--rank-silver); }
.rank--gold,     .frame--gold     { --rank-color: var(--rank-gold); }
.rank--platinum, .frame--platinum { --rank-color: var(--rank-platinum); }
.rank--diamond,  .frame--diamond  { --rank-color: var(--rank-diamond); }
.rank--master,   .frame--master   { --rank-color: var(--rank-master); }
.rank--predator, .frame--predator { --rank-color: var(--rank-predator); }

/* ランクの色（--rank-color）に白・黒を混ぜて、グラデーション用の明るい色・濃い色を作る */
[class*="rank--"],
[class*="frame--"] {
    --rank-light: color-mix(in srgb, var(--rank-color) 40%, #fff);
    --rank-dark:  color-mix(in srgb, var(--rank-color) 65%, #000);
}

/* ----- 料理レベルのカード ----- */
.level {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: #fff;
}

/* Lv.8 は赤い帯で目立たせる */
.level.rank--predator {
    background: linear-gradient(90deg, #ffe1dd, #fff6f4 70%);
    border: 1px solid #f2a59c;
    box-shadow: 0 0 16px rgba(224, 48, 47, 0.3);
}

.level__head {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 見出しのエンブレム */
.level__icon {
    display: inline-flex;
    font-size: 0;
}

/* 「Lv.2」の丸いラベル */
.level__lv {
    padding: 1px 10px;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
}

.level__title { font-size: 1.1rem; }

.level__points {
    margin-left: auto;              /* ポイントだけ右端へ */
    color: var(--text-muted);
    font-weight: 700;
}

/* バーの外枠（灰色）と中身 */
.level__bar {
    height: 10px;
    margin: 10px 0 6px;
    overflow: hidden;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
}

.level__fill {
    display: block;
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, #9cc46a, #e5b72c);
    transition: width 0.6s;
}

/* ランクが付いているときは、Lv のラベルとバーをランクの色にする */
.level[class*="rank--"] .level__lv   { background: var(--rank-color); }
.level[class*="rank--"] .level__fill { background: var(--rank-color); }

.level__next {
    display: block;
    color: var(--primary-dark);
    font-weight: 700;
}

.level__hint {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

/* ----- 今週の目標（スタンプ1週間分） ----- */
.stamp-card { margin-top: 20px; }

.stamp-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.stamp-card__stats {
    display: flex;
    gap: 16px;
    color: var(--text-muted);
}

.stamp-card__stats strong {
    color: var(--primary-dark);
    font-size: 1.3rem;
}

/* 7日分を横に並べる */
.stamp-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.stamp-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stamp-day__dow {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

/* スタンプの丸 */
.stamp-day__circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 72px;
    aspect-ratio: 1 / 1;
    border: 2px dashed var(--border);
    border-radius: 50%;
    background: #fff;
}

.stamp-day__date {
    color: var(--text-muted);
    font-size: 1rem;
}

.stamp-day__label {
    color: var(--text-muted);
    font-size: 0.72rem;
}

/* 作った日：ハンコを押したように */
.stamp-day.is-cooked .stamp-day__circle {
    border: 3px solid #e07b4f;
    background: #fff3e2;
    animation: stamp-in 0.35s ease-out;      /* ポンと押されたように見せる */
}

.stamp-day__mark {
    font-size: 2rem;
    transform: rotate(-12deg);
}

/* 今日 */
.stamp-day.is-today .stamp-day__circle { box-shadow: 0 0 0 3px #cfe3b0; }
.stamp-day.is-today .stamp-day__label { color: var(--success); font-weight: 700; }

/* まだ来ていない日は薄く */
.stamp-day.is-future { opacity: 0.5; }

/* 大きく出てから元の大きさに戻る（ハンコを押した感じ） */
@keyframes stamp-in {
    from { transform: scale(1.4); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* 1週間の目標のバー */
.stamp-goal { margin-top: 16px; }

.stamp-goal__text {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.9rem;
}

/* ----- 称号のラベル（エンブレム＋称号） ----- */
.reward-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: #fff8e6;
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 700;
}

/* ランクの色にする */
.reward-badge[class*="rank--"] {
    background: color-mix(in srgb, var(--rank-color) 15%, #fff);   /* ランクの色を薄くした背景 */
    border: 1px solid var(--rank-color);
    color: color-mix(in srgb, var(--rank-color) 70%, #000);        /* 少し濃くした文字 */
}

/* ----- アイコンの枠（金属の光沢のあるグラデーションの輪） ----- */
/*
    @property：CSS の変数に「角度」という型を教える。
    型がわかると、アニメーションで 0deg → 360deg と滑らかに変化させられる（光が回る）
*/
@property --frame-angle {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

/*
    枠のしくみ：
      border を透明にして、そこに背景のグラデーションを見せる。
      padding-box（内側）はふつうの背景色、border-box（枠の部分）は金属っぽいグラデーション。
      conic-gradient：中心からぐるっと一周する向きのグラデーション。明・暗を交互に置くと、金属の光沢に見える
*/
.avatar[class*="frame--"] {
    --frame-width: 3px;
    --frame-glow: 0px;
    border: var(--frame-width) solid transparent;
    background:
        linear-gradient(#e7ddd2, #e7ddd2) padding-box,
        conic-gradient(from var(--frame-angle),
            var(--rank-light), var(--rank-color) 20%, var(--rank-dark) 35%,
            var(--rank-color) 50%, var(--rank-light) 65%, var(--rank-dark) 85%, var(--rank-light)) border-box;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.12),                      /* 枠の外側の細い影（輪郭をくっきり） */
        0 0 var(--frame-glow) var(--rank-color);            /* 光（プラチナ以上） */
}

/* アイコンの大きさに合わせて、枠の太さを変える */
.avatar--sm[class*="frame--"] { --frame-width: 2px; }
.avatar--md[class*="frame--"] { --frame-width: 3px; }
.avatar--xl[class*="frame--"] { --frame-width: 6px; }

/* 光る：プラチナ（Lv.5）から。上のランクほど強く */
.avatar.frame--platinum { --frame-glow: 8px; }
.avatar.frame--diamond  { --frame-glow: 12px; }
.avatar.frame--master   { --frame-glow: 16px; }
.avatar.frame--predator { --frame-glow: 20px; }
.avatar--xl.frame--platinum { --frame-glow: 16px; }
.avatar--xl.frame--diamond  { --frame-glow: 22px; }
.avatar--xl.frame--master   { --frame-glow: 28px; }
.avatar--xl.frame--predator { --frame-glow: 34px; }

/* 光が輪の上をゆっくり回る：ダイヤ（Lv.6）から。速いと目が疲れるので、ゆっくりにしている */
@keyframes frame-spin {
    to { --frame-angle: 360deg; }
}

.avatar.frame--diamond,
.avatar.frame--master   { animation: frame-spin 10s linear infinite; }
.avatar.frame--predator { animation: frame-spin 8s linear infinite; }

/* ----- ランクのエンブレム（画像） ----- */
.rank-emblem {
    flex-shrink: 0;
    object-fit: contain;     /* 縦横の比率を保ったまま、枠に収める */
}

/* 称号のラベルの中のエンブレム：ラベルの高さに収める */
.reward-badge .rank-emblem {
    width: 22px;
    height: 22px;
}

/* Lv.8 だけ、ラベルの縁から少しだけ大きく出す（上下に余白を取らずに、ラベルの高さは変えない） */
.reward-badge .rank-emblem.rank--predator {
    width: 26px;
    height: 26px;
    margin: -4px 0 -4px -4px;
}

/* マイページのプロフィールのカードでは、ラベルが大きいのでエンブレムも大きく
   （上の2つより後に書いて、こちらを優先させる） */
.profile-card .reward-badge .rank-emblem {
    width: 30px;
    height: 30px;
}

/* Lv.8 は羽と王冠がある分、少しだけ大きく。はみ出した分はマイナスの余白で打ち消して、高さは変えない */
.profile-card .reward-badge .rank-emblem.rank--predator {
    width: 36px;
    height: 36px;
    margin: -3px 0;
}

/* ----- エンブレムの光（プラチナ＝Lv.5 から） -----
    drop-shadow：画像の「形にそって」影や光を付ける（透明な部分には付かない）。
    色はランクの色（--rank-color）を使うので、プラチナは青緑、ダイヤは青…と自動で変わる
*/
.rank-emblem.rank--platinum,
.rank-emblem.rank--diamond,
.rank-emblem.rank--master,
.rank-emblem.rank--predator {
    --glow-size: 6px;
    filter: drop-shadow(0 0 var(--glow-size) var(--rank-color));
    animation: emblem-glow 2.4s ease-in-out infinite;
}

/* 上のランクほど強く光る */
.rank-emblem.rank--diamond  { --glow-size: 8px; }
.rank-emblem.rank--master   { --glow-size: 10px; }
.rank-emblem.rank--predator { --glow-size: 12px; animation-duration: 3s; }     /* プレデターはゆっくり脈打つ */

/* 称号のラベルの中は小さいので、光も控えめにする */
.reward-badge .rank-emblem.rank--platinum,
.reward-badge .rank-emblem.rank--diamond,
.reward-badge .rank-emblem.rank--master,
.reward-badge .rank-emblem.rank--predator {
    --glow-size: 4px;
}

/* 光の強さを、ゆっくり大きく・小さくする */
@keyframes emblem-glow {
    0%, 100% { filter: drop-shadow(0 0 calc(var(--glow-size) * 0.5) var(--rank-color)); }
    50%      { filter: drop-shadow(0 0 var(--glow-size) var(--rank-color))
                       drop-shadow(0 0 calc(var(--glow-size) * 0.4) #fff); }
}

/* 動きを減らす設定にしている人には、アニメーションを止める（目が疲れる人への配慮）
   エンブレムの光は付けたまま、脈打つ動きだけ止める */
@media (prefers-reduced-motion: reduce) {
    .avatar[class*="frame--"] { animation: none; }
    .rank-emblem { animation: none; }
}

@media (max-width: 767px) {
    .stamp-week { gap: 4px; }
    .stamp-day__mark { font-size: 1.4rem; }
}


/* ==================================================
   == 17. 献立
   ================================================== */

/* ----- 週の移動 ----- */
.week-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.week-nav__shopping { margin-left: auto; }   /* 買い物リストだけ右端へ */

/* ----- 7日分の列（せまい画面では横にスクロール） ----- */
.week {
    display: grid;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;   /* 横スクロールが1日ずつピタッと止まる */
}

.day {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    scroll-snap-align: start;
}

/* 今日の列は緑色 */
.day.is-today { border-color: #b6cf8f; background: #f3f8e8; }

.day__head {
    padding: 10px 6px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--primary-dark);
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
}

.day.is-today .day__head { background: #dcebc3; }
.day__date { display: block; font-size: 1.05rem; }
.day__dow { font-size: 0.85rem; }

/* ----- 朝・昼・夜の枠 ----- */
.slot {
    padding: 8px;
    border-bottom: 1px dashed var(--border);
}

.slot:last-child { border-bottom: none; }

.slot__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.slot__label {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.85rem;
}

.slot__label .material-symbols-rounded { font-size: 1.05rem; color: var(--warning); }

/* 枠の右上の小さな「＋」 */
.slot__add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: var(--text-muted);
    text-decoration: none;
}

.slot__add:hover { background: var(--primary-light); color: var(--primary-dark); }
.slot__add .material-symbols-rounded { font-size: 1.1rem; }

/* ----- 献立1つ（名前 → 写真 → 作った） ----- */
.plan {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.plan__link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    color: var(--text);
    text-decoration: none;
}

/* 名前は1行で「…」 */
.plan__name {
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.4;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.plan__photo {
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.plan__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

/* マウスを乗せると写真が少し大きくなる（押せることがわかるように） */
.plan__link:hover .plan__photo img { transform: scale(1.05); }
.plan__photo .photo-placeholder { font-size: 1.8rem; }

.plan__cook { width: 100%; }

.plan__done {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 700;
}

.plan__done .material-symbols-rounded { font-size: 1.05rem; font-variation-settings: "FILL" 1; }

/* 作った献立の写真は少し薄く */
.plan.is-cooked .plan__photo { opacity: 0.6; }

/* ----- 献立の詳細 ----- */
.plan-detail {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.plan-detail__photo {
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    background: var(--surface-2);
}

.plan-detail__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plan-detail__photo .photo-placeholder { font-size: 4rem; }

.plan-detail__when {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    color: var(--text-muted);
    font-weight: 700;
}

.plan-detail__when .material-symbols-rounded { color: var(--warning); }
.plan-detail__title { margin: 4px 0 10px; }

.plan-detail__main-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

/* 変更・削除は、点線で区切って左寄せ */
.plan-detail .owner-actions {
    justify-content: flex-start;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

@media (max-width: 767px) {
    .week { grid-template-columns: repeat(7, 46%); }   /* 画面に約2日分ずつ見える */
    .week-nav__shopping { margin-left: 0; }
    .plan-detail { grid-template-columns: 1fr; }
}


/* ==================================================
   == 18. 食材管理
   ================================================== */

/* ----- 期限のお知らせ ----- */
.banner { align-items: center; }

/* 「すべて見る」を右端に */
.banner__link {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    color: var(--danger);
    font-weight: 700;
    white-space: nowrap;
}

/* ----- カテゴリのチップと並び順 ----- */
.filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

/* チップは1行に並べて、入りきらなければ横にスクロール */
.chip-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    flex: 1;
}

.chip-row .chip {
    flex-shrink: 0;
    padding: 4px 12px;
    white-space: nowrap;
}

.filters__sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    color: var(--text-muted);
}

/* ----- 食材の一覧 ----- */
.stock-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 1行 ＝ アイコン 52px｜名前（残り全部）｜数量（中身の幅）｜期限 150px｜操作（中身の幅） */
.stock-item {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto 150px auto;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.stock-item:last-child { border-bottom: none; }

/* 使い切った食材は薄く */
.stock-item.is-empty { opacity: 0.55; }

.stock-item__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    background: #f6e6d3;
    font-size: 1.8rem;
}

.stock-item__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stock-item__name {
    font-weight: 700;
    font-size: 1.02rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.stock-item__expiry {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}

.stock-item__expiry small { font-size: 0.75rem; }

.stock-item__actions { display: flex; }

/* 数量の −［150］＋ g */
.qty {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.qty input[type="number"] {
    width: 64px;
    padding: 4px 6px;
    text-align: center;
}

.qty__btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary);
}

.qty__btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.qty__btn .material-symbols-rounded { font-size: 1.05rem; }

.qty__unit {
    min-width: 2.5em;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ----- 期限が近い食材を使えるレシピ ----- */
.suggest-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
}

.suggest {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    text-decoration: none;
}

.suggest:hover { border-color: var(--primary); }

.suggest__photo {
    flex-shrink: 0;
    overflow: hidden;
    width: 64px;
    aspect-ratio: 4 / 3;
    border-radius: 6px;
    background: var(--surface-2);
}

.suggest__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.suggest__photo .photo-placeholder { font-size: 1.3rem; }
.suggest small { display: block; }

/* ----- 在庫で作れるレシピ ----- */
.cookable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

/* 1件：写真（左）＋ 料理名・そろっている数・足りない材料（右） */
.cookable {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.cookable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
}

.cookable__photo {
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.cookable__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cookable__photo .photo-placeholder { font-size: 2rem; }

.cookable__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.cookable__title { font-size: 1.02rem; }

.cookable__count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--success);
    font-size: 0.82rem;
    font-weight: 700;
}

.cookable__count .material-symbols-rounded { font-size: 1.05rem; }

.cookable__missing {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.cookable__missing-label {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ----- 買ったものを在庫に追加（確認画面） ----- */
.purchase-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

/* 1行：食材名｜数量｜単位｜カテゴリ｜期限の種類｜期限日｜× */
.purchase-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) 80px 70px minmax(0, 1.3fr) 110px 150px 36px;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.purchase-row input,
.purchase-row select { width: 100%; }

/* 見出しの行 */
.purchase-row--head {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

@media (max-width: 767px) {
    /* チップと並び順を縦に並べる */
    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    /*
        grid-template-areas：場所に名前を付けて、絵のように配置を決める書き方
        1行目：アイコン｜名前　｜操作
        2行目：アイコン｜数量　｜期限
    */
    .stock-item {
        grid-template-columns: 44px minmax(0, 1fr) auto;
        grid-template-areas:
            "icon main actions"
            "icon qty  expiry";
        gap: 6px 10px;
        padding: 12px;
    }

    .stock-item__icon { grid-area: icon; width: 44px; height: 44px; font-size: 1.5rem; }
    .stock-item__main { grid-area: main; }
    .stock-item__actions { grid-area: actions; }
    .qty { grid-area: qty; }
    .stock-item__expiry { grid-area: expiry; text-align: right; }

    /* 作れるレシピは1列に */
    .cookable-grid { grid-template-columns: 1fr; }
    .cookable { grid-template-columns: 90px minmax(0, 1fr); }

    /* 在庫に追加：1行目に食材名と×、2行目に数量・単位、3行目にカテゴリ、4行目に期限 */
    .purchase-row--head { display: none; }
    .purchase-row {
        grid-template-columns: 1fr 1fr 36px;
        grid-template-areas:
            "name name close"
            "qty  unit unit"
            "cat  cat  cat"
            "type date date";
    }
    .purchase-row > :nth-child(1) { grid-area: name; }
    .purchase-row > :nth-child(2) { grid-area: qty; }
    .purchase-row > :nth-child(3) { grid-area: unit; }
    .purchase-row > :nth-child(4) { grid-area: cat; }
    .purchase-row > :nth-child(5) { grid-area: type; }
    .purchase-row > :nth-child(6) { grid-area: date; }
    .purchase-row > :nth-child(7) { grid-area: close; }
}


/* ==================================================
   == 19. 買い物リスト（チェックすると取り消し線）
   ================================================== */
.check-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.check-list li {
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

.check-list li:last-child { border-bottom: none; }

/* チェックボックス・材料名・買う量を横に並べる。買う量は右端へ */
.check-list__item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.check-list__amount {
    flex-shrink: 0;                 /* 分量は縮めず、右端に残す */
    margin-left: auto;
    white-space: nowrap;
}

/* 材料名は縮められるようにする（長い名前でも、分量が画面の外に出ないように）。チェックボックスは縮めない */
.check-list__item > span { min-width: 0; }
.check-list__item > input { flex-shrink: 0; }

/* :has()：中のチェックボックスにチェックが入っている行だけに当てる */
.check-list__item:has(input:checked) {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* 在庫・使う献立の小さな文字は、チェックボックスの幅だけ右にずらして名前とそろえる */
.check-list__sub {
    display: block;
    margin-left: 28px;
}

/* ----- おまかせ献立 ----- */
.auto-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.auto-filter .form-label { margin: 0; }
.auto-filter__types { display: flex; gap: 14px; }
.auto-filter__types .check { margin-top: 0; }

.auto-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
}

/* 1行：チェック｜日付と枠｜写真｜料理名と理由 */
.auto-plan {
    display: grid;
    grid-template-columns: 24px 90px 96px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    transition: opacity 0.15s;
}

/* チェックを外した提案は薄くする（:has で「中のチェックが外れている行」を選ぶ） */
.auto-plan:has(input:not(:checked)) { opacity: 0.45; }

.auto-plan__when {
    display: flex;
    flex-direction: column;
    color: var(--primary-dark);
    font-weight: 700;
    line-height: 1.3;
}

.auto-plan__when small { display: flex; align-items: center; gap: 2px; }
.auto-plan__when .material-symbols-rounded { color: var(--warning); font-size: 1.05rem; }

.auto-plan__photo {
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.auto-plan__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auto-plan__photo .photo-placeholder { font-size: 1.8rem; }

.auto-plan__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.auto-plan .chips { margin: 0; }
.auto-plan .tag { white-space: normal; }   /* 材料が多いときは折り返す */

/* 緑のラベル（期限が近い食材を使える） */
.tag--good {
    background: var(--success-bg);
    color: var(--success);
}

/* スマホ：1行目に日付、2行目に写真と料理名 */
@media (max-width: 767px) {
    .auto-plan {
        grid-template-columns: 24px 80px minmax(0, 1fr);
        grid-template-areas:
            "check when  when"
            "check photo body";
        gap: 6px 10px;
    }
    .auto-plan > input       { grid-area: check; }
    .auto-plan__when         { grid-area: when; flex-direction: row; gap: 8px; }
    .auto-plan__photo        { grid-area: photo; }
    .auto-plan__body         { grid-area: body; }
}

/* ----- フォロワー一覧 ----- */
.follow-tabs { margin: 0 0 16px; }
.follow-tabs strong { margin-left: 4px; }

/* フォロワー・フォロー中の人数（プロフィールのカード） */
.follow-counts {
    display: flex;
    gap: 16px;
    margin: 0 0 6px;
    font-size: 0.85rem;
}

.follow-counts a {
    color: var(--text-muted);
    text-decoration: none;
}

.follow-counts a:hover { color: var(--primary-dark); }

.follow-counts strong {
    margin-right: 3px;
    color: var(--text);
    font-size: 1rem;
}

/* レシピ一覧の すべて／フォロー中 */
.feed-tabs { margin: 28px 0 0; }
.feed-tabs + .section-head { margin-top: 12px; }   /* タブのすぐ下の見出しは、間をつめる */


/* ==================================================
   == 20. 調理中モード（レシピ詳細。手順を1つずつ大きく表示する）
   ================================================== */
/* 調理中は、後ろのページがスクロールしないようにする */
body.is-cooking { overflow: hidden; }

.cook-mode {
    position: fixed;
    inset: 0;                       /* 画面いっぱい */
    z-index: 1000;                  /* ヘッダーや下部メニューより上 */
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
}

.cook-mode__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cook-mode__title {
    flex: 1;
    overflow: hidden;
    font-size: 1.1rem;
    white-space: nowrap;
    text-overflow: ellipsis;        /* 長い料理名は「…」で切る */
}

.cook-mode__count {
    color: var(--text-muted);
    font-weight: bold;
}

.cook-mode__steps {
    flex: 1;                        /* 残りの高さを全部使う */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.cook-mode__step {
    max-width: 720px;
    text-align: center;
}

.cook-mode__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 1.6rem;
    font-weight: bold;
}

.cook-mode__text {
    margin: 0;
    font-size: clamp(1.4rem, 4vw, 2.2rem);   /* 画面の幅に合わせて大きく */
    line-height: 1.6;
}

.cook-mode__timer {
    display: flex;
    justify-content: center;
    min-height: 44px;
}

#cookTimerButton {
    min-height: 56px;
    padding: 0 24px;
    font-size: 1.3rem;
}

.cook-mode__timer-display {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 28px;              /* まわりの余白を広げる */
    border-radius: var(--radius-pill);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 2.6rem;               /* 文字の大きさ（1.4rem → 2.6rem） */
}

/* タイマーのアイコン（⏱）も文字に合わせて大きくする */
.cook-mode__timer-display .material-symbols-rounded {
    font-size: 1em;
}

/* 時間になったら赤く光らせる（「止める」を押しやすいように、大きさは変えない） */
.cook-mode__timer-display.is-ringing {
    background: var(--danger-bg);
    color: var(--danger);
    animation: cook-ring 0.8s ease-in-out infinite;
}

@keyframes cook-ring {
    50% { box-shadow: 0 0 0 8px rgba(192, 83, 58, 0.35); }
}

@media (prefers-reduced-motion: reduce) {
    .cook-mode__timer-display.is-ringing { animation: none; }
}

.cook-mode__nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cook-mode__nav button {
    justify-content: center;
    min-height: 56px;               /* 料理中でも押しやすい大きさ */
    font-size: 1.1rem;
}


/* ==================================================
   == 21. AI（会話の表示・献立の登録）
   ================================================== */
/* 会話：質問は右、回答は左に、吹き出しのように並べる */
.ai-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.ai-chat__q,
.ai-chat__a {
    max-width: 90%;
    padding: 10px 14px;
    border-radius: var(--radius);
    line-height: 1.7;
    white-space: pre-line;          /* 改行をそのまま表示する */
}

.ai-chat__q {
    align-self: flex-end;
    background: var(--primary-light);
}

.ai-chat__a {
    align-self: flex-start;
    background: var(--surface-2);
}

/* 「会話をリセット」と「質問する」を横に並べる */
.ai-chat__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* AI の献立から登録する候補 */
.ai-picks {
    margin-top: 12px;
}

.ai-picks__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 12px;
    padding: 0;
    list-style: none;
}


/* ==================================================
   == 22. 一覧のいいね・カテゴリの写真・写真が全面のレシピカード
   ================================================== */

/* ----- レシピカードの写真の右上の ♡（押すとその場でいいね） ----- */
.recipe-card { position: relative; }   /* ♡ を重ねる基準 */

.card-like {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 250, 243, 0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    color: var(--primary-dark);
    text-decoration: none;
}

.card-like:hover {
    background: #fff;
    border: none;
    color: #d0604a;
}

.card-like:active { transform: scale(0.9); }
.card-like .material-symbols-rounded { font-size: 1.3rem; }

/* いいね済みは、塗りつぶしの赤いハート */
.card-like.is-liked { color: #d0604a; }
.card-like.is-liked .material-symbols-rounded { font-variation-settings: "FILL" 1; }

/* いいねしたとき、ハートがポンと弾む */
.card-like.is-pop .material-symbols-rounded { animation: heart-pop 0.5s ease-out; }

@keyframes heart-pop {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.4); }
    60%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

@media (max-width: 767px) {
    .card-like {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .card-like.is-pop .material-symbols-rounded { animation: none; }
}

/* ----- ホームのカテゴリ：写真があるときは、丸の中いっぱいに写真を出す ----- */
.category-card__icon.has-photo { overflow: hidden; }

.category-card__icon.has-photo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ----- レシピカード：写真をカードいっぱいに出し、文字を写真の上に重ねる -----
   HTML は今のまま（写真 → 料理名・タグ・ひとこと → 投稿者・いいね数）。
   写真がカードの大きさを決め、文字の部分（body・meta）は position: absolute で写真の下側に重ねる */
.recipe-card {
    border: none;
    background: #4e2e1b;            /* 写真を読み込むまでの色 */
}

.recipe-card__photo { aspect-ratio: 4 / 5; }   /* 少し縦長にして、写真を大きく見せる */

/* 写真の下半分に、だんだん濃くなる黒い影を重ねて、白い文字を読みやすくする */
.recipe-card__photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(20, 12, 6, 0) 35%,
        rgba(20, 12, 6, 0.4) 62%,
        rgba(20, 12, 6, 0.82) 100%);
    pointer-events: none;
}

/* 写真が無いレシピは、茶色の背景に絵文字（白い文字が読めるように）。
   絵文字は上のほうに置いて、下に重ねる料理名とぶつからないようにする */
.recipe-card .photo-placeholder {
    align-items: flex-start;
    padding-top: 18%;
    background: linear-gradient(135deg, #9a6a48, #4e2e1b);
}

/* 料理名・タグ・ひとこと：写真の下側に重ねる。下の余白は、投稿者・いいね数の段の分 */
.recipe-card__body {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    padding: 14px 14px 50px;
    color: #fff;
}

.recipe-card__title {
    color: #fff;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.recipe-card__desc {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.recipe-card__tags { margin-bottom: 8px; }
.recipe-card__tags .tag { background: rgba(255, 250, 243, 0.92); }

/* 投稿者・いいね数：いちばん下に重ねる（文字の部分より手前にして、押せるようにする） */
.recipe-card .recipe-card__meta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 0 14px 12px;
    color: #fff;
}

.recipe-card a.mini-user,
.recipe-card .like-mini {
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

/* スマホ（2列）：カードが小さいので、もう少し縦長にし、余白と文字を小さくする */
@media (max-width: 767px) {
    .recipe-card__photo { aspect-ratio: 3 / 4; }
    .recipe-card__body { padding: 10px 10px 42px; }
    .recipe-card__tags { gap: 4px; margin-bottom: 6px; }
    .recipe-card .recipe-card__meta { padding: 0 10px 10px; }
}


/* ==================================================
   == 23. 称号・料理レベル・プロフィールの枠（つやのある金属・光の演出）
   16章（料理ランク）の見た目を、ここで上書きする。色は16章の --rank-color・--rank-light・--rank-dark を使う。
   つやの作り方：
     ・金属：上が明るく、真ん中に影が入るグラデーション
     ・ガラスの反射：上半分に、白から透明になるグラデーションを重ねる（::before）
     ・光が走る：細い白い帯を、左から右へ動かす（::after）
   ================================================== */

/* --frame-glow（枠の外側の光の大きさ）に「長さ」という型を教える → 光が脈打つアニメーションができる */
@property --frame-glow {
    syntax: "<length>";
    inherits: false;
    initial-value: 0px;
}

/* ----- 23-1. 称号のラベル：金属のプレート＋ガラスの反射＋走る光 ----- */
.reward-badge[class*="rank--"] {
    position: relative;
    overflow: hidden;
    isolation: isolate;               /* 中の重ね順を、このラベルの中だけで決める */
    border: 1px solid var(--rank-dark);
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--rank-light) 55%, #fff) 0%,
        var(--rank-light) 22%,
        var(--rank-color) 50%,
        var(--rank-dark) 52%,
        var(--rank-color) 78%,
        var(--rank-light) 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),     /* 上のふちの光 */
        inset 0 -3px 4px rgba(0, 0, 0, 0.35),        /* 下のふちの影 */
        inset 0 0 0 1px rgba(255, 255, 255, 0.25),
        0 4px 14px color-mix(in srgb, var(--rank-color) 60%, transparent),
        0 0 18px color-mix(in srgb, var(--rank-light) 45%, transparent);
}

/* 上半分のガラスの反射 */
.reward-badge[class*="rank--"]::before {
    content: "";
    position: absolute;
    left: 6%;
    right: 6%;
    top: 2px;
    height: 48%;
    z-index: 0;
    border-radius: 999px 999px 40% 40% / 999px 999px 100% 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.15));
    pointer-events: none;
}

/* 数秒ごとに、白い光がプレートの上を走る */
.reward-badge[class*="rank--"]::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(105deg,
        transparent 30%, rgba(255, 255, 255, 0.25) 42%, rgba(255, 255, 255, 0.95) 50%,
        rgba(255, 255, 255, 0.25) 58%, transparent 70%);
    mix-blend-mode: screen;
    transform: translateX(-130%);
    animation: plate-shine 2.6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes plate-shine {
    0%, 55% { transform: translateX(-130%); }   /* しばらく止まってから */
    100%    { transform: translateX(130%); }    /* 左から右へ走る */
}

/* 文字とエンブレムは、反射より手前に出す */
.reward-badge > * { position: relative; z-index: 1; }

.reward-badge .rank-emblem {
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

/* Lv.8：深紅のプレートに明るい赤のふち。まわりが赤く脈打つ */
.reward-badge.rank--predator {
    border: 2px solid #ff8a7a;
    background: linear-gradient(180deg, #ff9a7e 0%, #ee4a3a 24%, #c41e1e 50%, #8a0f12 53%, #c8241f 80%, #f06a4f 100%);
    color: #fff0ee;
    animation: gold-pulse 4s ease-in-out infinite;
}

@keyframes gold-pulse {
    0%, 100% {
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 -3px 4px rgba(0, 0, 0, 0.35),
                    0 0 16px rgba(255, 70, 60, 0.75), 0 0 30px rgba(255, 70, 60, 0.35);
    }
    50% {
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 -3px 4px rgba(0, 0, 0, 0.35),
                    0 0 26px rgba(255, 70, 60, 0.95), 0 0 44px rgba(255, 70, 60, 0.5);
    }
}

/* ----- 23-2. 料理レベルのカード ----- */
.level[class*="rank--"] {
    position: relative;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--rank-color) 35%, #fff);
    background: linear-gradient(135deg, color-mix(in srgb, var(--rank-color) 12%, #fff), #fff 65%);
    box-shadow: 0 8px 22px color-mix(in srgb, var(--rank-color) 20%, transparent);
}

/* エンブレム：大きくして影と光を付け、ふわふわ浮かせる */
.level[class*="rank--"] .level__icon img {
    width: 58px;
    height: 58px;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35))
            drop-shadow(0 0 8px color-mix(in srgb, var(--rank-color) 70%, transparent));
    animation: emblem-float 3s ease-in-out infinite;
}

@keyframes emblem-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}

/* 「Lv.8」の丸いラベル：金属のプレート＋ガラスの反射 */
.level[class*="rank--"] .level__lv {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--rank-dark);
    background: linear-gradient(180deg, var(--rank-light), var(--rank-color) 50%, var(--rank-dark) 52%, var(--rank-color));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 2px 6px color-mix(in srgb, var(--rank-color) 45%, transparent);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-size: 0.85rem;
}

.level[class*="rank--"] .level__lv::before {
    content: "";
    position: absolute;
    left: 8%;
    right: 8%;
    top: 1px;
    height: 50%;
    border-radius: 999px 999px 40% 40% / 999px 999px 100% 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.1));
}

.level__title { font-size: 1.25rem; }

/* 進み具合のバー：太くして、くぼんだ溝に見せる */
.level .level__bar {
    height: 14px;
    background: #ece2d5;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.22);
}

/* バーの中身：ランクの色の金属に斜めの縞。縞が流れる */
.level[class*="rank--"] .level__fill {
    position: relative;
    background:
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.18) 0 8px, transparent 8px 16px),
        linear-gradient(180deg, var(--rank-light), var(--rank-color) 55%, var(--rank-dark));
    background-size: 22px 22px, 100% 100%;
    box-shadow: 0 0 10px color-mix(in srgb, var(--rank-color) 70%, transparent);
    animation: bar-stripes 1.2s linear infinite;
}

@keyframes bar-stripes {
    to { background-position: 22px 0, 0 0; }
}

/* バーの上半分のガラスの反射 */
.level[class*="rank--"] .level__fill::before {
    content: "";
    position: absolute;
    left: 4px;
    right: 4px;
    top: 1px;
    height: 45%;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.15));
}

/* バーの上を、白い光が走る */
.level[class*="rank--"] .level__fill::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(100deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%) no-repeat;
    background-size: 40% 100%;
    animation: bar-glint 2.8s ease-in-out infinite;
}

@keyframes bar-glint {
    from { background-position: -60% 0; }
    to   { background-position: 160% 0; }
}

/* Lv.8：黒に近い深紅のカードに赤のふち。きらめき・斜めに流れる光・赤く光る文字 */
.level.rank--predator {
    border: 2px solid #e0302f;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 110, 90, 0.28), transparent 38%),
        radial-gradient(circle at 92% 110%, rgba(230, 60, 40, 0.35), transparent 45%),
        linear-gradient(135deg, #3d0f0c, #1d0907 58%, #3a1608);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.4),
        0 10px 30px rgba(120, 20, 10, 0.45),
        0 0 26px rgba(224, 48, 47, 0.4);
}

/* 小さな光の点が瞬く */
.level.rank--predator::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 20% 30%, #ffe3df, transparent),
        radial-gradient(1.5px 1.5px at 70% 20%, #ff9a8f, transparent),
        radial-gradient(2px 2px at 85% 65%, #ffe3df, transparent),
        radial-gradient(1.5px 1.5px at 40% 80%, #ff9a8f, transparent),
        radial-gradient(1px 1px at 55% 45%, #fff, transparent);
    animation: twinkle 2.6s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 1; }
}

/* カードの表面を、斜めに光が流れる */
.level.rank--predator::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg,
        transparent 35%, rgba(255, 190, 180, 0.18) 48%, rgba(255, 255, 255, 0.28) 50%,
        rgba(255, 190, 180, 0.18) 52%, transparent 65%);
    background-size: 250% 100%;
    animation: card-sheen 4.5s ease-in-out infinite;
}

@keyframes card-sheen {
    from { background-position: 120% 0; }
    to   { background-position: -120% 0; }
}

/* 「伝説のシェフ」：赤く光る文字（グラデーションを文字の形に切り抜いて、横に流す） */
.level.rank--predator .level__title {
    background: linear-gradient(90deg, #ffd6d0, #ff5a4a 30%, #fff0ee 50%, #e0302f 70%, #ffd6d0);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 1.4rem;
    filter: drop-shadow(0 0 6px rgba(255, 90, 80, 0.6));
    animation: foil 4s linear infinite;
}

@keyframes foil {
    to { background-position: -200% 0; }
}

.level.rank--predator .level__points { color: #ff8a7a; }
.level.rank--predator .level__next { color: #ffc9c2; }
.level.rank--predator .level__hint { color: rgba(255, 220, 215, 0.65); }

.level.rank--predator .level__bar {
    background: rgba(0, 0, 0, 0.45);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.level.rank--predator .level__fill {
    background:
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.22) 0 8px, transparent 8px 16px),
        linear-gradient(180deg, #ffb3a8, #ff4a3a 45%, #b81a1a 55%, #ff6b5e);
    background-size: 22px 22px, 100% 100%;
    box-shadow: 0 0 14px rgba(255, 90, 80, 0.85);
}

/* ----- 23-3. プロフィールの枠：つやのある金属の輪＋細い白い縁（控えめ） ----- */
/* 輪の明るい部分を白く鋭くして、強い光の筋を2本入れる（輪が回ると、光の筋も回る） */
.avatar[class*="frame--"] {
    background:
        linear-gradient(#e7ddd2, #e7ddd2) padding-box,
        conic-gradient(from var(--frame-angle),
            #fff 0deg, var(--rank-light) 14deg, var(--rank-color) 60deg, var(--rank-dark) 110deg,
            var(--rank-color) 150deg, #fff 180deg, var(--rank-light) 194deg, var(--rank-color) 240deg,
            var(--rank-dark) 290deg, var(--rank-color) 330deg, #fff 360deg) border-box;
    /* 細い白い縁と、軽い影。まわりの光は16章の半分にして控えめに */
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.85),
        0 3px 8px rgba(0, 0, 0, 0.18),
        0 0 calc(var(--frame-glow) / 2) var(--rank-color);
}

/* 大きなアイコン（マイページなど）：白い縁と、外側に細い線を1本だけ */
.avatar--xl[class*="frame--"] {
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.95),
        0 0 0 3px color-mix(in srgb, var(--rank-dark) 70%, transparent),
        0 8px 18px rgba(0, 0, 0, 0.2),
        0 0 calc(var(--frame-glow) / 2) var(--rank-color);
}

/* Lv.8：赤と深紅の輪がゆっくり回り、赤い光がゆっくり脈打つ */
.avatar.frame--predator {
    background:
        linear-gradient(#e7ddd2, #e7ddd2) padding-box,
        conic-gradient(from var(--frame-angle),
            #fff 0deg, #ffd6d0 12deg, #ff5a4a 40deg, #c41e1e 80deg, #8a0f12 110deg, #ff6b5e 150deg,
            #fff 180deg, #ffd6d0 192deg, #e0302f 240deg, #8a0f12 280deg, #ff5a4a 320deg, #fff 360deg) border-box;
    animation: frame-spin 8s linear infinite, frame-pulse 5s ease-in-out infinite;
}

.avatar--xl.frame--predator {
    box-shadow:
        0 0 0 2px #ffe8e8,
        0 0 0 3px #a3161a,
        0 8px 18px rgba(0, 0, 0, 0.22),
        0 0 calc(var(--frame-glow) / 2) rgba(224, 48, 47, 0.7);
}

@keyframes frame-pulse {
    0%, 100% { --frame-glow: 22px; }
    50%      { --frame-glow: 30px; }   /* 光の変化は控えめに（大きく変わると目が疲れる） */
}

/* ----- 23-4. 動きを減らす設定の端末では、動きを止める ----- */
@media (prefers-reduced-motion: reduce) {
    .reward-badge[class*="rank--"]::after,
    .reward-badge.rank--predator,
    .level[class*="rank--"] .level__icon img,
    .level[class*="rank--"] .level__fill,
    .level[class*="rank--"] .level__fill::after,
    .level.rank--predator::before,
    .level.rank--predator::after,
    .level.rank--predator .level__title,
    .avatar[class*="frame--"] {
        animation: none;
    }
}

/* ===== フッター（利用規約・プライバシーポリシー） ===== */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 20px;
    margin-top: 40px;
    padding-top: 20px;
    padding-bottom: 24px;
    font-size: 0.8rem;
    color: var(--text-muted, #888);
}
.site-footer a { color: inherit; }
.auth-page .site-footer { margin-top: 20px; }

/* ===== 規約などの長い文章 ===== */
.legal h2 { font-size: 1.05rem; margin: 24px 0 8px; }
.legal p, .legal li { line-height: 1.8; }
.legal ul { padding-left: 1.4em; }


/* =====================================================================
   24. ランクの色に深みを出し、上からガラスをかける
       Lv.1〜4：黒を少しだけ混ぜ、ガラスは薄め
       Lv.5〜8：黒をしっかり混ぜて深い色に。ガラスと光を強くして「上級者」らしく
   ===================================================================== */

/* ----- 色：--rank-color に白・黒を混ぜた色を、ランクごとに作り直す（4章の値を上書き） ----- */
:is(.rank--rookie, .rank--bronze, .rank--silver, .rank--gold,
    .frame--rookie, .frame--bronze, .frame--silver, .frame--gold) {
    --rank-light: color-mix(in srgb, var(--rank-color) 55%, #fff);
    --rank-dark:  color-mix(in srgb, var(--rank-color) 55%, #000);
    --rank-deep:  color-mix(in srgb, var(--rank-color) 80%, #000);
}

:is(.rank--platinum, .rank--diamond, .rank--master, .rank--predator,
    .frame--platinum, .frame--diamond, .frame--master, .frame--predator) {
    --rank-light: color-mix(in srgb, var(--rank-color) 70%, #fff);
    --rank-dark:  color-mix(in srgb, var(--rank-color) 35%, #000);   /* 黒を多く混ぜる */
    --rank-deep:  color-mix(in srgb, var(--rank-color) 60%, #000);
}

/* ----- 写真の枠 -----
    background は上に書いたものほど手前に重なる。
      1枚目：ガラスの光沢（上半分だけ白い）… 枠の輪にかかる
      2枚目：枠の内側の背景色
      3枚目：深い色の輪（ゆっくり回る）
*/
.avatar[class*="frame--"] {
    position: relative;
    --glass-ring: 0.45;    /* 輪のガラスの白さ */
    --glass-photo: 0.25;   /* 写真のガラスの白さ */
    background:
        linear-gradient(180deg, rgba(255, 255, 255, var(--glass-ring)) 0%,
                        rgba(255, 255, 255, calc(var(--glass-ring) / 4)) 46%, transparent 50%) border-box,
        linear-gradient(#e7ddd2, #e7ddd2) padding-box,
        conic-gradient(from var(--frame-angle),
            var(--rank-light) 0deg, var(--rank-deep) 40deg, var(--rank-dark) 110deg,
            var(--rank-color) 160deg, var(--rank-light) 180deg, var(--rank-deep) 220deg,
            var(--rank-dark) 290deg, var(--rank-color) 340deg, var(--rank-light) 360deg) border-box;
}

/* 写真の上にもガラスをかける（写真より手前に重ねる） */
.avatar[class*="frame--"]::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 50%;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, var(--glass-photo)) 0%,
                                rgba(255, 255, 255, calc(var(--glass-photo) / 5)) 45%, transparent 47%);
}

/* Lv.5〜8：ガラスを強く */
.avatar:is(.frame--platinum, .frame--diamond, .frame--master, .frame--predator) {
    --glass-ring: 0.55;
    --glass-photo: 0.5;
}

/* ----- Lv.5〜8：まわりの光を強くする（上のランクほど強く） ----- */
.avatar.frame--platinum { --frame-glow: 14px; }
.avatar.frame--diamond  { --frame-glow: 18px; }
.avatar.frame--master   { --frame-glow: 22px; }
.avatar.frame--predator { --frame-glow: 26px; }
.avatar--xl.frame--platinum { --frame-glow: 26px; }
.avatar--xl.frame--diamond  { --frame-glow: 32px; }
.avatar--xl.frame--master   { --frame-glow: 38px; }
.avatar--xl.frame--predator { --frame-glow: 44px; }

/* 光を2段にする：ランクの色の強い光＋その外側に薄い光 */
.avatar:is(.frame--platinum, .frame--diamond, .frame--master, .frame--predator) {
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.95),
        0 0 0 3px color-mix(in srgb, var(--rank-dark) 70%, transparent),
        0 8px 18px rgba(0, 0, 0, 0.2),
        0 0 var(--frame-glow) var(--rank-color),
        0 0 calc(var(--frame-glow) * 1.8) color-mix(in srgb, var(--rank-color) 45%, transparent);
}

/* ----- 称号のバッジ ----- */
/* Lv.1〜4：少しだけ深い色のプレート */
.reward-badge:is(.rank--rookie, .rank--bronze, .rank--silver, .rank--gold) {
    border-color: var(--rank-dark);
    background: linear-gradient(180deg, var(--rank-light) 0%, var(--rank-color) 50%,
                                var(--rank-deep) 52%, var(--rank-color) 85%, var(--rank-light) 100%);
}

/* Lv.5〜8：深い色のプレート。ガラスの反射は少し控えめにして、深い色を見せる */
.reward-badge:is(.rank--platinum, .rank--diamond, .rank--master, .rank--predator) {
    border-color: var(--rank-dark);
    background: linear-gradient(180deg, var(--rank-color) 0%, var(--rank-deep) 50%,
                                var(--rank-dark) 52%, var(--rank-deep) 85%, var(--rank-color) 100%);
}

.reward-badge:is(.rank--platinum, .rank--diamond, .rank--master, .rank--predator)::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.12));
}

/* Lv.5〜7：まわりにランクの色の光（Lv.8 は 23-1 の gold-pulse で赤く脈打つ） */
.reward-badge:is(.rank--platinum, .rank--diamond, .rank--master) {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -3px 4px rgba(0, 0, 0, 0.35),
        0 0 14px var(--rank-color),
        0 0 28px color-mix(in srgb, var(--rank-color) 55%, transparent);
}

/* ----- エンブレムの光を強く ----- */
.rank-emblem.rank--platinum { --glow-size: 10px; }
.rank-emblem.rank--diamond  { --glow-size: 12px; }
.rank-emblem.rank--master   { --glow-size: 14px; }
.rank-emblem.rank--predator { --glow-size: 16px; }
.reward-badge .rank-emblem:is(.rank--platinum, .rank--diamond, .rank--master, .rank--predator) {
    --glow-size: 7px;
}


/* =====================================================================
   25. マイページ・プロフィールの並びと余白
   ===================================================================== */

/* 右の枠の中を縦に並べ、料理レベルのカードを「数字のまとめの下の空き」の真ん中に置く。
   左のプロフィールの枠が高くなっても（管理者はボタンが1つ多い）、カードは常に真ん中に来る */
.stats-card {
    display: flex;
    flex-direction: column;
}
.stats-card .stats {
    margin-bottom: 28px;    /* 数字のまとめとカードの間は、最低 28px あける */
}
.stats-card .level {
    margin: auto 0;         /* 上下の余白を自動にして、残りの空きを上下に同じだけ分ける */
}

