/* だがし棚そろえ（/dagashi/・2026-11-24）: 入口はサイトの明るい地のまま、遊ぶ画面（.dg-game）は画面全体を使う
   色: 木のこげ茶 --dink・生成り --dpanel・朱 --dred（駄菓子屋ののれん）。棚や品物の絵は site/js/dagashi/draw.js・items.js */
:root { --dbg: #e8cfa2; --dpanel: #fff8ea; --dline: #e2cba3; --dink: #3d2a1e; --dmut: #86664a; --dred: #c8452b; --dgold: #f2b632; }

/* ── 入口 ── */
.dg-top { display: grid; gap: 16px; padding-top: 8px; }
.dg-hero { position: relative; margin: 0; border-radius: 20px; overflow: hidden; background: var(--dbg); aspect-ratio: 1 / 1; max-height: 520px; box-shadow: 0 18px 40px -26px rgba(70, 40, 15, .8); }
@media (min-width: 480px) { .dg-hero { aspect-ratio: 6 / 5; } }
.dg-hero canvas { display: block; width: 100%; height: 100%; }
.dg-hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 30%; pointer-events: none; background: linear-gradient(180deg, rgba(61, 42, 30, 0), rgba(61, 42, 30, .55)); }
.dg-hero-cap { position: absolute; left: 16px; right: 16px; bottom: 12px; z-index: 1; display: grid; gap: 2px; color: #fff; pointer-events: none; }
.dg-eb { font-size: 12px; font-weight: 800; letter-spacing: .1em; color: #ffe3a3; text-shadow: 0 1px 6px rgba(40, 20, 5, .6); }
.dg-hero-cap b { font-family: var(--f-round); font-size: clamp(28px, 8.5vw, 42px); line-height: 1.15; letter-spacing: .04em; text-shadow: 0 2px 14px rgba(40, 20, 5, .7); }
.dg-top .lead b { color: #b8361d; }
.dg-start { display: grid; gap: 10px; }
.dg-start .btn.go { --go: var(--dred); --go-step: #8f2a17; --go-soft: rgba(143, 42, 23, .5); }
.dg-note { font-size: 13px; color: var(--muted); }
.dg-note b { color: var(--ink); }
.dg-h2 { font-size: 20px; margin-top: 12px; }
.dg-how { margin: 0; padding: 0; list-style: none; counter-reset: dg; display: grid; gap: 10px; }
.dg-how li { counter-increment: dg; position: relative; display: grid; gap: 2px; padding: 12px 14px 12px 50px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.dg-how li::before { content: counter(dg); position: absolute; left: 14px; top: 12px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--dred); color: #fff; font: 800 14px/1 var(--f-round); }
.dg-how b { font-size: 15.5px; }
.dg-how span { font-size: 13.5px; color: var(--ink2); line-height: 1.6; }
.dg-faq details { border-bottom: 1px solid var(--line); padding: 10px 2px; }
.dg-faq summary { cursor: pointer; font-weight: 700; }
.dg-faq p { margin-top: 6px; font-size: 14px; color: var(--ink2); }

/* ── 遊ぶ画面 ── */
html.dg-lock, html.dg-lock body { overflow: hidden; overscroll-behavior: none; }
.dg-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: #5a3a22; color: var(--dink); font-family: var(--f-body); line-height: 1.5; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.dg-game button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.dg-hud { display: flex; align-items: center; gap: 8px; padding: max(8px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 7px max(10px, env(safe-area-inset-left, 0px)); background: linear-gradient(180deg, #6b4426, #573620); color: #fff4df; box-shadow: 0 2px 0 rgba(30, 15, 5, .4); position: relative; z-index: 1; }
.dg-stage { display: grid; line-height: 1.15; min-width: 0; flex: 0 1 auto; }
.dg-stage b { font: 800 17px/1.15 var(--f-round); white-space: nowrap; }
.dg-stage span { font-size: 11px; color: #e7c99a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-timer { margin-left: auto; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 5px; align-items: center; padding: 4px 10px 5px; border-radius: 12px; background: #fff8ea; color: var(--dink); }
.dg-timer svg { width: 17px; height: 17px; grid-row: 1; }
.dg-timer b { font: 800 18px/1.1 var(--f-round); font-variant-numeric: tabular-nums; min-width: 2.6em; }
.dg-bar { grid-column: 1 / -1; display: block; position: relative; height: 4px; margin-top: 2px; border-radius: 4px; background: #ecdcbc; overflow: hidden; }
.dg-bar i { position: absolute; inset: 0 auto 0 0; width: 100%; background: #3aa65a; border-radius: 4px; }
.dg-timer.hot { background: #ffe1d9; color: #b8261b; }
.dg-timer.hot .dg-bar i { background: #e0352b; }
.dg-timer.hot b { animation: dg-beat 1s ease-in-out infinite; }
.dg-timer.off { display: block; font-size: 12px; font-weight: 700; color: var(--dmut); padding: 6px 10px; }
.dg-left { display: flex; align-items: baseline; gap: 3px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 248, 234, .14); border: 1px solid rgba(255, 248, 234, .3); white-space: nowrap; }
.dg-left b { font: 800 18px/1 var(--f-round); font-variant-numeric: tabular-nums; }
.dg-left span { font-size: 11px; color: #e7c99a; }
.dg-left.pop b { animation: dg-pop .3s ease-out; }
.dg-pause { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 12px; background: #fff8ea; color: var(--dink) !important; flex: none; }
.dg-pause svg { width: 18px; height: 18px; fill: currentColor; }
@media (max-width: 370px) {
  .dg-hud { gap: 6px; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .dg-left span:first-child { display: none; }
  .dg-left { padding: 5px 8px; }
  .dg-timer { padding: 4px 8px 5px; }
  .dg-stage b { font-size: 15.5px; }
}
.dg-boardbox { position: relative; min-height: 0; overflow: hidden; }
#dg-board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#dg-board:active { cursor: grabbing; }
.dg-banner { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 8px 14px; border-radius: 12px; background: rgba(61, 42, 30, .93); color: #fff8ea; font-size: 13.5px; font-weight: 700; text-align: center; line-height: 1.5; box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .7); pointer-events: none; animation: dg-in .25s ease-out; z-index: 2; }
.dg-banner.hot { background: rgba(200, 52, 36, .95); }
.dg-banner[hidden] { display: none; }
.dg-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, 234, .97); border: 1px solid var(--dline); color: var(--dink); font-size: 13.5px; font-weight: 700; text-align: center; box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .5); pointer-events: none; z-index: 2; }
.dg-toast[hidden] { display: none; }
.dg-toast.in { animation: dg-in .2s ease-out; }
.dg-tools { display: flex; gap: 8px; padding: 8px max(10px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px)); justify-content: center; background: linear-gradient(180deg, #573620, #4a2d1a); }
.dg-tool { position: relative; flex: 1 1 0; max-width: 130px; min-width: 0; display: grid; justify-items: center; gap: 1px; padding: 7px 4px 6px; border-radius: 14px; border: 0; background: #fff8ea; color: var(--dink) !important; box-shadow: 0 3px 0 #2e1a0d; transition: transform .08s; }
.dg-tool:active { transform: translateY(2px); box-shadow: 0 1px 0 #2e1a0d; }
.dg-tool svg { width: 24px; height: 24px; }
.dg-tool span { font-size: 12px; font-weight: 800; white-space: nowrap; }
.dg-tool em { position: absolute; top: -7px; right: -3px; min-width: 22px; padding: 1px 6px; border-radius: 999px; background: var(--dred); color: #fff; font: 800 12px/1.4 var(--f-round); font-style: normal; text-align: center; font-variant-numeric: tabular-nums; border: 2px solid #4a2d1a; }
.dg-tool.zero { opacity: .5; }
.dg-tool.zero em { background: #8a7a6a; }
.dg-tool[aria-disabled="true"]:not(.zero) { opacity: .75; }

/* 札（メニュー・クリア・時間ぎれ） */
.dg-sheet { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 14px; background: rgba(45, 26, 12, .55); animation: dg-fade .2s ease-out; }
.dg-sheet[hidden] { display: none; }
.dg-card { width: min(420px, 100%); max-height: calc(100% - 8px); overflow: auto; padding: 18px 18px 16px; border-radius: 20px; background: var(--dpanel); box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .6); display: grid; gap: 12px; animation: dg-up .25s ease-out; border: 3px solid #6b4426; }
.dg-card h2 { font: 900 24px/1.25 var(--f-round); text-align: center; }
.dg-win h2 { color: var(--dred); font-size: 30px; letter-spacing: .04em; }
.dg-eyebrow { text-align: center; font-size: 12.5px; font-weight: 800; color: var(--dmut); letter-spacing: .08em; margin-bottom: -8px; }
.dg-card .sub { font-size: 14px; color: var(--dmut); text-align: center; }
.dg-stars { display: flex; justify-content: center; align-items: flex-end; gap: 8px; }
.dg-stars svg { width: 54px; height: 54px; fill: #e9d9bd; }
.dg-stars svg:nth-child(2) { width: 64px; height: 64px; margin-bottom: 8px; }
.dg-stars svg.on { fill: var(--dgold); animation: dg-star .45s cubic-bezier(.3, 1.6, .5, 1) both; }
.dg-facts { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--dmut); }
.dg-facts b { color: var(--dink); font: 800 16px/1 var(--f-round); }
.dg-best { text-align: center; font-size: 13.5px; font-weight: 700; color: #2f8f5f; }
.dg-acts { display: grid; gap: 8px; }
.dg-acts .btn { min-height: 48px; font-size: 16px; }
.dg-game .btn.dg-next, .dg-menu-list .dg-main { background: var(--dred); color: #fff !important; border: 0; }
.dg-game .btn.sub { color: var(--dink) !important; }
.dg-menu-list { display: grid; gap: 8px; }
.dg-menu-list button { min-height: 48px; border-radius: 12px; border: 1px solid var(--dline); background: #fff; font-weight: 700; }
.dg-help { display: grid; gap: 8px; font-size: 13.5px; line-height: 1.6; }
.dg-help p { margin: 0; }
/* 共有のかたまり（../js/share.js の shareBlock）。札の中なので見出しを小さく左に。.dg-game button の font・color が共有の部品の字に効かないように戻す */
.dg-sharebox:empty { display: none; }
.dg-sharebox .section { margin-top: 2px; gap: 10px; }
.dg-sharebox .share > h2 { font: 800 15px/1.3 var(--f-round); text-align: left; }
.dg-sharebox .btn { min-height: 50px; color: #fff !important; font: 700 16px/1.3 var(--f-round); }
.dg-sharebox .seg button { font: 700 13px/1.5 var(--f-body); }
.dg-sharebox .share-apps { grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); }
.dg-sharebox .seg button:not([aria-pressed="true"]) { color: var(--dmut); }
/* 全画面のゲームの上に出す: 知らせ（.toast）と、画像を長押しで保存する窓（.share-sheet・アプリの中のブラウザ） */
.dg-lock .toast, .dg-lock .share-sheet { z-index: 2147483100; }
.dg-lock .pc-cols .toast { left: 50%; }

@keyframes dg-pop { 0% { transform: scale(1.35); } 100% { transform: none; } }
@keyframes dg-beat { 0%, 100% { transform: none; } 50% { transform: scale(1.12); } }
@keyframes dg-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes dg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dg-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes dg-star { from { opacity: 0; transform: scale(.2) rotate(-30deg); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dg-banner, .dg-toast.in, .dg-card, .dg-sheet, .dg-left.pop b, .dg-stars svg.on, .dg-timer.hot b { animation: none; } }

/* 横向き・パソコン: 道具は右の列に */
@media (orientation: landscape) and (min-width: 700px) {
  .dg-game { grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto; }
  .dg-hud { grid-column: 1 / -1; }
  .dg-tools { flex-direction: column; justify-content: center; padding: 10px max(12px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) 10px; background: linear-gradient(90deg, #573620, #4a2d1a); }
  .dg-tool { flex: 0 0 auto; width: 104px; max-width: none; padding: 12px 4px 10px; }
  .dg-hud .dg-timer { margin-left: auto; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .dg-hud { padding-top: max(4px, env(safe-area-inset-top, 0px)); padding-bottom: 3px; }
  .dg-tools { gap: 6px; }
  .dg-tool { width: 84px; padding: 6px 2px 5px; }
  .dg-tool svg { width: 20px; height: 20px; }
}
