/* ============================================================================
 * AMIX 公開版の追加（2026-11-24）
 * タイトルロゴ・タイトルの並び・操作方法・一時停止・デバッグ表示の切り替え
 * 色は 01-base.css の変数を使う。動きは最後の prefers-reduced-motion で止める。
 * ========================================================================== */

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* タイトルの間は操作パッドを出さない */
body:has(#title-overlay.visible) #touch-controls {
  display: none !important;
}

/* デバッグ用の「調整」は ?debug のときだけ */
body:not(.is-debug) #btn-tune {
  display: none !important;
}

/* ---------------------------------------------------------------------------
 * タイトルの並び：左にロゴと開始ボタン。右は3Dの迷宮を見せる
 * ------------------------------------------------------------------------- */
.overlay.title-mode {
  background:
    radial-gradient(120% 90% at 0% 50%, rgba(8, 10, 15, 0.9) 0%, rgba(8, 10, 15, 0.62) 42%, rgba(8, 10, 15, 0) 72%),
    linear-gradient(180deg, rgba(8, 10, 15, 0.35) 0%, rgba(8, 10, 15, 0) 22%, rgba(8, 10, 15, 0) 70%, rgba(8, 10, 15, 0.55) 100%);
}

.title-stage {
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---------------------------------------------------------------------------
 * タイトルロゴ（src/ui/title-logo.js が image/logo.svg を差しこむ）
 * ------------------------------------------------------------------------- */
.title-stage .title-logo {
  position: relative;
  margin: 0 0 clamp(26px, 4.4vh, 40px);
  width: min(460px, 100%);
  text-shadow: none;
  aspect-ratio: 1101.826 / 496.801;
  font-size: 0;
  line-height: 0;
}

/* 読みこみ前・読みこめなかったとき：<img> を象牙色にして出す */
.title-logo img {
  display: block;
  width: 100%;
  height: auto;
  filter: invert(94%) sepia(12%) saturate(380%) hue-rotate(345deg) brightness(102%) drop-shadow(0 3px 0 #05070a);
}

.title-logo.is-pending img {
  opacity: 0;
}

.title-logo-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 3px 0 #05070a) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55));
}

.logo-base .logo-l1,
.logo-base .logo-l2 {
  fill: url(#ruten-logo-ink);
}

.logo-base .logo-en {
  fill: var(--brass);
}

.logo-base .logo-px {
  /* 色は title-logo.js が「の」からの距離で決める（--t：0＝文字の色 → 1＝シアン） */
  fill: var(--soul-cyan);
}

.logo-shine .logo-shape {
  fill: url(#ruten-logo-shine);
  mix-blend-mode: screen;
  pointer-events: none;
}

/* 登場：文字は下からせり上がる → 英字 → ドットが飛んできて組み上がる */
.title-logo.is-playing .logo-base .logo-l1,
.title-logo.is-playing .logo-base .logo-l2 {
  animation: rutenGlyphIn 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(140ms + var(--i) * 75ms);
}

.title-logo.is-playing .logo-shine .logo-shape {
  animation: rutenGlyphIn 720ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(140ms + var(--i) * 75ms);
}

.title-logo.is-playing .logo-base .logo-en {
  animation: rutenEnIn 900ms cubic-bezier(0.2, 0, 0, 1) both;
  animation-delay: 980ms;
}

.title-logo.is-playing .logo-base .logo-px {
  animation:
    rutenPixelPeel 760ms cubic-bezier(0.22, 1, 0.36, 1) both,
    rutenPixelFlux 4.2s ease-in-out infinite;
  animation-delay:
    calc(560ms + var(--k) * 90ms),
    calc(2600ms + var(--k) * 380ms);
}

@keyframes rutenGlyphIn {
  0% { opacity: 0; transform: translateY(46px) scaleY(1.18); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scaleY(1); }
}

@keyframes rutenEnIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 「の」の方から剥がれて、今の位置まで離れていく */
@keyframes rutenPixelPeel {
  0% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.6); }
  25% { opacity: 1; }
  100% { opacity: 1; transform: translate(0, 0) scale(1); }
}

/* 「流転」：遠いドットほど大きく薄れて、少し右上へ流れてから戻る */
@keyframes rutenPixelFlux {
  0%, 70%, 100% { opacity: 1; transform: translate(0, 0); }
  80% { opacity: calc(1 - var(--t) * 0.8); transform: translate(calc(var(--t) * 9px), calc(var(--t) * -7px)); }
  90% { opacity: 1; transform: translate(0, 0); }
}

/* タイトルの下半分（ボタン類）はロゴのあとに出る */
.title-menu {
  display: flex;
  flex-direction: column;
}

#title-overlay.visible .title-menu {
  animation: rutenMenuIn 520ms cubic-bezier(0.2, 0, 0, 1) both;
  animation-delay: 620ms;
}

@keyframes rutenMenuIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------------
 * 開始ボタン・小さな操作・記録
 * ------------------------------------------------------------------------- */
.title-actions {
  grid-template-columns: 1.25fr 1fr;
  margin-bottom: 12px;
}

