/* ==========================================================================
   🎨 DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  color-scheme: light;
  /* Colors */
  --primary: #FF0000;           /* YouTube Red */
  --primary-hover: #E60000;
  --primary-active: #C80000;
  --primary-light: #FFF0F0;
  --primary-gradient: linear-gradient(135deg, #FF3333 0%, #FF0000 100%);
  
  --secondary: #333333;
  --secondary-hover: #1A1A1A;
  --secondary-light: #F2F2F2;

  --accent: #FF5E5E;
  --success: #2ECC71;
  --success-hover: #27AE60;
  --success-light: #E8F8F0;

  --background: #F9F7F6;        /* Warm background */
  --surface: #FFFFFF;
  --border: #FFE5E5;
  --border-focus: #FF8888;
  
  --text: #1F1F1F;              /* Soft dark text */
  --text-muted: #706F6F;
  --text-light: #FFFFFF;

  /* Typography */
  --font-family: 'Outfit', 'M PLUS 1p', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Spacing & Borders */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition-fast: 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* bouncy */
  --transition-normal: 0.3s ease;
  --easing-bouncy: cubic-bezier(0.175, 0.885, 0.32, 1.275); /* animation 短縮表記用（delay 誤解釈を避けるため timing-function 単体） */

  /* Shadows */
  --shadow-sm: 0 4px 12px rgba(255, 0, 0, 0.03);
  --shadow-md: 0 12px 32px rgba(255, 0, 0, 0.06);
  --shadow-lg: 0 20px 48px rgba(255, 0, 0, 0.1);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.06);
  
  --link-color: #065FD4;        /* YouTube standard link blue */
  
  /* Layout */
  --max-width: 680px;

  /* 初回表示: ロゴ内アニメ（delay-motion ≒ 490ms）に合わせた入場タイミング */
  --page-intro-tagline-delay: 340ms;
  --page-intro-tagline-duration: 420ms;
  --page-intro-form-delay: 500ms;
  --page-intro-form-duration: 520ms;
}

/* ==========================================================================
   🌙 DARK THEME VARIABLES
   ========================================================================== */
[data-theme="dark"] {
  color-scheme: dark;
  --background: #121212;        /* YouTube Dark background */
  --surface: #1E1E1E;
  --border: #332B2B;
  --border-focus: #CC0000;
  
  --secondary: #F1F1F1;         /* White borders for pop art in dark mode */
  --secondary-hover: #FFFFFF;
  --secondary-light: #2A2A2A;

  --text: #F1F1F1;              /* Soft light text */
  --text-muted: #AAAAAA;
  
  --link-color: #3EA6FF;        /* YouTube dark theme link blue */
  
  /* Pop box shadow adjust for dark mode */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   ✨ BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--background);
  overflow-x: clip;
  max-width: 100%;
}

html,
body {
  transition: none;
}

body {
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  position: relative;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-right: max(20px, env(safe-area-inset-right));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: max(20px, env(safe-area-inset-left));
}

/* ツール画面: 入力・出力欄以外は文字選択を抑止（UIラベル等の誤コピー防止） */
body.tool-app {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body.tool-app input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
body.tool-app textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* ロゴ・アイコン・操作ボタン: 端末差で SVG/img が選択・ドラッグされるのを明示的に抑止 */
body.tool-app svg,
body.tool-app img,
body.tool-app video,
body.tool-app canvas,
body.tool-app button,
body.tool-app .btn,
body.tool-app .brand-logo-link,
body.tool-app .logoRoot {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body.tool-app svg,
body.tool-app img {
  -webkit-user-drag: none;
  user-drag: none;
}

body.tool-app button img,
body.tool-app .btn img {
  pointer-events: none;
}

/* iOS Safari: ボタン連打時のダブルタップズームを抑止（±秒など）。ピンチズームは viewport 側で維持 */
button,
[type="button"],
[type="submit"],
[type="reset"],
a.btn-sns,
.site-select-trigger,
.lang-menu-item {
  touch-action: manipulation;
}

/* ==========================================================================
   🎈 BACKGROUND DECORATION BUBBLES
   ========================================================================== */
.bubble {
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  z-index: -1;
  opacity: 0.4;
  will-change: transform;
  animation: float 20s infinite alternate ease-in-out;
}

.bubble-1 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,0,0,0.2) 0%, rgba(255,255,255,0) 70%);
  top: -50px;
  left: -100px;
}

.bubble-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,94,94,0.15) 0%, rgba(255,255,255,0) 70%);
  bottom: 10%;
  right: -150px;
  animation-delay: -5s;
}

.bubble-3 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(255,0,0,0.1) 0%, rgba(255,255,255,0) 70%);
  top: 40%;
  left: 20%;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-30px) scale(1.1); }
}

/* ==========================================================================
   🏛️ LAYOUT & HEADER
   ========================================================================== */
.app-header {
  text-align: center;
  margin-top: 0;
  margin-bottom: 22px;
  max-width: var(--max-width);
  width: 100%;
  position: relative;
}

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

/* YouTube API 用の非表示マウント。left:-9999px は iOS Safari で横スクロール幅を広げるため使わない */
.yt-hidden-player-mount {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  clip-path: inset(50%);
  z-index: -1;
}

.yt-hidden-player-mount iframe {
  width: 1px !important;
  height: 1px !important;
}

.header-logo-wrap .brand-logo-link {
  display: inline-block;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}

.header-logo-wrap .brand-logo-link:active {
  background-color: transparent;
}

.header-logo-wrap {
  display: flex;
  justify-content: center;
  margin: 52px 0 clamp(-22px, -3.5vw, -12px);
}

.logoRoot.siteLogo {
  --logo-width: min(540px, 92vw);
}

/* Theme Switch Toggle */
.theme-switch-container {
  display: flex;
  justify-content: flex-start;
  position: absolute;
  top: max(0px, env(safe-area-inset-top));
  left: max(0px, env(safe-area-inset-left));
  z-index: 2;
}

/* Language Switch Toggle */
.lang-switch-container {
  display: flex;
  justify-content: flex-end;
  position: absolute;
  top: max(0px, env(safe-area-inset-top));
  right: max(0px, env(safe-area-inset-right));
  z-index: 2;
}

