/* NIHONGO ROAD · VF1-C · KIS-01 Registration + Welcome Runtime V1
   Presentational only. Approved Figma authorities: Registration 973:13,
   Welcome 973:145. KIS-01A source: 968:51. */

:root{
  --kis01-backdrop:#101c35;
  --kis01-panel:#fffdfa;
  --kis01-ink:#1d283e;
  --kis01-accent:#b8563b;
  --kis01-muted:#777e91;
  --kis01-line:#e0d6c9;
  --kis01-control:#f1f1f2;
  --kis01-secondary:#ece6dc;
}

/* First-run must be visually opaque: the application never shows through. */
#onboarding.overlay,
#kitsuneIntro.overlay{
  background:var(--kis01-backdrop);
  padding:max(18px,env(safe-area-inset-top)) max(18px,env(safe-area-inset-right)) max(18px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left));
  overflow-y:auto;
  overscroll-behavior:contain;
}

/* Registration / Profile Setup · same KIS-01A actor on Steps 1–4. */
#onboarding .onboard{
  width:min(404px,calc(100vw - 36px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-height:calc(100dvh - 36px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin:auto;
  padding:8px 20px 22px;
  background:var(--kis01-panel);
  color:var(--kis01-ink);
  border:0;
  border-radius:24px;
  box-shadow:0 8px 24px rgba(12,27,49,.22);
  overflow-y:auto;
  overscroll-behavior:contain;
}
#onboarding .onboard-kitsune-wrap{
  position:relative;
  z-index:0;
  width:124px;
  height:170px;
  margin:0 auto -4px;
  border-radius:0;
  overflow:visible;
  background:transparent;
  box-shadow:none;
}
#onboarding .onboard-kitsune-wrap::after{
  content:"";
  position:absolute;
  z-index:0;
  left:50%;
  bottom:3px;
  width:86px;
  height:10px;
  transform:translateX(-50%);
  border-radius:50%;
  background:rgba(44,34,30,.17);
  filter:blur(5px);
}
#onboarding .onboard-kitsune{
  position:relative;
  z-index:1;
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center bottom;
  border-radius:0;
}
#onboarding .onboarding-progress{
  margin:0 0 14px;
  min-height:24px;
}
#onboarding .onboarding-progress .chapter-label{
  color:var(--kis01-accent);
  font-size:16px;
  line-height:1;
  font-weight:500;
}
#onboarding .onboarding-dots{gap:6px;align-items:center;flex-wrap:nowrap}
#onboarding .onboarding-dot{width:8px;height:8px;background:#d9d1c6}
#onboarding .onboarding-dot.active{width:22px;background:#cf534e}
#onboarding .onboarding-step>.chapter-label{
  display:block;
  margin:0 0 10px;
  color:var(--kis01-accent);
  text-align:center;
  font-size:16px;
  line-height:1.2;
  font-weight:500;
}
#onboarding .onboarding-step h1{
  margin:0 0 16px;
  color:var(--kis01-ink);
  text-align:center;
  font-size:clamp(1.55rem,6.35vw,25px);
  line-height:1.05;
  text-wrap:balance;
}
#onboarding .onboarding-step>p{
  margin:0 0 18px;
  color:var(--kis01-ink);
  font-size:17px;
  line-height:24px;
}
#onboarding label{
  margin:13px 0;
  color:var(--kis01-ink);
  font-size:16px;
  line-height:1.2;
}
#onboarding input,
#onboarding select{
  min-height:52px;
  margin-top:8px;
  padding:0 14px;
  border:1px solid var(--kis01-line);
  border-radius:14px;
  background:var(--kis01-control);
  color:var(--kis01-ink);
  font-size:17px;
}
#onboarding input:focus,
#onboarding select:focus{
  outline:0;
  border-color:#74c0f7;
  box-shadow:0 0 0 2px #74c0f7;
}
#onboarding .onboarding-summary{
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:18px;
}
#onboarding .onboarding-summary>div{
  min-height:69px;
  padding:10px 11px;
  border:1px solid var(--kis01-line);
  border-radius:13px;
  background:#fffaf4;
}
#onboarding .onboarding-summary small{color:var(--kis01-muted);font-size:14px}
#onboarding .onboarding-summary b{color:var(--kis01-ink);font-size:16px}
#onboarding .onboarding-actions{
  position:static;
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:22px;
  padding:0;
  background:none;
}
#onboarding .onboarding-actions .btn{
  width:100%;
  min-height:44px;
  flex:0 0 auto;
  border-radius:14px;
}
#onboarding .onboarding-actions .ghost{background:var(--kis01-secondary)}
#onboarding .onboarding-actions .primary{background:var(--kis01-accent)}

