/* =========================================================
   V154.7 · GATE D · DAY 3 ONLY
   Strict yatai flow, FR/EN, responsive HUD and touch/pointer
   separation. Scoped to .chapter-day3 so J0-J2 locks stay frozen.
   ========================================================= */
.chapter-day3 :is(button,summary,[role="slider"]){box-sizing:border-box}
.chapter-day3 :is(.v104-whisper,.v104-dialogue-stack,.v104-dialogue,.v104-context-card,.v104-culture-note,.v104-menu-object,.v104-bill-flow,.v104-cruise-ticket,.v127-action-panel,.v127-conversation-panel,.v1547-point-order){overflow-wrap:anywhere}
.chapter-day3 button:disabled{cursor:default}

/* Optional information owns the foreground while it is open. */
.chapter-day3 .v104-approach:has(.v1547-yatai-info[open]) :is(.v104-world,.v104-mei-presence,.v104-context-card,.v104-path-action,.v104-whisper){opacity:0!important;visibility:hidden!important;pointer-events:none!important}
.chapter-day3 .v104-approach .v1547-yatai-info[open]{pointer-events:auto!important;z-index:78!important;max-height:min(58vh,460px)!important;overflow:auto!important}
.chapter-day3 .v104-cruise-ticket:has(.v1547-real-note[open]) > :not(.v1547-real-note):not(small):not(b):not(span){pointer-events:none!important;opacity:.26}
.chapter-day3 .v104-cruise-ticket .v1547-real-note[open]{pointer-events:auto!important;opacity:1!important}

/* A drink is optional. Selecting no drink is an explicit, equally weighted choice. */
.chapter-day3 .v1547-no-drink{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 10px;align-items:center;width:100%;min-height:54px;padding:10px 12px;margin-top:8px;border:1px solid rgba(255,255,255,.18);border-radius:14px;background:rgba(255,255,255,.055);color:inherit;text-align:left}
.chapter-day3 .v1547-no-drink b{font-size:14px}
.chapter-day3 .v1547-no-drink small{grid-row:2;grid-column:1/-1;font-size:10px;line-height:1.3;opacity:.72}
.chapter-day3 .v1547-no-drink::after{content:"○";grid-column:2;grid-row:1;font-size:18px;opacity:.65}
.chapter-day3 .v1547-no-drink.is-selected{background:rgba(231,204,151,.16);border-color:rgba(231,204,151,.52)}
.chapter-day3 .v1547-no-drink.is-selected::after{content:"✓";opacity:1}

