/* 15-Second Chaos Tension Mode — UI/UX only, no logic changes.
 * Scoped to .chaos-seven-seconds.chaos-cinematic-scene
 * Respects prefers-reduced-motion, Greek fonts, accessibility.
 */

/* Override parent chaos-seven-seconds::after (we use child orbs instead) */
.chaos-seven-seconds.chaos-cinematic-scene.chaos-game {
  background-image: none;
}

.chaos-seven-seconds.chaos-cinematic-scene.chaos-game::after {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .chaos-seven-seconds.chaos-cinematic-scene *,
  .chaos-seven-seconds.chaos-cinematic-scene *::before,
  .chaos-seven-seconds.chaos-cinematic-scene *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* B) Cinematic background */
.chaos-seven-seconds.chaos-cinematic-scene {
  --tension-max: 1000px;
  max-width: var(--tension-max);
  margin: 0 auto;
  padding: 2rem 2rem 2.5rem;
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, #0f0a1a 0%, #0d1229 25%, #0a0e1f 50%, #080c18 75%, #060a14 100%) !important;
  border: 1px solid rgba(155, 93, 255, 0.15);
  box-shadow: 0 0 40px rgba(155, 93, 255, 0.08), 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* Grain overlay */
.chaos-seven-seconds.chaos-cinematic-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: overlay;
}

/* Neural grid */
.chaos-seven-seconds.chaos-cinematic-scene::after {
  content: '';
  position: absolute;
  inset: -15%;
  background-image: 
    linear-gradient(rgba(155, 93, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(155, 93, 255, 0.025) 1px, transparent 1px);
  background-size: 36px 36px;
  animation: tensionGridMove 20s linear infinite;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

@keyframes tensionGridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(36px, 36px); }
}

/* Blurred orbs */
.chaos-seven-seconds.chaos-cinematic-scene .chaos-tension-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.2;
  pointer-events: none;
  z-index: 0;
}
.chaos-seven-seconds.chaos-cinematic-scene .chaos-tension-orb-1 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(155, 93, 255, 0.35), transparent);
  top: -8%; left: -5%;
  animation: tensionOrb1 25s ease-in-out infinite;
}
.chaos-seven-seconds.chaos-cinematic-scene .chaos-tension-orb-2 {
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.25), transparent);
  bottom: -5%; right: -6%;
  animation: tensionOrb2 30s ease-in-out infinite;
}
.chaos-seven-seconds.chaos-cinematic-scene .chaos-tension-orb-3 {
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255, 107, 157, 0.2), transparent);
  top: 35%; right: 8%;
  animation: tensionOrb3 22s ease-in-out infinite;
}

@keyframes tensionOrb1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(12px, -15px) scale(1.03); }
  66% { transform: translate(-8px, 12px) scale(0.98); }
}
@keyframes tensionOrb2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-15px, -12px) scale(1.05); }
}
@keyframes tensionOrb3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(8px, 20px); }
}

.chaos-seven-seconds.chaos-cinematic-scene > * {
  position: relative;
  z-index: 2;
}

/* E) Flow / hierarchy */
.chaos-seven-seconds.chaos-cinematic-scene .chaos-game-title {
  margin-bottom: 1.5rem;
}

.chaos-seven-seconds.chaos-cinematic-scene .chaos-cinematic-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 700px;
  margin: 0 auto;
}

/* A) Timer ring — circular countdown (always visible) */
.chaos-timer-ring-wrapper {
  display: flex !important;
  justify-content: center;
  align-items: center;
  margin: 0.5rem 0 1rem;
  visibility: visible !important;
  opacity: 1 !important;
}

.chaos-timer-ring-wrapper.chaos-timer-prominent {
  margin: 1rem 0 1.5rem;
}

.chaos-timer-ring {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}

.chaos-timer-ring-wrapper.chaos-timer-prominent .chaos-timer-ring {
  width: 110px;
  height: 110px;
}

.chaos-timer-ring-wrapper.chaos-timer-prominent .chaos-timer-ring-num {
  font-size: 2.5rem;
}

.chaos-timer-ring-bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    rgba(155, 93, 255, 0.5) 0deg,
    rgba(155, 93, 255, 0.5) calc(var(--timer-progress, 1) * 360deg),
    rgba(255, 255, 255, 0.08) calc(var(--timer-progress, 1) * 360deg)
  );
  padding: 4px;
  box-sizing: border-box;
}

.chaos-timer-ring-bg::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #0d1229;
  z-index: 0;
}

