/* lets-talk.humbulls.com
   トークンは site/theme-v3/css/core.css の :root を写したもの（正本はそちら）。
   このページ固有の構造:
     全画面 canvas（INK）+ 画面下半分に紙のパネル。パネルは会話が進むと上に伸びる。
   ============================================================ */
:root {
  --ink: #17191E;
  --ink-2: #383C45;
  --ink-3: #63666F;
  --paper: #FFFFFF;
  --surface: #F5F5F4;
  --line: #E7E7E4;
  --line-strong: #C9C9C6;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial,
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo UI", "Meiryo",
    "Noto Sans JP", sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0, 1);
  --radius-md: 8px;
  --radius-pill: 9999px;
  --radius-panel: 24px;

  --gutter: clamp(20px, 4.4vw, 64px);
  --panel-top: 52svh;        /* パネルの上端。is-compact で下がる */
  --dialog-size: clamp(24px, 3.5vw, 46px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;          /* ページはスクロールしない。スクロールするのはパネルの中だけ */
  overscroll-behavior: none;
}

body {
  font-family: var(--font-sans);
  font-feature-settings: "palt" 1, "tnum" 0, "onum" 0, "ss01" 0, "zero" 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.85;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

.lt-sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

/* ---------- 舞台 ---------- */
.lt {
  position: fixed;
  inset: 0;
  /* 上から下へ、紙 → ごく淡い灰。INK の透過（transmission）の抜け先になる */
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFAF9 46%, #F1F1EF 100%);
}

.lt-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;      /* ポインタは window で拾うのでイベントは通す */
}

/* パネルの上端。3 状態（導入 = 低い / 通常 / 確認 = 高い）を 1 変数で切り替え、
   INK のアンカーもこの変数から位置を決めるので、追従が自動でそろう */
.lt.is-compact { --panel-top: 82svh; }
.lt.is-tall { --panel-top: 30svh; }

/* INK の位置と大きさを決める見えない箱。CSS だけでレスポンシブを完結させる */
.lt-anchor {
  position: fixed;
  left: 50%;
  top: calc(var(--panel-top) * 0.46);
  transform: translate(-50%, -50%);
  width: min(38svh, 42vw);
  height: min(50svh, 55vw);
  pointer-events: none;
  z-index: 0;
  transition: top 0.42s var(--ease), width 0.42s var(--ease), height 0.42s var(--ease);
}
.lt.is-compact .lt-anchor { top: calc(var(--panel-top) * 0.5); }
.lt.is-tall .lt-anchor { width: min(17svh, 20vw); height: min(23svh, 27vw); }

