/* ====================================================================
   タイピング練習（ローマ字直接入力）exp001 CSS
   設置先: FTPで外部ファイルとして配置
==================================================================== */

#tpp-container {
  max-width: 760px;
  margin: 2rem auto;
  background: #f8fafc;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 0 0 1px #e2e8f0, 0 20px 60px rgba(15,23,42,0.12);
  font-family: 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
}
#tpp-container::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #0ea5e9, #6366f1, #0ea5e9);
  background-size: 200% 100%;
  animation: tpp-shimmer 3s linear infinite;
}
@keyframes tpp-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

#tpp-status-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0.75rem 1.5rem !important;
  background: #0f172a !important;
  color: #94a3b8 !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
}
#tpp-status-bar span { display: flex !important; align-items: center !important; gap: 0.4rem !important; }
#tpp-status-dot {
  width: 7px !important; height: 7px !important; border-radius: 50% !important;
  background: #22c55e !important; box-shadow: 0 0 6px #22c55e !important;
  animation: tpp-pulse 2s ease-in-out infinite !important;
}
@keyframes tpp-pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ---- コース選択 ---------------------------------------------------- */
#tpp-course-bar { padding: 1rem 1.5rem 0 !important; text-align: center !important; }
#tpp-course {
  display: inline-flex !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #fff !important;
}
#tpp-course button {
  border: none !important;
  background: #fff !important;
  color: #64748b !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  padding: 0.6rem 1.2rem !important;
  cursor: pointer !important;
  line-height: 1 !important;
}
#tpp-course button + button { border-left: 1px solid #e2e8f0 !important; }
#tpp-course button.active {
  background: linear-gradient(135deg, #0ea5e9, #6366f1) !important;
  color: #fff !important;
}
#tpp-course-desc { font-size: 0.8rem !important; color: #94a3b8 !important; margin: 0.6rem 0 0 !important; }

/* ---- ステータス行 --------------------------------------------------- */
#tpp-stats {
  display: flex !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  flex-wrap: wrap !important;
  padding: 0.8rem 1.5rem 0.4rem !important;
}
.tpp-chip {
  display: inline-flex !important;
  align-items: baseline !important;
  gap: 0.35rem !important;
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 99px !important;
  padding: 0.3rem 0.9rem !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  color: #94a3b8 !important;
  font-variant-numeric: tabular-nums !important;
}
.tpp-chip b { color: #0f172a !important; font-size: 0.95rem !important; }
.tpp-chip.kpm b { color: #4f46e5 !important; }
.tpp-chip.acc b { color: #16a34a !important; }

/* ---- ステージ（出題エリア） ------------------------------------------ */
#tpp-stage {
  position: relative !important;
  margin: 0.6rem 1.5rem 1rem !important;
  background: #fff !important;
  border: 2px solid #e2e8f0 !important;
  border-radius: 14px !important;
  padding: 1.4rem 1rem 1.2rem !important;
  text-align: center !important;
  outline: none !important;
}
#tpp-progress {
  position: absolute !important;
  top: 0.6rem !important; right: 0.9rem !important;
  font-size: 0.74rem !important; font-weight: 700 !important; color: #94a3b8 !important;
  font-variant-numeric: tabular-nums !important;
}
#tpp-disp {
  font-size: 2rem !important;
  font-weight: 800 !important;
  color: #0ea5e9 !important;
  line-height: 1.4 !important;
  margin: 0 0 0.3rem !important;
  min-height: 2.8rem !important;
}
#tpp-disp.shake { animation: tpp-shake 0.22s linear !important; color: #e11d48 !important; }
@keyframes tpp-shake { 25%{transform:translateX(4px)} 50%{transform:translateX(-4px)} 75%{transform:translateX(2px)} }
#tpp-kana { font-size: 1rem !important; color: #64748b !important; margin: 0 0 0.5rem !important; }
#tpp-romaji {
  font-family: 'Consolas', 'Courier New', monospace !important;
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.12em !important;
  color: #0f172a !important;
  margin: 0 !important;
  min-height: 1.8rem !important;
}
#tpp-romaji .done { color: #c7d2fe !important; }

