/* =========================================================
 * フードビンゴ！（apps/fbingo）の 見た目
 * タウンビンゴ！（apps/tbingo）の style.css を もとに した（交流ビンゴ 共通の 見た目）。
 * ちがう ところ：いちばん上の :root の 色・.hidden を 8つの 指定に（新しい アプリの 型 3-4）・
 * さいごの「★ フードビンゴ だけ」の まとまり。
 * ========================================================= */
:root {
    --main: #c9483a;
    --main-dark: #94301f;
    --main-soft: #fde2dc;
    --accent: #f08a24;
    --accent-dark: #b9620f;
    --paper: #fffaf1;
    --dot: #fbe5cc;
}

:root {
    --ink: #444;
    --font: 'M PLUS Rounded 1c', 'Gowun Dodum', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'BIZ UDPGothic', 'Meiryo', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    --font-hand: 'Klee One', 'M PLUS Rounded 1c', 'Gowun Dodum', 'UD Digi Kyokasho N-R', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'BIZ UDPGothic', 'Meiryo', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: calc(140px + env(safe-area-inset-left, 0px));
    /* ビンゴの盤の大きさ：高さ と 横はば（右の パネル 360px を ひいた のこり）の 小さいほう */
    --board: min(calc(100dvh - 96px - var(--safe-top) - var(--safe-bottom)), calc(100vw - 420px));
}
html[lang="ko"] { --font: 'Gowun Dodum', 'M PLUS Rounded 1c', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'BIZ UDPGothic', 'Meiryo', sans-serif; }
html[lang="ko"] body { word-break: keep-all; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
    font-family: var(--font); color: var(--ink); background-color: var(--paper);
    background-image: radial-gradient(var(--dot) 10%, transparent 10%), radial-gradient(var(--dot) 10%, transparent 10%);
    background-size: 20px 20px; background-position: 0 0, 10px 10px;
    height: 100dvh; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
textarea { user-select: text; -webkit-user-select: text; }

/* UI要塞化 */
.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    z-index: -1 !important;
    position: absolute !important;
    max-width: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
}