.btn-lang-toggle {
  background-color: var(--surface);
  border: 2px solid var(--secondary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 var(--secondary);
  transition: all var(--transition-fast);
  outline: none;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.btn-lang-toggle:hover {
  transform: translate(-1px, -1px) scale(1.05);
  box-shadow: 4px 4px 0 var(--secondary);
}

.btn-lang-toggle:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

.lang-label {
  display: block;
  pointer-events: none;
}

/* 言語選択ドロップダウンメニュー */
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  max-height: 60vh;
  overflow-y: auto;
  background-color: var(--surface);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  box-shadow: 4px 4px 0 var(--secondary);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 10;
}

.lang-menu-item {
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background-color: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.lang-menu-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.lang-menu-item.is-active {
  background-color: var(--primary);
  color: #FFFFFF;
}

/* RTL (アラビア語) 用の最小調整 */
[dir="rtl"] .lang-menu-item {
  text-align: right;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 54px auto 6px;
  padding: 0 58px;
}

.site-nav a,
.footer-nav a {
  color: var(--secondary);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  line-height: 1.35;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.site-nav a:active,
.footer-nav a:active {
  background-color: transparent;
}

.site-nav a:hover,
.footer-nav a:hover,
.site-nav a[aria-current="page"],
.footer-nav a[aria-current="page"] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.btn-theme-toggle {
  background-color: var(--surface);
  border: 2px solid var(--secondary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 var(--secondary);
  transition: all var(--transition-fast);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-theme-toggle:hover {
  transform: translate(-1px, -1px) rotate(15deg);
  box-shadow: 4px 4px 0 var(--secondary);
}

.btn-theme-toggle:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

.theme-icon {
  width: 24px;
  height: 24px;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

.tagline {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 700;
  padding: 0 15px;
  line-break: strict;
  word-break: keep-all;
  text-wrap: pretty;
  /* backwards: 入場アニメ後は opacity を base(1) に戻すので、モード切替の opacity フェードと両立する */
  animation: introContentIn var(--page-intro-tagline-duration) ease-out var(--page-intro-tagline-delay) backwards;
  transition: opacity 0.2s ease;
}

.logoRoot {
  --logo-width: min(760px, 92vw);
  --timeline-start-position: 11.8%;
  --timeline-stop-position: 41.4%;
  --duration-intro: 185ms;
  --duration-progress: 1200ms;
  --duration-dot-start: 200ms;
  --duration-dot-settle: 200ms;
  --duration-click: 180ms;
  --duration-pop: 360ms;
  --delay-timeline: 90ms;
  --delay-progress: 230ms;
  --delay-motion-gap: 70ms;
  --delay-motion: calc(var(--delay-progress) + var(--duration-dot-start) + var(--delay-motion-gap));
  --delay-click: calc(var(--delay-motion) + var(--duration-progress));
  --delay-pop: calc(var(--delay-click) + 110ms);
  --ease-progress: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-pop: cubic-bezier(0.24, 1.42, 0.36, 1);
  --play-press-scale: 0.94;
  --play-click-scale: 1.18;
  --dot-start-scale: 0.96;
  --dot-start-pop-scale: 1.04;
  --dot-stop-scale: 0.92;
  --jump-pop-distance: 20px;
  --jump-pop-scale: 1.1;
  --trail-scale: 1.14;
  --trail-opacity: 0.22;
  /* バーrect (x=236.07, width=1517.77 / viewBox 2000) を scaleX で伸ばし、
     先端が 41.4% に達する倍率: (41.4 - 11.8) / 75.8885 */
  --timeline-bar-scale-end: 0.3901;

  display: block;
  inline-size: var(--logo-width);
  max-inline-size: 100%;
}

.logoStage {
  position: relative;
  inline-size: 100%;
  aspect-ratio: 2000 / 600;
  overflow: visible;
  isolation: isolate;
}

.logoStage > svg {
  position: absolute;
  inset: 0;
  display: block;
  inline-size: 100%;
  block-size: 100%;
  overflow: visible;
  transform-box: border-box;
  transform-origin: center;
  pointer-events: none;
}

.textBlack,
.textRed,
.timelineBase,
.timelineProgress,
.timelineDot,
.timelineDotCircle,
.playIconTrail,
.jumpIconTrail,
.playIcon,
.jumpIcon {
  fill: currentColor;
  will-change: clip-path, opacity, transform;
}

.textBlack {
  color: var(--text);
  opacity: 0;
  animation: logoPartFade var(--duration-intro) ease-out forwards;
}

.textRed {
  color: #d5412d;
  clip-path: inset(0 100% 0 0);
  animation: logoTextReveal var(--duration-progress) var(--delay-motion) var(--ease-progress) forwards;
}

.timelineBase {
  color: #cacccb;
  opacity: 0;
  animation: logoPartFade var(--duration-intro) var(--delay-timeline) ease-out forwards;
}

.timelineProgress {
  color: #d5412e;
  transform: scaleX(0);
  animation: timelineBarGrow var(--duration-progress) var(--delay-motion) var(--ease-progress) forwards;
}

/* バーはrect左端 (11.8%) を原点に伸ばす。ドットと同じくtransformのみで動かすことで
   コンポジタ上で実行され、メインスレッド混雑時もドットとピクセル単位で同期する */
.logoStage > .timelineProgress {
  transform-origin: 11.8% center;
}

.timelineDot {
  color: #fff;
  stroke: #d5432f;
  stroke-miterlimit: 10;
  stroke-width: 12px;
  transform: translate3d(0, 0, 0);
  animation: timelineDotTravel var(--duration-progress) var(--delay-motion) var(--ease-progress) forwards;
  backface-visibility: hidden;
  will-change: transform;
}

.timelineDotCircle {
  transform-box: fill-box;
  transform-origin: center;
  animation:
    dotStartKick var(--duration-dot-start) var(--delay-progress) ease-out both,
    dotStopSettle var(--duration-dot-settle) calc(var(--delay-motion) + var(--duration-progress)) ease-out forwards;
}

.playIcon,
.playIconTrail {
  color: #d5412d;
  transform-box: fill-box;
  transform-origin: center;
}

.jumpIcon,
.jumpIconTrail {
  color: #d5412d;
  transform-box: fill-box;
  transform-origin: center;
}

.playIcon {
  animation: playScale var(--duration-click) var(--delay-click) ease-out both;
}

.jumpIcon {
  animation: jumpScale var(--duration-pop) var(--delay-pop) var(--ease-pop) both;
}

.playIconTrail {
  opacity: 0;
  animation: playButtonTrail var(--duration-click) var(--delay-click) ease-out both;
}

.jumpIconTrail {
  opacity: 0;
  animation: iconTrail var(--duration-pop) var(--delay-pop) ease-out both;
}

@keyframes logoPartFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes logoTextReveal {
  from {
    clip-path: inset(0 100% 0 0);
  }

  to {
    clip-path: inset(0 calc(100% - var(--timeline-stop-position)) 0 0);
  }
}

/* 赤バーとドットは同一 duration / delay / easing の transform アニメーションとして
   コンポジタで実行する (clip-pathや変数駆動はメインスレッド依存となり、
   読み込み中にカクつき・バーとドットの同期ズレが発生するため) */
@keyframes timelineBarGrow {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(var(--timeline-bar-scale-end));
  }
}

@keyframes timelineDotTravel {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(calc(var(--timeline-stop-position) - var(--timeline-start-position)), 0, 0);
  }
}

@keyframes dotStartKick {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(var(--dot-start-scale));
  }
}

@keyframes dotStopSettle {
  0% {
    transform: scale(1);
  }

  48% {
    transform: scale(var(--dot-stop-scale));
  }

  100% {
    transform: scale(1);
  }
}

@keyframes playScale {
  0% {
    transform: scale(1);
  }

  28% {
    transform: scale(var(--play-press-scale));
  }

  64% {
    transform: scale(var(--play-click-scale));
  }

  100% {
    transform: scale(1);
  }
}

@keyframes playButtonTrail {
  0%,
  30% {
    opacity: 0;
    transform: scale(1);
  }

  64% {
    opacity: var(--trail-opacity);
    transform: scale(var(--play-click-scale));
  }

  100% {
    opacity: 0;
    transform: scale(var(--play-click-scale));
  }
}

@keyframes jumpScale {
  0%,
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
  }

  34% {
    transform: translateY(4px) scale(0.98) rotate(0deg);
  }

  62% {
    transform: translateY(calc(0px - var(--jump-pop-distance))) scale(var(--jump-pop-scale)) rotate(-5deg);
  }
}

@keyframes iconTrail {
  0% {
    opacity: 0;
    transform: scale(1);
  }

  36% {
    opacity: var(--trail-opacity);
  }

  100% {
    opacity: 0;
    transform: scale(var(--trail-scale));
  }
}

@media (prefers-reduced-motion: reduce) {
  .logoRoot {
    animation: none;
  }

  .textBlack,
  .textRed,
  .timelineBase,
  .timelineProgress,
  .timelineDot,
  .timelineDotCircle,
  .playIconTrail,
  .jumpIconTrail,
  .playIcon,
  .jumpIcon {
    animation: none;
    will-change: auto;
  }

  .tagline,
  .input-card {
    animation: none;
  }

  .textBlack,
  .timelineBase {
    opacity: 1;
  }

  .textRed {
    clip-path: inset(0 calc(100% - var(--timeline-stop-position)) 0 0);
  }

  .timelineProgress {
    transform: scaleX(var(--timeline-bar-scale-end));
  }

  .timelineDot {
    transform: translate3d(calc(var(--timeline-stop-position) - var(--timeline-start-position)), 0, 0);
  }

  .timelineDotCircle {
    transform: scale(1);
  }

  .playIconTrail,
  .jumpIconTrail {
    opacity: 0;
  }

  .playIcon,
  .jumpIcon {
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

/* 静的ロゴ（サブページヘッダー用・アニメ最終状態を常時固定。REV-024 / 戻す場合はこのブロックを削除） */
.logoRoot.is-static {
  animation: none;
}

.logoRoot.is-static .textBlack,
.logoRoot.is-static .textRed,
.logoRoot.is-static .timelineBase,
.logoRoot.is-static .timelineProgress,
.logoRoot.is-static .timelineDot,
.logoRoot.is-static .timelineDotCircle,
.logoRoot.is-static .playIconTrail,
.logoRoot.is-static .jumpIconTrail,
.logoRoot.is-static .playIcon,
.logoRoot.is-static .jumpIcon {
  animation: none;
  will-change: auto;
}

.logoRoot.is-static .textBlack,
.logoRoot.is-static .timelineBase {
  opacity: 1;
}

.logoRoot.is-static .textRed {
  clip-path: inset(0 calc(100% - var(--timeline-stop-position)) 0 0);
}

.logoRoot.is-static .timelineProgress {
  transform: scaleX(var(--timeline-bar-scale-end));
}

.logoRoot.is-static .timelineDot {
  transform: translate3d(calc(var(--timeline-stop-position) - var(--timeline-start-position)), 0, 0);
}

.logoRoot.is-static .timelineDotCircle {
  transform: scale(1);
}

.logoRoot.is-static .playIconTrail,
.logoRoot.is-static .jumpIconTrail {
  /* 静的ロゴでは軌跡演出は不要。display:none でモバイルの横スクロール(overflow:visibleによるはみ出し)も防ぐ */
  display: none;
}

.logoRoot.is-static .playIcon,
.logoRoot.is-static .jumpIcon {
  transform: translateY(0) scale(1) rotate(0deg);
}

/* サブページヘッダーのロゴ配置（小さめ・中央・トップへのリンク。REV-024） */
.brand-logo-link {
  display: inline-block;
  line-height: 0;
  -webkit-tap-highlight-color: transparent;
}

.brand-logo-link:active {
  background-color: transparent;
}

.static-header .logoRoot.is-static {
  --logo-width: min(300px, 72vw);
  margin: 0 auto;
}

/* 静的ロゴでは timelineDot 等の transform がsvg枠ごとはみ出すため、枠内にクリップして
   モバイルの横スクロールを防ぐ（ドット本体は枠内に収まり表示される） */
.static-header .logoStage {
  overflow: hidden;
}

.static-header .brand-logo-link svg,
.static-header .brand-logo-link img {
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.app-main {
  max-width: var(--max-width);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-grow: 1;
}

.content-section {
  background-color: color-mix(in srgb, var(--surface) 82%, var(--background));
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px;
}

.content-section h2 {
  color: var(--secondary);
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 14px;
}

.content-section h3 {
  color: var(--secondary);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 8px;
}

.content-section p,
.content-section li {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.content-section p + p {
  margin-top: 12px;
}

.content-kicker {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.info-panel {
  border-left: 4px solid var(--primary);
  padding-left: 14px;
}

.content-section details {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.content-section details:first-of-type {
  border-top: none;
}

.content-section summary {
  color: var(--secondary);
  cursor: pointer;
  font-weight: 800;
  line-height: 1.45;
}

.content-section details p {
  margin-top: 8px;
}

/* ==========================================================================
   📦 CARDS (POP NEOMORPHISM LIGHT STYLE)
   ========================================================================== */
.card {
  background-color: var(--surface);
  border: 3px solid var(--secondary);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 6px 6px 0px var(--secondary); /* Pop 3D flat shadow */
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.input-card {
  animation: introContentIn var(--page-intro-form-duration) ease-out var(--page-intro-form-delay) both;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0px var(--secondary);
  }
}

/* ==========================================================================
   📝 FORM & INPUTS
   ========================================================================== */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flex-1 {
  flex: 1;
}

label {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-card label {
  flex-wrap: wrap;
  color: var(--secondary);
  line-height: 1.35;
}

.label-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

input[type="url"],
input[type="text"] {
  width: 100%;
  padding: 14px 18px;
  font-size: 1rem;
  font-family: var(--font-family);
  font-weight: 600;
  background-color: var(--background);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  color: var(--text);
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

input[type="url"] {
  padding-right: 45px; /* space for clear button */
}

input[type="url"]::placeholder,
input[type="text"]::placeholder {
  color: #A0A0A0;
  font-weight: 500;
}

input[type="url"]:focus,
input[type="text"]:focus {
  background-color: var(--surface);
  border-color: var(--primary);
  box-shadow: var(--shadow-inner);
}

.btn-input-action {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn-clear {
  font-size: 1.4rem;
  color: var(--text-muted);
}

.btn-clear:hover {
  color: var(--primary);
}

.btn-paste-url {
  font-family: var(--font-family);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-muted);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--secondary);
  padding: 5px 8px;
}

.btn-paste-url:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-paste-url:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

.error-message {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  animation: shake 0.4s ease;
}

.time-preview {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 2px;
  background-color: var(--primary-light);
  padding: 4px 10px;
  border-radius: 8px;
  display: inline-block;
  align-self: flex-start;
  border: 1px solid rgba(255, 0, 0, 0.15);
  animation: pulseLight 2s infinite ease-in-out;
}

/* Chips & Presets */
.comment-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.chip-comment {
  font-family: var(--font-family);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 8px 8px;
  background-color: var(--surface);
  border: 2px solid var(--secondary);
  border-radius: 30px;
  color: var(--secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 2px 2px 0 var(--secondary);
  min-width: 0;
  text-align: center;
  line-height: 1.3;
  white-space: normal;
}

.chip-comment:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--primary);
}

.chip-comment:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--primary);
}

/* ==========================================================================
   ⏱️ TIME STEPPER (Microwave-style display & buttons)
   ========================================================================== */
input.start-time-display {
  text-align: center;
  font-family: 'Outfit', var(--font-family);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 18px 18px;
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

input.start-time-display::placeholder {
  color: var(--primary);
  opacity: 0.35;
  font-weight: 800;
  letter-spacing: 2px;
}

input.start-time-display:focus {
  background-color: var(--surface);
  border-color: var(--primary);
}

.time-stepper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.time-stepper-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.35;
  margin-bottom: 2px;
}

.time-stepper-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.chip-stepper {
  min-width: 0;
  font-family: var(--font-family);
  font-size: clamp(0.78rem, 2.8vw, 0.9rem);
  font-weight: 800;
  padding: 10px clamp(8px, 2vw, 12px);
  background-color: var(--surface);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  color: var(--secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 2px 2px 0 var(--secondary);
}

.chip-stepper:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--primary);
}

.chip-stepper:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--primary);
}

.chip-stepper-minus {
  background-color: var(--secondary-light);
}

.chip-stepper-reset {
  grid-column: span 2;
  background-color: var(--surface);
  border-style: dashed;
  color: var(--text-muted);
}

.chip-stepper-reset:hover {
  border-style: solid;
  background-color: var(--secondary-light);
  border-color: var(--secondary);
  color: var(--secondary);
  box-shadow: 3px 3px 0 var(--secondary);
}

.chip-stepper-reset:active {
  box-shadow: 1px 1px 0 var(--secondary);
}

/* ==========================================================================
   🔘 BUTTONS (POP 3D STYLE)
   ========================================================================== */
.btn {
  font-family: var(--font-family);
  font-size: 1.05rem;
  font-weight: 800;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  border: 3px solid var(--secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  text-decoration: none;
  outline: none;
}

.btn-svg-icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  object-fit: contain;
  flex: 0 0 auto;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background: var(--primary-gradient);
  color: var(--text-light);
  box-shadow: 4px 4px 0 var(--secondary);
}

.btn-primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--secondary);
}

.btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--secondary);
}

