/* styles-thinking.css — 質問間の「考えている」演出（20秒タイムライン） */

.tk-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 50%,
    color-mix(in oklch, var(--bg-0) 70%, transparent) 0%,
    color-mix(in oklch, var(--bg-0) 30%, transparent) 60%,
    transparent 100%);
  backdrop-filter: blur(2px);
  animation: tkFade 20s ease-out forwards;
}
@keyframes tkFade {
  0% { opacity: 0; backdrop-filter: blur(0); }
  3% { opacity: 1; backdrop-filter: blur(8px); }
  96% { opacity: 1; backdrop-filter: blur(8px); }
  100% { opacity: 0; backdrop-filter: blur(0); }
}

/* === 液体メタルのストリーム（ループ） === */
.tk-stream {
  position: absolute;
  width: 200vw;
  height: 30vh;
  top: 50%;
  left: 50%;
  transform-origin: center;
  background: linear-gradient(90deg,
    transparent 0%,
    color-mix(in oklch, var(--accent-a) 40%, transparent) 30%,
    color-mix(in oklch, var(--accent-b) 50%, transparent) 50%,
    color-mix(in oklch, var(--accent-c) 40%, transparent) 70%,
    transparent 100%);
  filter: blur(40px);
  opacity: 0;
  mix-blend-mode: screen;
}
.theme-porcelain .tk-stream { mix-blend-mode: multiply; }
.tk-stream-1 { --rot: -8deg; }
.tk-stream-2 { --rot: 4deg; height: 18vh; }
.tk-stream-3 { --rot: -15deg; height: 12vh; }

/* Aから来るとき左→右にループ、Bから来るとき右→左にループ */
.tk-from-a .tk-stream {
  animation: tkStreamLoopL 6s linear infinite;
}
.tk-from-b .tk-stream {
  animation: tkStreamLoopR 6s linear infinite;
}
.tk-from-a .tk-stream-2,
.tk-from-b .tk-stream-2 { animation-duration: 7.5s; animation-delay: -2s; }
.tk-from-a .tk-stream-3,
.tk-from-b .tk-stream-3 { animation-duration: 9s; animation-delay: -4s; }

@keyframes tkStreamLoopL {
  0%   { opacity: 0; transform: translate(-150%, -50%) rotate(var(--rot)) scaleX(0.6); }
  20%  { opacity: 0.7; }
  60%  { opacity: 0.7; transform: translate(-50%, -50%) rotate(var(--rot)) scaleX(1); }
  100% { opacity: 0; transform: translate(50%, -50%) rotate(var(--rot)) scaleX(1.4); }
}
@keyframes tkStreamLoopR {
  0%   { opacity: 0; transform: translate(50%, -50%) rotate(var(--rot)) scaleX(0.6); }
  20%  { opacity: 0.7; }
  60%  { opacity: 0.7; transform: translate(-50%, -50%) rotate(var(--rot)) scaleX(1); }
  100% { opacity: 0; transform: translate(-150%, -50%) rotate(var(--rot)) scaleX(1.4); }
}

/* === 中央の核 === */
.tk-core {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  opacity: 0;
  animation: tkCoreIn 20s ease-out forwards;
}
@keyframes tkCoreIn {
  0%   { opacity: 0; transform: scale(0.6); filter: blur(20px); }
  4%   { opacity: 1; transform: scale(1); filter: blur(0); }
  96%  { opacity: 1; transform: scale(1); filter: blur(0); }
  100% { opacity: 0; transform: scale(1.3); filter: blur(12px); }
}

.tk-core-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 0.5px solid transparent;
  border-top-color: var(--accent-a);
  border-right-color: var(--accent-b);
  animation: tkSpin 4s linear infinite;
}
.tk-core-ring-1 { inset: 8px; }
.tk-core-ring-2 {
  inset: 0;
  border-top-color: var(--accent-c);
  border-left-color: var(--accent-a);
  animation-duration: 5.5s;
  animation-direction: reverse;
}
.tk-core-ring-3 {
  inset: -10px;
  border-top-color: var(--accent-b);
  border-bottom-color: var(--accent-c);
  animation-duration: 7s;
  opacity: 0.5;
}
@keyframes tkSpin { to { transform: rotate(360deg); } }

.tk-core-pulse {
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: var(--metal-grad);
  background-size: 200% 200%;
  filter: blur(8px);
  animation: tkPulseLoop 3s ease-in-out infinite, tkShimmer 5s linear infinite;
  box-shadow: 0 0 40px var(--accent-a), 0 0 80px var(--accent-b);
}
@keyframes tkPulseLoop {
  0%, 100% { transform: scale(0.95); opacity: 0.85; }
  50%      { transform: scale(1.15); opacity: 1; }
}
@keyframes tkShimmer { to { background-position: 200% 0; } }

