:root{
  --bg:#f4f6fa; --panel:#ffffff; --ink:#101828; --ink-2:#475467; --ink-3:#8792a6;
  --line:#dfe4ec; --accent:#1d4ed8; --accent-soft:#e5edff;
  --here:#0f9d58; --here-soft:#e3f5ea;
  --hi:#e8590c; --hi-soft:#ffe8d6;
  --room:#eef1f6; --room-line:#c6cddb; --hall:#e3f0fb; --stage:#e3f3e6;
  --back:#e9ebf0; --void:#f0f1f4; --fac:#fdf0d5; --svc:#fdf3c8; --lec:#ffe8d6;
  --shadow:0 1px 2px rgba(16,24,40,.06),0 8px 24px rgba(16,24,40,.08);
  --safe-b:env(safe-area-inset-bottom,0px);
}
@media (prefers-color-scheme:dark){
  :root{
    --bg:#0b1020; --panel:#131a2c; --ink:#e9eefb; --ink-2:#aab6d0; --ink-3:#7c89a6;
    --line:#27314a; --accent:#7aa2ff; --accent-soft:#1b2547;
    --here:#4ade80; --here-soft:#12301f;
    --hi:#ffa552; --hi-soft:#4a2d14;
    --room:#1b2338; --room-line:#33405e; --hall:#1a2b40; --stage:#1b3328;
    --back:#171e2f; --void:#141a29; --fac:#3a2f18; --svc:#3a3418; --lec:#4a2d14;
    --shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.45);
  }
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:"Hiragino Kaku Gothic ProN","Hiragino Sans","Noto Sans JP",
    -apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif;
  font-size:15px; line-height:1.6;
  display:flex; flex-direction:column;
  -webkit-text-size-adjust:100%; overscroll-behavior:none;
}
body.modal-open{overflow:hidden}

/* ---------- top ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:10px 16px; padding-top:max(10px,env(safe-area-inset-top,0px));
  background:var(--panel); border-bottom:1px solid var(--line); flex:0 0 auto;
}
.brand{display:flex; align-items:baseline; gap:8px; min-width:0}
.brand-main{font-weight:700; font-size:17px; letter-spacing:.02em}
.brand-sub{font-size:12px; color:var(--ink-3); white-space:nowrap}
.herebtn{
  display:inline-flex; align-items:center; gap:7px; flex:0 0 auto;
  border:1px solid var(--line); background:var(--panel); color:var(--ink-2);
  border-radius:999px; padding:7px 14px; font-size:13px; font-weight:600;
  font-family:inherit; cursor:pointer; white-space:nowrap;
}
.herebtn:active{transform:scale(.97)}
.herebtn.on{background:var(--here-soft); border-color:var(--here); color:var(--here)}
.herebtn .dot{width:9px;height:9px;border-radius:50%;background:var(--ink-3);flex:0 0 auto}
.herebtn.on .dot{background:var(--here); box-shadow:0 0 0 4px color-mix(in srgb,var(--here) 25%,transparent)}

.floortabs{
  display:flex; gap:6px; padding:8px 16px; background:var(--panel);
  border-bottom:1px solid var(--line); flex:0 0 auto; overflow-x:auto;
}
.floortabs button{
  position:relative; flex:1 1 0; min-width:72px;
  border:1px solid var(--line); background:transparent; color:var(--ink-2);
  border-radius:10px; padding:8px 10px; font-size:14px; font-weight:600;
  font-family:inherit; cursor:pointer; white-space:nowrap;
}
.floortabs button.on{background:var(--accent); border-color:var(--accent); color:#fff}
.floortabs button .mark{position:absolute; top:4px; right:6px; width:7px; height:7px; border-radius:50%}
.floortabs button .mark.here{background:var(--here)}
.floortabs button .mark.target{background:var(--hi)}

.status{
  margin:0; padding:9px 16px; font-size:12.5px; line-height:1.5;
  background:var(--accent-soft); color:var(--ink);
  border-bottom:1px solid var(--line); flex:0 0 auto;
}
.status.ok{background:var(--here-soft)}

/* ---------- map ---------- */
.mapwrap{
  position:relative; flex:1 1 auto; min-height:46vh; overflow:hidden;
  background:var(--bg); touch-action:none;
}
.mapstage{position:absolute; inset:0; transform-origin:0 0;
  display:flex; align-items:center; justify-content:center}
.mapstage svg{width:100%; height:100%; display:block; user-select:none}