/* Welcome / Onboarding · narrative-first, slightly larger actor. */
#kitsuneIntro .intro-card{
  width:min(404px,calc(100vw - 36px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-height:calc(100dvh - 36px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin:auto;
  padding:10px 20px 21px;
  background:var(--kis01-panel);
  color:var(--kis01-ink);
  border-radius:24px;
  box-shadow:0 8px 24px rgba(12,27,49,.22);
  overflow-y:auto;
  overscroll-behavior:contain;
}
#kitsuneIntro .intro-scene{
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:0;
  text-align:center;
}
#kitsuneIntro .intro-scene::before{
  content:"";
  position:absolute;
  z-index:0;
  top:178px;
  left:50%;
  width:92px;
  height:10px;
  transform:translateX(-50%);
  border-radius:50%;
  background:rgba(44,34,30,.17);
  filter:blur(5px);
}
#kitsuneIntro .intro-kitsune{
  position:relative;
  z-index:1;
  display:block;
  width:136px;
  height:186px;
  margin:0 auto 22px;
  object-fit:contain;
  object-position:center bottom;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  animation:none;
  filter:none;
}
#kitsuneIntro .intro-copy{width:100%;flex:none;text-align:center}
#kitsuneIntro .intro-copy .chapter-label{
  display:block;
  margin:0 0 12px;
  color:var(--kis01-ink);
  font-size:17px;
  line-height:1;
  font-weight:500;
}
#kitsuneIntro .intro-copy h2{
  margin:0 0 22px;
  color:var(--kis01-ink);
  font-size:clamp(1.9rem,8.7vw,34px);
  line-height:1.05;
  text-wrap:balance;
}
#kitsuneIntro .intro-copy p{
  margin:0 auto;
  max-width:364px;
  color:var(--kis01-ink);
  font-size:17px;
  line-height:24px;
  text-align:center;
  text-wrap:balance;
}
#kitsuneIntro .intro-dots{margin:24px 0 22px;gap:6px}
#kitsuneIntro .intro-dot{width:10px;height:10px;background:#d9d1c6;transform:none}
#kitsuneIntro .intro-dot.active{background:#d34a47;transform:none}
#kitsuneIntro #introNext{
  min-height:44px;
  border-radius:14px;
  background:var(--kis01-accent);
}

/* Narrow portrait: preserve composition and avoid horizontal overflow. */
@media(max-width:420px){
  #onboarding.overlay,#kitsuneIntro.overlay{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}
  #onboarding .onboard,#kitsuneIntro .intro-card{width:min(404px,calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));padding-left:20px;padding-right:20px}
  #onboarding .onboarding-step>p,#kitsuneIntro .intro-copy p{font-size:16px;line-height:23px}
}

/* Short landscape: the whole first-run canvas scrolls vertically; no clipping. */
@media(orientation:landscape) and (max-height:560px){
  #onboarding.overlay,#kitsuneIntro.overlay{
    place-items:start center;
    padding-top:max(12px,env(safe-area-inset-top));
    padding-bottom:max(12px,env(safe-area-inset-bottom));
  }
  #onboarding .onboard,#kitsuneIntro .intro-card{
    max-height:none;
    overflow:visible;
    margin:0 auto;
  }
}

/* VF1-C · KIS-02A Adventure Briefing Runtime V1
   Figma authorities: Portrait 559:42 + shadow 914:8; Landscape 559:153 +
   shadow 919:8; Constrained 559:242 + shadow 923:2. The one Adventure actor
   remains owned by Hero Core and may overlap Briefing. No second DOM actor. */
body[data-shell-variant="adventure"] .adventure-hero-kitsune{
  overflow:visible;
}
body[data-shell-variant="adventure"] .adventure-hero-kitsune::after{
  content:"";
  position:absolute;
  z-index:0;
  border-radius:50%;
  background:rgba(44,34,30,.17);
  filter:blur(5px);
  pointer-events:none;
}
body[data-shell-variant="adventure"] .adventure-hero-kitsune img{
  position:relative;
  z-index:1;
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center;
  animation:none;
  filter:none;
}

/* Portrait reference 559:42. Restrict to the existing mobile range so VF1-A
   large-portrait geometry remains authoritative outside the iPhone profile. */
@media(max-width:620px){
  body[data-shell-variant="adventure"][data-nav-mode="dock"] .adventure-hero-kitsune{
    top:48px;
    right:max(29px,env(safe-area-inset-right));
    width:138px;
    height:136px;
  }
  body[data-shell-variant="adventure"][data-nav-mode="dock"] .adventure-hero-kitsune::after{
    left:23px;
    top:97px;
    width:88px;
    height:16px;
  }
}

