/* Shared kiosk UI: bottom bar, in-page web view, factsheet viewer.
   Lives outside the scaled stage, so it uses the real screen size. */
:root {
  --k-gold: #ffc600;
  --k-gold-soft: #ffd95a;
  --k-gold-line: rgba(255, 198, 0, .45);
  --k-muted: rgba(255, 255, 255, .62);
}

.k-layer {
  /* Same frame as the app stage (set by Kiosk.fitStage); full screen if not set */
  position: fixed; z-index: 50; background: #000; overflow: hidden;
  left: var(--k-x, 0px); top: var(--k-y, 0px); width: var(--k-w, 100vw); height: var(--k-h, 100vh);
  display: flex; flex-direction: column;
  font-family: "NT", "Prompt", system-ui, sans-serif; color: #fff;
  opacity: 0; visibility: hidden; transform: translateY(24px);
  transition: opacity .35s ease, transform .35s ease, visibility 0s linear .35s;
  pointer-events: none; /* a closing layer must not catch taps while it fades out */
}
.k-layer.open { opacity: 1; visibility: visible; transform: none; transition: opacity .35s ease, transform .35s ease; pointer-events: auto; }

/* Bottom bar */
.k-bar {
  order: 2; flex: 0 0 auto; box-sizing: content-box; height: 72px;
  padding: 0 16px env(safe-area-inset-bottom, 0px);
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(0deg, #17120a, #0a0805); border-top: 2px solid var(--k-gold);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .45);
}
.k-btn {
  height: 50px; padding: 0 24px 0 16px; border: 0; border-radius: 26px;
  display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto;
  font: 600 20px "NT", "Prompt", system-ui, sans-serif; cursor: pointer;
  background: var(--k-gold); color: #111;
}
.k-btn svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.k-btn.ghost { background: transparent; color: var(--k-gold); border: 1.5px solid var(--k-gold-line); padding: 0 14px; }
.k-btn:active { transform: scale(.96); }
.k-btn[disabled] { opacity: .3; }
.k-title {
  flex: 1; min-width: 0; text-align: center; font-size: 20px; font-weight: 600; letter-spacing: .06em;
  color: var(--k-gold-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.k-count { font-size: 18px; color: var(--k-muted); min-width: 70px; text-align: center; font-variant-numeric: tabular-nums; }

.k-body { position: relative; flex: 1; overflow: hidden; }

/* Web view */
.k-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.k-msg {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 18px; text-align: center;
  background: #000; font-size: max(22px, calc(var(--k-h, 100vh) * .02)); color: var(--k-muted);
}
.k-msg[hidden] { display: none; }
.k-mascot { display: block; height: max(200px, calc(var(--k-h, 100vh) * .2)); margin: 0 auto 4px; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .5)); animation: k-bob 2.4s ease-in-out infinite; }
@keyframes k-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.k-spinner {
  width: 54px; height: 54px; margin: 0 auto; border-radius: 50%;
  border: 4px solid rgba(255, 198, 0, .2); border-top-color: var(--k-gold); animation: k-spin 1s linear infinite;
}
@keyframes k-spin { to { transform: rotate(360deg); } }

/* Factsheet viewer */
.k-viewer .k-body { background: #0b0b0d; touch-action: none; }
.k-page {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; transform-origin: 0 0; will-change: transform;
  transition: transform .25s ease;
  -webkit-user-drag: none; user-select: none;
}
.k-page.dragging { transition: none; }
.k-zoomhint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  padding: 8px 18px; border-radius: 20px; background: rgba(0, 0, 0, .7); border: 1px solid var(--k-gold-line);
  font-size: 16px; color: var(--k-muted); pointer-events: none; transition: opacity .3s;
}

/* Video player */
.k-video .k-body { background: #000; }
.k-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }

/* Toast: short message, centered in the app frame */
.k-toast {
  position: fixed; z-index: 60; left: calc(var(--k-x, 0px) + var(--k-w, 100vw) / 2); top: calc(var(--k-y, 0px) + var(--k-h, 100vh) * .5);
  transform: translate(-50%, -50%) scale(.96); max-width: calc(var(--k-w, 100vw) * .8);
  display: flex; align-items: center; gap: 14px; white-space: nowrap;
  padding: 10px 28px 10px 14px; border-radius: 22px; background: rgba(10, 8, 4, .94); border: 1.5px solid var(--k-gold-line);
  font: 500 18px "NT", "Prompt", system-ui, sans-serif; color: #fff; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.k-toast.show { opacity: 1; transform: translate(-50%, -50%); }

.k-toast img { height: 74px; }

/* Idle screen: the NT mascot invites the next visitor (inside the app frame) */
.k-idle {
  position: fixed; z-index: 80; left: var(--k-x, 0px); top: var(--k-y, 0px); width: var(--k-w, 100vw); height: var(--k-h, 100vh);
  display: grid; place-items: center; overflow: hidden; cursor: pointer;
  background: radial-gradient(ellipse 70% 55% at 50% 52%, rgba(70, 54, 8, .92), rgba(8, 7, 4, .97) 70%), #050505;
  font-family: "NT", "Prompt", system-ui, sans-serif; color: #fff;
  opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s linear .5s;
}
.k-idle.open { opacity: 1; visibility: visible; transition: opacity .5s ease; }
.k-idle-in { display: flex; flex-direction: column; align-items: center; text-align: center; }
.k-idle-pose { position: relative; height: calc(min(var(--k-h, 100vh), var(--k-w, 100vw) * 1.6) * .46); width: calc(min(var(--k-h, 100vh), var(--k-w, 100vw) * 1.6) * .46); animation: k-bob 2.4s ease-in-out infinite; }
.k-idle-pose img { position: absolute; left: 50%; bottom: 0; height: 100%; transform: translateX(-50%) scale(.94);
  opacity: 0; transition: opacity .6s ease, transform .6s ease; filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .6)); }