.btn-success {
  background-color: var(--success);
  color: var(--text-light);
  box-shadow: 4px 4px 0 var(--secondary);
}

.btn-success:hover {
  background-color: var(--success-hover);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--secondary);
}

.btn-success:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--secondary);
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--secondary);
  box-shadow: 4px 4px 0 var(--secondary);
}

.btn-secondary:hover {
  background-color: var(--secondary-light);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--secondary);
}

.btn-secondary:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--secondary);
}

.btn-outline {
  background-color: transparent;
  color: var(--secondary);
  border-style: dashed;
  box-shadow: none;
}

.btn-outline:hover {
  border-style: solid;
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ==========================================================================
   🖼️ THUMBNAIL PREVIEW
   ========================================================================== */
.preview-card {
  display: flex;
  flex-direction: row;
  gap: 20px;
  align-items: center;
  padding: 16px;
  background-color: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 4px 4px 0 var(--primary);
}

.preview-card:hover {
  box-shadow: 6px 6px 0 var(--primary);
}

@media (max-width: 500px) {
  .preview-card {
    flex-direction: column;
    text-align: center;
  }
}

.thumbnail-wrapper {
  position: relative;
  width: 160px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--secondary);
  flex-shrink: 0;
  box-shadow: 3px 3px 0 var(--secondary);
}

.thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(255, 0, 0, 0.9);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  border: 2px solid white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  pointer-events: none;
}

.preview-details {
  flex-grow: 1;
}

.preview-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 4px;
}

.preview-desc {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Live Comment Customize inside Result Card */
.customize-box {
  background-color: var(--background);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-inner);
}

.customize-box label {
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.customize-box input[type="text"] {
  padding: 10px 14px;
  font-size: 0.9rem;
}

/* Test Play Box & Clickable Blue Timestamp Link */
/* 1行：左=[再生][リセット]、テスト再生リンク=動画幅の中央 */
.preview-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(38px, auto);
  align-items: center;
  width: 100%;
  margin: 10px 0 16px;
}

.preview-controls {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1;
  margin: 0;
}

.test-play-box {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  align-self: center;
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  z-index: 0;
  margin: 0;
  text-align: center;
}

.test-play-link {
  font-family: var(--font-family);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 2px dashed var(--link-color);
  padding-bottom: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

/* 📍/↗️ をロゴの再生アイコン・ジャンプ矢印（ブランドの赤）に置き換え。文字サイズに追従 */
.test-play-link .tp-icon {
  width: auto;
  height: 1.1em;
  fill: var(--primary);
  flex-shrink: 0;
}

.test-play-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
  border-bottom-style: solid;
  transform: scale(1.05);
}

.test-play-link:active {
  transform: scale(0.95);
}

/* ==========================================================================
   🎉 RESULT DISPLAY
   ========================================================================== */