/* Landscape references 559:153 / 559:242. Reuse VF1-A's existing container
   split; no new responsive composition or breakpoint is introduced. */
@media(orientation:landscape) and (max-height:560px){
  @container adventure-canvas (min-width:780px){
    body[data-shell-variant="adventure"][data-nav-mode="rail"][data-global-nav-visible="true"] .adventure-hero-kitsune{
      top:75px;
      left:490px;
      right:auto;
      width:103px;
      height:101px;
    }
    body[data-shell-variant="adventure"][data-nav-mode="rail"][data-global-nav-visible="true"] .adventure-hero-kitsune::after{
      left:20px;
      top:70px;
      width:60px;
      height:13px;
    }
  }
  @container adventure-canvas (max-width:779.98px){
    body[data-shell-variant="adventure"][data-nav-mode="rail"][data-global-nav-visible="true"] .adventure-hero-kitsune{
      top:46px;
      left:auto;
      right:33px;
      width:139px;
      height:136px;
    }
    body[data-shell-variant="adventure"][data-nav-mode="rail"][data-global-nav-visible="true"] .adventure-hero-kitsune::after{
      left:33px;
      top:101px;
      width:70px;
      height:13px;
    }
  }
}

/* KIS02A-QA-BLOCK-WIDE01 · Large Wide / Tall keep the same Wide composition,
   but KIS-02A has its own approved geometry. Interpolate only the actor and
   contact shadow between the validated 559:367 (1360x760) and 559:457
   (1360x920) endpoints. No device sniffing and no new layout family. */
@media(min-height:700px){
  @container adventure-canvas (min-width:780px){
    body[data-shell-variant="adventure"][data-nav-mode="rail"][data-global-nav-visible="true"] .adventure-hero-kitsune{
      top:clamp(113px,calc(20vh - 39px),145px);
      left:clamp(693px,calc(15.625vh + 574.25px),718px);
      right:auto;
      width:clamp(165px,calc(18.75vh + 22.5px),195px);
      height:clamp(160px,calc(18.75vh + 17.5px),190px);
    }
    body[data-shell-variant="adventure"][data-nav-mode="rail"][data-global-nav-visible="true"] .adventure-hero-kitsune::after{
      left:clamp(35px,calc(4.375vh + 1.75px),42px);
      top:clamp(117px,calc(18.75vh - 25.5px),147px);
      width:clamp(96px,calc(5vh + 58px),104px);
      height:clamp(15px,calc(.625vh + 10.25px),16px);
    }
  }
}


/* KIS02A-WIDE-GEOMETRY-OWNERSHIP01 · SHARED METRICS SUPPORT
   Figma places Metrics, actor and contact shadow as AV-TOP siblings. Runtime
   keeps one semantic Hero actor, but all three now consume the same Stage
   coordinate system: cqw owns inline growth and the active VF1-A Metrics token
   owns the support plane. These equations pass exactly through 559:102,
   559:367 and 559:457 without device or host routing. */
@media(orientation:landscape){
  @container adventure-canvas (min-width:780px){
    body[data-shell-variant="adventure"][data-nav-mode="rail"][data-global-nav-visible="true"] .adventure-hero-kitsune{
      --kis02a-metrics-support-y:var(--vf1a-ri-w-metrics-top,var(--vf1a-ac-w-metrics-top,152px));
      --kis02a-actor-support-offset-y:clamp(77px,calc(1.1764705882cqw + 13.75vh + 6.2647058824px),147px);
      --kis02a-shadow-plane-offset-y:clamp(0px,min(calc(.3125vh + 5.625px),calc(46px - 5vh)),8px);
      top:calc(var(--kis02a-metrics-support-y) - var(--kis02a-actor-support-offset-y));
      left:clamp(490px,calc(45cqw + 15.625vh + 29.75px),718px);
      right:auto;
      width:clamp(103px,min(calc(19.375vh + 17.75px),calc(18.75vh + 22.5px)),195px);
      height:clamp(101px,max(calc(18.4375vh + 19.875px),calc(18.75vh + 17.5px)),190px);
    }
    body[data-shell-variant="adventure"][data-nav-mode="rail"][data-global-nav-visible="true"] .adventure-hero-kitsune::after{
      left:clamp(20px,calc(.2941176471cqw + 4.375vh - 1.8088235294px),42px);
      top:calc(var(--kis02a-actor-support-offset-y) - var(--kis02a-shadow-plane-offset-y));
      width:clamp(60px,calc(5.8823529412cqw + 5vh - 13.1764705882px),104px);
      height:clamp(13px,calc(.625vh + 10.25px),16px);
      background:rgba(71,46,31,.4);
      filter:blur(20px);
    }
  }
}
