/* 操作の帯（2026-11-18 G）
   下＝アクションの帯（いつも出ている。小さな丸いアイコンが横に 1 列。えらんでいる物は だいだいの輪）
   道具の上に小さく＝大きさ／おく・おこす の中身／ひとりでに わく
   上＝みる の帯（目と「…」。近づける・押すと 動かす・角度・＋・−・ぜんたい が出る。みる の間は 出たまま）
   字は そえる程度：名前は 近づけた時・長押しで #tip に出る */
:root { --tb: 46px; --tbi: 30px; --lb: 38px; }
@media (max-width: 400px), (max-height: 460px) { :root { --tb: 42px; --tbi: 27px; --lb: 36px; } }

/* ---- 下：アクションの帯 ---- */
.bar { position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 3px; padding: 4px; border-radius: 999px; background: var(--glass); box-shadow: var(--shadow);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-sizing: border-box; max-width: calc(100vw - 16px);
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; white-space: nowrap; }
.bar::-webkit-scrollbar { display: none; }
.bar .tools { display: flex; flex-wrap: nowrap; gap: 3px; width: auto; margin: 0; }
.bar-sep { flex: none; width: 1.5px; height: 26px; border-radius: 1px; background: rgba(120, 90, 60, .22); margin: 0 1px; }
.tool, .undob { flex: none; width: var(--tb); height: var(--tb); border: 0; border-radius: 50%; background: transparent; padding: 0;
  display: grid; place-items: center; cursor: pointer; position: relative; color: var(--ink);
  -webkit-touch-callout: none; touch-action: manipulation; transition: background .12s ease, box-shadow .12s ease, transform .12s ease, opacity .2s ease; }