.result-card {
  border-color: var(--success);
  box-shadow: 6px 6px 0 var(--success);
}

.result-card:hover {
  box-shadow: 8px 8px 0 var(--success);
}

.badge-success {
  background-color: var(--success-light);
  color: var(--success);
  font-size: 0.9rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 30px;
  border: 2px solid var(--success);
  display: inline-block;
  margin-bottom: 20px;
  box-shadow: 2px 2px 0 var(--success);
}


.btn-playpause,
.btn-preview-reset {
  -webkit-tap-highlight-color: transparent;
}

.btn-playpause .btn-media-icon,
.btn-preview-reset .btn-media-icon {
  display: block;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.btn-playpause .btn-media-icon-pause {
  display: none;
}

.btn-playpause.is-playing .btn-media-icon-play {
  display: none;
}

.btn-playpause.is-playing .btn-media-icon-pause {
  display: block;
}

.btn-preview-reset .btn-media-icon {
  width: 18px;
  height: 18px;
}

/* 開始位置に戻す（リセット）丸ボタン。再生ボタンと同じ大きさ・形、色は白地で区別 */
.btn-preview-reset {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--secondary);
  background: var(--surface);
  color: var(--secondary);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 2px 2px 0 var(--secondary);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-preview-reset:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--secondary); }
.btn-preview-reset:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--secondary); }

.result-box {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 共有文の見出し行（ラベル左・「〜から見て👇」トグル右。狭い時は折り返す） */
.result-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* 汎用 iOS風トグル（共有文の時間行ON/OFFなど）。ビジュアルは .switch-visual を共用 */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--secondary);
  user-select: none;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-switch input:checked + .switch-visual { background: var(--primary); }
.toggle-switch input:checked + .switch-visual::before { transform: translateX(20px); }
.toggle-switch input:focus-visible + .switch-visual { outline: 2px solid var(--primary); outline-offset: 2px; }
[dir="rtl"] .toggle-switch input:checked + .switch-visual::before { transform: translateX(-20px); }

textarea#result-text {
  width: 100%;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 14px;
  border: 2.5px solid var(--secondary);
  border-radius: var(--radius-md);
  background-color: var(--background);
  resize: none;
  outline: none;
  color: var(--secondary);
  box-shadow: var(--shadow-inner);
}

.button-group {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 480px) {
  .button-group {
    flex-direction: column;
    gap: 12px;
  }
}

/* SNS Sharing Grid */
.share-sns-container {
  border-top: 2px dashed var(--border);
  padding-top: 20px;
  margin-bottom: 20px;
}

.share-label {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.share-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 480px) {
  .share-buttons {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.btn-sns {
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 10px;
  border-radius: 12px;
  border: 2px solid var(--secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: white;
  box-shadow: 2px 2px 0 var(--secondary);
}

.btn-x {
  background-color: #000000;
}

.btn-x:hover {
  background-color: #222;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--secondary);
}

.btn-x:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

.btn-line {
  background-color: #06C755;
}

.btn-line:hover {
  background-color: #05B04B;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--secondary);
}

.btn-line:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

.btn-whatsapp {
  background-color: #25D366;
}

.btn-whatsapp:hover {
  background-color: #1FB855;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--secondary);
}

.btn-whatsapp:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

.btn-telegram {
  background-color: #229ED9;
}

.btn-telegram:hover {
  background-color: #1E8BC0;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--secondary);
}

.btn-telegram:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

.btn-threads {
  background-color: #000000;
}

.btn-threads:hover {
  background-color: #222;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--secondary);
}

.btn-threads:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

.btn-os {
  background-color: var(--surface);
  color: var(--secondary);
}

.btn-os:hover {
  background-color: var(--secondary-light);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--secondary);
}

.btn-os:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

.icon-sns {
  width: 18px;
  height: 18px;
}

/* Moment Preview Player (指定タイムのフレーム表示。REQUEST-009 / 戻す場合はこのブロックを削除) */
.moment-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: #000;
  box-shadow: 4px 4px 0 var(--secondary);
}

.moment-preview iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* QR Code Display Box */
.qr-container {
  border-top: 2px dashed var(--border);
  padding-top: 20px;
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  background-color: var(--background);
  border-radius: var(--radius-md);
  border: 2px solid var(--secondary);
  animation: slideDown 0.4s var(--easing-bouncy);
}

#qrcode {
  padding: 10px;
  background-color: white;
  border-radius: 8px;
  border: 1.5px solid var(--secondary);
}

#qrcode img,
#qrcode canvas {
  display: block;
}

.qr-save-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.55);
}

.qr-save-overlay-panel {
  width: min(100%, 320px);
  padding: 20px 16px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--secondary);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.qr-save-overlay-hint {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.5;
  line-break: strict;
  word-break: keep-all;
}

.qr-save-overlay-img {
  display: block;
  width: min(100%, 220px);
  height: auto;
  margin: 0 auto 16px;
  padding: 10px;
  border-radius: 8px;
  border: 1.5px solid var(--secondary);
  background: #fff;
  -webkit-touch-callout: default;
  user-select: auto;
  -webkit-user-select: auto;
}

.qr-save-overlay-close {
  width: 100%;
}

.qr-download-button {
  width: 100%;
  max-width: 220px;
  padding: 10px 14px;
  font-size: 0.85rem;
}

.qr-desc {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  max-width: 280px;
}

/* チャプター: すべて削除の確認（window.confirm は Cursor 内蔵ブラウザ等で表示されないため） */
.chapters-confirm {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}

.chapters-confirm-box {
  background: var(--surface);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  box-shadow: 4px 4px 0 var(--secondary);
  padding: 20px;
  max-width: 360px;
  width: 100%;
}

.chapters-confirm-msg {
  margin: 0 0 16px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.chapters-confirm-actions {
  display: flex;
  gap: 12px;
}

/* ==========================================================================
   🍞 TOAST NOTIFICATION
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--secondary);
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: 30px;
  border: 2px solid white;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 9999;
  text-align: center;
  line-break: strict;
  word-break: keep-all;
  animation: popUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================================================
   🏛️ FOOTER
   ========================================================================== */
.app-footer {
  text-align: center;
  margin-top: 40px;
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.6;
}

.footer-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.footer-nav-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
}

.footer-support {
  margin: 0 0 12px;
}

.footer-support-link {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--text-muted) 70%, transparent);
  -webkit-tap-highlight-color: transparent;
}

.footer-support-link:active {
  background-color: transparent;
}

.footer-support-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ==========================================================================
   📄 STATIC CONTENT PAGES
   ========================================================================== */
.static-header {
  max-width: 840px;
  width: 100%;
  text-align: center;
  padding-top: 18px;
}

.static-header .site-nav {
  margin: 18px auto 0;
  padding: 0;
}

