/* be_okay.css */

/* --- Hero Section & Mind Tuning --- */
.chapter-hero {
  margin-bottom: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  padding: 4rem 2rem;
  border-radius: 20px;
}

.be-okay-hero-icon-wrap {
  font-size: 3.5rem;
  color: #475569;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
  animation: float-hero 6s ease-in-out infinite;
}

@keyframes float-hero {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

header.chapter-hero.genki-frame.mind-tuning-target {
  background-color: #94a3b8 !important;
  color: #1e293b !important;
  border: 4px solid #fcd34d; /* Add the golden border seen in the image */
  transition: all 0.8s ease;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

@keyframes aura-pulse {
  0% { box-shadow: 0 0 20px rgba(234, 179, 8, 0.4), inset 0 0 20px rgba(255, 255, 255, 0.2); }
  50% { box-shadow: 0 0 40px rgba(234, 179, 8, 0.7), inset 0 0 30px rgba(255, 255, 255, 0.4); }
  100% { box-shadow: 0 0 20px rgba(234, 179, 8, 0.4), inset 0 0 20px rgba(255, 255, 255, 0.2); }
}

header.chapter-hero.genki-frame.mind-tuning-target.tuned {
  background: linear-gradient(135deg, #fef08a 0%, #facc15 50%, #eab308 100%) !important;
  background-size: 200% 200% !important;
  animation: gradient-flow 3s ease infinite, aura-pulse 3s ease-in-out infinite;
  border: 4px solid #fbbf24;
}

@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

header.chapter-hero.genki-frame.mind-tuning-target.tuned h1 {
  background: linear-gradient(to right, #78350f, #92400e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent !important;
}

header.chapter-hero.genki-frame.mind-tuning-target.tuned p {
  color: #92400e !important;
  font-weight: bold;
}

/* --- Tuning Switch --- */
.tuning-switch-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  transition: all 0.5s;
}

.chapter-hero.mind-tuning-target.tuned .tuning-switch-container {
  background: rgba(255, 255, 255, 0.6);
  border-color: #fcd34d;
}

.tuning-label {
  font-weight: bold;
  color: #64748b;
  font-size: 0.9rem;
  transition: opacity 0.5s ease;
}

.tuning-label:last-child { opacity: 0; }
.mind-tuning-target.tuned .tuning-label:first-child { opacity: 0; }
.mind-tuning-target.tuned .tuning-label:last-child { opacity: 1; }

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px; width: 26px;
  left: 4px; bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider { background-color: #f59e0b; }
input:checked + .slider:before { transform: translateX(26px); }

/* --- Content Blocks --- */
.content-section {
  background: white;
  padding: 2.5rem;
  border-radius: 20px;
  margin-bottom: 2rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
  border: 1px solid #f1f5f9;
}

.content-section h2 {
  font-size: 1.5rem;
  color: #d97706;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px dashed #fcd34d;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.content-section h2 i {
  background: #fffbeb;
  padding: 0.5rem;
  border-radius: 10px;
  color: #d97706;
}

.highlight-box {
  background: #fffbeb;
  border-left: 5px solid #f59e0b;
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 0 10px 10px 0;
}

.highlight-box.highlight-gray {
  border-color: #64748b;
  background: #f8fafc;
}

.highlight-box p {
  margin-bottom: 0;
  font-weight: 700;
  color: #92400e;
  font-size: 1.1rem;
}

.highlight-box.highlight-gray p { color: #475569; }

/* --- Reframing Story --- */
.reframing-story-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: #f8fafc;
  border-radius: 15px;
  border: 1px dashed #cbd5e1;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.3s;
}

.reframing-story-container:not(.is-playing) .story-scene,
.reframing-story-container:not(.is-playing) .story-arrow {
  filter: blur(8px);
  opacity: 0.3;
  transition: all 1s ease;
}

/* Glass Enhancement */
.reframing-story-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem 0;
  padding: 2rem;
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  border: 1px solid rgba(203, 213, 225, 0.5);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.reframing-story-container:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
}

.reframing-story-container::after {
  content: "\f144";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 5rem;
  color: #fbbf24; /* Golden Play Button */
  opacity: 1;
  transition: all 0.5s;
  background: white;
  width: 80px; height: 80px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  z-index: 10;
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.4);
}

.reframing-story-container.is-playing::after { 
  opacity: 0; 
  transform: translate(-50%, -50%) scale(2);
}

.story-scene { text-align: center; position: relative; width: 160px; }
.scene-wrapper { position: relative; height: 70px; display: flex; justify-content: center; align-items: center; }
.scene-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.reframing-story-container.is-playing .animate-trip i {
  animation: collapseBoldly 1.5s ease-in-out forwards;
}

@keyframes collapseBoldly {
  0% { transform: rotate(0deg) translateY(0); }
  20% { transform: rotate(-15deg) translateY(-5px); }
  40% { transform: rotate(10deg) translateY(-10px); }
  100% { transform: rotate(110deg) translateY(15px) scale(0.9); color: #475569; }
}

.bad-mood { color: #475569; display: block; font-size: 0.8rem; opacity: 0; }
.reframing-story-container.is-playing .bad-mood { animation: fadeInText 0.5s ease-out forwards; animation-delay: 1.5s; }

.reframing-story-container.is-playing .story-scene.scene-good {
  opacity: 0;
  animation: fadeInScene 0.5s ease-out forwards;
  animation-delay: 4.5s;
}

@keyframes fadeInScene { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInText { to { opacity: 1; } }

.reframing-story-container.is-playing .scene-good .scene-icon.safe-person {
  animation: blownAway 4s ease-in-out forwards;
  animation-delay: 4.5s;
  color: #f59e0b;
}

.car-layer { position: absolute; top: 10px; left: 0; width: 100%; height: 100%; pointer-events: none; }
.speeding-car { position: absolute; color: #ef4444; font-size: 2rem; top: 0; left: 100%; opacity: 0; }

.reframing-story-container.is-playing .speeding-car {
  animation: driveBySlow 4s linear forwards;
  animation-delay: 4.5s;
}

@keyframes driveBySlow {
  0% { left: 120%; transform: scaleX(-1); opacity: 1; }
  30% { left: 50%; transform: scaleX(-1); opacity: 1; }
  35% { left: 45%; transform: scaleX(-1); opacity: 1; }
  90% { left: 45%; transform: scaleX(-1); opacity: 1; }
  100% { left: 45%; transform: scaleX(-1); opacity: 0; }
}

@keyframes blownAway {
  0%, 29% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  30% { transform: translate(-5px, -5px) rotate(-10deg); opacity: 1; }
  32% { transform: translate(-10px, -10px) rotate(-45deg); opacity: 1; }
  100% { transform: translate(-200px, -150px) rotate(-720deg); opacity: 0; }
}

.hidden-danger {
  position: absolute; top: -25px; right: -25px;
  background: #ef4444; color: white;
  padding: 4px 10px; border-radius: 20px;
  opacity: 0; transform: scale(0);
}

.reframing-story-container.is-playing .hidden-danger {
  animation: revealFlash 4s linear forwards;
}

@keyframes revealFlash {
  0%, 29% { opacity: 0; transform: scale(0); }
  30% { opacity: 1; transform: scale(1.5) rotate(-10deg); }
  35% { opacity: 1; transform: scale(1) rotate(0deg); }
  80% { opacity: 1; transform: scale(1); }
  90%, 100% { opacity: 0; transform: scale(0); }
}

/* --- Wavelength Resonator --- */
.wavelength-resonator {
  background: #f8fafc;
  border-radius: 20px;
  padding: 2rem;
  margin: 3rem 0;
  border: 1px solid #e2e8f0;
  transition: all 0.5s ease;
  position: relative;
  overflow: hidden;
}

.wavelength-resonator.is-negative { background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%); border-color: #94a3b8; }
.wavelength-resonator.is-neutral { background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); border-color: #6ee7b7; }
.wavelength-resonator.is-positive { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: #fcd34d; }

.resonance-chamber {
  position: relative;
  height: 250px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.center-emitter {
  position: relative;
  width: 60px; height: 60px;
  background: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  z-index: 10;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.wavelength-resonator.is-negative .center-emitter { color: #64748b; }
.wavelength-resonator.is-neutral .center-emitter { color: #10b981; }
.wavelength-resonator.is-positive .center-emitter { color: #f59e0b; }

.pulse-ring {
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  border-radius: 50%; border: 2px solid currentColor;
  opacity: 0; width: 100%; height: 100%;
}

.wavelength-resonator.is-negative .pulse-ring { animation: pulseEmissions 3s infinite; color: #94a3b8; }
.wavelength-resonator.is-neutral .pulse-ring { animation: pulseEmissions 2s infinite; color: #6ee7b7; }
.wavelength-resonator.is-positive .pulse-ring { animation: pulseEmissions 1s infinite; color: #fcd34d; }

@keyframes pulseEmissions {
  0% { width: 100%; height: 100%; opacity: 0.8; border-width: 2px; }
  100% { width: 300%; height: 300%; opacity: 0; border-width: 0; }
}

.orbit-path {
  position: absolute;
  width: 200px; height: 200px;
  animation: orbitRotate 10s linear infinite;
}

.wavelength-resonator.is-negative .orbit-path { animation-duration: 20s; }
.wavelength-resonator.is-positive .orbit-path { animation-duration: 5s; }

@keyframes orbitRotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.attraction-group {
  position: absolute; width: 100%; height: 100%;
  top: 0; left: 0; opacity: 0; transition: opacity 0.5s;
}

.wavelength-resonator.is-negative .group-negative,
.wavelength-resonator.is-neutral .group-neutral,
.wavelength-resonator.is-positive .group-positive { opacity: 1; }

.item { position: absolute; font-size: 1.5rem; animation: counterRotate 10s linear infinite; }
.wavelength-resonator.is-negative .item { animation-duration: 20s; }
.wavelength-resonator.is-positive .item { animation-duration: 5s; }

@keyframes counterRotate { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }

.float-1 { top: 0; left: 50%; transform: translate(-50%, -50%); }
.float-2 { bottom: 20px; right: 20px; }
.float-3 { bottom: 20px; left: 20px; }

.resonance-control { text-align: center; position: relative; z-index: 5; margin-top: 1.5rem; }
.tuning-slider { width: 80%; margin: 1rem 0; accent-color: #64748b; }
.wavelength-resonator.is-neutral .tuning-slider { accent-color: #10b981; }
.wavelength-resonator.is-positive .tuning-slider { accent-color: #f59e0b; }

.attraction-words { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; }
.wavelength-resonator.is-negative .words-negative,
.wavelength-resonator.is-positive .words-positive { display: block; }

.word-particle {
  position: absolute; top: 50%; left: 50%; font-size: 0.9rem; font-weight: bold; opacity: 0;
}

@keyframes suckInTop {
  0% { transform: translate(-50%, -150px) scale(1); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(-50%, -10px) scale(0.2); opacity: 0; }
}

@keyframes suckInBot {
  0% { transform: translate(-50%, 150px) scale(1); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(-50%, 10px) scale(0.2); opacity: 0; }
}

@keyframes suckInLeft {
  0% { transform: translate(-200px, -50%) scale(1); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(-20px, -50%) scale(0.2); opacity: 0; }
}

@keyframes suckInRight {
  0% { transform: translate(200px, -50%) scale(1); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(20px, -50%) scale(0.2); opacity: 0; }
}

.wavelength-resonator.is-negative .p1 { animation: suckInTop 2s infinite linear; }
.wavelength-resonator.is-negative .p2 { animation: suckInBot 2.5s infinite linear; animation-delay: 0.8s; }
.wavelength-resonator.is-negative .p3 { animation: suckInLeft 2.2s infinite linear; animation-delay: 1.5s; }

.wavelength-resonator.is-positive .p1 { animation: suckInTop 2s infinite linear; }
.wavelength-resonator.is-positive .p2 { animation: suckInBot 2.5s infinite linear; animation-delay: 0.8s; }
.wavelength-resonator.is-positive .p3 { animation: suckInRight 2.2s infinite linear; animation-delay: 1.5s; }

/* --- Summary & Essence --- */
.summary-box {
  background: linear-gradient(to right, #eff6ff, #f0f9ff);
  border: 2px solid #bae6fd;
  border-radius: 15px;
  padding: 2rem;
  margin-top: 3rem;
}

.summary-box h3 { color: #0369a1; text-align: center; margin-bottom: 1rem; }
.summary-list { list-style: none; padding: 0; }
.summary-list li { position: relative; padding-left: 1.5rem; margin-bottom: 0.8rem; color: #1e293b; }
.summary-list li::before {
  content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900;
  color: #0ea5e9; position: absolute; left: 0; top: 2px;
}

.dashed-divider { border: 0; border-top: 2px dashed #bae6fd; margin: 2rem 0; }
.summary-title { text-align: center; font-weight: bold; color: #0369a1; margin-bottom: 1rem; }
.summary-content-box { text-align: center; background: white; padding: 1.5rem; border-radius: 10px; border: 2px solid #e0f2fe; }

.kotodama-text {
  cursor: pointer; position: relative; display: inline-block;
  border-bottom: 2px dashed #fcd34d; transition: all 0.3s;
}

.kotodama-text:hover { color: #d97706; text-shadow: 0 0 5px rgba(251, 191, 36, 0.5); }

.ripple-circle {
  position: absolute; border-radius: 50%; background: rgba(251, 191, 36, 0.4);
  transform: scale(0); animation: ripple-anim 0.8s linear; pointer-events: none;
}

@keyframes ripple-anim { to { transform: scale(4); opacity: 0; } }

.key-essence-box {
  border-left: 6px solid #10b981;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  padding: 2.5rem;
  border-radius: 24px;
  margin: 3rem 0;
  box-shadow: 0 15px 40px rgba(16, 185, 129, 0.1);
}

.footer-navigation { display: flex; justify-content: center; align-items: center; gap: 2rem; margin-top: 4rem; }
.back-home-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.8rem 2rem; border-radius: 50px;
  background: #f1f5f9; color: #64748b; text-decoration: none;
  font-weight: 600; border: 1px solid #cbd5e1; transition: all 0.3s;
}

.btn-next-chapter { background: #fef9c3; border-color: #fde047; color: #854d0e; }

.list-unstyled-bold { list-style: none; padding: 0; font-weight: bold; color: #57534e; }
.list-icon-orange { color: #d97706; }
.text-care-red { color: #dc2626; font-weight: bold; }

/* --- Sidebar Styles --- */
.sticky-sidebar-wrapper {
  position: sticky !important;
  top: 2rem !important; /* Adjust based on nav height if needed */
  height: fit-content;
}

.sidebar-widget {
  background: white;
  padding: 1.5rem;
  border-radius: 20px;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #f1f5f9;
}

.sidebar-advice-text {
  font-size: 0.85rem; /* Slightly smaller as requested */
  line-height: 1.6;
  color: #475569;
}

.advice-highlight {
  color: #f59e0b;
  font-weight: bold;
}

.sidebar-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav-list li {
  margin-bottom: 0.5rem;
}

.sidebar-nav-list a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #64748b;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.5rem;
  border-radius: 10px;
  transition: all 0.3s;
}

.sidebar-nav-list a:hover,
.sidebar-nav-list a.active {
  background: #fffbeb;
  color: #d97706;
}

.nav-title {
  font-size: 1.1rem;
  color: #1e293b;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-separator {
  height: 1px;
  background: #f1f5f9;
  margin-bottom: 1rem;
}

/* --- Sidebar Wavelength Gauge --- */
.wavelength-gauge-container {
  margin-bottom: 2rem;
  text-align: center;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
}

.gauge-header {
  font-size: 0.8rem;
  font-weight: 800;
  color: #64748b;
  margin-bottom: 1rem;
  display: block;
  letter-spacing: 0.1rem;
}

.gauge-wrap {
  position: relative;
  width: 140px;
  height: 70px;
  margin: 0 auto;
  overflow: hidden;
}

.gauge-base {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(
    from 270deg,
    #94a3b8 0% 120deg,
    #10b981 120deg 240deg,
    #fbbf24 240deg 360deg
  );
  opacity: 0.2;
}

.gauge-needle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 2px;
  height: 60px;
  background: #1e293b;
  transform-origin: bottom center;
  transform: rotate(-90deg); /* Range -90 to 90 */
  transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gauge-needle::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  background: #1e293b;
  border-radius: 50%;
}

/* --- Soul Memory Particles --- */
.word-soul-particle {
  position: fixed;
  pointer-events: none;
  z-index: 10002;
  font-weight: bold;
  color: #d97706;
  font-size: 0.9rem;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
  animation: soulFly 1.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes soulFly {
  0% { transform: scale(1) translate(0, 0); opacity: 1; filter: blur(0); }
  20% { transform: scale(1.5) translate(0, -20px); opacity: 1; }
  100% { transform: scale(0.5) translate(var(--fly-x), var(--fly-y)); opacity: 0; filter: blur(4px); }
}

.memorized-words-list {
  margin-top: 1rem;
}

.word-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: #fffbeb;
  color: #d97706;
  border-radius: 50px;
  margin: 0.2rem;
  border: 1px solid #fde68a;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- Dynamic Background Effects --- */
body.bg-sync-negative .blob { filter: hue-rotate(200deg) brightness(0.8); animation-duration: 30s !important; }
body.bg-sync-positive .blob { filter: hue-rotate(40deg) brightness(1.1); animation-duration: 10s !important; }
body.bg-sync-positive .blob-1 { box-shadow: 0 0 60px rgba(251, 191, 36, 0.3); }

/* Wavelength Sync Labels */
.resonance-control .tuning-feedback {
  font-size: 1.3rem;
  transition: all 0.5s;
  transform: scale(1);
}

.resonance-control .tuning-feedback.changed {
  animation: feedbackPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes feedbackPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