/* スタートオーバーレイ */
#tpp-start-overlay {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(255,255,255,0.92) !important;
  border-radius: 12px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.8rem !important;
  z-index: 3 !important;
}
#tpp-start-overlay.hidden { display: none !important; }
#tpp-start-overlay p { font-size: 0.85rem !important; color: #64748b !important; margin: 0 !important; }
#tpp-start {
  display: inline-flex !important;
  padding: 0.75rem 2.2rem !important;
  border: none !important;
  border-radius: 10px !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(14,165,233,0.35) !important;
  line-height: 1 !important;
}

/* IME警告 */
#tpp-ime-warn {
  margin: 0 1.5rem 0.8rem !important;
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  border-radius: 10px !important;
  color: #b91c1c !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  text-align: center !important;
  padding: 0.6rem !important;
}
#tpp-touch-warn {
  margin: 0 1.5rem 0.8rem !important;
  background: #fffbeb !important;
  border: 1px solid #fde68a !important;
  border-radius: 10px !important;
  color: #92400e !important;
  font-size: 0.8rem !important;
  text-align: center !important;
  padding: 0.6rem !important;
}

/* ---- キーボード ------------------------------------------------------ */
#tpp-keyboard {
  padding: 0 1.5rem 0.4rem !important;
  user-select: none !important;
}
.tpp-krow {
  display: flex !important;
  justify-content: center !important;
  gap: 4px !important;
  margin-bottom: 4px !important;
}
.tpp-key {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 38px !important;
  height: 38px !important;
  background: #fff !important;
  border: 1px solid #cbd5e1 !important;
  border-bottom-width: 3px !important;
  border-radius: 7px !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  color: #64748b !important;
  transition: all 0.1s !important;
}
.tpp-key.home { box-shadow: inset 0 -3px 0 #e2e8f0 !important; }
.tpp-key.next {
  background: linear-gradient(135deg, #0ea5e9, #6366f1) !important;
  border-color: #4f46e5 !important;
  color: #fff !important;
  transform: scale(1.12) !important;
  box-shadow: 0 4px 12px rgba(99,102,241,0.45) !important;
}
.tpp-key.miss {
  background: #fee2e2 !important;
  border-color: #f87171 !important;
  color: #b91c1c !important;
}

/* ---- 指ガイド --------------------------------------------------------- */
#tpp-finger-area { text-align: center !important; padding: 0 1.5rem 1.3rem !important; }
#tpp-fingers {
  display: flex !important;
  justify-content: center !important;
  align-items: flex-end !important;
  gap: 6px !important;
  margin-bottom: 0.4rem !important;
}
.tpp-finger {
  width: 26px !important;
  border-radius: 13px 13px 6px 6px !important;
  background: #e2e8f0 !important;
  transition: all 0.12s !important;
}
.tpp-finger[data-f="0"], .tpp-finger[data-f="7"] { height: 30px !important; }
.tpp-finger[data-f="1"], .tpp-finger[data-f="6"] { height: 40px !important; }
.tpp-finger[data-f="2"], .tpp-finger[data-f="5"] { height: 46px !important; }
.tpp-finger[data-f="3"], .tpp-finger[data-f="4"] { height: 42px !important; }
.tpp-finger.active {
  background: linear-gradient(180deg, #0ea5e9, #6366f1) !important;
  box-shadow: 0 4px 10px rgba(99,102,241,0.4) !important;
}
.tpp-finger-gap { width: 34px !important; }
#tpp-finger-label {
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  color: #4f46e5 !important;
  min-height: 1.2rem !important;
  margin: 0 !important;
}

/* ---- 結果・ベスト ------------------------------------------------------ */
#tpp-result {
  margin: 0 1.5rem 1.25rem !important;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff) !important;
  border: 2px solid #c7d2fe !important;
  border-radius: 14px !important;
  padding: 1.3rem !important;
  text-align: center !important;
}
#tpp-r-badge {
  display: inline-block !important;
  background: linear-gradient(90deg, #f59e0b, #f97316) !important;
  color: #fff !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.16em !important;
  border-radius: 99px !important;
  padding: 0.3rem 1rem !important;
  margin-bottom: 0.6rem !important;
}
.tpp-result-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.5rem !important;
  margin-bottom: 1rem !important;
}
.tpp-stat {
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 0.65rem 0.3rem !important;
}
.tpp-stat .lbl { display: block !important; font-size: 0.68rem !important; font-weight: 700 !important; color: #94a3b8 !important; }
.tpp-stat .val { display: block !important; font-size: 1.3rem !important; font-weight: 800 !important; color: #0f172a !important; font-variant-numeric: tabular-nums !important; }
.tpp-stat.kpm .val { color: #4f46e5 !important; }
.tpp-result-btns { display: flex !important; justify-content: center !important; gap: 0.5rem !important; flex-wrap: wrap !important; }
.tpp-btn-primary {
  padding: 0.65rem 1.4rem !important; border-radius: 9px !important;
  font-size: 0.9rem !important; font-weight: 700 !important;
  background: linear-gradient(135deg, #0ea5e9, #6366f1) !important;
  color: #fff !important; border: none !important; cursor: pointer !important;
}
.tpp-btn-dark {
  padding: 0.65rem 1.4rem !important; border-radius: 9px !important;
  font-size: 0.9rem !important; font-weight: 700 !important;
  background: #0f172a !important; color: #fff !important;
  border: none !important; cursor: pointer !important;
}
#tpp-best-bar {
  border-top: 1px solid #f1f5f9 !important;
  background: #fff !important;
  padding: 0.8rem 1.5rem !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 0.4rem !important;
  font-size: 0.82rem !important;
  color: #64748b !important;
}
#tpp-best-bar b { color: #4f46e5 !important; }
#tpp-clear {
  background: none !important; border: none !important; cursor: pointer !important;
  color: #94a3b8 !important; font-size: 0.74rem !important; text-decoration: underline !important;
}

/* ---- 汎用セクション ----------------------------------------------------- */
.tpp-section .container {
  background: #fff !important;
  border-radius: 16px !important;
  padding: 1.75rem !important;
  box-shadow: 0 2px 12px rgba(15,23,42,0.06) !important;
  border: 1px solid #f1f5f9 !important;
  margin-bottom: 1rem !important;
}
.tpp-section-header {
  display: flex !important;
  align-items: center !important;
  margin-bottom: 1.25rem !important;
  padding-bottom: 0.75rem !important;
  border-bottom: 2px solid #f1f5f9 !important;
}
.tpp-section .section-title {
  font-size: 1.1rem !important;
  font-weight: 800 !important;
  margin: 0 !important;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tpp-steps { list-style: none !important; padding: 0 !important; margin: 0 !important; display: flex !important; flex-direction: column !important; gap: 0.75rem !important; }
.tpp-steps li { display: flex !important; align-items: flex-start !important; gap: 0.75rem !important; padding: 0.75rem 1rem !important; background: #f8fafc !important; border-radius: 10px !important; font-size: 0.92rem !important; color: #334155 !important; border: 1px solid #f1f5f9 !important; line-height: 1.6 !important; margin: 0 !important; }
.tpp-steps li::before { display: none !important; }
.tpp-step-num { display: inline-flex !important; align-items: center !important; justify-content: center !important; min-width: 26px !important; height: 26px !important; border-radius: 50% !important; background: linear-gradient(135deg, #0ea5e9, #6366f1) !important; color: #fff !important; font-size: 0.78rem !important; font-weight: 800 !important; flex-shrink: 0 !important; margin-top: 1px !important; }
.tpp-notice {
  background: #fffbeb !important;
  border: 1px solid #fde68a !important;
  border-radius: 10px !important;
  font-size: 0.82rem !important;
  color: #92400e !important;
  padding: 0.8rem 1rem !important;
  line-height: 1.7 !important;
  margin: 1rem 0 0 !important;
}
.tpp-hero-badge { display: inline-flex !important; align-items: center !important; background: linear-gradient(135deg, #0ea5e9, #6366f1) !important; color: #fff !important; font-size: 0.72rem !important; font-weight: 800 !important; letter-spacing: 0.12em !important; padding: 0.3rem 0.9rem !important; border-radius: 99px !important; margin-bottom: 0.75rem !important; }
.tpp-beta-badge { display: inline-flex !important; background: #f59e0b !important; color: #fff !important; font-size: 0.68rem !important; font-weight: 800 !important; letter-spacing: 0.1em !important; padding: 0.2rem 0.7rem !important; border-radius: 99px !important; margin-left: 0.5rem !important; vertical-align: middle !important; }

@media (max-width: 640px) {
  .tpp-key { width: 26px !important; height: 30px !important; font-size: 0.68rem !important; }
  #tpp-disp { font-size: 1.5rem !important; }
  #tpp-romaji { font-size: 1.05rem !important; }
  .tpp-result-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (prefers-reduced-motion: reduce) {
  #tpp-container::before { animation: none !important; }
  #tpp-status-dot { animation: none !important; }
  #tpp-disp.shake { animation: none !important; }
}

/* ---- 5分セッションバー（v2追加） ---------------------------------- */
#tpp-session-bar {
  display: flex !important;
  align-items: center !important;
  gap: 0.7rem !important;
  padding: 0.8rem 1.5rem 0 !important;
}
.tpp-sb-label {
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  color: #94a3b8 !important;
  letter-spacing: 0.08em !important;
  flex-shrink: 0 !important;
}
#tpp-time-bar-bg {
  flex: 1 !important;
  height: 10px !important;
  background: #e2e8f0 !important;
  border-radius: 99px !important;
  overflow: hidden !important;
}
#tpp-time-bar {
  height: 100% !important;
  width: 100% !important;
  background: linear-gradient(90deg, #22c55e, #4ade80) !important;
  border-radius: 99px !important;
  transition: width 0.2s linear, background 0.4s !important;
}
#tpp-time-bar.warn { background: linear-gradient(90deg, #f97316, #ef4444) !important; }
#tpp-time-left {
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  font-variant-numeric: tabular-nums !important;
  min-width: 3.2rem !important;
  text-align: right !important;
  flex-shrink: 0 !important;
}
#tpp-quit {
  flex-shrink: 0 !important;
  background: #fff7ed !important;
  border: 1px solid #fdba74 !important;
  border-radius: 99px !important;
  color: #c2410c !important;
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  padding: 0.4rem 0.9rem !important;
  cursor: pointer !important;
  line-height: 1 !important;
}
#tpp-quit:hover { background: #ffedd5 !important; }

/* ---- カウントダウンオーバーレイ（v2追加） --------------------------- */
#tpp-countdown {
  position: absolute !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(255,255,255,0.88) !important;
  border-radius: 12px !important;
  z-index: 4 !important;
  font-size: 4rem !important;
  font-weight: 800 !important;
  background-image: none !important;
  color: #4f46e5 !important;
}
#tpp-countdown.hidden { display: none !important; }

/* ---- かな・ローマ字の進捗表示（v2追加） ----------------------------- */
#tpp-kana .done { color: #c7d2fe !important; }
#tpp-romaji .cur {
  color: #fff !important;
  background: linear-gradient(135deg, #0ea5e9, #6366f1) !important;
  border-radius: 4px !important;
  padding: 0 2px !important;
}
.tpp-chip.done b { color: #d97706 !important; }

/* ---- 結果5列グリッド・メッセージ（v2追加） --------------------------- */
.tpp-result-grid.five { grid-template-columns: repeat(5, 1fr) !important; }
#tpp-r-msg {
  font-size: 0.88rem !important;
  color: #4f46e5 !important;
  font-weight: 700 !important;
  margin: 0 0 1rem !important;
}
@media (max-width: 640px) {
  .tpp-result-grid.five { grid-template-columns: repeat(2, 1fr) !important; }
  #tpp-session-bar { flex-wrap: wrap !important; }
}
