/* HORO-BEAT sim: the shell lane's screens (app bar, tab bar, screen containers, Home, Rules). Owner: shell lane
   (reports/polish/DESIGN.md §4.1, §10). The look is identity 3, Night Parade (reports/polish/identity-3/mockup.html).
   Tokens and components come from theme/ (tokens.css, components.css). Decorative paint goes in the @layer hb-fx block
   at the end, scoped to body:not(.hb-perf); the flat rules underneath always set a solid background-color. */

@layer hb-screens {
  .hb-rules a:not(.hb-btn), .hb-home a:not(.hb-panel):not(.hb-btn) { color: var(--hb-kin-text); }

  /* ------------------------------------------------------------------ app bar: lantern + wordmark, crest nav, EN | 日本語, ⚙
     BZ's order: brand left, the screens next to it, language + settings at the right end on every screen */
  .hb-appbar { position: relative; z-index: 50; flex: none; display: flex; align-items: center; gap: 28px; height: var(--hb-appbar-h);
    padding: 0 max(24px, var(--hb-safe-r)) 0 max(24px, var(--hb-safe-l)); background-color: var(--hb-ink-0); border-bottom: 1px solid var(--hb-kin-line); }
  .hb-brand { display: flex; align-items: center; gap: 10px; flex: none; color: var(--hb-text); text-decoration: none; }
  .hb-brand__lantern { width: 26px; height: 38px; flex: none; }
  .hb-wordmark { display: flex; flex-direction: column; line-height: 1; }
  .hb-wordmark small { margin: 0 0 3px 2px; color: var(--hb-kin-text); font: 700 9px/1 var(--hb-font-ui); letter-spacing: .62em; }
  .hb-wordmark b { color: var(--hb-text); font: italic 900 23px/1 var(--hb-font-wordmark); letter-spacing: .02em; white-space: nowrap; }
  .hb-wordmark b i { color: var(--hb-shu-hi); font-style: normal; }
  .hb-brand__sim { align-self: flex-end; margin-bottom: 3px; color: var(--hb-text-3); font: 800 10px/1 var(--hb-font-ui); letter-spacing: .18em; }
  .hb-nav { display: flex; align-items: stretch; align-self: stretch; gap: 4px; min-width: 0; }
  .hb-nav a { position: relative; display: flex; align-items: center; gap: 9px; padding: 0 14px; color: var(--hb-text-2); font-weight: 700; white-space: nowrap; text-decoration: none;
    transition: color var(--hb-dur-hover), transform var(--hb-dur-press) var(--hb-ease-out); }
  .hb-nav a:hover { color: var(--hb-text); }
  .hb-nav a:hover .hb-crest { border-color: var(--hb-kin); }
  .hb-nav a:active .hb-crest { transform: scale(.92); }
  .hb-nav a[aria-current="page"] { color: var(--hb-text); }
  .hb-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; background: var(--hb-kin); }
  .hb-appbar__end { display: flex; align-items: center; gap: 10px; flex: none; margin-left: auto; }
  .hb-brand:focus-visible, .hb-nav a:focus-visible, .hb-tabbar a:focus-visible { outline: 2px solid var(--hb-focus); outline-offset: -2px; }

  /* ------------------------------------------------------------------ screens */
  /* overflow-x: clip: a screen sliding in (fx.js page(), translateX(+24px) for a move to the right) never widens the
     layout viewport (a phone's document went 390 -> 414 px for the slide). Sideways only (the screens scroll
     vertically themselves); clip makes no scroll container and does not clip position: fixed descendants */
  #app { position: relative; flex: 1 1 auto; min-height: 0; overflow-x: clip; }
  .hb-screen { position: absolute; inset: 0; display: none; overflow: auto; }
  .hb-screen.is-on { display: block; }
  .hb-screen--fixed { overflow: hidden; }
  .hb-boot { display: flex; align-items: center; justify-content: center; gap: 12px; height: 100%; color: var(--hb-text-3); font: 700 var(--hb-fs-14)/1 var(--hb-font-display); letter-spacing: .08em; }
  .hb-boot__lantern { width: 22px; height: 33px; }

  /* ------------------------------------------------------------------ phone tab bar (≤ 760 px, hb-phone below) */
  .hb-tabbar { display: none; }
  /* DURING A MATCH the app's bars are hidden, like Battle Zone (owner, 2026-11-11): the board takes their height; the
     match bar has leaving (X / Concede), Settings and the language. They return when the match is left (play.js matchBars) */
  body.hb-match .hb-appbar { display: none; }

  /* ------------------------------------------------------------------ home: the night-city hero */
  .hb-home { display: flex; flex-direction: column; min-height: 100%; }
  /* the hero fills the screen; its 560 px composition (copy + fan, and the scene's sky) stays centred on its height */
  .hb-hero { position: relative; flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; min-height: 560px; overflow: hidden; background-color: var(--hb-ink-0); border-bottom: 1px solid var(--hb-kin-line); }
  .hb-hero__inner { position: relative; z-index: 5; flex: none; display: grid; grid-template-columns: minmax(0, 640px) minmax(0, 1fr); gap: 32px; width: 100%; max-width: 1340px; height: 560px; margin: 0 auto; padding: 96px 48px 0; }
  .hb-hero__copy { display: flex; align-items: flex-start; gap: 30px; }
  .hb-hero__text { min-width: 0; }
  .hb-hero .hb-kicker { display: block; margin: 0 0 14px; word-break: keep-all; text-wrap: balance; }
  .hb-hero__title { margin: 0; color: var(--hb-text); font: 800 var(--hb-fs-46)/1.16 var(--hb-font-display); letter-spacing: .01em; }
  .hb-hero__title em { color: var(--hb-shu-hi); font-style: normal; }
  .hb-hero__sub { max-width: 470px; margin: 16px 0 26px; color: var(--hb-text-2); font-size: var(--hb-fs-16); line-height: 1.65; }
  .hb-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }
  /* Resume: the primary when a solo game waits; its round sits beside the word in Playfair, like the meta numerals */
  .hb-hero__resume small { margin-left: 2px; padding-left: 10px; border-left: 1px solid color-mix(in srgb, var(--hb-on-shu) 35%, transparent); font: italic 900 var(--hb-fs-14)/1 var(--hb-font-num); letter-spacing: .02em; opacity: .92; }
  .hb-hero__resume .hb-icon { width: 16px; height: 16px; }
  .hb-hero__meta { display: flex; flex-wrap: wrap; gap: 16px; margin: 22px 0 0; color: var(--hb-text-3); font-size: var(--hb-fs-12); }
  .hb-hero__meta b { margin-right: 4px; color: var(--hb-text); font: italic 900 15px var(--hb-font-num); }
  /* the fan: five printings over the moon; a click opens the card (the shared card window) */
  .hb-fan { position: relative; height: 430px; }
  .hb-fan__float { position: absolute; inset: 0; }
  .hb-fan__card { --x: 0px; --r: 0deg; --y: 0px; position: absolute; left: 50%; top: 34px; width: 182px; margin-left: -91px; padding: 0; border: 0; border-radius: var(--hb-r-print); background: none; cursor: pointer;
    transform-origin: 50% 130%; transform: translateX(var(--x)) rotate(var(--r)) translateY(var(--y)); transition: transform var(--hb-dur-move) var(--hb-ease-stamp); }
  .hb-fan__card .hb-cimg { display: block; width: 100%; box-shadow: var(--hb-e3); }
  .hb-fan__card:nth-child(1) { z-index: 1; --x: -168px; --r: -15deg; --y: 30px; }
  .hb-fan__card:nth-child(2) { z-index: 2; --x: -88px; --r: -7deg; --y: 10px; }
  .hb-fan__card:nth-child(3) { z-index: 3; --y: -18px; }
  .hb-fan__card:nth-child(4) { z-index: 2; --x: 88px; --r: 7deg; --y: 10px; }
  .hb-fan__card:nth-child(5) { z-index: 1; --x: 168px; --r: 15deg; --y: 30px; }
  .hb-fan__card:hover, .hb-fan__card:focus-visible { --y: -30px; z-index: 5; }
  .hb-fan__card:nth-child(3):hover, .hb-fan__card:nth-child(3):focus-visible { --y: -36px; }
  .hb-fan__card:focus-visible { outline: 2px solid var(--hb-focus); outline-offset: 3px; }
  /* the footer line: the fan notice, the official site */
  .hb-home__foot, .hb-rules__foot { flex: none; display: flex; align-items: center; gap: 10px 14px; max-width: 1340px; width: 100%; margin: 0 auto; padding: 14px 48px 18px; color: var(--hb-text-3); font-size: var(--hb-fs-12); }
  .hb-home__dama { width: 12px; height: 12px; color: var(--hb-kin-lo); }
  .hb-home__fan { flex: 1 1 auto; min-width: 0; }
  .hb-home__link { display: inline-flex; align-items: center; gap: 6px; flex: none; font-weight: 700; text-decoration: none; }
  .hb-home__link:hover { text-decoration: underline; text-underline-offset: 3px; }
  .hb-home__link .hb-icon { width: 13px; height: 13px; }

  /* ------------------------------------------------------------------ rules: a quick reference (one language) */
  .hb-rules { max-width: 1080px; margin: 0 auto; padding: 30px var(--hb-6) 8px; }
  .hb-rules__head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; padding-bottom: 18px; border-bottom: 1px solid var(--hb-line); }
  .hb-rules__crest { width: 46px; height: 46px; border-width: 2px; border-color: var(--hb-kin); font-size: 23px; }
  .hb-rules__titles { min-width: 0; }
  .hb-rules__titles .hb-kicker { margin-bottom: 6px; }
  .hb-rules__title { margin: 0; color: var(--hb-text); font: 800 var(--hb-fs-36)/1.05 var(--hb-font-display); letter-spacing: .02em; }
  .hb-rules__links { display: flex; flex-wrap: wrap; gap: var(--hb-4); margin-left: auto; }
  .hb-rules__links .hb-icon { width: 15px; height: 15px; }
  .hb-rules__pdf small { font: 500 var(--hb-fs-11)/1 var(--hb-font-ui); letter-spacing: .04em; opacity: .85; }
  /* the round strip: A ROUND · 1 Summon → 2 Battle → 3 End (each a jump link to its section) */
  .hb-rnum { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background-color: var(--hb-ink-0); border: 1.5px solid var(--hb-kin);
    color: var(--hb-kin-hi); font: 400 17px/1 var(--hb-font-gemnum); font-synthesis: none; }   /* (ui/ink.js centres the italic figure's ink) */
  .hb-rflow { display: flex; align-items: center; gap: 14px; margin: 20px 0 18px; }
  .hb-rflow__tag { flex: none; }
  .hb-rflow__steps { display: flex; align-items: stretch; gap: 8px; flex: 1 1 auto; min-width: 0; }
  .hb-rflow__step { display: flex; align-items: center; gap: 12px; flex: 1 1 0; min-width: 0; padding: 10px 14px; border-radius: var(--hb-r-panel); background-color: var(--hb-ink-2);
    box-shadow: inset 0 0 0 1px var(--hb-line); color: var(--hb-text); text-decoration: none; transition: box-shadow var(--hb-dur-hover), transform var(--hb-dur-press) var(--hb-ease-out); }
  .hb-rflow__step:hover { box-shadow: inset 0 0 0 1px var(--hb-kin); }
  .hb-rflow__step:active { transform: translateY(1px) scale(.98); }
  .hb-rflow__t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .hb-rflow__t b { font: 800 var(--hb-fs-16)/1.2 var(--hb-font-display); color: var(--hb-text); }
  .hb-rflow__t span { overflow: hidden; color: var(--hb-text-3); font-size: var(--hb-fs-12); line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }   /* one line: the three titles stay level */
  .hb-rflow__arrow { flex: none; align-self: center; width: 10px; height: 14px; background-color: var(--hb-kin-lo); clip-path: polygon(0 0, 100% 50%, 0 100%); }
  /* the sections flow in two columns (no equal-height holes) */
  .hb-rules__cols { columns: 2 380px; column-gap: var(--hb-6); }
  .hb-rsec { display: block; break-inside: avoid; margin: 0 0 var(--hb-6); padding: 16px 20px 14px; }
  .hb-rsec__h { display: flex; align-items: center; gap: 10px; min-height: 28px; margin: 0 0 10px; color: var(--hb-kin-text); font: 800 var(--hb-fs-18)/1.2 var(--hb-font-display); letter-spacing: .03em; }
  .hb-rsec__h .hb-rnum { width: 26px; height: 26px; font-size: 15px; }
  .hb-rsec__dama { width: 18px; height: 18px; color: var(--hb-kin); }
  .hb-rsec__dl { margin: 0; }
  .hb-rsec__row { display: grid; grid-template-columns: minmax(96px, 30%) minmax(0, 1fr); gap: 2px 14px; padding: 8px 0; border-top: 1px solid var(--hb-line); }
  .hb-rsec__row:first-child { border-top: 0; padding-top: 2px; }
  .hb-rsec dt { display: flex; align-items: flex-start; gap: 8px; color: var(--hb-text); font-weight: 700; line-height: 1.5; }
  .hb-rsec dt .hb-trig { margin-top: 1px; }
  .hb-rsec dd { margin: 0; color: var(--hb-text-2); line-height: 1.6; }
  html[lang="ja"] .hb-rsec dd { line-height: 1.75; }
  /* Japanese wraps at phrase boundaries (Chrome's auto-phrase), never leaving "ト）。" alone on a line */
  html[lang="ja"] .hb-rules :is(dd, dt), html[lang="ja"] .hb-hero__sub { word-break: auto-phrase; }
  .hb-rules__foot { max-width: none; padding: 6px 0 28px; }
}