.brand-link {
  color: var(--secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Outfit', var(--font-family);
  font-size: 1.6rem;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  color: var(--primary);
}

.static-main {
  max-width: 840px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
  flex-grow: 1;
}

.static-hero {
  padding: 30px 0 4px;
}

.static-hero h1 {
  color: var(--secondary);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 12px;
  text-align: center;
  line-break: strict;
  word-break: keep-all;
  text-wrap: pretty;
}

.static-hero p {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 700;
  max-width: 660px;
  margin: 0 auto;
}

.static-section {
  background-color: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 26px;
}

.static-section h2 {
  color: var(--secondary);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 12px;
  line-break: strict;
  word-break: keep-all;
  text-wrap: pretty;
}

.static-section h3 {
  color: var(--secondary);
  font-size: 1rem;
  font-weight: 800;
  margin: 16px 0 8px;
}

.static-section p,
.static-section li {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.static-section p + p {
  margin-top: 12px;
}

.static-section ul,
.static-section ol {
  padding-left: 1.25rem;
}

.static-section li + li {
  margin-top: 8px;
}

.plain-link {
  color: var(--link-color);
  font-weight: 800;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.note-box {
  background-color: var(--primary-light);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  color: var(--secondary);
  font-weight: 800;
  padding: 16px;
}

.notice-list {
  display: grid;
  gap: 14px;
}

.notice-list > div {
  border-left: 4px solid var(--primary);
  padding-left: 14px;
}

.notice-list h3 {
  margin-top: 0;
}

@media (max-width: 640px) {
  body {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
  }

  .card {
    padding: 18px 16px;
    border-radius: var(--radius-md);
  }

  .header-logo-wrap {
    margin-top: 44px;
    margin-bottom: -10px;
  }

  /* アニメロゴの jumpIcon / 軌跡が右端からはみ出し横スクロールを起こすのを防ぐ（静的ロゴと同様） */
  .header-logo-wrap .logoStage {
    overflow: hidden;
  }

  .logoRoot.siteLogo .playIconTrail,
  .logoRoot.siteLogo .jumpIconTrail {
    display: none;
  }

  .logoRoot.siteLogo {
    --logo-width: min(400px, 86vw);
  }

  .tagline {
    font-size: clamp(0.82rem, 3.6vw, 0.9rem);
    padding: 0 6px;
    line-height: 1.5;
  }

  .static-hero h1 {
    font-size: clamp(1.45rem, 5.2vw, 2rem);
    line-height: 1.35;
  }

  .static-section h2 {
    font-size: clamp(1.05rem, 4.2vw, 1.25rem);
    line-height: 1.45;
  }

  /* 結果コメントチップ: 1行目=chip1+chip3、2行目=chip2+chip4 */
  #result-comment-chips .chip-result-comment:nth-child(1) { order: 1; }
  #result-comment-chips .chip-result-comment:nth-child(2) { order: 3; }
  #result-comment-chips .chip-result-comment:nth-child(3) { order: 2; }
  #result-comment-chips .chip-result-comment:nth-child(4) { order: 4; }

  #result-comment-chips .chip-result-comment:nth-child(1),
  #result-comment-chips .chip-result-comment:nth-child(3) {
    white-space: nowrap;
  }

  .input-card label .label-hint {
    flex: 1 1 100%;
    font-size: 0.72rem;
    line-height: 1.45;
    margin-top: 2px;
  }

  .preview-actions {
    grid-template-rows: auto auto;
    gap: 10px;
  }

  .preview-controls {
    grid-row: 1;
    justify-self: start;
  }

  .test-play-box {
    grid-row: 2;
    justify-self: stretch;
  }

  .test-play-link {
    font-size: 0.95rem;
  }

  .mode-toggle-opt {
    white-space: normal;
    font-size: clamp(0.72rem, 2.8vw, 0.9rem);
    line-height: 1.25;
    padding: 9px 6px;
  }

  .chapters-header {
    padding-top: max(48px, calc(44px + env(safe-area-inset-top)));
  }

  .list-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .list-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .site-nav {
    margin-top: 58px;
    padding: 0 4px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .content-section,
  .static-section {
    padding: 20px;
  }
}

/* ==========================================================================
   🎬 ANIMATIONS
   ========================================================================== */
@keyframes introContentIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  0% { opacity: 0; transform: translateY(-20px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes scaleIn {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

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

@keyframes popUp {
  0% { opacity: 0; transform: translate(-50%, 20px); }
  100% { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes pulseLight {
  0% { opacity: 1; }
  50% { opacity: 0.85; }
  100% { opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Utility Hidden state */
.hidden {
  display: none !important;
}

/* テーマ切替の瞬間だけトランジションを殺し、要素ごとの色変化タイミングのズレを抑える */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition: none !important;
}

/* 背景 bubble の blur アニメーションが html/body の再描画を遅らせないよう、切替中は一時停止 */
.theme-transitioning .bubble {
  animation-play-state: paused !important;
}

/* 視差効果を減らす設定のユーザーへの配慮 (A11y / WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   🎬 CHAPTERS PAGE (chapters.html)
   ========================================================================== */
/* ヘッダーはテーマ/言語トグルを絶対配置するため relative + 上余白を確保 */
.chapters-header {
  position: relative;
  padding-top: 56px;
}

.chapters-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chapters-intro {
  text-align: center;
  padding: 4px 0 2px;
}

.chapters-intro h1 {
  color: var(--secondary);
  font-size: clamp(1.6rem, 5vw, 2.3rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 10px;
}

.chapters-intro p {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 700;
  max-width: 600px;
  margin: 0 auto;
}

.chapters-sticky-scope {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.chapters-sticky-scope.hidden {
  display: none;
}

/* 映像 sticky の固定範囲（プレーヤー＋追加した場面リスト）。出力はこの外側。
   タッチ/狭幅では JS が映像をこの直下へ移し、本要素の末尾で sticky を離脱させる。 */
.chapters-pin-scope {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.player-card,
.list-card,
.output-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-card {
  overflow: visible;
}

/* 16:9 レスポンシブ埋め込みプレーヤー */
/* チャプターの動画プレビューはリンク作成モードと同じ .preview-card / .preview-title / .preview-desc を再利用 */

.chapters-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--secondary);
  background: #000;
  box-shadow: 4px 4px 0 var(--secondary); /* リンク作成の動画表示(.moment-preview)と同じポップアート影 */
}

/* タッチ/狭幅でのプレーヤー映像ピン留め（REV-041）:
   既定では映像は再生カード内に在席。スクロールで画面上端へ position:fixed でピン留めし、
   「追加した場面」リスト末尾（#chapters-pin-scope）で離脱する。出力は範囲外。
   ピン時は in-flow から外れるため spacer（同じ 16:9 寸法）でレイアウト跳ねを防ぐ。 */
.chapters-player-wrap-spacer {
  display: none;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
  pointer-events: none;
}

@media (pointer: coarse) and (hover: none), (max-width: 640px) {
  .chapters-player-wrap.is-pinned {
    position: fixed;
    z-index: 30;
    margin-bottom: 0;
    transform: translateZ(0); /* 独自レイヤーへ昇格させ iOS のスクロール追従を安定化 */
    backface-visibility: hidden;
  }

  .chapters-player-wrap-spacer.is-active {
    display: block;
  }
}

.chapters-player-wrap iframe,
.chapters-player-wrap > div {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* 0秒のときにプレーヤーの上へ被せるサムネイル（プライム再生を隠す） */
.chapters-thumb {
  z-index: 2;
  background: #000;
  pointer-events: none; /* クリックは下のプレーヤーへ通す */
}
.chapters-thumb.hidden { display: none; }
.chapters-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* seek 先がまだ未読み込みのときに出す自前のローディング表示 */
.chapters-loading {
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92); /* 裏のミュート再生を隠すためほぼ不透明 */
  pointer-events: none;
}
.chapters-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tj-spin 0.8s linear infinite;
}
@keyframes tj-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .chapters-spinner { animation-duration: 1.6s; }
}

.capture-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.capture-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.capture-now {
  font-weight: 800;
  color: var(--secondary);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.capture-now strong {
  font-family: 'Outfit', var(--font-family);
  font-size: 1.4rem;
  color: var(--primary);
  min-width: 64px;
}

.capture-bar .btn {
  flex: 1 1 auto;
}

.btn-textlink {
  background: none;
  border: none;
  color: var(--link-color);
  font-family: var(--font-family);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  align-self: flex-start;
}

.btn-textlink.danger {
  color: var(--primary);
}

.manual-add {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.manual-add .manual-time {
  flex: 0 0 96px;
  width: 96px;
  text-align: center;
}

.manual-add .manual-label {
  flex: 1 1 140px;
}

.manual-add .btn {
  flex: 0 0 auto;
  padding: 12px 18px;
  font-size: 0.95rem;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.list-head h2 {
  color: var(--secondary);
  font-size: 1.15rem;
  font-weight: 800;
}

.list-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

/* 自動再生 ON/OFF トグル（iOS風スイッチ） */
.autoplay-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--secondary);
  user-select: none;
}

.autoplay-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-visual {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--secondary-light);
  border: 2px solid var(--secondary);
  transition: background-color var(--transition-fast);
}

.switch-visual::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--secondary);
  transition: transform var(--transition-fast);
}

.autoplay-switch input:checked + .switch-visual {
  background: var(--primary);
}

.autoplay-switch input:checked + .switch-visual::before {
  transform: translateX(20px);
}

.autoplay-switch input:focus-visible + .switch-visual {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

[dir="rtl"] .autoplay-switch input:checked + .switch-visual::before {
  transform: translateX(-20px);
}

.list-time-hint {
  display: none;
  margin: 2px 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-muted);
}

@media (pointer: coarse) and (hover: none) {
  .list-time-hint {
    display: block;
  }
}

.chapters-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chapter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.chapter-handle {
  flex: 0 0 auto;
  cursor: grab;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 2px;
  user-select: none;
  touch-action: none;
}

.chapter-handle:active {
  cursor: grabbing;
}

.chapter-item.dragging {
  opacity: 0.5;
}

/* ドロップ位置インジケーター（上/下に赤いライン） */
.chapter-item.drop-before {
  box-shadow: inset 0 3px 0 0 var(--primary);
}

.chapter-item.drop-after {
  box-shadow: inset 0 -3px 0 0 var(--primary);
}

.chapter-time {
  font-family: 'Outfit', var(--font-family);
  font-weight: 800;
  color: var(--primary);
  font-size: 0.95rem;
  flex: 0 0 auto;
  min-width: 58px;
  text-align: center;
  cursor: pointer;
}

/* リスト内の時間（クリックでジャンプ＋手入力で修正できる入力欄） */
.chapter-time-cell {
  flex: 0 0 auto;
  width: 78px;
}

.chapter-item .chapter-time-btn {
  width: 100%;
  padding: 6px 4px;
  font-family: 'Outfit', var(--font-family);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--primary);
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.chapter-item .chapter-time-btn:hover {
  border-color: var(--border);
}

.chapter-item .chapter-time-btn:active {
  border-color: var(--primary);
  background: var(--surface);
}

.chapter-time-cell .chapter-time-input {
  width: 100%;
}

.chapter-time-input.is-collapsed {
  display: none;
}

.chapter-item .chapter-time-input {
  flex: 0 0 auto;
  width: 78px;
  padding: 6px 4px;
  font-family: 'Outfit', var(--font-family);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--primary);
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.chapter-item .chapter-time-input:hover {
  border-color: var(--border);
}

.chapter-item .chapter-time-input:focus {
  border-color: var(--primary);
  background: var(--surface);
  outline: none;
  box-shadow: none;
  cursor: text;
}

.chapter-item .chapter-label {
  flex: 1 1 auto;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 16px; /* iOS Safari での入力フォーカス時に画面がズームする（寄る）挙動を防ぐため 16px 以上に指定 */
  -webkit-user-select: text;
  user-select: text;
}

.chapter-label-cell {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: stretch;
  cursor: text;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.chapter-label-cell .chapter-label {
  cursor: text;
}

.chapter-del {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--secondary);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.chapter-del:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.output-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.output-block + .output-block {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 2px dashed var(--border);
}

.output-block label {
  color: var(--secondary);
}

/* チャプター用テキストの見出し行（ラベル左・記号プルダウン右） */
.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.output-head label {
  flex: 1 1 auto;
  min-width: 0;
}

/* サイト共通カスタム select（ネイティブ option は OS 描画のため自前メニュー） */
.site-select {
  position: relative;
  flex: 0 1 auto;
  min-width: 7.5rem;
  max-width: min(100%, 13rem);
}

.site-select.is-open {
  z-index: 50;
}

.site-select-trigger {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  font-family: var(--font-family);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 10px 36px 10px 14px;
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--secondary);
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  box-shadow: 2px 2px 0 var(--secondary);
  text-align: left;
}

.site-select-trigger::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -2px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--secondary);
  pointer-events: none;
  transition: border-top-color var(--transition-fast);
}

.site-select-trigger:hover,
.site-select.is-open .site-select-trigger {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--primary);
}

.site-select-trigger:hover::after,
.site-select.is-open .site-select-trigger::after {
  border-top-color: var(--primary);
}

.site-select-trigger:focus-visible {
  background-color: var(--surface);
  border-color: var(--primary);
  color: var(--text);
  box-shadow: var(--shadow-inner), 2px 2px 0 var(--primary);
}

.site-select-trigger:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--primary);
}

.site-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  min-width: 100%;
  max-height: min(240px, 40vh);
  overflow-y: auto;
  background-color: var(--surface);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  box-shadow: 4px 4px 0 var(--secondary);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-select-option {
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: left;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background-color: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.site-select-option:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.site-select-option.is-active {
  background-color: var(--primary);
  color: #FFFFFF;
}

.site-select-option.is-active:hover {
  background-color: var(--primary-hover);
  color: #FFFFFF;
}

[dir="rtl"] .site-select-option {
  text-align: right;
}

.output-block textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--background);
  border: 2px solid var(--secondary);
  border-radius: var(--radius-md);
  color: var(--text);
  resize: vertical;
  line-height: 1.7;
  outline: none;
}