/* WebGL が使えない環境: ガスのブロブに落ちる（会話は問題なく続けられる） */
.lt-fallback { display: none; }
.no-ink-3d .lt-canvas { display: none; }
.no-ink-3d .lt-fallback {
  display: block;
  position: fixed;
  left: 50%;
  top: calc(var(--panel-top) * 0.46);
  transform: translate(-50%, -50%);
  width: min(34svh, 38vw);
  aspect-ratio: 1;
  border-radius: 50%;
  z-index: 0;
  background:
    radial-gradient(60% 60% at 32% 28%, #BFE8FF 0%, rgba(191, 232, 255, 0) 70%),
    radial-gradient(55% 55% at 70% 34%, #5FA8FF 0%, rgba(95, 168, 255, 0) 72%),
    radial-gradient(50% 50% at 58% 70%, #9B7CFF 0%, rgba(155, 124, 255, 0) 74%),
    radial-gradient(42% 42% at 34% 74%, #FF5A3C 0%, rgba(255, 90, 60, 0) 76%);
  filter: blur(26px);
  opacity: 0.85;
}

/* ---------- ヘッダー ---------- */
.lt-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px var(--gutter);
  pointer-events: none;
}
.lt-logo { pointer-events: auto; display: block; }
.lt-logo img { width: clamp(112px, 11vw, 148px); height: auto; }

/* 会話に付き合いたくない人の逃げ道。ヘッダーに置くのは本文と重ならないため */
.lt-alt {
  pointer-events: auto;
  font-size: 13px;
  line-height: 1;
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 0.3em;
  text-decoration-thickness: 1px;
}
.lt-alt:hover { color: var(--ink); }

/* ---------- パネル ---------- */
.lt-main {
  position: fixed;
  inset: var(--panel-top) 0 0 0;
  z-index: 20;
  transition: inset 0.42s var(--ease);
}
/* 確認画面は項目が多いので見出しを小さくして 1 画面に収める */
.lt.is-tall { --dialog-size: clamp(20px, 2.2vw, 30px); }

.lt-panel {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  box-shadow: 0 -18px 48px rgba(23, 25, 30, 0.06);
  padding: clamp(26px, 3.6vw, 44px) var(--gutter) calc(var(--gutter) + 56px);
}

/* ---------- セリフ ---------- */
.lt-lines {
  display: flex;
  flex-direction: column;
  gap: 0;
  cursor: default;
}
.lt-line {
  font-size: var(--dialog-size);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.005em;
  color: var(--ink);
  transform-origin: top left;
  transition: opacity 0.34s var(--ease), transform 0.34s var(--ease), filter 0.34s var(--ease),
              margin 0.34s var(--ease), font-size 0.34s var(--ease);
}
/* 読み終わった行は上に退避してぼかす。data-depth = 現在行からの距離 */
.lt-line[data-depth="1"] {
  font-size: calc(var(--dialog-size) * 0.52);
  opacity: 0.34;
  filter: blur(1.4px);
  margin-bottom: 0.5em;
}
.lt-line[data-depth="2"] {
  font-size: calc(var(--dialog-size) * 0.42);
  opacity: 0.16;
  filter: blur(2.6px);
  margin-bottom: 0.3em;
}
/* タイプ中のキャレット */
.lt-line.is-typing::after {
  content: "";
  display: inline-block;
  width: 0.42em;
  height: 0.52em;
  margin-left: 0.12em;
  transform: translateY(0.02em);
  background: var(--ink);
  animation: lt-caret 1s steps(1) infinite;
}
@keyframes lt-caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ---------- 入力・選択 ---------- */
.lt-body {
  margin-top: clamp(22px, 2.6vw, 34px);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.lt-body.is-in { opacity: 1; transform: none; }

.lt-form { max-width: 620px; }
.lt-field { position: relative; margin-bottom: 22px; }

.lt-input {
  width: 100%;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 8px 0 7px;
  transition: border-color 0.2s var(--ease);
}
textarea.lt-input { resize: vertical; min-height: 5.4em; }
.lt-input:focus { outline: none; border-bottom-color: var(--ink); }
.lt-input:focus-visible { outline: none; }
.lt-input.is-invalid { border-bottom-color: #C0392B; }

/* フローティングラベル。placeholder=" " と :placeholder-shown で判定 */
.lt-label {
  position: absolute;
  left: 0;
  top: 8px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-3);
  pointer-events: none;
  transform-origin: left top;
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}
.lt-input:focus + .lt-label,
.lt-input:not(:placeholder-shown) + .lt-label {
  transform: translateY(-22px) scale(0.72);
  color: var(--ink-3);
}

.lt-errors { min-height: 1.4em; font-size: 14px; color: #C0392B; }

.lt-actions, .lt-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.lt-choices { margin-top: 0; max-width: 780px; }

.lt-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  text-align: left;
  text-decoration: none;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 9px 22px;
  cursor: pointer;
  transition: opacity 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.lt-btn:hover { opacity: 0.82; }
.lt-btn.-ghost { color: var(--ink); background: transparent; border-color: var(--line-strong); }
.lt-btn.-ghost:hover { opacity: 1; border-color: var(--ink); background: var(--surface); }
.lt-u { text-decoration: underline; text-underline-offset: 0.2em; }

/* ---------- 確認パネル（送信中） ---------- */
.lt-recap { max-width: 620px; }
.lt-recap dl {
  display: grid;
  grid-template-columns: minmax(96px, auto) 1fr;
  gap: 2px 20px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.lt-recap dt { font-size: 13px; font-weight: 700; color: var(--ink-3); line-height: 1.9; }
.lt-recap dd { font-size: 15px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; margin-bottom: 6px; }
.lt-recap_status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  font-size: 14px;
  color: var(--ink-3);
}
.lt-spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: lt-spin 0.7s linear infinite;
}
@keyframes lt-spin { to { transform: rotate(360deg); } }

/* ---------- 戻る・進捗 ---------- */
/* パネル内のフローに置く。固定配置にすると本文のボタンと重なる（スクロール位置で必ず衝突する） */
.lt-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink-3);
  background: none;
  border: 0;
  padding: 4px 8px 4px 0;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.lt-back:hover { color: var(--ink); }
.lt-back svg { width: 15px; height: 15px; }

.lt-progress {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 45;
  height: 3px;
  background: var(--ink);
  transform: scaleX(var(--progress, 0));
  transform-origin: bottom left;
  transition: transform 0.42s var(--ease);
}

/* ---------- ノート ---------- */
/* [hidden] は UA スタイルなのでクラス側の display に負ける。明示的に打ち消す */
[hidden] { display: none !important; }

.lt-note {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgba(23, 25, 30, 0.42);
  backdrop-filter: blur(3px);
}
.lt-note_panel {
  width: min(620px, 100%);
  max-height: 82svh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: var(--radius-panel);
  padding: clamp(26px, 3.4vw, 40px);
}
.lt-note_title { font-size: clamp(20px, 2.4vw, 28px); line-height: 1.4; margin-bottom: 18px; }
.lt-note_body h3 {
  font-size: 15px;
  line-height: 1.6;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.lt-note_body p { font-size: 15px; line-height: 1.9; color: var(--ink-2); }
.lt-note_close {
  margin-top: 26px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: var(--radius-pill);
  padding: 9px 24px;
  cursor: pointer;
}

/* ---------- モバイル ---------- */
@media (max-width: 767px) {
  :root { --panel-top: 46svh; --dialog-size: clamp(21px, 5.6vw, 27px); }
  .lt.is-compact { --panel-top: 76svh; }
  .lt.is-tall { --panel-top: 20svh; --dialog-size: 19px; }
  .lt-anchor { width: min(32svh, 62vw); height: min(42svh, 82vw); }
  .lt.is-tall .lt-anchor { width: min(13svh, 26vw); height: min(17svh, 34vw); }
  .lt-panel { padding-bottom: calc(var(--gutter) + 24px); }
  .lt-alt { font-size: 11px; }
  .lt-btn { font-size: 14px; padding: 8px 18px; }
  .lt-recap dl { grid-template-columns: 1fr; gap: 0; }
  .lt-recap dt { line-height: 1.7; margin-top: 10px; }
  .lt-recap dd { line-height: 1.7; }
}

/* ---------- モーション低減 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .lt-line.is-typing::after { display: none; }
}