.tool svg { width: var(--tbi); height: var(--tbi); display: block; pointer-events: none; }
.undob svg { width: 24px; height: 24px; pointer-events: none; }
/* 名前は 字で出さない（読み上げ用に残す。目に見える名前は #tip） */
.tool span, .lookbar button span, .morepop button span, .overlays button span {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.tool kbd { position: absolute; right: 4px; bottom: 3px; font: 9px/1 var(--font); color: #b9a68e; pointer-events: none; }
@media (hover: none), (pointer: coarse), (max-width: 720px) { .tool kbd { display: none; } }
.tool:hover, .undob:hover:not(:disabled) { background: rgba(255, 255, 255, .78); }
.tool:active, .undob:active:not(:disabled) { transform: scale(.92); }
.tool[aria-pressed="true"], .tool.evopen.cur { background: #fff7ea; box-shadow: inset 0 0 0 3px var(--accent), 0 2px 6px rgba(60, 40, 20, .18); }
.tool[aria-pressed="true"] kbd { color: var(--accent); }
.tool.evopen[aria-expanded="true"]:not(.cur) { background: var(--accent-soft); }
.tool[hidden] { display: none; }
.undob:disabled { opacity: .28; cursor: default; }

/* ---- 道具の上に小さく（JS が 選んだ道具の上に置く） ---- */
.toolpop { padding: 4px; border-radius: 22px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-sizing: border-box; max-width: calc(100vw - 16px); }
.toolpop .evtools { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; width: auto; margin: 0; padding: 0; border: 0; }
.toolpop .evtools .tool { width: calc(var(--tb) - 4px); height: calc(var(--tb) - 4px); }
.toolpop .evtools .tool svg { width: calc(var(--tbi) - 3px); height: calc(var(--tbi) - 3px); }
.toolpop .evtools[hidden] { display: none; }
.size { display: flex; gap: 2px; margin: 0; padding: 2px; border-radius: 999px; background: var(--paper2); }
.size[hidden] { display: none; }
.size button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; touch-action: manipulation; }
.size i { display: block; border-radius: 50%; background: #c9b597; pointer-events: none; }
.size button[aria-pressed="true"] { background: #fff; }
.size button[aria-pressed="true"] i { background: var(--accent); }
.autosp { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--paper2); padding: 0; display: grid; place-items: center; cursor: pointer; touch-action: manipulation; }
.autosp svg { width: 30px; height: 30px; overflow: visible; pointer-events: none; }
.autosp .cross { display: none; }
.autosp[aria-pressed="false"] .cross { display: inline; }
.autosp[aria-pressed="false"] .drops { opacity: .35; }

/* ---- 上：みる の帯 ---- */
.lookbar { position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: var(--glass); box-shadow: var(--shadow);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: opacity .7s ease; white-space: nowrap; box-sizing: border-box; max-width: calc(100vw - 16px); }
.lookbar button { width: var(--lb); height: var(--lb); min-width: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; padding: 0;
  display: grid; place-items: center; position: relative; -webkit-touch-callout: none; touch-action: manipulation; }
.lookbar button:hover { background: rgba(255, 255, 255, .78); }
.lookbar svg { width: 20px; height: 20px; flex: none; pointer-events: none; }
.lookbar #lookBtn svg { width: 27px; height: 27px; }
#lookBtn[aria-pressed="true"] { background: var(--look-soft); box-shadow: inset 0 0 0 2.5px var(--look); }
#lookBtn.glow { animation: invite 1.6s ease-in-out 3; }
.lookbar .lb-views { display: none; align-items: center; gap: 2px; padding: 0 2px; margin: 0 1px; border-left: 1.5px solid rgba(120, 90, 60, .18); border-right: 1.5px solid rgba(120, 90, 60, .18); }
.lookbar.open .lb-views, .lookbar.look .lb-views { display: flex; animation: lbIn .16s ease-out; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lookbar .lb-pair, .lookbar .lb-zoom { display: flex; gap: 2px; }
.lookbar .lb-pair button[aria-pressed="true"] { background: var(--look-soft); box-shadow: inset 0 0 0 2px var(--look); }
#moreBtn[aria-expanded="true"] { background: var(--accent-soft); }
#moreBtn.invite { animation: invite 1.8s ease-in-out 4; }

/* ---- 「…」の枡目：みる の帯の下に 小さな丸いアイコン ---- */
.morepop { width: auto; max-width: min(296px, calc(100vw - 16px)); padding: 6px; box-sizing: border-box;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.morepop .grid { display: contents; }
.morepop button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--paper2); cursor: pointer; padding: 0;
  display: grid; place-items: center; position: relative; color: var(--ink); -webkit-touch-callout: none; touch-action: manipulation; }
.morepop button svg { width: 24px; height: 24px; pointer-events: none; }
.morepop button:hover { background: #ece0c9; }
.morepop button[hidden] { display: none; }
#btnOv[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.morepop .mrow { flex-basis: 100%; display: flex; justify-content: center; gap: 4px; }
.morepop .mrow[hidden] { display: none; }
.morepop .timerow { padding: 2px; border-radius: 999px; background: var(--paper2); flex-basis: auto; }
.morepop .timerow button { background: transparent; }
.morepop .mrow button[aria-pressed="true"] { background: #fff; box-shadow: inset 0 0 0 2.5px var(--accent); }
.morepop .carryrow button { width: 64px; border-radius: 999px; background: var(--accent-soft); }
.morepop .carryrow button svg { width: 52px; height: 26px; }
/* なまえ と さかい（「なまえ」を押したときだけ ひらく 1 列） */
.overlays { flex-basis: 100%; display: flex; justify-content: center; gap: 2px; margin-top: 2px; padding: 2px; border-radius: 999px; background: var(--paper2); }
.overlays[hidden] { display: none; }
.overlays button { width: 38px; height: 38px; background: transparent; }
.overlays button svg { width: 22px; height: 22px; }
.overlays button[aria-pressed="true"] { background: #fff; box-shadow: inset 0 0 0 2px var(--accent); }
.overlays.faint { opacity: .45; }

/* ---- 名前の札（近づけた時・長押しで） ---- */
.tip { position: fixed; left: 0; top: 0; z-index: 30; padding: 4px 10px; border-radius: 999px; background: rgba(54, 40, 24, .9); color: #fff;
  font: 12px/1.35 var(--font); letter-spacing: .03em; white-space: nowrap; pointer-events: none; max-width: calc(100vw - 16px);
  overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 8px rgba(40, 25, 10, .25); }
.tip[hidden] { display: none; }

/* ---- 窓（あそびかた・ずかん・ふりかえり・はじめから・地図からつくる・タイトル）が開いている間は 帯を出さない（窓の × や 下端に重なるため） ---- */
html:has(.veil.open, .sg-veil, #geoVeil:not([hidden])) #bar,
html:has(.veil.open, .sg-veil, #geoVeil:not([hidden])) #toolPop,
html:has(.veil.open, .sg-veil, #geoVeil:not([hidden])) #lookBar,
html:has(.veil.open, .sg-veil, #geoVeil:not([hidden])) #morePop { visibility: hidden; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .lookbar.open .lb-views, .lookbar.look .lb-views { animation: none; } }
/* 「…」の枡目が開いている間は 知らせの一行も隠す（枡目と重なるため。閉じれば もどる） */
body:has(#morePop:not([hidden])) .toast { visibility: hidden; }
/* まちの窓が開いている間は 札と 知らせの一行を隠す（窓と重なるため） */
body:has(#townWin:not([hidden])) .sg-pins, body:has(#townWin:not([hidden])) .toast, body:has(#townWin:not([hidden])) #geoPlaceBadge { visibility: hidden; }