.title-start-btn,
.daily-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: 8px 12px;
}

.title-btn-main {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.title-btn-sub {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.03em;
  color: rgba(22, 17, 8, 0.72);
}

.daily-btn-main {
  font-size: 14px;
}

.daily-btn-sub {
  font-size: 10px;
}

.title-sub-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  margin: 0 0 12px;
  padding: 2px 0;
}

.title-sub-actions .text-btn + .text-btn::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 50%;
  width: 1px;
  height: 12px;
  margin-top: -6px;
  background: var(--brass-dim);
}

.text-btn {
  position: relative;
  appearance: none;
  min-height: 40px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-inner);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 140ms var(--ease-ui), background-color 140ms var(--ease-ui);
}

.text-btn:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 1px;
}

@media (hover: hover) {
  .text-btn:hover {
    color: var(--ink-main);
    background: rgba(240, 231, 213, 0.06);
  }
}

.text-btn[aria-pressed="false"].sound-btn {
  color: #6f6a60;
}

/* 開始ボタンまわりの左だけの線はやめ、四辺同じ細枠にそろえる */
.boss-practice-trigger-btn {
  border-left: 0;
}

.checkpoint-picker {
  border-left: 1px solid var(--stone-edge);
}

.title-records {
  justify-content: flex-start;
  gap: 18px;
  margin: 0;
  padding: 0 2px;
  background: transparent;
  border: 0;
  font-size: 11px;
}

.title-records .record-cell {
  flex: 0 1 auto;
  justify-content: flex-start;
}

.title-credit {
  margin: clamp(18px, 4vh, 36px) 0 0;
  font-size: 10.5px;
  line-height: 1.8;
  color: #77736a;
  letter-spacing: 0.02em;
}

.title-credit .cg {
  display: inline-block;
  margin-right: 10px;
}

.title-credit a {
  color: #a8a294;
  text-decoration: none;
  border-bottom: 1px solid rgba(168, 162, 148, 0.35);
}

@media (hover: hover) {
  .title-credit a:hover {
    color: var(--brass-bright);
    border-bottom-color: var(--brass);
  }
}

/* ---------------------------------------------------------------------------
 * 操作方法
 * ------------------------------------------------------------------------- */
.controls-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(6, 8, 12, 0.72);
}

.controls-sheet-inner {
  width: min(520px, 100%);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: 18px 20px 16px;
  background: var(--stone-base);
  border: 1px solid var(--stone-edge);
  border-top-color: var(--stone-bevel-top);
  border-bottom: 2px solid var(--stone-ledge);
  border-radius: var(--radius-outer);
  box-shadow: 0 6px 0 var(--stone-ledge), 0 18px 40px rgba(0, 0, 0, 0.5);
  animation: rutenMenuIn 220ms cubic-bezier(0.2, 0, 0, 1) both;
}

.controls-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.controls-sheet-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink-main);
}

.controls-sheet .controls-list {
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px 0 0;
  font-size: 12.5px;
}

.controls-sheet .controls-list li {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  align-items: center;
  gap: 10px;
  white-space: normal;
}

.controls-sheet .controls-list .ck {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.controls-sheet .controls-touch {
  display: none;
}

body.touch-mode .controls-sheet .controls-touch {
  display: grid;
}

body.touch-mode .controls-sheet .controls-pc {
  display: none;
}

.controls-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(240, 231, 213, 0.1);
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------------------
 * 一時停止
 * ------------------------------------------------------------------------- */
.pause-btn {
  min-width: 40px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

body:not(.is-playing) .pause-btn {
  visibility: hidden;
}

.pause-overlay {
  justify-content: center;
  padding: 18px;
  background: rgba(6, 8, 12, 0.66);
  z-index: 40;
}

.pause-sheet {
  width: min(340px, 100%);
  padding: 22px 22px 18px;
  text-align: center;
  background: var(--stone-base);
  border: 1px solid var(--stone-edge);
  border-top-color: var(--stone-bevel-top);
  border-bottom: 2px solid var(--stone-ledge);
  border-radius: var(--radius-outer);
  box-shadow: 0 6px 0 var(--stone-ledge), 0 18px 40px rgba(0, 0, 0, 0.5);
}

.pause-sheet h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--ink-main);
}

.pause-sheet .result-brass-rule {
  margin-left: auto;
  margin-right: auto;
}

.pause-floor {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}

.pause-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.pause-note {
  margin: 14px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-muted);
}


/* ---------------------------------------------------------------------------
 * HUD の折りたたみ・整理
 * ------------------------------------------------------------------------- */
/* 音のボタンはシアン（魔法の合図）にしない。OFF のときだけ沈ませる */
#btn-mute[aria-pressed] {
  border-color: var(--stone-edge);
  color: var(--ink-main);
}

#btn-mute[aria-pressed="false"] {
  color: #6f6a60;
}

/* 地図：右上の「地図 ▴」でたたむ。たたむと札だけ残る */
.minimap-card {
  position: relative;
}