.app { position: relative; width: 100%; height: 100%; }
.screen { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.lang-slot { position: absolute; top: calc(10px + var(--safe-top)); right: calc(10px + env(safe-area-inset-right, 0px)); z-index: 100; }

.wrap { max-width: 820px; margin: 0 auto; padding: calc(76px + var(--safe-top)) 20px calc(40px + var(--safe-bottom)); }
h1 { margin: 0 0 14px; text-align: center; color: var(--main); font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 900; text-shadow: 2px 2px 0 var(--dot); }
.lead { text-align: center; font-weight: 700; line-height: 1.7; margin: 0 0 16px; }
.card { background: #fff; border: 4px solid var(--main); border-radius: 22px; padding: 18px 20px; margin-bottom: 18px; box-shadow: 4px 4px 0 var(--main); }
.card h3 { margin: 0 0 8px; font-size: 1.2rem; }
.card p { margin: 6px 0; line-height: 1.7; }
.note { font-size: 0.92rem; color: #777; }
.safe-note { background: var(--main-soft); color: var(--main-dark); border-radius: 14px; padding: 10px 14px; font-weight: 700; line-height: 1.6; font-size: 0.95rem; }

textarea {
    width: 100%; min-height: 200px; resize: vertical; border: 3px solid var(--main-soft); border-radius: 14px; padding: 12px;
    font-family: var(--font-hand); font-size: 1.15rem; line-height: 1.6; outline: none; background: #fff; color: var(--ink);
}
textarea:focus { border-color: var(--main); }

.btn {
    font-family: var(--font); font-weight: 800; font-size: clamp(1.05rem, 2.2vw, 1.3rem); line-height: 1.3;
    min-height: 60px; padding: 10px 24px; border: none; border-radius: 50px; cursor: pointer; color: #fff; background: var(--accent);
    box-shadow: 0 5px 0 var(--accent-dark); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform 0.08s, box-shadow 0.08s; touch-action: manipulation; text-align: center;
}
.btn:active:not(:disabled) { transform: translateY(5px); box-shadow: none; }
.btn:disabled { background: #c5c5c5; box-shadow: 0 5px 0 #999; cursor: default; }
.btn:focus-visible { outline: 3px solid var(--main-dark); outline-offset: 3px; }
.btn-main { background: var(--main); box-shadow: 0 5px 0 var(--main-dark); }
.btn-green { background: #2eaa63; box-shadow: 0 5px 0 #1f7a46; }
.btn-gray { background: #8a959e; box-shadow: 0 5px 0 #66717a; }
.btn-light { background: #fff; color: var(--main); border: 3px solid var(--main); box-shadow: 0 5px 0 var(--main-soft); }
.btn-wide { width: 100%; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 200px; }
.center { text-align: center; }

.msg { margin: 10px 0 0; padding: 10px 14px; border-radius: 12px; font-weight: 700; line-height: 1.6; }
.msg.ok { background: #e6f7ec; color: #1f7a46; }
.msg.ng { background: #ffe9e6; color: #b03a2e; }
.msg.info { background: var(--main-soft); color: var(--main-dark); }
#qr-canvas { background: #fff; border: 6px solid #fff; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.12); image-rendering: pixelated; max-width: 100%; }

/* ===== 名前を えらぶ（大きな ボタン） ===== */
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.name-btn {
    min-height: 64px; padding: 6px 10px; border-radius: 16px; border: 3px solid var(--main); background: #fff; color: var(--ink);
    font-family: var(--font-hand); font-weight: 600; font-size: 1.25rem; line-height: 1.25; cursor: pointer; touch-action: manipulation;
    box-shadow: 0 4px 0 var(--main-soft); overflow-wrap: anywhere;
}
.name-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
.name-btn:disabled { border-color: #ddd; color: #aaa; background: #f4f4f4; box-shadow: none; cursor: default; }
.name-btn .used { display: block; font-family: var(--font); font-size: 0.75rem; font-weight: 700; color: #999; }

/* ===== 小窓（名前の えらびなおし・たしかめ） ===== */
.overlay {
    position: fixed; inset: 0; z-index: 8000; background: rgba(30,36,46,0.55); display: flex; align-items: center; justify-content: center;
    padding: calc(70px + var(--safe-top)) 12px calc(12px + var(--safe-bottom));
}
.sheet {
    width: min(900px, 100%); max-height: 100%; overflow-y: auto; background: var(--paper); border: 5px solid var(--main); border-radius: 24px;
    padding: 16px 18px 18px; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.sheet-head img { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 14px; border: 3px solid var(--main-soft); flex: 0 0 auto; }
.sheet-head h2 { margin: 0; font-size: clamp(1.2rem, 2.6vw, 1.6rem); color: var(--main-dark); line-height: 1.4; }
.sheet-head .ask { display: block; font-size: 0.95rem; color: #666; font-weight: 700; margin-top: 2px; }
.sheet-foot { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
/* 名前が 多くても「とじる」が いつも 見える */
.sheet > .sheet-foot { position: sticky; bottom: -18px; margin: 14px -18px -18px; padding: 12px 18px 16px; background: var(--paper); border-top: 3px solid var(--main-soft); }
.sheet .name-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (max-height: 760px) { .sheet .name-btn { min-height: 56px; font-size: 1.15rem; } .sheet-head img { width: 64px; height: 64px; } }
.sheet-foot .btn { flex: 1 1 200px; }
.dialog-box { width: min(460px, 100%); background: #fff; border: 5px solid var(--main); border-radius: 24px; padding: 22px 20px 16px; text-align: center; }
.dialog-box p { margin: 0 0 6px; font-size: 1.25rem; font-weight: 800; line-height: 1.6; white-space: pre-wrap; }

/* ===== カードを つくる（pbingo・sbingo） ===== */
.build { display: grid; grid-template-columns: var(--board) minmax(0, 1fr); gap: 20px; padding: calc(70px + var(--safe-top)) 20px calc(12px + var(--safe-bottom)); height: 100%; }
.build-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.build-side h2 { margin: 0; color: var(--main); font-size: clamp(1.2rem, 2.4vw, 1.6rem); font-weight: 900; }
.build-side .how { margin: 0; font-weight: 700; line-height: 1.6; }
.tray { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; align-content: start;
    background: #fff; border: 4px solid #f1c40f; border-radius: 18px; padding: 10px; }
.tray-item { aspect-ratio: 1 / 1; border: 3px solid #ddd; border-radius: 14px; background: var(--paper); padding: 4px; cursor: pointer; touch-action: manipulation; display: flex; }
.tray-item img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.tray-item.selected { border-color: var(--accent); border-width: 5px; transform: scale(1.06); box-shadow: 0 4px 10px rgba(0,0,0,0.18); }
.tray-item.used { opacity: 0.28; filter: grayscale(60%); }

/* ===== ビンゴの盤 ===== */
.board { width: var(--board); height: var(--board); display: grid; gap: 8px; align-self: start; }
.cell {
    position: relative; min-width: 0; min-height: 0; background: #fff; border: 3px dashed var(--main); border-radius: 16px; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4px; cursor: pointer;
    touch-action: manipulation; box-shadow: 2px 2px 5px rgba(0,0,0,0.06); transition: transform 0.12s;
}
.cell:active { transform: scale(0.96); }
.cell:focus-visible { outline: 4px solid var(--main-dark); outline-offset: 2px; }
.cell.filled { border-style: solid; }
.cell .cimg { width: 100%; flex: 1 1 auto; min-height: 0; object-fit: contain; pointer-events: none; }
.cell .cname {
    flex: 0 0 auto; width: 100%; font-family: var(--font-hand); font-weight: 600; line-height: 1.2; color: var(--ink);
    font-size: calc(var(--board) / var(--n, 3) / 7.5); overflow-wrap: anywhere; padding: 2px 2px 0;
}
.cell .cname.empty { color: #aaa; font-family: var(--font); font-weight: 700; font-size: calc(var(--board) / var(--n, 3) / 9); }
.cell .ctext { font-family: var(--font-hand); font-weight: 600; line-height: 1.25; font-size: calc(var(--board) / var(--n, 3) / 5.6); overflow-wrap: anywhere; }
.cell.free { background: #fff9c4; border-style: solid; cursor: default; }
.cell .free-label { font-size: calc(var(--board) / var(--n, 3) / 10); color: #d35400; font-weight: 800; }
.cell.marked { background: #fff3f6; border-style: solid; border-color: #f48fb1; }
.cell.marked::after {
    content: "🌸"; position: absolute; top: 2px; left: 4px; font-size: calc(var(--board) / var(--n, 3) / 4.2); line-height: 1;
    animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; pointer-events: none; filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.2));
}
.cell.line { box-shadow: 0 0 0 4px #ffd54f inset; }
@keyframes pop { 0% { transform: scale(0) rotate(-20deg); } 100% { transform: scale(1) rotate(0); } }

/* ===== あそぶ 画面 ===== */
.play { display: grid; grid-template-columns: var(--board) minmax(0, 1fr); gap: 20px; padding: calc(70px + var(--safe-top)) 20px calc(12px + var(--safe-bottom)); min-height: 100%; }
.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.side h2 { margin: 0; font-size: clamp(1.15rem, 2.3vw, 1.5rem); color: var(--main); font-weight: 900; line-height: 1.35; overflow-wrap: anywhere; }
.side .how { margin: 0; font-weight: 700; line-height: 1.6; font-size: 0.98rem; }
.bingo-count { font-size: clamp(1.3rem, 2.8vw, 1.8rem); font-weight: 900; color: #d35400; text-align: center; background: #fff; border: 4px solid #ffd54f; border-radius: 18px; padding: 6px 10px; }
.thanks { background: #fff; border: 4px solid var(--main); border-radius: 18px; padding: 10px 12px; }
.thanks h3 { margin: 0 0 6px; color: var(--main); font-size: 1.15rem; }
.thanks .btn { width: 100%; min-height: 56px; font-size: 1.1rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; max-height: 120px; overflow-y: auto; }
.tag { background: var(--main-soft); border: 2px solid var(--main); border-radius: 20px; padding: 4px 12px; font-family: var(--font-hand); font-weight: 600; color: var(--main-dark); animation: pop 0.3s ease both; }
.side .btn-small { min-height: 52px; font-size: 1rem; }

/* ビンゴ！の お祝い */
#bingo-banner {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8500; pointer-events: none;
    font-size: clamp(3rem, 10vw, 6rem); font-weight: 900; color: #fff; text-shadow: 0 6px 0 #d35400, 0 0 24px rgba(255,160,0,0.8);
    -webkit-text-stroke: 3px #d35400; white-space: nowrap; animation: banner 1.6s ease both;
}
@keyframes banner { 0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 30% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }

#toast {
    position: fixed; left: 50%; bottom: calc(22px + var(--safe-bottom)); transform: translateX(-50%); z-index: 8600; max-width: min(92vw, 640px);
    background: rgba(40,48,60,0.95); color: #fff; padding: 12px 20px; border-radius: 16px; font-weight: 700; line-height: 1.6; text-align: center;
}
#qr-zoom { position: fixed; inset: 0; z-index: 8000; background: rgba(255,255,255,0.98); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; cursor: pointer; }
#qr-zoom canvas { image-rendering: pixelated; }
#qr-zoom p { margin: 0; color: #777; font-weight: 700; }

/* せまい 画面・たて：盤を 上、パネルを 下に（スクロール） */
@media (max-width: 760px) {
    :root { --board: min(calc(100vw - 32px), 560px); }
    .build, .play { grid-template-columns: minmax(0, 1fr); height: auto; padding-left: 16px; padding-right: 16px; }
    .board { justify-self: center; }
    .tray { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
    .cell.marked::after, .tag, #bingo-banner { animation: none; }
    .cell, .btn { transition: none; }
}
@media print {
    .btn, .lang-slot, .overlay, #toast { display: none !important; }
}

/* =========================================================
 * ★ フードビンゴ だけ（タウンビンゴの まとまりを もとに）
 * ========================================================= */

/* 料理の タイル（トレイ・食べたいものを えらぶ）：絵 ＋ 英語 ＋（日本語・韓国語の ときは 母語の なまえ） */
.tray { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); border-color: var(--main); }
.tray-item {
    aspect-ratio: auto; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
    background: var(--cat, var(--paper)); padding: 6px 4px 6px; position: relative; font-family: var(--font); color: var(--ink);
}
.tray-item img { width: 100%; height: auto; aspect-ratio: 1 / 1; flex: 0 0 auto; }
.tray-item .fw { font-size: 0.88rem; font-weight: 800; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.tray-item .fk { font-size: 0.72rem; font-weight: 700; line-height: 1.1; color: #777; text-align: center; overflow-wrap: anywhere; }
.tray-item:focus-visible { outline: 3px solid var(--main-dark); outline-offset: 2px; }
.tray-item:disabled { cursor: default; }

/* 盤の マス：なかまの 色 ＋ 英語の なまえ */
.cell.filled { background: var(--cat, #fff); }
.cell.marked { background: #fff3f6; }
.cell .cword {
    flex: 0 0 auto; width: 100%; font-family: var(--font); font-weight: 800; line-height: 1.1; color: var(--main-dark);
    font-size: calc(var(--board) / var(--n, 3) / 11); overflow-wrap: anywhere; padding: 1px 2px 0;
}

/* 💬 はなしかた */
.talk { background: #fff; border: 4px solid var(--accent); border-radius: 18px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.talk h3 { margin: 0; color: var(--accent-dark); font-size: 1.1rem; }
.talk .note { margin: 0; font-size: 0.82rem; line-height: 1.4; }
.say-row { display: flex; align-items: center; gap: 8px; }
.say-who {
    flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 900; color: #fff; font-size: 0.95rem;
}
.say-who.q { background: var(--main); }
.say-who.a { background: var(--accent); }
.say { flex: 1 1 auto; min-width: 0; font-family: var(--font-hand); font-weight: 600; font-size: clamp(1rem, 1.9vw, 1.2rem); line-height: 1.3; overflow-wrap: anywhere; }
.spk {
    flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--main); background: #fff; font-size: 1.3rem; line-height: 1;
    cursor: pointer; touch-action: manipulation; box-shadow: 0 3px 0 var(--main-soft); display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.spk:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.spk:disabled { border-color: #ddd; opacity: 0.45; cursor: default; box-shadow: none; }
.spk:focus-visible { outline: 3px solid var(--main-dark); outline-offset: 2px; }
.talk h4 { margin: 4px 0 0; font-size: 1rem; color: var(--main-dark); }

/* 🍽 食べたいもの（3つ） */
.mytown { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mt-item {
    min-width: 0; border: 3px solid #ddd; border-radius: 14px; background: var(--cat, #fff); padding: 4px 3px 4px; cursor: pointer; touch-action: manipulation;
    display: flex; flex-direction: column; align-items: center; gap: 1px; font-family: var(--font); color: var(--ink);
}
.mt-item img { width: 100%; max-width: 72px; aspect-ratio: 1 / 1; object-fit: contain; pointer-events: none; }
.mt-item .fw { font-size: 0.78rem; font-weight: 800; line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.mt-item.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.mt-item.empty { min-height: 84px; justify-content: center; border-style: dashed; border-color: var(--main); background: #fff; color: var(--main); font-size: 1.8rem; font-weight: 900; }
.mt-item:active { transform: scale(0.96); }
.mt-item:focus-visible { outline: 3px solid var(--main-dark); outline-offset: 2px; }
.talk .btn { min-height: 48px; font-size: 1rem; padding: 6px 16px; }

/* かくした QR の 大きな 画面（canvas 600px）：.hidden が 8つの 指定なので、ここで 足す ものは ない（tbingo の B22 の 直しは .hidden に 入った） */

/* 食べたいものを えらぶ 小窓 */
/* B22：タイル（position: relative）が 下の「これで OK」に かぶらないよう、下の ボタンの 列を 上に */
.sheet > .sheet-foot { z-index: 2; }
.town-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.town-item.selected { transform: none; }
.pick-no {
    position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff;
    font-weight: 900; display: flex; align-items: center; justify-content: center; font-size: 1rem; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.pick-count { margin-left: auto; flex: 0 0 auto; font-size: 1.3rem; font-weight: 900; color: var(--accent-dark); background: #fff; border: 3px solid var(--accent); border-radius: 20px; padding: 2px 12px; }

@media (max-width: 760px) {
    .town-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .mt-item, .spk { transition: none; }
}

/* ---------- ここから fbingo で 足した もの ---------- */

/* 💬 はなしかた の わくの 中で かくす 行（.hidden の position: absolute の 親） */
.talk { position: relative; }
.talk-head { display: flex; align-items: center; gap: 8px; }
.talk-head h3 { flex: 1 1 auto; min-width: 0; }
.talk .btn-all { flex: 0 0 auto; min-height: 44px; padding: 4px 14px; font-size: 0.95rem; }
.say-who.blank { background: transparent; }
.say-row + .say-row { margin-top: 2px; }

/* こえの はやさ（0.5・0.8・1ばい。英語アプリ 共通の deji-voice-rate） */
.rate-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.rate-label { font-size: 0.85rem; font-weight: 800; color: var(--main-dark); }
.rate-btns { display: inline-flex; gap: 6px; }
.rate-btn {
    min-height: 44px; min-width: 64px; padding: 2px 10px; border-radius: 22px; border: 3px solid var(--main); background: #fff; color: var(--main-dark);
    font-family: var(--font); font-weight: 800; font-size: 0.95rem; cursor: pointer; touch-action: manipulation;
}
.rate-btn.on { background: var(--main); color: #fff; }
.rate-btn:active { transform: translateY(2px); }
.rate-btn:focus-visible { outline: 3px solid var(--main-dark); outline-offset: 2px; }

/* 食べたいもの：えらんだ じゅんの 番号 */
.mt-item { position: relative; }
.mt-no {
    position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff;
    font-weight: 900; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; pointer-events: none;
}

/* なかまの 見出し（トレイ・食べたいものの 小窓） */
.tray-cat {
    grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1rem; color: var(--ink);
    padding: 2px 4px 0; margin-top: 4px;
}
.tray-cat::before { content: ""; flex: 0 0 auto; width: 14px; height: 14px; border-radius: 50%; background: var(--plate, #999); }
.tray-cat::after { content: ""; flex: 1 1 auto; height: 3px; border-radius: 2px; background: var(--plate, #999); opacity: 0.35; }
.tray-cat:first-child { margin-top: 0; }

/* 食べたいものの 小窓：いまの 文 */
.pick-say {
    margin: 0 0 12px; padding: 8px 14px; background: #fff; border: 3px dashed var(--accent); border-radius: 14px;
    font-family: var(--font-hand); font-weight: 600; font-size: clamp(1.05rem, 2.2vw, 1.3rem); line-height: 1.35; color: var(--ink); overflow-wrap: anywhere;
}

/* 食べたいものの 小窓：見出しと いまの 文は 上に のこす（下の 料理を えらんでも 文が 見える） */
.sheet > .sheet-top { position: sticky; top: -16px; z-index: 2; margin: -16px -18px 12px; padding: 16px 18px 10px; background: var(--paper); border-bottom: 3px solid var(--main-soft); }
.sheet-top .sheet-head { margin-bottom: 8px; }
.sheet-top .pick-say { margin: 0; }

/* トレイの なかまの 見出しは 上に のこす（46この 料理を スクロールしても いま どの なかまか わかる） */
.tray .tray-cat { position: sticky; top: -10px; z-index: 1; background: #fff; margin: -2px -4px 0; padding: 6px 8px 4px; }

/* お知らせ（toast）が 出ている あいだも 下の ボタンを おせる（rules md 2-9） */
#toast { pointer-events: none; }

/* 低い 画面（よこの スマホ）：上に のこす 見出しと 下の ボタンで 料理が おせなく ならないよう、見出しは いっしょに スクロール */
@media (max-height: 560px) {
    .sheet > .sheet-top { position: static; }
    .sheet-top .ask { font-size: 0.85rem; }
    .pick-say { font-size: 1rem; padding: 6px 10px; }
}

/* せまい たての 画面：小窓の 下の ボタンを 1行に（料理を えらぶ 場所を ひろく） */
@media (max-width: 600px) {
    .sheet > .sheet-foot .btn { flex: 1 1 0; min-width: 0; padding-left: 10px; padding-right: 10px; }
    .sheet-top .ask { font-size: 0.82rem; }
    .sheet-top .sheet-head h2 { font-size: 1.15rem; }
    .pick-say { font-size: 1rem; padding: 6px 10px; }
}

/* よこの 低い 画面（スマホの よこ・844×340 など）：rules md 2-9
   ・カードを つくる：右の 列を 上まで 使い（言語ボタンは この 画面では 出ない）、トレイを ひろく・タイルを 小さく
   ・あそぶ：盤を 上に のこす（右の パネルを スクロールしても 盤が 見える。🏠 の 下から）
   ・小窓：下の ボタンを ひくく、タイルを 小さく */
@media (max-height: 560px) and (orientation: landscape) {
    /* 667×375 は はばの @media（760px まで）で 上下ならびに なるので、左右ならびに もどす */
    :root { --board: min(calc(100dvh - 96px - var(--safe-top) - var(--safe-bottom)), calc(100vw - 420px)); }
    .build, .play { grid-template-columns: var(--board) minmax(0, 1fr); padding-left: 16px; padding-right: 16px; gap: 16px; }
    .build { height: 100%; }
    .board { justify-self: start; }
    .build-side { margin-top: -58px; gap: 8px; }
    .build-side h2 { font-size: 1.1rem; }
    .build-side .how { font-size: 0.8rem; line-height: 1.35; }
    .build-side .btn { min-height: 48px; font-size: 1rem; padding: 6px 14px; }
    .tray { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; padding: 6px; }
    .tray .tray-cat { top: -6px; }
    .tray-item { padding: 3px 2px 4px; }
    .tray-item .fw { font-size: 0.74rem; }
    .tray-item .fk { display: none; }
    .play .board { position: sticky; top: calc(62px + var(--safe-top)); }
    .sheet > .sheet-foot .btn { min-height: 48px; font-size: 1rem; }
    .town-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
}
