/* ============================================================================
 * 稽古場（src/ui/training-ui.js）
 * 札の枠・見出し・ボタンは一時停止の窓（.pause-sheet）と同じ UI キットを使う
 * ========================================================================== */
body.is-training #hud-floor-plaque,
.tr-hud[hidden],
.tr-hud [hidden] {
  display: none !important;
}

.tr-hud {
  box-sizing: border-box;
  width: min(560px, 100%);
  padding: 9px 16px 11px;
}

.tr-hud-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tr-step {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-muted, #a2a8b3);
  white-space: nowrap;
}

.tr-name {
  margin-right: auto;
  font-size: 15px;
  color: var(--kit-gold-hi, #f0d883);
  white-space: nowrap;
}

.tr-link {
  min-height: 32px;
  padding: 4px 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: auto;
  touch-action: manipulation;
}

.tr-text {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  color: var(--ink-main, #eef0f4);
}

.tr-overlay {
  z-index: 60;
  justify-content: center;
  padding: 18px;
  background: rgba(6, 8, 12, 0.6);
}

.tr-overlay[hidden] {
  display: none !important;
}

.tr-sheet {
  width: min(400px, 100%);
}

.tr-praise {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
}

.tr-sheet .pause-floor {
  margin-bottom: 12px;
}

.tr-card-text {
  margin: 10px 4px 16px;
  white-space: pre-line;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.75;
  color: var(--ink-main, #eef0f4);
  text-align: left;
}

.tr-sheet .primary-btn,
.tr-sheet .secondary-btn {
  width: 100%;
  min-height: 48px;
}

.tr-sheet .secondary-btn {
  margin-top: 10px;
}

.tr-sheet .primary-btn.is-waiting {
  filter: grayscale(0.5) brightness(0.75);
}

/* 操作方法の窓の中の入口（タイトルのときだけ） */
.controls-training {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
}

body.is-playing .controls-training {
  display: none;
}

/* タイトルの「稽古場で練習」：下の列の先頭に、枠付きで置く（縦の長さは増やさない） */
.title-training-btn {
  appearance: none;
  min-height: 40px;
  margin-right: 4px;
  padding: 6px 12px;
  border-style: solid;
  border-width: 2px;
  border-color: transparent;
  border-image: url("../image/ui/row-steel.webp") 26 fill / 10px / 0 stretch;
  background: transparent;
  color: var(--ink-main, #eef0f4);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  touch-action: manipulation;
}

.title-training-btn:focus-visible {
  outline: 2px solid var(--kit-gold-hi, #f0d883);
  outline-offset: 2px;
}

@media (hover: hover) {
  .title-training-btn:hover {
    border-image: url("../image/ui/row-gold.webp") 30 fill / 11px / 0 stretch;
  }
}

/* 1行に入らない幅では、稽古場を1段目、ほかを2段目に */
@media (max-width: 359px) {
  .title-sub-actions .title-training-btn {
    flex: 1 0 100%;
    margin: 0;
  }
}

/* 会話の窓の「とばす」と、序章のときの真っ暗な背景（src/ui/story.js） */
.story-skip {
  position: absolute;
  right: 6px;
  top: -40px;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-main, #eef0f4);
  background: rgba(10, 14, 24, 0.82);
  border: 1px solid var(--kit-steel, #314157);
  cursor: pointer;
  touch-action: manipulation;
}

.story-skip[hidden],
.story-veil[hidden] {
  display: none !important;
}

.story-skip:focus-visible {
  outline: 2px solid var(--kit-gold-hi, #f0d883);
  outline-offset: 2px;
}

.story-veil {
  position: fixed;
  inset: 0;
  z-index: 68;
  background: #000;
}

.story-veil.is-leaving {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

@media (max-width: 760px) {
  .tr-hud {
    position: fixed;
    top: calc(6px + env(safe-area-inset-top, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    width: auto;
    min-height: 88px;
    padding: 5px 12px 8px;
    z-index: 16;
  }

  .tr-text {
    margin-top: 1px;
    font-size: 12.5px;
    line-height: 1.5;
  }

  .tr-hud-top {
    gap: 8px;
  }

  .tr-name {
    font-size: 14px;
  }

  .tr-link {
    font-size: 11px;
  }

  /* 帯の分だけ、ステータスとボタンの列を下げる */
  body.is-training .hud-top {
    top: calc(104px + env(safe-area-inset-top, 0px));
  }

  body.is-training .morph-preview,
  body.is-training.touch-mode .morph-preview {
    top: calc(320px + env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - 590px);
  }
}
