/* まつり三つぞろえ（/matsuri/・2026-11-24）: 入口はサイトの明るい地のまま、遊ぶ画面（.mt-game）は画面全体を使う
   色: 夜空の藍 --mnight・ちょうちんの朱 --mred・金 --mgold・木 --mwood。小物の色は site/js/matsuri/draw.js の ITEMS */
:root { --mnight: #1b1940; --mnight2: #2a2154; --mred: #d63a2f; --mred-dk: #8f2018; --mgold: #ffd257; --mwood: #6b3d1b; --mpaper: #fff8ec; --mink: #2a1a10; --mmut: #7d6a55; }

/* ── 入口 ── */
.mt-top { display: grid; gap: 16px; padding-top: 8px; }
.mt-hero { position: relative; margin: 0; border-radius: 20px; overflow: hidden; background: var(--mnight); aspect-ratio: 4 / 3; box-shadow: 0 18px 40px -24px rgba(20, 10, 40, .8); }
.mt-hero canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.mt-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(20, 15, 50, 0) 60%, rgba(15, 8, 30, .78)); }
.mt-hero-cap { position: absolute; left: 16px; right: 16px; bottom: 12px; z-index: 1; display: grid; gap: 2px; color: #fff; }
.mt-eb { font-size: 12px; font-weight: 800; letter-spacing: .12em; color: #ffd9a0; }
.mt-hero-cap b { font-family: var(--f-round); font-size: clamp(27px, 8.2vw, 42px); line-height: 1.15; letter-spacing: .04em; text-shadow: 0 2px 16px rgba(255, 110, 50, .55), 0 2px 4px rgba(0, 0, 0, .6); }
.mt-top .lead b { color: #b8291f; }
.mt-start { display: grid; gap: 10px; }
.mt-start .btn.go { --go: #d63a2f; --go-step: #8f2018; --go-soft: rgba(143, 32, 24, .5); }
.mt-note { font-size: 13px; color: var(--muted); }
.mt-note b { color: var(--ink); }
.mt-pick { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 4px 12px; }
.mt-pick[hidden] { display: none; }
.mt-pick summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.mt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; padding: 4px 0 12px; max-height: 260px; overflow: auto; }
.mt-cell { display: grid; justify-items: center; gap: 1px; min-height: 48px; padding: 5px 2px 4px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font: 800 14px/1.2 var(--f-round); cursor: pointer; }
.mt-cell.now { border-color: var(--mred); background: #fff2ee; }
.mt-mini { display: flex; gap: 1px; }
.mt-mini svg { width: 11px; height: 11px; }
.mt-stars svg.on, .mt-mini svg.on { fill: var(--mgold); stroke: #b77a06; stroke-width: 1.4; stroke-linejoin: round; }
.mt-stars svg.off, .mt-mini svg.off { fill: rgba(120, 95, 60, .16); stroke: rgba(120, 95, 60, .25); stroke-width: 1.2; }
.mt-h2 { font-size: 20px; margin-top: 12px; }
.mt-how { margin: 0; padding: 0; list-style: none; counter-reset: mt; display: grid; gap: 10px; }
.mt-how li { counter-increment: mt; position: relative; display: grid; gap: 2px; padding: 12px 14px 12px 50px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.mt-how li::before { content: counter(mt); position: absolute; left: 14px; top: 12px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--mnight2); color: #fff; font: 800 14px/1 var(--f-round); }
.mt-how b { font-size: 15.5px; }
.mt-how span { font-size: 13.5px; color: var(--ink2); line-height: 1.6; }
.mt-how span b { font-size: inherit; }
.mt-faq details { border-bottom: 1px solid var(--line); padding: 10px 2px; }
.mt-faq summary { cursor: pointer; font-weight: 700; }
.mt-faq p { margin-top: 6px; font-size: 14px; color: var(--ink2); }

/* ── 遊ぶ画面 ── */
html.mt-lock, html.mt-lock body { overflow: hidden; overscroll-behavior: none; }
.mt-game { position: fixed; inset: 0; z-index: 2147483000; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); background: var(--mnight); color: #fff; font-family: var(--f-body); line-height: 1.5; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.mt-game button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.mt-hud { display: grid; gap: 6px; justify-items: center; padding: max(8px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 8px max(10px, env(safe-area-inset-left, 0px)); background: linear-gradient(180deg, #2a1608, #3b2010); border-bottom: 3px solid #1a0c04; box-shadow: 0 2px 0 rgba(255, 200, 120, .12) inset; }
.mt-hudrow { display: flex; align-items: center; gap: 8px; width: min(100%, 640px); }
.mt-title { display: grid; line-height: 1.2; min-width: 0; flex: 1 1 auto; }
.mt-title b { font: 800 17px/1.2 var(--f-round); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff3dc; }
.mt-title span { font-size: 12px; color: #ffcf7a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-moves { display: flex; align-items: baseline; gap: 3px; padding: 4px 12px; border-radius: 999px; background: var(--mpaper); color: var(--mink); white-space: nowrap; box-shadow: 0 2px 0 #b8925c; }
.mt-moves b { font: 900 22px/1 var(--f-round); font-variant-numeric: tabular-nums; min-width: 1.2em; text-align: center; color: #b8291f; }
.mt-moves span { font-size: 11.5px; font-weight: 800; color: var(--mmut); }
.mt-moves.low { animation: mt-pulse 1s ease-in-out infinite; }
.mt-menu-btn { display: grid; gap: 3px; place-content: center; flex: none; width: 40px; height: 38px; border: 1px solid rgba(255, 240, 220, .35); border-radius: 10px; background: rgba(255, 255, 255, .08); }
.mt-menu-btn i { display: block; width: 17px; height: 2px; border-radius: 2px; background: #fff3dc; }
.mt-goals { display: flex; gap: 6px; justify-content: center; flex-wrap: nowrap; min-width: 0; width: min(100%, 640px); }
.mt-goal { display: flex; align-items: center; gap: 4px; min-width: 0; padding: 3px 10px 3px 5px; border-radius: 12px; background: rgba(255, 248, 236, .96); color: var(--mink); box-shadow: 0 2px 0 #9b6b33; }
.mt-goal canvas { flex: none; }
.mt-goal b { font: 900 18px/1 var(--f-round); font-variant-numeric: tabular-nums; min-width: 1.3em; text-align: center; }
.mt-goal.done { background: #e3f6d8; box-shadow: 0 2px 0 #5d9b45; }
.mt-goal.done b { color: #2f8a3a; }
.mt-goal.bump { animation: mt-bump .3s ease-out; }
.mt-fieldbox { position: relative; min-height: 0; overflow: hidden; }
#mt-field { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: pointer; }
.mt-banner { position: absolute; left: 50%; top: 10%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 9px 15px; border-radius: 12px; background: rgba(255, 248, 236, .97); color: var(--mink); font-size: 14px; font-weight: 800; text-align: center; box-shadow: 0 10px 26px -12px rgba(0, 0, 0, .8); border: 2px solid #e0a84c; pointer-events: none; animation: mt-in .25s ease-out; z-index: 2; }
.mt-banner.bubble { transform: none; width: auto; text-align: left; border-radius: 14px 14px 14px 4px; animation: mt-pop .25s ease-out; transform-origin: 0 100%; }
.mt-banner.bubble::before { content: ""; position: absolute; left: -8px; bottom: 8px; width: 12px; height: 12px; background: inherit; border-left: 2px solid #e0a84c; border-bottom: 2px solid #e0a84c; transform: rotate(45deg); border-radius: 0 0 0 3px; }
.mt-banner.bubble.hot::before { border-color: #ffb3a8; }
.mt-banner.hot { background: rgba(214, 58, 47, .97); color: #fff; border-color: #ffb3a8; }
.mt-banner[hidden] { display: none; }
.mt-toast { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 8px 14px; border-radius: 12px; background: rgba(255, 248, 236, .97); border: 1px solid #e0c08a; color: var(--mink); font-size: 13.5px; font-weight: 700; text-align: center; box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .6); pointer-events: none; z-index: 2; }
.mt-toast[hidden] { display: none; }
.mt-toast.in { animation: mt-in .2s ease-out; }
.mt-skip { position: absolute; right: 10px; bottom: 10px; z-index: 3; min-height: 44px; padding: 6px 16px; border-radius: 999px; border: 0; background: rgba(255, 248, 236, .95); color: var(--mink) !important; font-weight: 800 !important; box-shadow: 0 3px 0 #9b6b33; }
.mt-skip[hidden] { display: none; }
.mt-tools { display: flex; gap: 8px; padding: 8px max(10px, env(safe-area-inset-right, 0px)) max(9px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px)); justify-content: center; background: linear-gradient(180deg, #3b2010, #2a1608); border-top: 3px solid #1a0c04; }
.mt-tool { position: relative; flex: 1 1 0; max-width: 120px; min-width: 0; min-height: 54px; display: grid; justify-items: center; align-content: center; gap: 1px; padding: 6px 2px 5px; border-radius: 14px; border: 0; background: var(--mpaper); color: var(--mink) !important; box-shadow: 0 3px 0 #b8925c; }
.mt-tool:active { transform: translateY(2px); box-shadow: 0 1px 0 #b8925c; }
.mt-tool svg { width: 26px; height: 26px; color: var(--mink); }
.mt-tool span { font-size: 12px; font-weight: 800; white-space: nowrap; }
.mt-tool em { position: absolute; top: -7px; right: -3px; min-width: 22px; padding: 1px 6px; border-radius: 999px; background: var(--mred); color: #fff; font: 800 12px/1.4 var(--f-round); font-style: normal; text-align: center; font-variant-numeric: tabular-nums; }
.mt-tool.on { background: #ffe9a8; box-shadow: 0 0 0 3px #ffd257, 0 3px 0 #b8925c; }
.mt-tool.zero { opacity: .5; }
.mt-tool.zero em { background: #8d7b63; }
.mt-tool[disabled] { opacity: .4; cursor: default; }

/* 札（メニュー・クリア・おしまい） */
.mt-sheet { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 14px; background: rgba(15, 8, 30, .55); animation: mt-fade .2s ease-out; }
.mt-sheet[hidden] { display: none; }
.mt-card { width: min(420px, 100%); max-height: calc(100% - 4px); overflow: auto; padding: 18px 18px 16px; border-radius: 20px; background: var(--mpaper); color: var(--mink); box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .7); display: grid; gap: 12px; animation: mt-up .25s ease-out; border-top: 6px solid var(--mred); }
.mt-card h2 { font: 900 24px/1.3 var(--f-round); text-align: center; }
.mt-card .sub { font-size: 13.5px; color: var(--mmut); text-align: center; margin: -4px 0 0; }
.mt-clear-eb { text-align: center; color: var(--mred); font-size: 13px; font-weight: 800; letter-spacing: .08em; margin: 0 0 -8px; }
.mt-stars.big { display: flex; justify-content: center; gap: 6px; }
.mt-stars.big svg { width: 48px; height: 48px; animation: mt-star .5s cubic-bezier(.3, 1.6, .5, 1) backwards; }
.mt-stars.big svg:nth-child(2) { animation-delay: .15s; width: 56px; height: 56px; margin-top: -8px; }
.mt-stars.big svg:nth-child(3) { animation-delay: .3s; }
.mt-big { text-align: center; }
.mt-big b { font: 900 50px/1 var(--f-round); font-variant-numeric: tabular-nums; color: #b8291f; }
.mt-big span { font-size: 18px; font-weight: 800; margin-left: 4px; }
.mt-best { text-align: center; font-size: 13.5px; font-weight: 700; color: #2f8f5f; margin: 0; }
.mt-acts { display: grid; gap: 8px; }
.mt-acts .btn { min-height: 48px; font: 700 16px/1.3 var(--f-round); color: var(--mink); }
.mt-acts .btn.mt-main { background: var(--mred); color: #fff; box-shadow: 0 4px 0 var(--mred-dk); }
.mt-menu-list { display: grid; gap: 8px; }
.mt-menu-list button { min-height: 48px; border-radius: 12px; border: 1px solid #e6d2ae; background: #fff; font-weight: 700; color: var(--mink) !important; }
.mt-help { display: grid; gap: 8px; font-size: 13.5px; line-height: 1.6; }
.mt-help p { margin: 0; }
/* 共有のかたまり（../js/share.js の shareBlock）。札の中なので、上の余白をつめて見出しを小さく左に
   .mt-game button の font: inherit・color: inherit が、共有の部品のボタンの字に効かないように戻す */
.mt-sharebox .section { margin-top: 2px; gap: 10px; }
.mt-sharebox .share > h2 { font: 800 15px/1.3 var(--f-round); text-align: left; }
.mt-sharebox .btn { min-height: 50px; color: #fff; font: 700 16px/1.3 var(--f-round); }
.mt-sharebox .seg button { font: 700 13px/1.5 var(--f-body); color: var(--mink); }
.mt-sharebox .share-apps { grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); }
.mt-sharebox .seg button:not([aria-pressed="true"]) { color: var(--mmut); }
/* 全画面のゲームの上に出す: 知らせ（.toast）と、画像を長押しで保存する窓（.share-sheet・アプリの中のブラウザ） */
.mt-lock .toast, .mt-lock .share-sheet { z-index: 2147483100; }
.mt-lock .pc-cols .toast { left: 50%; }

@keyframes mt-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes mt-pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes mt-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mt-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes mt-star { from { opacity: 0; transform: scale(.2) rotate(-40deg); } to { opacity: 1; transform: none; } }
@keyframes mt-bump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes mt-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .mt-banner, .mt-banner.bubble, .mt-toast.in, .mt-card, .mt-sheet, .mt-stars.big svg, .mt-goal.bump, .mt-moves.low { animation: none; } }

@media (max-width: 360px) {
  .mt-hudrow { gap: 6px; }
  .mt-title b { font-size: 15px; }
  .mt-title span { font-size: 11px; }
  .mt-moves { padding: 4px 9px; }
  .mt-moves b { font-size: 20px; }
  .mt-moves span { font-size: 10.5px; }
  .mt-menu-btn { width: 36px; }
  .mt-goal { padding: 2px 7px 2px 3px; }
  .mt-goal b { font-size: 16px; }
  .mt-tool span { font-size: 11px; }
}
@media (min-width: 700px) {
  .mt-tools { gap: 12px; }
  .mt-tool { max-width: 140px; }
}
