/* 吧台地圖 /bar/：由 .bar-prototype 移植（docs/PROMPT-bar-map-3d-v0.1.md 階段 5）。
   全部掛在 .bar-page 底下，不動站上共用的 :root 變數與 body 版型。
   進入 3D 時場景是頁面裡的一個區塊，高度為視窗減掉它上方的導覽列（--bar-top，由 bar.js 量測）；
   浮動面板以這個區塊為定位基準，頁面照常往下捲到站上頁尾與免責聲明。 */
.bar-page {
  --bar-top: 0px;
  --night: #07111c; --ink: #0b0d0f; --gold: #c7a66a; --paper: #e9ddc5; --mist: #9a9388; --wine: #8a2f3a;
  --line: rgba(199,166,106,.28); --glass: rgba(7,17,28,.72); --panel: rgba(13,22,33,.92);
  --font-display: "Iansui", "Noto Serif TC", serif;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color-scheme: dark;
}
.bar-page, .bar-page * { box-sizing: border-box; }
.bar-page [hidden] { display: none !important; }
.bar-page {
  color: var(--paper); font-family: var(--font-body); font-size: 15px; line-height: 1.7;
}
.wrap { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.wrap > *, .tonight > *, .stage > *, .enter-row > * { min-width: 0; }
.eyebrow { font-size: 12px; letter-spacing: .14em; color: var(--gold); }
.bar-page h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 4.4vw, 44px); line-height: 1.2; margin: 0; }
.brand { display: grid; gap: 2px; }
.lede { color: var(--mist); margin: 6px 0 0; max-width: 60ch; overflow-wrap: anywhere; }
.tonight { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-block: 12px; min-width: 0; }
.tonight .score { font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.tonight .state { font-family: var(--font-display); font-size: 24px; }
.tonight .score, .tonight .state { color: var(--accent, var(--gold)); transition: color .9s linear; }
@media (prefers-reduced-motion: reduce) { .tonight .score, .tonight .state { transition: none; } }
.tonight .tape { color: var(--mist); flex: 1 1 220px; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.tag { font-size: 12px; color: var(--mist); border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; white-space: nowrap; }
.notice { margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px; background: rgba(138,47,58,.18); }
.enter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; color: var(--mist); font-size: 13px; }

.btn, .toolbar button, .tabs button, .chip {
  min-height: 44px; border-radius: 6px; border: 1px solid var(--line); background: rgba(11,13,15,.55);
  color: var(--paper); font: inherit; font-size: 14px; padding: 0 16px; cursor: pointer; line-height: 1.3;
}
.btn:hover, .toolbar button:hover, .tabs button:hover, .chip:hover { border-color: var(--gold); }
.toolbar button[aria-pressed="true"], .tabs button[aria-selected="true"], .btn.primary { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.bar-page :focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.primary { display: inline-flex; align-items: center; text-decoration: none; font-weight: 500; }
.btn:disabled { opacity: .6; cursor: progress; }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.map { min-width: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #0a0d10; }
.map svg { display: block; width: 100%; max-width: 100%; height: auto; }
.map .bottle, .map .cup { cursor: pointer; outline: none; }
.map .bottle .glass { transition: transform .25s ease; transform-box: fill-box; transform-origin: 50% 100%; }
.map .bottle:hover .glass, .map .bottle:focus-visible .glass, .map .bottle.selected .glass { transform: translateY(-6px); }
.map .bottle:focus-visible .ring, .map .bottle.selected .ring { stroke: var(--paper); stroke-opacity: 1; stroke-width: 2; }
.map .bottle .halo, .map .bottle .ribbon { opacity: 0; transition: opacity .4s ease; }
.map .bottle.pick .halo, .map .bottle.pick .ribbon { opacity: 1; }
.map .label { font-size: 13px; fill: var(--paper); }
.map .bottle.selected .label { fill: var(--gold); }
.map .shelf-name { font-family: var(--font-display); font-size: 17px; fill: var(--gold); }
.map .shelf-sub { font-size: 11px; fill: var(--mist); letter-spacing: .12em; }
.map .cup .liquid { opacity: 0; transition: opacity .35s ease; }
.map .cup.on .liquid { opacity: 1; }
.map .cup .cup-name { font-size: 12px; fill: var(--mist); }
.map .cup.on .cup-name { fill: var(--paper); font-weight: 700; }
.map .cup:focus-visible .rim { stroke: var(--paper); stroke-width: 2.5; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; min-width: 0; position: relative; }
#card-body { display: grid; gap: 10px; }
.card h2 { font-family: var(--font-display); font-weight: 400; font-size: 23px; line-height: 1.35; margin: 0; padding-right: 36px; }
.card p { margin: 0; color: #d6ccb8; }
.card .std { color: var(--mist); font-size: 14px; }
.card .sub { font-size: 12px; letter-spacing: .14em; color: var(--gold); margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 0 12px; font-size: 13px; }
.badge { justify-self: start; font-size: 12px; color: var(--ink); background: var(--gold); border-radius: 999px; padding: 1px 10px; }
.readrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.path { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--mist); word-break: break-all; }
.alist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.alist button { all: unset; box-sizing: border-box; cursor: pointer; display: block; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 6px; color: #d6ccb8; line-height: 1.5; font-size: 14px; border: 1px solid transparent; }
.alist button:hover { border-color: var(--gold); }
.alist button:focus-visible { outline: 3px solid var(--gold); }
.close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--mist); font-size: 22px; cursor: pointer; }
.close:hover { border-color: var(--gold); }
.handle { display: none; }
body:not(.is-3d) .close { display: none; }

.menu { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px 8px 8px; min-width: 0; overflow-x: hidden; }
.menu-head { display: grid; gap: 8px; padding: 0 8px; }
.menu input { min-height: 44px; border-radius: 6px; border: 1px solid var(--line); background: rgba(0,0,0,.3); color: var(--paper); font: inherit; padding: 0 12px; width: 100%; }
.tabs { display: flex; gap: 8px; padding: 10px 8px 4px; }
.tabs button { flex: 1; }
.menu h3 { font-size: 12px; letter-spacing: .14em; color: var(--gold); margin: 12px 8px 4px; font-weight: 500; }
.menu ol, .menu ul { list-style: none; margin: 0; padding: 0; }
.menu li a { display: flex; gap: 10px; align-items: baseline; padding: 9px 8px; min-height: 44px; border-radius: 6px; color: #e2d8c4; text-decoration: none; line-height: 1.5; border: 1px solid transparent; min-width: 0; overflow-wrap: anywhere; }
.menu .t { min-width: 0; }
.menu li a:hover { border-color: var(--gold); }
.menu li a[aria-current="true"] { color: var(--gold); background: rgba(199,166,106,.14); }
.menu .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; transform: translateY(-2px); background: transparent; }
.menu li.pick .dot { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.menu .sum { margin: 0 8px 2px 24px; color: var(--mist); font-size: 13px; }
.menu li > .path { display: block; margin: 0 8px 12px 24px; }
#cc-list button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; width: 100%; min-height: 44px; padding: 9px 8px; border-radius: 6px; border: 1px solid transparent; color: #e2d8c4; font-size: 14px; line-height: 1.5; }
#cc-list button:hover { border-color: var(--gold); }
#cc-list button:focus-visible { outline: 3px solid var(--gold); }
#cc-list small { color: var(--mist); white-space: nowrap; }
.toolbar, .hint, .mob { display: none; }
.bar-page .bar-note { font-size: 12px; color: var(--mist); border-top: 1px solid var(--line); padding-top: 12px; }
#scene { display: none; }
#keys { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 30; }
#keys button:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; padding: 0; border: 0; }
#keys button:focus { position: fixed; left: 50%; bottom: 92px; translate: -50% 0; max-width: calc(100vw - 32px); min-height: 44px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--gold); background: var(--glass); color: var(--paper); font: inherit; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .stage { grid-template-columns: minmax(0, 1fr); } }

/* ---- 3D mode ---- */
body.is-loading3d #scene { display: block; position: fixed; inset: 0; visibility: hidden; z-index: -1; }
body.is-3d { overflow-x: clip; }
body.is-3d .bar-page { position: relative; height: calc(100vh - var(--bar-top)); height: calc(100dvh - var(--bar-top)); min-height: 420px; margin-left: calc(-1 * var(--bar-left, 0px)); width: var(--bar-w, 100%); overflow: hidden; }
body.is-3d #scene { display: block; position: absolute; inset: 0; z-index: 0; background: radial-gradient(120% 90% at 50% 15%, #1a140e 0%, #05070a 78%); }
#scene canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#scene .labels { position: absolute; top: 0; left: 0; pointer-events: none; }
body.is-3d .wrap, body.is-3d .stage { display: contents; }
body.is-3d .lede, body.is-3d .map, body.is-3d .enter-row, body.is-3d .bar-page .bar-note, body.is-3d .notice { display: none; }
body.is-3d .glass { background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 8px; }
body.is-3d .brand { position: absolute; top: 16px; left: 16px; z-index: 10; padding: 10px 16px; }
body.is-3d .brand h1 { font-size: 22px; }
body.is-3d .tonight { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 10; width: clamp(300px, calc(100vw - 760px), 520px); padding: 8px 16px; gap: 0 12px; line-height: 1.5; }
body.is-3d .tonight .score { font-size: 30px; }
body.is-3d .tonight .state { font-size: 20px; }
body.is-3d .tonight .tape { font-size: 13px; flex-basis: 100%; }
body.is-3d .menu { display: none; position: absolute; top: 92px; left: 16px; bottom: 84px; width: 300px; z-index: 12; overflow-y: auto; overflow-x: hidden; }
body.is-3d.menu-open .menu { display: block; }
body.is-3d .mob { display: inline-flex; align-items: center; }
body.is-3d .menu .sum, body.is-3d .menu li > .path { display: none; }
body.is-3d .card { position: absolute; top: 112px; right: 16px; width: 360px; max-height: calc(100% - 200px); overflow: auto; z-index: 10; background: var(--glass); }
body.is-3d .toolbar { display: flex; gap: 8px; position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); z-index: 10; padding: 6px; }
body.is-3d .hint { display: block; position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--mist); margin: 0; z-index: 10; pointer-events: none; }
.lbl { white-space: nowrap; font-family: var(--font-body); pointer-events: none; }
.lbl.plate { font-family: var(--font-display); font-size: 14px; color: var(--gold); text-shadow: 0 1px 3px #000; }
.lbl.pick { font-size: 11px; font-weight: 700; color: var(--ink); background: #f3d38f; border-radius: 999px; padding: 0 8px; box-shadow: 0 0 12px rgba(243,211,143,.6); }
.lbl.cup { font-size: 12px; color: var(--mist); text-shadow: 0 1px 3px #000; }
.lbl.cup.on { color: var(--paper); font-weight: 700; }
.lbl.cup.hover { color: var(--gold); }
.lbl.link { font-size: 12px; line-height: 1.35; color: var(--paper); background: rgba(7,17,28,.82); border: 1px solid var(--gold); border-radius: 4px; padding: 3px 8px; text-align: center; }
.lbl.link small { display: block; font-size: 10px; color: var(--mist); }
@media (max-width: 800px) {
  body.is-3d .bar-page { height: calc(100vh - var(--bar-top) - 64px); height: calc(100dvh - var(--bar-top) - 64px); }
  body.is-3d .brand { top: 8px; left: 8px; padding: 4px 10px; }
  body.is-3d .brand .eyebrow { font-size: 10px; }
  body.is-3d .brand h1 { font-size: 16px; }
  body.is-3d .tonight { top: 8px; left: auto; right: 8px; transform: none; width: calc(100vw - 140px); padding: 4px 10px; }
  body.is-3d .tonight .score { font-size: 22px; }
  body.is-3d .tonight .state { font-size: 16px; }
  body.is-3d .tonight .tape { display: none; }
  body.is-3d .toolbar { top: 70px; bottom: auto; left: 8px; right: 8px; transform: none; justify-content: center; flex-wrap: wrap; }
  body.is-3d .toolbar button { padding: 0 10px; font-size: 13px; }
  body.is-3d .mob { display: inline-flex; align-items: center; }
  body.is-3d .menu { display: none; top: 132px; left: 8px; right: 8px; bottom: 16px; width: auto; z-index: 12; }
  body.is-3d.menu-open .menu { display: block; }
  body.is-3d .card { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--sheet-h, 40vh); max-height: none; border-radius: 14px 14px 0 0; padding-top: 28px; z-index: 11; }
  body.is-3d .handle { display: block; position: absolute; top: 0; left: 0; right: 0; height: 28px; cursor: grab; touch-action: none; }
  body.is-3d .handle::after { content: ""; position: absolute; top: 10px; left: 50%; width: 44px; height: 4px; margin-left: -22px; border-radius: 2px; background: var(--mist); }
  body.is-3d .hint { display: none; }
}