.floorplan .outline{fill:var(--panel); stroke:var(--room-line); stroke-width:3}
.room-shape{fill:var(--room); stroke:var(--room-line); stroke-width:1.4}
.kind-hall  .room-shape{fill:var(--hall)}
.kind-stage .room-shape{fill:var(--stage)}
.kind-back  .room-shape{fill:var(--back)}
.kind-void  .room-shape{fill:var(--void); stroke-dasharray:6 5}
.kind-facility .room-shape{fill:var(--fac)}
.kind-service  .room-shape{fill:var(--svc)}
.kind-lec   .room-shape{fill:var(--lec); stroke:var(--hi); stroke-width:2}
.room-label,.room-sub{fill:var(--ink); font-family:inherit; text-anchor:middle; pointer-events:none}
.room-sub{font-size:9px; fill:var(--ink-3)}
.room-icon{font-size:19px; text-anchor:middle; pointer-events:none}
.kind-void .room-label{fill:var(--ink-3)}

.room.is-target .room-shape{
  fill:var(--hi); stroke:var(--hi); stroke-width:3;
  animation:pulse 1.6s ease-in-out infinite;
}
.room.is-target .room-label{fill:#fff; font-weight:700}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.72}}

/* 現在地マーカー */
.mk-pulse{fill:color-mix(in srgb,var(--here) 30%,transparent); animation:ping 2s ease-out infinite}
@keyframes ping{
  0%{transform-origin:center; opacity:.65; r:19}
  100%{opacity:0; r:42}
}
.mk-ring{fill:color-mix(in srgb,var(--here) 22%,transparent); stroke:var(--here); stroke-width:2}
.mk-dot{fill:var(--here); stroke:#fff; stroke-width:3.5}
.mk-tag-bg{fill:var(--here)}
.mk-tag-tx{fill:#fff; font-size:17px; font-weight:700; text-anchor:middle; font-family:inherit}

.mapctl{position:absolute; right:10px; bottom:12px; display:flex; flex-direction:column; gap:6px}
.mapctl button{
  width:38px; height:38px; border-radius:10px; border:1px solid var(--line);
  background:var(--panel); color:var(--ink); font-size:17px; font-family:inherit;
  cursor:pointer; box-shadow:var(--shadow);
}
#zoom-here{color:var(--here); border-color:var(--here); font-size:19px}

/* ---------- sheet ---------- */
.sheet{
  flex:0 0 auto; max-height:44vh; overflow-y:auto; background:var(--panel);
  border-top:1px solid var(--line); box-shadow:var(--shadow);
  padding-bottom:var(--safe-b); -webkit-overflow-scrolling:touch;
}
.sheet-tabs{
  display:flex; gap:4px; padding:8px 12px 0; position:sticky; top:0;
  background:var(--panel); border-bottom:1px solid var(--line); z-index:2;
}
.sheet-tabs button{
  flex:1; border:0; background:transparent; color:var(--ink-3);
  font-size:13px; font-weight:600; font-family:inherit; padding:9px 4px 11px;
  border-bottom:2.5px solid transparent; cursor:pointer;
}
.sheet-tabs button.on{color:var(--accent); border-bottom-color:var(--accent)}
.pane{display:none; padding:14px 16px 4px}
.pane.on{display:block}
.lead{margin:0 0 10px; font-size:13px; color:var(--ink-2)}

/* 現在地カード */
.herecard{border-radius:12px; padding:14px; margin-bottom:14px; border:1px solid var(--line)}
.herecard.on{background:var(--here-soft); border-color:var(--here)}
.herecard.off{background:var(--bg)}
.hc-cap{margin:0 0 3px; font-size:11.5px; font-weight:700; letter-spacing:.08em; color:var(--ink-3)}
.herecard.on .hc-cap{color:var(--here)}
.hc-main{margin:0 0 10px; font-size:21px; font-weight:700; line-height:1.35}
.hc-lead{margin:0 0 12px; font-size:13px; color:var(--ink-2); line-height:1.7}
.hc-act{display:flex; gap:8px; flex-wrap:wrap}
.mini{
  border:0; background:var(--accent); color:#fff; border-radius:9px;
  padding:9px 14px; font-size:13px; font-weight:600; font-family:inherit; cursor:pointer;
}
.mini.ghost{background:transparent; color:var(--ink-2); border:1px solid var(--line)}
.mini:active{transform:scale(.97)}

.pick{display:block}
.pick span{display:block; font-size:12px; color:var(--ink-3); margin-bottom:5px}
select{
  width:100%; padding:11px 12px; border-radius:10px; border:1px solid var(--line);
  background:var(--bg); color:var(--ink); font-size:15px; font-family:inherit;
}
.card{margin-top:12px; padding:13px 14px; border-radius:12px;
  background:var(--hi-soft); border:1px solid var(--hi)}
.card .cap{margin:0 0 3px; font-size:11.5px; font-weight:700; letter-spacing:.08em; color:var(--hi)}
.card .where{font-size:19px; font-weight:700; margin:0 0 3px}
.card .when{font-size:13px; color:var(--ink-2); margin:0 0 7px}
.card .who{font-size:13px; margin:0; color:var(--ink)}
.card .route{margin:9px 0 0; font-size:13px; color:var(--ink-2);
  border-top:1px dashed var(--hi); padding-top:8px}

.daytabs{display:flex; gap:6px; margin-bottom:10px}
.daytabs button{
  border:1px solid var(--line); background:transparent; color:var(--ink-2);
  border-radius:999px; padding:6px 14px; font-size:13px; font-weight:600;
  font-family:inherit; cursor:pointer;
}
.daytabs button.on{background:var(--accent); border-color:var(--accent); color:#fff}
.program{list-style:none; margin:0; padding:0}
.program li{display:flex; gap:11px; align-items:flex-start; padding:10px 2px;
  border-bottom:1px solid var(--line); cursor:pointer}
.program li:last-child{border-bottom:0}
.program .t{flex:0 0 46px; font-weight:700; font-size:13.5px; font-variant-numeric:tabular-nums}
.program .b{min-width:0; flex:1}
.program .rm{font-size:13.5px; font-weight:700}
.program .rm .fl{color:var(--ink-3); font-weight:600; font-size:12px; margin-left:5px}
.program .sp{font-size:12.5px; color:var(--ink-2); margin-top:1px}

.facility{list-style:none; margin:0; padding:0;
  display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:8px}
.facility li{border:1px solid var(--line); border-radius:10px; padding:9px 11px;
  font-size:13px; cursor:pointer; background:var(--bg)}
.facility .fl{display:block; font-size:11px; color:var(--ink-3)}

.fineprint{padding:12px 16px 16px; border-top:1px solid var(--line); margin-top:14px}
.fineprint p{margin:0; font-size:11px; line-height:1.55; color:var(--ink-3)}

/* ---------- 現在地ピッカー ---------- */
.sheetback{
  position:fixed; inset:0; background:rgba(10,15,30,.55); z-index:40;
  display:flex; align-items:flex-end; justify-content:center;
}
/* [hidden] は display:flex に負けるので明示的に打ち消す */
.sheetback[hidden]{display:none}
/* 閉じる途中: 見た目は消すがクリックは受け止める（すり抜け防止） */
.sheetback.closing{background:transparent}
.sheetback.closing .picker{opacity:0; transition:opacity .18s ease-out; pointer-events:none}
.toast[hidden]{display:none}
.picker{
  background:var(--panel); width:100%; max-width:560px; max-height:82vh;
  border-radius:16px 16px 0 0; overflow-y:auto; padding:0 16px 24px;
  padding-bottom:calc(24px + var(--safe-b));
}
.picker-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  position:sticky; top:0; background:var(--panel); padding:16px 0 10px; z-index:1;
  border-bottom:1px solid var(--line); margin-bottom:12px;
}
.picker-head h2{margin:0; font-size:17px}
#picker-close{
  border:1px solid var(--line); background:transparent; color:var(--ink-2);
  width:34px; height:34px; border-radius:50%; font-size:15px; cursor:pointer; font-family:inherit;
}
.pk-floor{margin:16px 0 8px; font-size:12px; font-weight:700; letter-spacing:.06em; color:var(--ink-3)}
.pk-list{list-style:none; margin:0; padding:0; display:grid; gap:6px}
.pk-item{
  width:100%; text-align:left; border:1px solid var(--line); background:var(--bg);
  color:var(--ink); border-radius:10px; padding:12px 14px; font-size:14px;
  font-family:inherit; cursor:pointer;
}
.pk-item.cur{border-color:var(--here); background:var(--here-soft); font-weight:700}

.toast{
  position:fixed; left:50%; bottom:calc(18px + var(--safe-b)); transform:translateX(-50%);
  background:var(--ink); color:var(--bg); padding:10px 16px; border-radius:999px;
  font-size:13px; font-weight:600; z-index:50; box-shadow:var(--shadow);
  max-width:88vw; text-align:center;
}

@media (min-width:820px){
  body{flex-direction:row; flex-wrap:wrap}
  .topbar,.floortabs,.status{width:100%}
  .mapwrap{flex:1 1 60%; min-height:0}
  .sheet{flex:0 0 380px; max-height:none; border-top:0; border-left:1px solid var(--line)}
  .sheetback{align-items:center}
  .picker{border-radius:16px; max-height:78vh}
}