.map-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  appearance: none;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid var(--stone-edge);
  border-radius: var(--radius-inner);
  background: rgba(16, 19, 26, 0.86);
  color: var(--ink-muted);
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.map-toggle::after {
  /* 指で押しやすいよう、押せる範囲だけ広げる */
  content: "";
  position: absolute;
  inset: -8px;
}

@media (hover: hover) {
  .map-toggle:hover {
    color: var(--ink-main);
    border-color: var(--brass-dim);
  }
}

.minimap-card.is-collapsed {
  padding: 0;
  min-width: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.minimap-card.is-collapsed::before,
.minimap-card.is-collapsed::after {
  display: none;
}

.minimap-card.is-collapsed #minimap-canvas,
.minimap-card.is-collapsed .minimap-legend {
  display: none;
}

.minimap-card.is-collapsed .map-toggle {
  position: static;
  min-height: 32px;
  padding: 5px 11px;
  background: var(--stone-base);
  border-bottom: 2px solid var(--stone-ledge);
  box-shadow: 0 3px 0 var(--stone-ledge);
  color: var(--ink-main);
}

/* 操作の案内の帯：はじめて B3F に着いたら引っこめる（一時停止の「操作方法」で見られる） */
.key-hint-strip.is-retired {
  display: none;
}

@media (max-width: 760px) {
  /* スマホは凡例を出さない（色の意味は「操作方法」と about で） */
  .minimap-card .minimap-legend {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
 * スマホ（縦）
 * ------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .overlay.title-mode {
    background:
      radial-gradient(90% 34% at 50% 44%, rgba(8, 10, 15, 0.72) 0%, rgba(8, 10, 15, 0) 100%),
      linear-gradient(
        180deg,
        rgba(8, 10, 15, 0.12) 0%,
        rgba(8, 10, 15, 0.3) 36%,
        rgba(8, 10, 15, 0.88) 64%,
        rgba(8, 10, 15, 0.97) 100%
      );
  }

  .title-stage {
    width: 100%;
  }

  /* ロゴは画面の真ん中あたり、ボタン類は下にまとめる */
  .overlay.title-mode {
    align-items: stretch;
  }

  .title-stage {
    height: 100%;
    justify-content: flex-end;
  }

  .title-stage .title-logo {
    width: min(340px, 86vw);
    margin: auto auto 0;
    /* 上下の余白の真ん中より少し下（画面の真ん中寄り）に置く */
    top: clamp(0px, 5.5vh, 52px);
  }

  .title-menu {
    margin-top: auto;
    padding-top: clamp(20px, 5vh, 44px);
  }

  .title-actions {
    grid-template-columns: 1fr;
  }

  .title-sub-actions {
    justify-content: center;
  }

  .title-records {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 16px;
  }

  .title-credit {
    text-align: center;
  }

  .controls-sheet .controls-list li {
    grid-template-columns: 7.5em 1fr;
  }

  /* 知らせはステータス欄・地図に重ねず、画面の上から3割ほどの床の上に出す */
  .hud-toast,
  body.has-boss-bar .hud-toast {
    top: calc(34vh + env(safe-area-inset-top, 0px));
  }
}

/* ---------------------------------------------------------------------------
 * 動きを減らす設定
 * ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .title-logo.is-playing .logo-shape,
  #title-overlay.visible .title-menu,
  .controls-sheet-inner {
    animation: none !important;
  }

  .logo-shine {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
 * ボス練習（タイトルから開いたとき：ボスを選ぶ所だけ）
 * ------------------------------------------------------------------------- */
.tuning-panel.is-practice-only .tuning-body > :not(.tune-section-boss):not(.tune-boss-box) {
  display: none !important;
}

.tuning-panel.is-practice-only #tuning-reset,
.tuning-panel.is-practice-only #tuning-export,
.tuning-panel.is-practice-only .tuning-status {
  display: none !important;
}

.tune-boss-heading-play,
.tuning-panel.is-practice-only .tune-boss-heading-debug {
  display: none;
}

.tuning-panel.is-practice-only .tune-boss-heading-play {
  display: inline;
}

/* ボスの札：左だけの色線はやめ、四辺同じ細枠。中ボス・最終ボスは枠と背景の色で分ける */
.tune-boss-btn {
  border-left: 1px solid var(--stone-edge);
}

.tune-boss-btn.is-mid {
  border-color: #3a4558;
  border-left-color: #3a4558;
}

.tune-boss-btn.is-final {
  border-color: #6d3131;
  border-left: 1px solid #6d3131;
}

.tune-boss-btn:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 1px;
}

.controls-sheet .icon-btn:focus-visible,
.pause-sheet button:focus-visible,
.title-stage button:focus-visible {
  outline: 1px solid var(--brass-bright);
  outline-offset: 2px;
}

.controls-sheet .controls-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(240, 231, 213, 0.1);
  font-size: 12px;
  color: var(--ink-muted);
}

/* 結果画面：URL共有は控えめな文字のボタンにして最後へ */
.result-actions .share-url-btn {
  width: 100%;
  min-height: 36px;
  font-size: 12px;
  color: var(--ink-muted);
}