.output-block textarea:focus {
  border-color: var(--primary);
}

.output-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

/* 埋め込み不可動画などの案内（タイムリンク作成・チャプター作成 共通） */
.embed-note {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: var(--primary-light);
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.6;
}

/* YouTubeチャプター条件のソフト警告（満たさない項目だけ表示・非ブロック） */
.chapter-warnings {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--primary-light);
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
}
.chapter-warnings .req-heading {
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--text);
  margin: 0 0 4px;
}
.chapter-warnings .req-note {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 8px;
  line-height: 1.5;
}
.chapter-warnings ul {
  margin: 0;
  padding-left: 1.2em;
}
.chapter-warnings li {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 精密シーク（1秒単位で位置を合わせる） */
.seek-control {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seek-readout {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-weight: 800;
  color: var(--secondary);
  font-size: 0.9rem;
}

/* ラベル・総時間は単語の途中で折り返さない（入力欄とは別の行へ送る） */
.seek-readout > span {
  white-space: nowrap;
}

/* 現在位置（手入力できる赤文字フィールド） */
.seek-readout .current-time-input {
  font-family: 'Outfit', var(--font-family);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
  width: 5.5em;
  padding: 2px 6px;
  text-align: center;
  cursor: text;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.seek-readout .current-time-input:hover {
  border-color: var(--border);
}

.seek-readout .current-time-input:focus {
  border-color: var(--primary);
  background: var(--surface);
  outline: none;
  box-shadow: none;
}

.seek-total {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.seek-slider {
  /* 再生済み（つまみより左）を黄色く塗る。--seek-fill は JS が % で更新（Chrome/Safari用） */
  --seek-fill: 0%;
  --seek-fill-color: #FFD400;
  --seek-track-color: var(--secondary-light);
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--seek-fill-color) var(--seek-fill), var(--seek-track-color) var(--seek-fill));
  border: 2px solid var(--secondary);
  outline: none;
  cursor: pointer;
}

/* Firefox は進捗を自動で塗れる */
.seek-slider::-moz-range-progress {
  background: var(--seek-fill-color);
  height: 100%;
  border-radius: 999px;
}

.seek-slider::-moz-range-track {
  background: var(--seek-track-color);
  height: 100%;
  border-radius: 999px;
}

[dir="rtl"] .seek-slider {
  background: linear-gradient(to left, var(--seek-fill-color) var(--seek-fill), var(--seek-track-color) var(--seek-fill));
}

.seek-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--secondary);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--secondary);
}