/* === 粒子（ループ回転） === */
.tk-particle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-a);
  box-shadow: 0 0 10px currentColor;
  top: 50%;
  left: 50%;
  transform-origin: 0 0;
  opacity: 0;
  animation: tkParticleLoop 5s linear infinite var(--delay);
}
@keyframes tkParticleLoop {
  0%   { opacity: 0; transform: translate(-50%, -50%) rotate(var(--angle)) translateX(40px) scale(0.5); }
  20%  { opacity: 1; transform: translate(-50%, -50%) rotate(calc(var(--angle) + 80deg)) translateX(80px) scale(1); }
  50%  { opacity: 0.9; transform: translate(-50%, -50%) rotate(calc(var(--angle) + 200deg)) translateX(72px) scale(1.1); }
  80%  { opacity: 0.6; transform: translate(-50%, -50%) rotate(calc(var(--angle) + 320deg)) translateX(60px) scale(0.9); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(calc(var(--angle) + 360deg)) translateX(40px) scale(0.5); }
}

/* === メッセージ === */
.tk-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--ink-90);
  text-transform: uppercase;
  opacity: 0;
  animation: tkMsgWrap 20s ease-out forwards;
}
@keyframes tkMsgWrap {
  0%   { opacity: 0; transform: translateY(10px); }
  4%   { opacity: 1; transform: translateY(0); }
  96%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-6px); }
}
.tk-msg-bar {
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-a));
}
.tk-msg-text {
  background: var(--metal-grad);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  background-size: 200% 200%;
  animation: tkShimmer 5s linear infinite, tkTextSwap 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: inline-block;
}
@keyframes tkTextSwap {
  0%   { opacity: 0; transform: translateY(8px); filter: blur(6px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.tk-msg-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 2px;
}
.tk-msg-dots i {
  width: 3px;
  height: 3px;
  background: var(--accent-a);
  border-radius: 50%;
  animation: tkDot 1.4s ease-in-out infinite;
}
.tk-msg-dots i:nth-child(2) { animation-delay: 0.2s; }
.tk-msg-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes tkDot {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50%      { opacity: 1; transform: translateY(-2px); }
}

/* === メッセージ進行ステップ（点） === */
.tk-steps {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  opacity: 0;
  animation: tkMsgWrap 20s ease-out forwards;
}
.tk-step {
  width: 22px;
  height: 1px;
  background: var(--ink-30);
  border-radius: 1px;
  transition: background 0.4s ease, height 0.4s ease;
}
.tk-step.is-done {
  background: color-mix(in oklch, var(--accent-a) 70%, transparent);
}
.tk-step.is-active {
  background: var(--accent-a);
  box-shadow: 0 0 8px var(--accent-a);
}

/* === 取得タグチップ === */
.tk-tag {
  position: absolute;
  bottom: 22%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 0.5px solid var(--line);
  border-radius: 100px;
  background: var(--glass-strong);
  backdrop-filter: blur(20px);
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--ink-70);
  text-transform: uppercase;
  opacity: 0;
  animation: tkTagIn 20s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes tkTagIn {
  0%   { opacity: 0; transform: translateY(20px) scale(0.9); }
  6%   { opacity: 1; transform: translateY(0) scale(1); }
  94%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-10px) scale(1.05); }
}
.tk-tag-plus {
  color: var(--accent-a);
  font-size: 11px;
  font-weight: 600;
}

/* === 全体プログレスバー === */
.tk-progress {
  position: absolute;
  bottom: 12%;
  width: min(280px, 60vw);
  height: 1px;
  background: var(--line);
  overflow: hidden;
  opacity: 0;
  animation: tkMsgWrap 20s ease-out forwards;
}
.tk-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--metal-grad);
  background-size: 200% 100%;
  animation: tkProgress 20s linear forwards, tkShimmer 4s linear infinite;
  box-shadow: 0 0 10px var(--accent-a);
}
@keyframes tkProgress {
  to { width: 100%; }
}

/* === 最後の閃光フラッシュ === */
.tk-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 50%,
    color-mix(in oklch, var(--accent-a) 30%, transparent),
    transparent 70%);
  opacity: 0;
  animation: tkFlash 20s ease-out forwards;
  mix-blend-mode: screen;
}
.theme-porcelain .tk-flash { mix-blend-mode: multiply; }
@keyframes tkFlash {
  0%, 96% { opacity: 0; }
  98%     { opacity: 1; }
  100%    { opacity: 0; }
}

/* === スマホ縦長 === */
@media (max-width: 640px) {
  .tk-core {
    width: 110px;
    height: 110px;
    margin-bottom: 22px;
  }
  @keyframes tkParticleLoop {
    0%   { opacity: 0; transform: translate(-50%, -50%) rotate(var(--angle)) translateX(32px) scale(0.5); }
    20%  { opacity: 1; transform: translate(-50%, -50%) rotate(calc(var(--angle) + 80deg)) translateX(64px) scale(1); }
    50%  { opacity: 0.9; transform: translate(-50%, -50%) rotate(calc(var(--angle) + 200deg)) translateX(58px) scale(1.1); }
    80%  { opacity: 0.6; transform: translate(-50%, -50%) rotate(calc(var(--angle) + 320deg)) translateX(48px) scale(0.9); }
    100% { opacity: 0; transform: translate(-50%, -50%) rotate(calc(var(--angle) + 360deg)) translateX(32px) scale(0.5); }
  }
  .tk-msg { font-size: 10.5px; }
  .tk-tag { bottom: 26%; font-size: 9px; }
  .tk-progress { bottom: 14%; }
}
