:root {
  /* Reuse the real inset collected by the shared layout. A fixed 34px floor happens to
   * match an iPhone Home Indicator, but raises the banner above Android's already-excluded
   * system navigation area and exposes a dark strip below the ad. */
  --line-safe-bottom: var(--safe-b);
  --line-status-h: 0px;
}

html, body { min-height: 100%; background: #1a1210; }
/* Keep the anti-mistap gap, but paint only that non-clickable strip as a continuation
 * of the game's cream bottom navigation instead of exposing the dark page letterbox. */
body::before {
  content: ""; position: fixed; z-index: 89; pointer-events: none;
  left: 50%; bottom: var(--ad-safe-fill); transform: translateX(-50%);
  width: min(100%, 576px); height: max(0px, calc(var(--ad-pad) - var(--ad-safe-fill)));
  background: linear-gradient(to bottom, #ffe0bd, #fff6e6);
}
body.line-practice { --line-status-h: 28px; }
body.line-practice #app {
  height: calc(100dvh - var(--line-status-h) - var(--ad-pad));
  margin-top: var(--line-status-h);
}

#line-boot {
  position: fixed; inset: 0; z-index: 100000;
  display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 20%, #fff3cc, #f7d9a0 48%, #b96a54);
  color: #4a251c; font-family: system-ui, -apple-system, "Noto Sans JP", sans-serif;
}
#line-boot.hidden { display: none; }
.line-boot-card {
  width: min(320px, 92vw); display: grid; gap: 12px; justify-items: center;
  padding: 26px 20px; border: 3px solid #6f3b2a; border-radius: 24px;
  background: rgba(255,255,255,.92); box-shadow: 0 16px 50px rgba(70,28,15,.25); text-align: center;
}
.line-boot-mark {
  display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%;
  background: #06c755; color: white; font-weight: 900; font-size: 23px; border: 5px solid white;
  box-shadow: 0 5px 0 #078d41;
}
#line-boot-message { min-height: 2.8em; font-size: 13px; line-height: 1.45; color: #744c3d; }
#line-boot-actions { width: 100%; display: grid; gap: 9px; }
.line-boot-btn { border: 0; border-radius: 14px; min-height: 48px; padding: 10px 14px; font-weight: 800; font-size: 15px; }
.line-boot-btn.primary { background: #06c755; color: white; }
.line-boot-btn.secondary { background: #f3e5d0; color: #5f3528; }

.line-runtime-status {
  position: fixed; left: 0; right: 0; top: 0; z-index: 90000; min-height: 28px;
  display: none; align-items: center; justify-content: center; padding: 5px 12px;
  background: #8c4d00; color: white; font: 700 12px/1.4 system-ui, sans-serif; text-align: center;
}
body.line-practice .line-runtime-status { display: flex; }

.line-qa {
  position: fixed; z-index: 95000; right: 8px; top: calc(var(--line-status-h) + 8px);
  max-width: 86vw; padding: 8px 10px; border-radius: 8px; pointer-events: none;
  background: rgba(0,0,0,.78); color: #9effb8; white-space: pre-line;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}

#line-ad-banner {
  position: fixed; z-index: 8000; left: 50%; bottom: var(--line-safe-bottom);
  transform: translateX(-50%); width: min(100%, 420px); height: 50px;
  box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: #fff; color: #5d514c; border-top: 1px solid #dbcfc8;
  font: 700 12px/1.2 system-ui, sans-serif;
}
#line-ad-banner.hidden { display: none; }
#line-ad-banner .line-test-chip { padding: 3px 6px; border-radius: 5px; background: #ffe36c; color: #5b4300; }

#line-result-display-ad {
  width: min(300px, 100%); min-height: min(250px, 78vw); margin: 12px auto 14px;
  box-sizing: border-box; overflow: hidden; border-radius: 12px;
}
.line-result-display-test {
  display: grid; grid-template-rows: 1fr auto; padding: 14px;
  aspect-ratio: 6 / 5; background: linear-gradient(145deg, #e7f8ee, #f4fff7 58%, #d9ebff);
  color: #254033; border: 2px dashed #06a848; font: 700 12px/1.25 system-ui, sans-serif;
}
.line-result-display-art { display: grid; place-content: center; justify-items: center; gap: 3px; }
.line-result-display-art span { font-size: 54px; line-height: 1; font-weight: 950; color: #06c755; letter-spacing: -5px; }
.line-result-display-art i { font-style: normal; font-size: 13px; letter-spacing: 5px; color: #29724a; }
.line-result-display-test > div:last-child { display: flex; justify-content: space-between; align-items: end; gap: 8px; }
.line-result-display-test b { padding: 4px 7px; border-radius: 5px; background: #ffe36c; color: #5b4300; }
.line-result-display-test small { color: #4d675a; font-size: 10px; }
.line-result-display-live { background: transparent; }

.line-test-ad-modal {
  position: fixed; inset: 0; z-index: 99990; display: grid; place-items: center;
  padding: 24px; background: rgba(15,10,8,.92); color: white; font-family: system-ui, sans-serif;
}
.line-test-ad-card { width: min(340px, 94vw); padding: 28px; border-radius: 22px; background: #2c2444; text-align: center; }
.line-test-ad-label { display: inline-block; margin-bottom: 20px; padding: 6px 10px; background: #ffe36c; color: #2a2100; border-radius: 7px; font-weight: 900; }
.line-test-ad-count { margin: 22px auto; font-size: 48px; font-weight: 900; }
.line-test-ad-skip { margin-top: 10px; border: 0; background: transparent; color: #d7d0e5; text-decoration: underline; }

.line-provider { margin: -2px 8px 8px; color: #795b4d; font-size: 11px; line-height: 1.5; text-align: center; margin-top: 8px; }
.line-contact-button {
  display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  width: 100%; min-height: 44px; text-align: center; text-decoration: none;
}

.line-friend-modal {
  position: fixed; inset: 0; z-index: 99000; display: grid; place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 18px max(20px, var(--line-safe-bottom));
  background: rgba(12, 31, 42, .72); font-family: system-ui, -apple-system, "Noto Sans JP", sans-serif;
}
.line-friend-modal.hidden { display: none; }
.line-friend-card {
  position: relative; width: min(354px, 94vw); max-height: calc(100dvh - 48px); overflow-y: auto;
  box-sizing: border-box; padding: 112px 24px 22px; border-radius: 28px; background: #fff;
  color: #13233a; text-align: center; box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}
.line-friend-icon {
  position: absolute; top: 16px; left: 50%; translate: -50% 0;
  display: grid; place-items: center; width: 82px; height: 82px; border-radius: 22px;
  background: #06c755; color: white; border: 6px solid #fff; box-shadow: 0 10px 20px rgba(6, 145, 64, .25);
  font-size: 20px; font-weight: 950;
}
.line-friend-eyebrow { color: #06b44e; font-size: 13px; font-weight: 900; letter-spacing: 3px; }
.line-friend-card h2 { margin: 9px 0 5px; font-size: 25px; line-height: 1.25; }
.line-friend-lead { margin: 0 0 15px; color: #526276; font-size: 13px; font-weight: 700; }
.line-friend-benefits {
  display: grid; gap: 10px; margin: 0 0 14px; padding: 14px; border-radius: 18px;
  background: #f2f6fa; text-align: left; list-style: none;
}
.line-friend-benefits li { display: flex; align-items: center; gap: 10px; color: #24364c; font-size: 13px; font-weight: 800; }
.line-friend-benefits span { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 10px; background: white; }
.line-friend-note { margin: 0 0 12px; min-height: 1.4em; color: #8190a1; font-size: 11px; }
.line-friend-add, .line-friend-later { width: 100%; min-height: 48px; border: 0; border-radius: 24px; font-weight: 900; }
.line-friend-add { background: linear-gradient(#17d25f, #06b84b); color: white; box-shadow: 0 8px 20px rgba(6, 199, 85, .23); font-size: 16px; }
.line-friend-add:disabled { opacity: .55; }
.line-friend-later { margin-top: 6px; background: transparent; color: #8491a0; font-size: 14px; }

@supports (height: 100dvh) {
  #app { min-height: calc(100dvh - var(--line-status-h) - var(--ad-pad)); }
}

@media (orientation: landscape) {
  #line-boot::after {
    content: "このゲームは縦向きで遊んでください"; position: fixed; inset: auto 12px 12px;
    padding: 8px 12px; border-radius: 10px; background: #4a251c; color: white; text-align: center;
  }
}