/* Pointing on a menu is a physical interaction, not a disguised CTA. */
.chapter-day3 .v1547-point-order{position:absolute;z-index:54;left:clamp(24px,4vw,64px);bottom:clamp(26px,5vh,60px);width:min(500px,40vw);display:grid;gap:10px;padding:16px;border:1px solid rgba(247,240,223,.22);border-radius:20px;background:rgba(5,24,31,.91);color:#fff;box-shadow:0 20px 52px rgba(0,0,0,.3);backdrop-filter:blur(12px)}
.chapter-day3 .v1547-point-order>small{font:700 9px/1 system-ui,sans-serif;letter-spacing:.14em;color:#e7cc97}
.chapter-day3 .v1547-point-order>p{margin:0;font-size:13px;line-height:1.42;color:rgba(255,255,255,.82)}
.chapter-day3 .v1547-point-menu{display:grid;gap:5px}
.chapter-day3 .v1547-point-menu>div{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;gap:1px 12px;padding:7px 10px;border-radius:11px;background:rgba(255,255,255,.07)}
.chapter-day3 .v1547-point-menu b{font-size:15px;line-height:1.15}
.chapter-day3 .v1547-point-menu span{grid-row:2;font-size:10px;opacity:.72}
.chapter-day3 .v1547-point-menu strong{grid-column:2;grid-row:1/3;align-self:center;font-size:12px}
.chapter-day3 .v1547-point-surface{position:relative;height:118px;min-height:118px;border:1px solid rgba(247,240,223,.22);border-radius:16px;background:linear-gradient(180deg,rgba(247,240,223,.08),rgba(247,240,223,.15));overflow:hidden;touch-action:none!important;user-select:none;cursor:grab;outline:none}
.chapter-day3 .v1547-point-surface:active{cursor:grabbing}
.chapter-day3 .v1547-point-surface:focus-visible{outline:3px solid rgba(247,240,223,.92);outline-offset:3px}
.chapter-day3 .v1547-point-line{position:absolute;left:50%;top:12px;bottom:12px;width:3px;transform:translateX(-50%);border-radius:99px;background:rgba(239,181,150,.2)}
.chapter-day3 .v1547-point-line::after{content:"";display:block;width:100%;height:var(--d3-point-progress);border-radius:inherit;background:#efb596;box-shadow:0 0 18px rgba(239,181,150,.42)}
.chapter-day3 .v1547-point-hand{position:absolute;z-index:3;left:50%;top:clamp(24px,var(--d3-point-progress),calc(100% - 24px));width:48px;height:48px;display:grid;place-items:center;transform:translate(-50%,-50%);border-radius:50%;background:#f7f0df;color:#17313a;font-size:24px;box-shadow:0 8px 20px rgba(0,0,0,.28)}
.chapter-day3 .v1547-point-surface em{position:absolute;left:10px;bottom:8px;font:600 9px/1 system-ui,sans-serif;letter-spacing:.08em;text-transform:uppercase;color:rgba(255,255,255,.58)}
.chapter-day3 .v1547-point-footer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center}
.chapter-day3 .v1547-point-footer>b{font-size:15px}
.chapter-day3 .v1547-point-footer .v104-action{position:static!important;min-height:48px!important;padding:9px 12px!important}

.chapter-day3 .v1547-real-note{margin-top:7px;padding-top:7px;border-top:1px solid rgba(255,255,255,.14)}
.chapter-day3 .v1547-real-note summary{cursor:pointer;font-size:10px;font-weight:750;letter-spacing:.06em;color:#e7cc97}
.chapter-day3 .v1547-real-note p{margin:7px 0;font-size:10.5px;line-height:1.42;color:rgba(255,255,255,.78)}
.chapter-day3 .v1547-real-note a{display:inline-block;font-size:10px;color:#f6dfae;text-decoration:underline;text-underline-offset:2px}

/* ---------- Laptop / desktop ---------- */
@media (min-width:761px){
  .chapter-day3 .hud-layer .sound,.chapter-day3 > .sound{top:var(--dobox-safe-top,20px)!important;right:clamp(24px,3vw,48px)!important;width:58px!important;height:58px!important;min-width:58px!important;min-height:58px!important}
  .chapter-day3 .hud-layer .journey-menu-trigger,.chapter-day3 > .journey-menu-trigger{top:var(--dobox-safe-top,20px)!important;right:calc(clamp(24px,3vw,48px) + 68px)!important;width:58px!important;height:58px!important;min-width:58px!important;min-height:58px!important}
  .chapter-day3 .hud-layer .scene-meta{max-width:min(42vw,560px)!important}
  .chapter-day3 .v104-d3-scene .v104-hud{top:90px!important;left:clamp(24px,4vw,64px)!important;right:auto!important;max-width:min(430px,38vw)!important}
  .chapter-day3 .v104-d3-scene .v104-back{top:136px!important;left:clamp(24px,4vw,64px)!important;min-width:50px!important;min-height:50px!important}
  .chapter-day3 .v104-d3-scene :is(.v104-action,.v104-hotspot,.v104-menu-close,.v104-menu-object button,.v128-cruise-glances button){min-height:50px}
  .chapter-day3 .v104-menu-object{top:84px!important;bottom:18px!important;max-height:calc(100vh - 102px)!important;overflow:auto!important}
  .chapter-day3 .v104-culture-note{max-width:min(390px,32vw)!important}
}
@media (min-width:761px) and (max-height:820px){
  .chapter-day3 .v104-d3-scene :is(.v104-whisper,.v104-dialogue-stack,.v104-dialogue,.v104-optional-reply,.v104-bill-flow,.v104-cruise-ticket,.v127-action-panel,.v127-conversation-panel,.v1547-point-order){max-height:54vh!important;overflow:auto!important}
  .chapter-day3 .v104-menu-object{top:74px!important;bottom:12px!important;max-height:calc(100vh - 86px)!important}
  .chapter-day3 .v1547-point-order{padding:12px;gap:7px;max-height:58vh!important;overflow:auto!important}
  .chapter-day3 .v1547-point-surface{height:96px;min-height:96px}
}
@media (hover:hover) and (pointer:fine){
  .chapter-day3 :is(button,summary,[role="slider"]):focus-visible{outline:3px solid rgba(247,240,223,.92)!important;outline-offset:3px!important}
  .chapter-day3 :is(.v104-action,.v104-hotspot,.v104-menu-object button,.v128-cruise-glances button,.v1547-no-drink){transition:transform .18s ease,box-shadow .18s ease,background .18s ease}
  .chapter-day3 :is(.v104-action,.v104-menu-object button,.v128-cruise-glances button,.v1547-no-drink):not(:disabled):hover{transform:translateY(-2px)}
}

/* ---------- Phone: touch-first ---------- */
@media (max-width:760px){
  html[data-dobox-layout^="phone"] .chapter-day3 .brand,
  html[data-dobox-layout^="phone"] .chapter-day3 .brand.brand-home{top:max(8px,env(safe-area-inset-top))!important;left:8px!important;max-width:calc(100vw - 76px)!important;padding:4px 8px 4px 4px!important;gap:7px!important;height:50px!important;min-height:50px!important;max-height:none!important;box-sizing:border-box!important;transform:none!important;transform-origin:top left!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .brand img{width:36px!important;height:36px!important;flex:0 0 36px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .sound{top:max(8px,env(safe-area-inset-top))!important;right:8px!important;width:50px!important;height:50px!important;min-width:50px!important;min-height:50px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .journey-menu-trigger{top:max(66px,calc(env(safe-area-inset-top) + 58px))!important;right:8px!important;width:50px!important;height:50px!important;min-width:50px!important;min-height:50px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .scene-meta{top:max(66px,calc(env(safe-area-inset-top) + 58px))!important;left:10px!important;right:70px!important;width:auto!important;max-width:none!important;transform:none!important;text-align:left!important;overflow:hidden!important;padding:4px 8px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .scene-meta time{font-size:15px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .scene-meta span{font-size:10px!important;line-height:1.2!important;letter-spacing:.06em!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}

  html[data-dobox-layout^="phone"] .chapter-day3 .v104-d3-scene .v104-hud{top:max(124px,calc(env(safe-area-inset-top) + 116px))!important;left:10px!important;right:70px!important;width:auto!important;max-width:none!important;transform:none!important;overflow:hidden!important;padding:6px 9px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-d3-scene .v104-hud :is(span,b){white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-d3-scene .v104-back{top:max(124px,calc(env(safe-area-inset-top) + 116px))!important;right:10px!important;left:auto!important;width:50px!important;height:50px!important;min-width:50px!important;min-height:50px!important}

  html[data-dobox-layout^="phone"] .chapter-day3 .v104-d3-scene :is(.v104-action,.v104-hotspot,.v104-menu-close,.v104-menu-object button,.v128-cruise-glances button,.v1547-no-drink){min-width:50px!important;min-height:50px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-d3-scene :is(.v104-whisper,.v104-dialogue-stack,.v104-dialogue,.v104-optional-reply,.v104-bill-flow,.v104-cruise-ticket,.v127-action-panel,.v127-conversation-panel){left:10px!important;right:10px!important;width:auto!important;max-width:none!important;max-height:43svh!important;overflow:auto!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-mei-presence>.v104-whisper{right:23vw!important}

  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-object{inset:max(124px,calc(env(safe-area-inset-top) + 116px)) 8px max(8px,env(safe-area-inset-bottom))!important;width:auto!important;max-width:none!important;max-height:none!important;overflow:auto!important;padding:14px 12px 78px!important;overscroll-behavior:contain!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-list,
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-drinks{grid-template-columns:1fr!important;gap:7px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-object footer{position:sticky!important;bottom:-66px!important;z-index:5;background:linear-gradient(180deg,rgba(8,31,39,0),rgba(8,31,39,.98) 28%)!important;padding-top:26px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-close{width:50px!important;height:50px!important}

  html[data-dobox-layout^="phone"] .chapter-day3 .v1547-yatai-info[open]{left:10px!important;right:10px!important;top:max(180px,calc(env(safe-area-inset-top) + 170px))!important;bottom:max(10px,env(safe-area-inset-bottom))!important;width:auto!important;max-width:none!important;max-height:none!important;overflow:auto!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v1547-point-order{left:10px!important;right:10px!important;bottom:max(10px,env(safe-area-inset-bottom))!important;width:auto!important;max-width:none!important;max-height:48svh!important;overflow:auto!important;padding:12px!important;gap:8px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v1547-point-surface{height:96px;min-height:96px}
  html[data-dobox-layout^="phone"] .chapter-day3 .v1547-point-hand{width:50px;height:50px}
  html[data-dobox-layout^="phone"] .chapter-day3 .v1547-point-footer{grid-template-columns:1fr!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v1547-point-footer .v104-action{width:100%!important;min-height:50px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-cruise-ticket{padding-bottom:max(12px,env(safe-area-inset-bottom))!important}
}

@media (max-width:760px) and (hover:none), (max-width:760px) and (pointer:coarse){
  html[data-dobox-layout^="phone"] .chapter-day3 :is(.v104-action,.v104-menu-object button,.v128-cruise-glances button,.v1547-no-drink):hover{transform:none!important}
  html[data-dobox-layout^="phone"] .chapter-day3 :is(.v104-action,.v104-menu-object button,.v128-cruise-glances button,.v1547-no-drink):active{transform:scale(.985)}
}

@media (max-width:400px){
  html[data-dobox-layout^="phone"] .chapter-day3 .brand small{display:none!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-object{padding-left:9px!important;padding-right:9px!important}
  html[data-dobox-layout^="phone"] .chapter-day3 .v1547-point-menu>div{grid-template-columns:minmax(0,1fr) auto!important}
}

@media (prefers-reduced-motion:reduce){
  .chapter-day3 *, .chapter-day3 *::before, .chapter-day3 *::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important;scroll-behavior:auto!important}
}

/* Gate D phone coordinate fix: v149 full-world scenes deliberately extend
   78px above/below the interaction layer. Foreground UI must therefore own
   viewport coordinates instead of inheriting the expanded scene origin. */
@media (max-width:760px){
  /* Outer scene-meta already carries time/place on phones; hiding the authored
     duplicate keeps the top rail readable and prevents a second HUD collision. */
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-d3-scene .v104-hud{display:none!important}

  html[data-dobox-layout^="phone"] .chapter-day3 .v104-d3-scene .v104-back{
    position:fixed!important;
    top:max(124px,calc(env(safe-area-inset-top) + 116px))!important;
    right:10px!important;left:auto!important;
    z-index:76!important;
  }
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-d3-scene:has(.v104-menu-object) .v104-back,
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-d3-scene:has(.v1547-yatai-info[open]) .v104-back{display:none!important}

  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-object{
    position:fixed!important;
    inset:max(124px,calc(env(safe-area-inset-top) + 116px)) 8px max(8px,env(safe-area-inset-bottom))!important;
    z-index:82!important;
    box-sizing:border-box!important;
  }
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-list,
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-drinks{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:7px!important;
  }
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-object :is(.v104-menu-list,.v104-menu-drinks)>button{
    min-width:0!important;
    padding:8px 9px!important;
  }
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-object :is(.v104-menu-list,.v104-menu-drinks)>button span{
    min-width:0!important;
  }
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-object :is(.v104-menu-list,.v104-menu-drinks)>button small{
    white-space:normal!important;
    line-height:1.2!important;
  }

  html[data-dobox-layout^="phone"] .chapter-day3 :is(.v123-d3-taxi-meter,.v123-d3-taxi-receipt){
    position:fixed!important;
    left:10px!important;right:10px!important;
    bottom:max(10px,env(safe-area-inset-bottom))!important;
    width:auto!important;max-width:none!important;
    max-height:42svh!important;
    overflow:auto!important;
    box-sizing:border-box!important;
    z-index:74!important;
  }

  html[data-dobox-layout^="phone"] .chapter-day3 :is(.v104-culture-note summary,.v1547-real-note summary){
    min-height:50px!important;
    display:flex!important;
    align-items:center!important;
    box-sizing:border-box!important;
  }
}

@media (max-width:340px){
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-list,
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-menu-drinks{grid-template-columns:1fr!important}
}
@media (max-width:760px){
  html[data-dobox-layout^="phone"] .chapter-day3 :is(.v123-d3-taxi-meter,.v123-d3-taxi-receipt){
    transform:none!important;
    margin:0!important;
  }
  html[data-dobox-layout^="phone"] .chapter-day3 :is(.v104-culture-note summary,.v1547-real-note summary){
    min-width:50px!important;
    padding-inline:10px!important;
  }
  /* Keep the optional yatai note away from the bottom narrative/action rail. */
  html[data-dobox-layout^="phone"] .chapter-day3 .v104-approach .v1547-yatai-info:not([open]){
    position:fixed!important;
    top:max(124px,calc(env(safe-area-inset-top) + 116px))!important;
    left:10px!important;right:auto!important;bottom:auto!important;
    width:auto!important;max-width:150px!important;
    z-index:72!important;
  }
}

/* J3 owns a true viewport-sized world on phones. The architecture-layer
   negative margin was meant to cancel padding for normal-flow scenes, but
   v104-d3-scene is already absolute/inset:0; keeping that margin enlarged the
   coordinate space to 414×994 at 390×844 and placed bottom CTAs off-screen. */
@media (max-width:600px){
  html[data-dobox-layout^="phone"] .chapter-day3 .interaction-layer > .v104-d3-scene{
    margin:0!important;
    inset:0!important;
    width:auto!important;
    height:auto!important;
  }
}

/* The product HUD already exposes time + place. The legacy in-scene copy was
   duplicate information and could collide with the brand/back rail on laptops. */
.chapter-day3 .v104-d3-scene .v104-hud{display:none!important}

/* Menu typography: Japanese item name and translation are distinct reading
   levels on every viewport instead of running into each other. */
.chapter-day3 .v104-menu-object :is(.v104-menu-list,.v104-menu-drinks)>button>span{
  display:grid!important;
  gap:2px!important;
  min-width:0!important;
}
.chapter-day3 .v104-menu-object :is(.v104-menu-list,.v104-menu-drinks)>button>span>b,
.chapter-day3 .v104-menu-object :is(.v104-menu-list,.v104-menu-drinks)>button>span>small{
  display:block!important;
  min-width:0!important;
}
.chapter-day3 .v104-menu-object :is(.v104-menu-list,.v104-menu-drinks)>button>span>small{
  line-height:1.2!important;
  opacity:.72!important;
}

@media (min-width:761px){
  .chapter-day3 .v104-menu-object footer{
    position:sticky!important;
    bottom:-1px!important;
    z-index:8!important;
    margin-top:8px!important;
    padding-top:18px!important;
    padding-bottom:2px!important;
    background:linear-gradient(180deg,rgba(247,240,223,0),var(--paper,#f7f0df) 34%)!important;
  }
}

/* Wide desktop: the menu behaves like a physical sheet, not a stretched modal.
   Short laptops keep the scrollable full-height composition above. */
@media (min-width:1600px) and (min-height:900px){
  .chapter-day3 .v104-menu-object{
    top:50%!important;
    bottom:auto!important;
    height:auto!important;
    max-height:calc(100vh - 150px)!important;
    transform:translateY(-50%)!important;
    overflow:auto!important;
  }
}
@media (min-width:1600px) and (min-height:900px){
  .chapter-day3 .v104-d3-scene .v104-menu-object{
    top:50%!important;
    bottom:auto!important;
    height:auto!important;
    max-height:calc(100vh - 150px)!important;
    transform:translateY(-50%)!important;
    overflow:auto!important;
  }
}
