/* だんごソート（/dango/・2026-11-24）: 入口はサイトの明るい地のまま、遊ぶ画面（.dg-game）は画面全体を使う
   色: 土壁 --dbg・文字＝こげ茶 --dink・のれんの藍 --dai・朱 --dred。だんごの色は site/js/dango/draw.js の DANGO */
:root { --dbg: #ead9b6; --dpanel: #fffaf0; --dline: #e2cfa9; --dink: #3b2a1c; --dmut: #7d6a55; --dai: #2f4c7c; --dred: #c8553d; --dgold: #f2b21b; }

/* ── 入口 ── */
.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: 16 / 10; box-shadow: 0 18px 40px -26px rgba(70, 45, 20, .75); }
.dg-hero canvas { display: block; width: 100%; height: 100%; }
.dg-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(234, 217, 182, 0) 58%, rgba(47, 30, 16, .7)); }
.dg-hero-cap { position: absolute; left: 16px; right: 16px; bottom: 12px; z-index: 1; display: grid; gap: 2px; color: #fff; }
.dg-eb { font-size: 12px; font-weight: 800; letter-spacing: .12em; color: #ffe0a8; }
.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 16px rgba(40, 20, 5, .55); }
.dg-top .lead b { color: #b2402b; }
.dg-start { display: grid; gap: 10px; }
.dg-start .btn.go { --go: #c8553d; --go-step: #8f3526; --go-soft: rgba(143, 53, 38, .5); }
.dg-note { font-size: 13px; color: var(--muted); }
.dg-note b { color: var(--ink); }
.dg-pick { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 4px 12px; }
.dg-pick[hidden] { display: none; }
.dg-pick summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.dg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; padding: 4px 0 12px; max-height: 260px; overflow: auto; }
.dg-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; }
.dg-cell.now { border-color: var(--dred); background: #fff3ee; }
.dg-mini { display: flex; gap: 1px; }
.dg-mini svg { width: 11px; height: 11px; }
.dg-stars svg.on, .dg-mini svg.on { fill: var(--dgold); stroke: #b77a06; stroke-width: 1.4; stroke-linejoin: round; }
.dg-stars svg.off, .dg-mini svg.off { fill: rgba(120, 95, 60, .16); stroke: rgba(120, 95, 60, .25); stroke-width: 1.2; }
.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(--dai); 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-how span b { font-size: inherit; }
.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: #e8d6b2; 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: #3a2617; color: #fbf1dc; }
.dg-title { display: grid; line-height: 1.2; min-width: 0; flex: 1 1 auto; }
.dg-title b { font: 800 17px/1.2 var(--f-round); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-title span { font-size: 12px; color: #f2cf8a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-moves { display: flex; align-items: baseline; gap: 4px; padding: 4px 13px; border-radius: 999px; background: #fbf1dc; color: var(--dink); white-space: nowrap; }
.dg-moves b { font: 900 21px/1 var(--f-round); font-variant-numeric: tabular-nums; min-width: 1.2em; text-align: right; }
.dg-moves span { font-size: 12px; font-weight: 700; color: var(--dmut); }
.dg-menu-btn { display: grid; gap: 3px; place-content: center; flex: none; width: 40px; height: 38px; border: 1px solid rgba(251, 241, 220, .35); border-radius: 10px; background: rgba(255, 255, 255, .08); }
.dg-menu-btn i { display: block; width: 17px; height: 2px; border-radius: 2px; background: #fbf1dc; }
.dg-fieldbox { position: relative; min-height: 0; overflow: hidden; }
#dg-field { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: pointer; }
.dg-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(47, 76, 124, .95); color: #fff; font-size: 14px; font-weight: 700; text-align: center; box-shadow: 0 10px 26px -14px rgba(0, 0, 0, .7); pointer-events: none; animation: dg-in .25s ease-out; }
.dg-banner.hot { background: rgba(178, 64, 43, .96); }
.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, 250, 240, .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; }
.dg-toast[hidden] { display: none; }
.dg-toast.in { animation: dg-in .2s ease-out; }
.dg-tools { display: flex; gap: 8px; padding: 7px 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: #3a2617; }
.dg-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: #fbf1dc; color: var(--dink); box-shadow: 0 3px 0 #b8925c; }
.dg-tool:active { transform: translateY(2px); box-shadow: 0 1px 0 #b8925c; }
.dg-tool svg { width: 26px; height: 26px; color: var(--dink); }
.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(--dai); color: #fff; font: 800 12px/1.4 var(--f-round); font-style: normal; text-align: center; font-variant-numeric: tabular-nums; }
.dg-tool.zero { opacity: .5; }
.dg-tool.zero em { background: #8d7b63; }
.dg-tool[disabled] { opacity: .4; cursor: default; }

/* 札（メニュー・クリア） */
.dg-sheet { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 14px; background: rgba(47, 30, 16, .42); animation: dg-fade .2s ease-out; }
.dg-sheet[hidden] { display: none; }
.dg-card { width: min(420px, 100%); max-height: calc(100% - 4px); 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; }
.dg-card h2 { font: 900 23px/1.3 var(--f-round); text-align: center; }
.dg-card .sub { font-size: 13.5px; color: var(--dmut); text-align: center; margin: -4px 0 0; }

.dg-clear .dg-clear-eb { text-align: center; color: var(--dai); font-size: 13px; letter-spacing: .08em; margin: 0 0 -8px; }
.dg-stars.big { display: flex; justify-content: center; gap: 6px; }
.dg-stars.big svg { width: 48px; height: 48px; animation: dg-star .5s cubic-bezier(.3, 1.6, .5, 1) backwards; }
.dg-stars.big svg:nth-child(2) { animation-delay: .15s; width: 56px; height: 56px; margin-top: -8px; }
.dg-stars.big svg:nth-child(3) { animation-delay: .3s; }
.dg-big { text-align: center; }
.dg-big b { font: 900 54px/1 var(--f-round); font-variant-numeric: tabular-nums; color: #b2402b; }
.dg-big span { font-size: 16px; font-weight: 800; margin-left: 4px; }
.dg-best { text-align: center; font-size: 13.5px; font-weight: 700; color: #2f8f5f; margin: 0; }
.dg-acts { display: grid; gap: 8px; }
.dg-acts .btn { min-height: 48px; font: 700 16px/1.3 var(--f-round); color: var(--dink); }
.dg-acts .btn.dg-main { background: var(--dred); color: #fff; box-shadow: 0 4px 0 #8f3526; }
.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: inherit・color: inherit が、共有の部品のボタンの字に効かないように戻す */
.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; 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-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(-40deg); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dg-banner, .dg-toast.in, .dg-card, .dg-sheet, .dg-stars.big svg { animation: none; } }

@media (max-width: 360px) {
  .dg-hud { gap: 6px; }
  .dg-title b { font-size: 15.5px; }
  .dg-title span { font-size: 11px; }
  .dg-moves { padding: 4px 10px; }
  .dg-moves b { font-size: 19px; }
  .dg-menu-btn { width: 36px; }
  .dg-tool span { font-size: 11px; }
}
@media (min-width: 700px) {
  .dg-tools { gap: 12px; }
  .dg-tool { max-width: 140px; }
}