@layer hb-phone {
  /* narrow desktops / tablets: the nav keeps its words, the bar tightens */
  @media (max-width: 1060px) and (min-width: 761px) {
    .hb-appbar { gap: 16px; padding: 0 16px; }
    .hb-brand__sim { display: none; }
    .hb-nav a { gap: 7px; padding: 0 9px; }
  }
  @media (max-width: 900px) and (min-width: 761px) {
    .hb-wordmark small { display: none; }
    .hb-wordmark b { font-size: 20px; }
    .hb-nav { gap: 0; }
    .hb-nav a { padding: 0 7px; font-size: var(--hb-fs-13); }
  }
  /* the hero between desktop and phone: the fan shrinks with its column (it needs ~520 px at full size), then moves
     under the copy; the copy never sits under the cards */
  @media (max-width: 1280px) and (min-width: 601px) {
    .hb-hero__actions .hb-hero__rules { display: none; }   /* Rules stays one click away in the nav */
  }
  @media (max-width: 1280px) and (min-width: 1001px) {
    .hb-hero__inner { grid-template-columns: minmax(0, 540px) minmax(0, 1fr); padding: 96px 32px 0; }
    .hb-hero__title { font-size: calc(42px * var(--hb-font-scale, 1)); }
    .hb-fan { transform: scale(.76); transform-origin: 50% 20%; }
  }
  /* (1001-1100 px, e.g. a 2560 px screen at 250 %: at .76 the outer cards' corners ran off the screen and into the copy) */
  @media (max-width: 1100px) and (min-width: 1001px) {
    .hb-fan { transform: scale(.62); }
  }
  /* tablets: the phone's three-card fan beside the copy */
  @media (max-width: 1000px) and (min-width: 601px) {
    .hb-hero__inner { grid-template-columns: minmax(0, 1fr) 290px; gap: 28px; padding: 88px 28px 0; }
    .hb-hero__title { font-size: calc(34px * var(--hb-font-scale, 1)); }
    .hb-fan__card { width: 134px; margin-left: -67px; top: 60px; }
    .hb-fan__card:nth-child(1), .hb-fan__card:nth-child(5) { display: none; }
    .hb-fan__card:nth-child(2) { --x: -66px; --r: -9deg; }
    .hb-fan__card:nth-child(4) { --x: 66px; --r: 9deg; }
    .hb-rflow__t span { display: none; }   /* the round strip's gists would be cut; the sections below carry them */
  }
  @media (max-width: 760px) {
    .hb-appbar { gap: 10px; padding: 0 12px; }
    .hb-nav { display: none; }
    .hb-brand__lantern { width: 20px; height: 30px; }
    .hb-wordmark b { font-size: 19px; }
    .hb-brand__sim { display: none; }
    .hb-appbar__end .hb-btn--icon { width: 34px; height: 34px; }
    .hb-tabbar { position: relative; z-index: 50; flex: none; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--hb-tabbar-h) + var(--hb-safe-b)); padding-bottom: var(--hb-safe-b);
      background-color: var(--hb-ink-0); border-top: 1px solid var(--hb-kin-line); }
    .hb-tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; color: var(--hb-text-3);
      font: 700 var(--hb-fs-10)/1.1 var(--hb-font-ui); text-align: center; text-decoration: none; transition: color var(--hb-dur-hover); }
    .hb-tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: -2px 0; padding: 2px; }
    .hb-tabbar a:active .hb-crest { transform: scale(.9); }
    .hb-tabbar a[aria-current="page"] { color: var(--hb-text); }
    .hb-tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 2px; background: var(--hb-kin); }
    body.hb-match .hb-tabbar { display: none; }
    .hb-rules { padding: 20px var(--hb-gutter) 4px; }
    .hb-rules__links { margin-left: 0; width: 100%; }
    .hb-rflow { flex-direction: column; align-items: stretch; gap: 10px; }
    .hb-rflow__tag { align-self: flex-start; }
  }
  @media (max-width: 600px) {
    .hb-hero { min-height: 0; flex: none; }
    .hb-hero__inner { grid-template-columns: minmax(0, 1fr); gap: 0; height: auto; padding: 62px 16px 0; }
    .hb-hero__copy { gap: 14px; }
    .hb-hero .hb-kicker { margin-bottom: 10px; font-size: var(--hb-fs-11); letter-spacing: .12em; }
    .hb-hero__ksep { display: none; }
    .hb-hero__kp { display: block; }
    .hb-hero__title { font-size: 29px; }
    .hb-hero__sub { margin: 10px 0 16px; font-size: var(--hb-fs-14); }
    .hb-hero__actions { gap: 8px; }
    .hb-hero__actions .hb-btn--lg { height: 42px; padding: 0 14px; font-size: var(--hb-fs-14); }
    .hb-hero__actions .hb-hero__rules { display: none; }   /* Rules is in the tab bar */
    .hb-hero__meta { gap: 12px; margin-top: 14px; }
    .hb-fan { height: 300px; margin-top: 8px; }
    .hb-fan__card { width: 132px; margin-left: -66px; top: 22px; }
    .hb-fan__card:nth-child(1), .hb-fan__card:nth-child(5) { display: none; }
    .hb-fan__card:nth-child(2) { --x: -74px; --r: -9deg; }
    .hb-fan__card:nth-child(4) { --x: 74px; --r: 9deg; }
    .hb-fan__card:hover, .hb-fan__card:focus-visible { --y: -10px; }
    .hb-home__foot { flex-wrap: wrap; padding: 14px 16px 20px; }
    .hb-home__fan { flex-basis: calc(100% - 26px); }
    .hb-home__link { margin-left: 26px; }
    .hb-rules__head { gap: 12px; }
    .hb-rules__crest { width: 38px; height: 38px; font-size: 19px; }
    .hb-rules__title { font-size: var(--hb-fs-28); }
    .hb-rules__links .hb-btn { flex: 1 1 auto; }
    .hb-rules__links .hb-rules__pdf { flex-basis: 100%; }
    /* the round strip: three compact steps in a row (number over the phase name; the gist is in each section) */
    .hb-rflow__steps { gap: 6px; }
    .hb-rflow__arrow { display: none; }
    .hb-rflow__step { flex-direction: column; justify-content: flex-start; gap: 6px; padding: 10px 6px; text-align: center; }
    .hb-rflow__step .hb-rnum { width: 26px; height: 26px; font-size: 15px; }
    .hb-rflow__t b { font-size: var(--hb-fs-14); }
    .hb-rflow__t span { display: none; }
    .hb-rsec { padding: 14px 14px 10px; margin-bottom: var(--hb-4); }
    .hb-rsec__row { grid-template-columns: 1fr; gap: 2px; padding: 8px 0; }
  }
  @media (max-width: 380px) {
    .hb-hero__title { font-size: 26px; }   /* "After dark, the city" stays on one line at 360 */
  }
}