.seek-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--secondary);
  cursor: pointer;
}

.seek-nudge {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.chip-seek {
  font-family: 'Outfit', var(--font-family);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--secondary);
  background: var(--surface);
  color: var(--secondary);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--secondary);
  transition: all var(--transition-fast);
  flex: 1 1 auto;
  min-width: 64px;
}

.chip-seek:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.chip-seek:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

/* 再生/一時停止ボタン（現在位置の左） */
.btn-playpause {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--secondary);
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0 var(--secondary);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  padding: 0;
}

.btn-playpause:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--secondary);
}

.btn-playpause:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--secondary);
}

/* キーボードショートカット説明（キーボードのある環境＝デスクトップのみ表示） */
.shortcut-hint {
  display: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

@media (hover: hover) and (pointer: fine) {
  .shortcut-hint {
    display: block;
  }
}

/* ==========================================================================
   🔀 TOOL MODE TOGGLE（リンク作成 ⇄ チャプター作成 / スライド式スイッチ）
   ========================================================================== */
.mode-toggle-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 0 auto 22px;
}

.mode-toggle {
  position: relative;
  display: flex;
  width: 100%;
  background: var(--surface);
  border: 3px solid var(--secondary);
  border-radius: 999px;
  padding: 5px;
  box-shadow: 4px 4px 0 var(--secondary);
}

/* スライドするノブ（アクティブ側に動く） */
.mode-toggle-thumb {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc(50% - 5px);
  background: var(--primary-gradient);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--secondary);
  transition: transform var(--transition-normal);
  z-index: 0;
}

.mode-toggle[data-mode="chapters"] .mode-toggle-thumb {
  transform: translateX(100%);
}

.mode-toggle-opt {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  text-align: center;
  padding: 11px 14px;
  border: none;
  background: transparent;
  border-radius: 999px;
  font-family: var(--font-family);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.mode-toggle-opt.is-active {
  color: var(--text-light);
}

.mode-toggle-opt:not(.is-active):hover {
  color: var(--primary);
}

/* RTL（アラビア語）ではノブの移動方向を反転 */
[dir="rtl"] .mode-toggle[data-mode="chapters"] .mode-toggle-thumb {
  transform: translateX(-100%);
}

/* 「時間を手入力して追加」を可愛いピル型に */
.manual-toggle-btn {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-family);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--primary);
  background: var(--primary-light);
  border: 2px dashed var(--primary);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}

.manual-toggle-btn:hover {
  background: var(--primary);
  color: #fff;
  border-style: solid;
  transform: translateY(-1px);
}

.manual-toggle-btn:active {
  transform: translateY(0);
}

/* モード切替時のふわっとフェードイン */
@keyframes modeFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* モードのラッパー内でもカード間に余白を持たせる（.app-main と同じ gap）。
   これが無いとカードが密着し、6px のフラットシャドウが次のカードに被って見える。 */
#mode-single,
#mode-chapters {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#mode-single:not(.hidden),
#mode-chapters:not(.hidden) {
  animation: modeFadeIn 0.28s ease;
}

@media (max-width: 640px) {
  .output-block textarea {
    font-size: 16px; /* iOS Safari の入力フォーカス時の画面ズーム（寄る挙動）を防ぐ */
  }
}
