/* チュートリアル（吹き出し・光らせ・ゴーストの手・まとめ）、初回のカード、あそびかたノート（ui/tutorial.js・ui/help.js） */

/* ---------- 光らせ ---------- */
.tut-glow { position: relative; z-index: 2; animation: tut-glow 1.1s ease-in-out infinite; outline: 3px solid #ffe14a; outline-offset: 3px; border-radius: 10px; }
@keyframes tut-glow { 0%, 100% { outline-color: rgba(255, 225, 74, 1); box-shadow: 0 0 0 0 rgba(255, 225, 74, 0.7); } 50% { outline-color: rgba(255, 140, 40, 0.9); box-shadow: 0 0 18px 6px rgba(255, 225, 74, 0.45); } }

/* ---------- 吹き出し（2段：キャラの一言＋メモ） ---------- */
.tut-say { font-weight: 800; line-height: 1.45; }
.tut-say b { display: block; font-size: 0.78em; color: var(--c-accent, #ff6a2b); letter-spacing: 0.05em; }
.tut-memo { display: flex; gap: 0.5em; align-items: flex-start; margin-top: 0.35em; padding: 0.35em 0.55em; border-radius: 8px; background: #eef3ff; color: #2a3266; font-weight: 700; line-height: 1.4; white-space: pre-line; font-size: 0.9em; }
.tut-memo i { flex: none; font-style: normal; font-size: 0.75em; padding: 0.1em 0.45em; border-radius: 99px; background: #3b5bdb; color: #fff; margin-top: 0.15em; }

.bt-root .tut-layer { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
.bt-root .tut-layer > * { pointer-events: auto; }
.bt-root .tut-bubble {
  position: absolute; left: calc(var(--safe-l, 0px) + 1.2vw); top: max(25%, calc(var(--bt-u) * 22));
  width: clamp(230px, 28vw, 380px); display: flex; gap: calc(var(--bt-u) * 1); align-items: flex-start;
  padding: calc(var(--bt-u) * 1.2); background: var(--c-panel, #fffdf6); color: var(--c-text, #1b1f3b);
  border: 3px solid #1b1f3b; border-radius: 14px; box-shadow: 0 4px 0 rgba(11, 15, 38, 0.9), 0 10px 24px rgba(0, 0, 0, 0.35);
  font: 700 max(12px, calc(var(--bt-u) * 1.95)) var(--font-ui); animation: tut-in 0.22s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.bt-root .tut-bubble::after { content: ''; position: absolute; left: calc(var(--bt-u) * 4); bottom: -12px; width: 18px; height: 18px; background: inherit; border-right: 3px solid #1b1f3b; border-bottom: 3px solid #1b1f3b; transform: rotate(45deg); }
.bt-root .tut-bubble--tip { border-color: #3b5bdb; }
.bt-root .tut-bubble--tip::after { border-color: #3b5bdb; }
.bt-root .tut-bubble--blip { border-color: #ff6a2b; }
.bt-root.bt-root--lefty .tut-bubble { left: auto; right: calc(var(--safe-r, 0px) + 1.2vw); }
@keyframes tut-in { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.tut-face { flex: none; width: calc(max(12px, var(--bt-u) * 1.95) * 4.2); height: calc(max(12px, var(--bt-u) * 1.95) * 4.2); border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 35%, #fff 0, var(--c, #ff9ec7) 140%); border: 3px solid var(--c, #ff9ec7); }
.tut-face img, .tut-face .ph { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; }
.tut-bubble-body { flex: 1 1 auto; min-width: 0; }
.tut-bubble-title { font-weight: 900; color: #3b5bdb; margin-bottom: 0.2em; }
.tut-bubble-btns { display: flex; gap: 0.5em; justify-content: flex-end; margin-top: 0.45em; flex-wrap: wrap; }
.tut-btn { font: 800 0.85em var(--font-ui); padding: 0.3em 0.9em; min-height: 30px; border-radius: 99px; border: 2px solid #1b1f3b; background: #fff; color: #1b1f3b; cursor: pointer; }
.tut-btn:hover { background: #fff4d6; }
.tut-btn--skip { border-color: #9aa3c7; color: #6a6f8f; font-size: 0.75em; }
.tut-btn--big { background: linear-gradient(180deg, #ffb347, #ff6a2b); color: #fff; border-color: #b8320c; font-size: 1em; }

/* 手順のあいだは使わないボタンを隠す（パス・必殺） */
.bt-root.tut-lock .bt-pass, .bt-root.tut-lock .bt-special { visibility: hidden; }

/* 必殺：覚える前（錠の印） */
.bt-root .bt-special.is-locked { filter: grayscale(0.7); opacity: 0.85; }
/* 覚える前の必殺：錠の印は左上の角に（「必殺」の字にかぶせない）。下の行は小さい画面でも読める大きさに */
.bt-root .bt-special.is-locked .bt-special-l2 { font-size: max(7px, calc(var(--bt-u) * 1.15)); max-width: none; overflow: visible; text-overflow: clip; letter-spacing: -0.07em; white-space: nowrap; }
.bt-root .tut-lock-ic { position: absolute; left: calc(var(--bt-u) * -0.5); top: calc(var(--bt-u) * -0.6); width: max(11px, calc(var(--bt-u) * 2.2)); height: max(9px, calc(var(--bt-u) * 1.8)); background: #ffd23f; border: 2px solid #1b1f3b; border-radius: 3px; font-size: max(11px, calc(var(--bt-u) * 2.2)); }
.bt-root .tut-lock-ic::before { content: ''; position: absolute; left: 50%; bottom: 100%; width: 0.5em; height: 0.45em; transform: translateX(-50%); border: 2px solid #1b1f3b; border-bottom: 0; border-radius: 0.3em 0.3em 0 0; }

/* ゴーストの手：押した所（定規）から、引く向きへ動く指と、引いた跡 */
.bt-root .tut-ghost { position: absolute; inset: 0; pointer-events: none !important; transition: opacity 0.1s; }
.bt-root .tut-ghost-finger { position: absolute; left: var(--x); top: var(--y); width: calc(var(--bt-u) * 5); height: calc(var(--bt-u) * 5); min-width: 28px; min-height: 28px; transform: translate(-50%, -50%) scale(calc(1 - var(--press, 0) * 0.18));
  border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff, #ffe7c8 60%, #ffb36b); border: 3px solid #fff; box-shadow: 0 0 0 3px #ff6a2b, 0 0 calc(var(--press, 0) * 20px) 4px rgba(255, 140, 40, 0.8); }
.bt-root .tut-ghost-trail { position: absolute; left: var(--sx); top: var(--sy); width: var(--len); height: 6px; transform-origin: 0 50%; transform: translateY(-50%) rotate(var(--ang)); background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.95) 0 10px, transparent 10px 18px); border-radius: 3px; filter: drop-shadow(0 0 3px #ff6a2b); }

/* T11 まとめ */
.bt-root .tut-sum { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(8, 10, 30, 0.55); }
.bt-root .tut-sum-card { width: min(520px, 86vw); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 0.6em; padding: 1em 1.2em; font: 700 max(12px, calc(var(--bt-u) * 2)) var(--font-ui); animation: tut-in 0.25s cubic-bezier(0.2, 1.4, 0.4, 1); }
.bt-root .tut-sum-title { font: 400 1.5em var(--font-title); text-align: center; color: var(--c-accent-2, #1d2a6b); }
.bt-root .tut-sum-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3em; }
.bt-root .tut-sum-list li { display: flex; align-items: center; gap: 0.6em; }
.bt-root .tut-sum-list li i { flex: none; width: 1.2em; height: 1.2em; border-radius: 50%; border: 2px solid #9aa3c7; }
.bt-root .tut-sum-list li.ok i { background: var(--c-ok, #33d17a); border-color: #1b7a45; }
.bt-root .tut-sum-list li.ok i::after { content: '✓'; display: block; text-align: center; color: #fff; font-size: 0.85em; line-height: 1.2em; }
.bt-root .tut-sum-list li.skip { color: #9aa3c7; }
.bt-root .tut-sum-foot { display: flex; gap: 0.6em; align-items: flex-start; }
.bt-root .tut-sum-ok { align-self: center; min-width: 8em; }

/* ---------- 初回のカード（画面の上） ---------- */
.tut-card-back { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 25, 0.5); animation: fade-in 0.15s; }
.tut-card-back.is-out { opacity: 0; transition: opacity 0.15s; }
.tut-card { width: min(520px, 90vw); max-height: 88vh; overflow: auto; font: 700 var(--fs-m) var(--font-ui); animation: tut-in 0.25s cubic-bezier(0.2, 1.4, 0.4, 1); }
.tut-card-title { font: 400 var(--fs-l) var(--font-title); color: var(--c-accent-2); margin-bottom: 0.4em; display: flex; align-items: center; gap: 0.5em; }
.tut-card-title span { font: 900 var(--fs-xs) var(--font-ui); padding: 0.15em 0.6em; border-radius: 99px; background: var(--c-accent); color: #fff; }
.tut-card-row { display: flex; gap: 0.8em; align-items: flex-start; }
.tut-card-face { flex: none; width: clamp(64px, 16vh, 120px); height: clamp(64px, 16vh, 120px); border-radius: 50%; overflow: hidden; border: 3px solid var(--c); background: radial-gradient(circle at 50% 35%, #fff 0, var(--c) 140%); }
.tut-card-face img, .tut-card-face .ph { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; }
.tut-card-body { flex: 1 1 auto; min-width: 0; }
.tut-card-btns { display: flex; gap: var(--gap); justify-content: flex-end; margin-top: 0.8em; flex-wrap: wrap; }
.tut-learn { margin-top: 0.5em; padding: 0.4em 0.6em; border-radius: 8px; background: #fff4d6; color: #5a3a00; font-weight: 800; line-height: 1.5; }

/* ---------- あそびかたノート ---------- */
.help-back { position: absolute; inset: 0; display: grid; place-items: center; padding: max(10px, var(--safe-t)) max(10px, var(--safe-r)) max(10px, var(--safe-b)) max(10px, var(--safe-l)); background: rgba(5, 8, 25, 0.66); animation: fade-in 0.15s; }
.help-back.is-out { opacity: 0; transition: opacity 0.15s; }
.help-book { width: min(980px, 96vw); height: min(640px, 92vh); display: flex; flex-direction: column; gap: 0.5em; padding: clamp(8px, 1.4vh, 18px) clamp(10px, 1.6vw, 22px); font: 700 var(--fs-s) var(--font-ui);
  background: repeating-linear-gradient(180deg, #fffdf6 0 calc(1.9em - 1px), #dfe6ff calc(1.9em - 1px) 1.9em), #fffdf6; animation: tut-in 0.22s cubic-bezier(0.2, 1.4, 0.4, 1); }
.help-head { display: flex; align-items: center; justify-content: space-between; }
.help-title { display: flex; align-items: center; gap: 0.4em; font: 400 var(--fs-l) var(--font-title); color: var(--c-accent-2); }
.help-title-ic { width: 1.4em; height: 1.4em; object-fit: contain; font-size: 12px; }
.help-main { flex: 1 1 auto; min-height: 0; display: flex; gap: clamp(8px, 1.2vw, 16px); }
.help-tabs { flex: 0 0 clamp(108px, 17vw, 190px); display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.help-tab { position: relative; text-align: left; padding: 0.45em 0.7em; min-height: 36px; border-radius: 10px; border: 2px solid #1b1f3b; background: #fff; color: #1b1f3b; font: 800 var(--fs-s) var(--font-ui); cursor: pointer; }
.help-tab.is-on { background: linear-gradient(180deg, #ffb347, #ff6a2b); color: #fff; border-color: #b8320c; }
.help-new { display: inline-block; margin-left: 0.4em; padding: 0 0.4em; border-radius: 99px; background: #ff3b5c; color: #fff; font: 900 0.68em/1.6 var(--font-ui); font-style: normal; vertical-align: middle; }
.help-pane { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding-right: 4px; }
.help-pane-title { margin: 0 0 0.3em; font: 400 var(--fs-m) var(--font-title); color: var(--c-accent); }
.help-page { margin: 0 0 0.6em; padding: 0.5em 0.8em; border-radius: 10px; background: rgba(255, 255, 255, 0.92); border: 2px solid #c9d3f5; }
.help-page h4 { margin: 0 0 0.2em; font: 900 var(--fs-m) var(--font-ui); color: var(--c-accent-2); }
.help-page p { margin: 0.15em 0; line-height: 1.55; }
.help-who { display: flex; align-items: center; gap: 0.6em; margin-top: 0.3em; }
.help-who-face { flex: none; width: 2.6em; height: 2.6em; border-radius: 50%; overflow: hidden; border: 2px solid var(--c); background: radial-gradient(circle at 50% 35%, #fff 0, var(--c) 140%); }
.help-who-face img, .help-who-face .ph { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; font-size: 12px; }
.help-who-say { padding: 0.25em 0.7em; border-radius: 12px; background: #fff4d6; }
.help-who-say b { margin-right: 0.5em; color: var(--c-accent); }
.help-foot { display: flex; gap: var(--gap); justify-content: flex-end; }

/* マップ下部の「？」 */
.map-dock-btn--help img, .map-dock-btn--help .ph { border-radius: 50%; }

@media (max-height: 460px) {
  .help-book { height: 94vh; gap: 0.3em; }
  .help-tabs { flex-basis: clamp(96px, 20vw, 150px); }
  .help-tab { min-height: 30px; padding: 0.3em 0.6em; }
  .help-page { padding: 0.35em 0.6em; margin-bottom: 0.4em; }
  .tut-card-face { width: 64px; height: 64px; }
}
/* 吹き出しが自分の定規に重なるときの置き場所（ui/tutorial.js の avoidRulers） */
.bt-root .tut-bubble.tut-bubble--pos1 { left: auto; right: calc(var(--safe-r, 0px) + 1.2vw); }
.bt-root .tut-bubble.tut-bubble--pos2 { top: auto; bottom: calc(var(--bt-u) * 34); }
.bt-root .tut-bubble.tut-bubble--pos3 { left: auto; right: calc(var(--safe-r, 0px) + 1.2vw); top: auto; bottom: calc(var(--bt-u) * 34); }
.bt-root.bt-root--lefty .tut-bubble.tut-bubble--pos1, .bt-root.bt-root--lefty .tut-bubble.tut-bubble--pos3 { right: auto; left: calc(var(--safe-l, 0px) + 1.2vw); }
.bt-root .tut-bubble.tut-bubble--pos2::after, .bt-root .tut-bubble.tut-bubble--pos3::after { display: none; }