@layer hb-fx {
  body:not(.hb-perf) .hb-appbar { background-image: var(--tex-grain), linear-gradient(180deg, #120b08, var(--hb-ink-0)); }
  body:not(.hb-perf) .hb-appbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px; pointer-events: none; background: var(--pat-seigaiha) 0 0 / 16px 8px; opacity: .8; }
  body:not(.hb-perf) .hb-tabbar { background-image: var(--tex-grain), linear-gradient(0deg, #120b08, var(--hb-ink-0)); }
  body:not(.hb-perf) .hb-tabbar::after { content: ""; position: absolute; left: 0; right: 0; top: -4px; height: 3px; pointer-events: none; background: var(--pat-seigaiha) 0 0 / 16px 8px; opacity: .7; transform: scaleY(-1); }
  /* the boot lantern sways while the engine loads */
  body:not(.hb-perf) .hb-boot__lantern { transform-origin: 50% 0; animation: hb-shell-sway 2.6s var(--hb-ease-sway) infinite alternate; }
  /* the fan: a lantern glow under the cards, dealt in, then a slow drift on the wrapper (transform only) */
  body:not(.hb-perf) .hb-fan__card .hb-cimg { box-shadow: var(--hb-e3), var(--glow-lantern); }
  body:not(.hb-perf) .hb-fan__card:hover .hb-cimg { box-shadow: var(--hb-e3), 0 26px 70px -6px rgba(255,140,60,.55); }
  body:not(.hb-perf) .hb-fan--deal .hb-fan__card { animation: hb-deal 700ms var(--hb-ease-stamp) backwards; }
  body:not(.hb-perf) .hb-fan__card:nth-child(1) { animation-delay: 60ms; }
  body:not(.hb-perf) .hb-fan__card:nth-child(2) { animation-delay: 140ms; }
  body:not(.hb-perf) .hb-fan__card:nth-child(3) { animation-delay: 220ms; }
  body:not(.hb-perf) .hb-fan__card:nth-child(4) { animation-delay: 300ms; }
  body:not(.hb-perf) .hb-fan__card:nth-child(5) { animation-delay: 380ms; }
  body:not(.hb-perf) .hb-fan__float { animation: hb-shell-drift 7s var(--hb-ease-sway) 1.2s infinite alternate; }
  @keyframes hb-deal { from { opacity: 0; transform: translateX(0) rotate(0deg) translateY(90px); } to { opacity: 1; transform: translateX(var(--x)) rotate(var(--r)) translateY(var(--y)); } }
  @keyframes hb-shell-drift { from { transform: translateY(0); } to { transform: translateY(-8px); } }
  @keyframes hb-shell-sway { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
  /* rules: the round strip steps glow like the lantern buttons on hover */
  body:not(.hb-perf) .hb-rflow__step { background-image: var(--tex-grain); }
  body:not(.hb-perf) .hb-rflow__step:hover { box-shadow: inset 0 0 0 1px var(--hb-kin), var(--glow-lantern); }
  body:not(.hb-perf) .hb-rnum { box-shadow: 0 0 10px rgba(241,212,138,.18); }
  /* phones: the lantern string hangs ABOVE the copy, smaller, as in the identity-3 phone mockup (the night city's own
     22 px lanterns at 24-44 px reached down over the kicker) */
  @media (max-width: 600px) {
    .hb-hero .hb-lantern { width: 15px; height: 23px; margin-top: -12px; }
    .hb-hero .hb-lantern::after { width: 70px; height: 70px; margin: -35px 0 0 -35px; }
  }
}