.chaos-timer-ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #ff8fb3;
  font-family: 'Manrope', 'Noto Sans Greek', 'Noto Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-shadow: 0 0 12px rgba(255, 107, 157, 0.5);
  transition: transform 0.15s ease;
  z-index: 1;
}

.chaos-seven-seconds.chaos-cinematic-scene .chaos-timer-ring-num.timer-pulse {
  animation: tensionTimerPulse 1s ease-out;
}

@keyframes tensionTimerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* Last 5 seconds — heartbeat */
.chaos-seven-seconds.chaos-cinematic-scene.timer-urgent .chaos-timer-ring-num {
  animation: tensionTimerHeartbeat 0.8s ease-in-out infinite;
}

.chaos-seven-seconds.chaos-cinematic-scene.timer-urgent .chaos-timer-ring-bg {
  box-shadow: 0 0 20px rgba(255, 107, 157, 0.4);
}

.chaos-seven-seconds.chaos-cinematic-scene.timer-urgent {
  filter: saturate(1.08);
}

@keyframes tensionTimerHeartbeat {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.95; }
}

/* C) Scenario card — glassmorphism */
.chaos-scenario-card {
  padding: 1.5rem 1.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.chaos-scenario-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  animation: tensionBeamSlide 6s linear infinite;
}

@keyframes tensionBeamSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.chaos-scenario-card .chaos-cinematic-line {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #e8ecff;
  margin: 0.25rem 0;
}

/* C) Question card — hero, energy edge */
.chaos-question-card {
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, rgba(255, 140, 180, 0.12), rgba(155, 93, 255, 0.08));
  border: 1px solid rgba(255, 140, 180, 0.25);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}

.chaos-question-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  padding: 2px;
  background: linear-gradient(90deg, rgba(255, 107, 157, 0.5), rgba(155, 93, 255, 0.4), rgba(0, 212, 255, 0.3), rgba(255, 107, 157, 0.5));
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: tensionShimmer 4s linear infinite;
  pointer-events: none;
}

@keyframes tensionShimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.chaos-question-card .chaos-question-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.chaos-question-card:focus-within {
  outline: 2px solid rgba(155, 93, 255, 0.5);
  outline-offset: 2px;
}

/* D) Answer buttons — game feel */
.chaos-seven-seconds.chaos-cinematic-scene .chaos-seconds-option {
  min-height: 52px;
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  color: #f5f7ff;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}

.chaos-seven-seconds.chaos-cinematic-scene .chaos-seconds-option:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(155, 93, 255, 0.4);
  box-shadow: 0 8px 24px rgba(155, 93, 255, 0.2);
}

.chaos-seven-seconds.chaos-cinematic-scene .chaos-seconds-option:active {
  transform: translateY(-1px);
}

.chaos-seven-seconds.chaos-cinematic-scene .chaos-seconds-option::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.15), transparent 60%);
  opacity: 0;
  pointer-events: none;
}

.chaos-seven-seconds.chaos-cinematic-scene .chaos-seconds-option:active::after {
  opacity: 1;
  animation: tensionRipple 0.4s ease-out;
}

@keyframes tensionRipple {
  to { transform: scale(2); opacity: 0; }
}

.chaos-seven-seconds.chaos-cinematic-scene .chaos-seconds-option:focus-visible {
  outline: 2px solid rgba(155, 93, 255, 0.7);
  outline-offset: 3px;
}

.chaos-seven-seconds.chaos-cinematic-scene .chaos-seconds-option.selected,
.chaos-seven-seconds.chaos-cinematic-scene .chaos-seconds-option[aria-pressed="true"] {
  border-color: rgba(155, 93, 255, 0.6);
  background: rgba(155, 93, 255, 0.15);
  box-shadow: inset 0 0 20px rgba(155, 93, 255, 0.15);
}

.chaos-seven-seconds.chaos-cinematic-scene .chaos-seconds-option.dimmed {
  opacity: 0.5;
}

/* Vertical flow beam */
.chaos-seven-seconds.chaos-cinematic-scene .chaos-flow-beam {
  width: 1px;
  height: 24px;
  margin: 0 auto;
  background: linear-gradient(180deg, transparent, rgba(155, 93, 255, 0.15), transparent);
}

/* Mobile */
@media (max-width: 768px) {
  .chaos-seven-seconds.chaos-cinematic-scene {
    padding: 1.5rem 1.25rem 2rem;
  }
  .chaos-seven-seconds.chaos-cinematic-scene .chaos-seconds-option {
    min-height: 56px;
    padding: 1rem 1.25rem;
  }
}