.k-idle-pose img.on { opacity: 1; transform: translateX(-50%) scale(1); }
.k-bubble { margin-bottom: 2%; padding: .55em 1.2em; border-radius: 1em; background: #fff; color: #111;
  font-size: calc(var(--k-h, 100vh) * .03); font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); position: relative; }
.k-bubble b { color: #c99400; font-weight: 700; }
.k-bubble::after { content: ""; position: absolute; left: 50%; bottom: -.5em; width: 1em; height: 1em; background: #fff; transform: translateX(-50%) rotate(45deg); }
.k-idle-title { margin-top: 2.5%; font-size: calc(var(--k-h, 100vh) * .045); font-weight: 700; color: var(--k-gold); text-shadow: 0 0 24px rgba(255, 198, 0, .4); }
.k-idle-hint { margin-top: 1.2%; display: flex; align-items: center; gap: .6em; font-size: calc(var(--k-h, 100vh) * .022); letter-spacing: .3em; color: rgba(255, 255, 255, .8); }
.k-idle-hint i { width: .7em; height: .7em; border-radius: 50%; background: var(--k-gold); box-shadow: 0 0 12px var(--k-gold); animation: k-pulse 1.4s ease-in-out infinite; }
@keyframes k-pulse { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.2); opacity: 1; } }

/* ---------- Touch stability (all apps, 25.11.26) ---------- */
/* no pull-to-refresh / rubber band, no selection, no callout, no grey flash, no image drag */
html, body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
img, svg, a { -webkit-user-drag: none; }
/* Nothing in the app stage scrolls, so the browser never takes a touch for panning or zooming:
   swipes are not cancelled half-way and taps react at once. Scrolling text opts back in. */
#stage { touch-action: none; }
#stage .sbody { touch-action: pan-y; }
.k-bar, .k-idle, .k-toast, .k-msg { touch-action: none; }
/* A closed screen must never catch a tap. In GDCC and Teams Phone the active page inside a screen
   sets "pointer-events: auto; visibility: visible", which beat the closed parent: after closing
   Infra Cloud, its hidden page still took the taps meant for the home buttons. */
.sec:not(.open), .sec:not(.open) * { pointer-events: none !important; }
