/* ── Sammy Adventure Widget — White & Pink ─────────────────── */
/* Embedded in ideas.krisadamstv.com/sammy                      */
/* White canvas, pink accents. Sammy's colours.                 */

#sammy-adventure {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  background: #120f1c;
  border: 1px solid rgba(233, 87, 138, 0.22);
  border-radius: 22px;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(233, 87, 138, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Animations ──────────────────────────────────────────── */

@keyframes sammyFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes sammyPulse {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50%      { transform: scale(1.15); opacity: 0.75; }
}

@keyframes choiceFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sammy-fade-in {
  animation: sammyFadeIn 0.6s var(--ease-out-expo, ease-out) forwards;
}

/* ── Node Layout ─────────────────────────────────────────── */

/* The stage is the live adventure content area inside the card */
.sammy-stage {
  flex: 1;
  min-height: 300px;
  padding: 2.25rem 2.25rem 2rem;
  position: relative;
}

.sammy-node {
  width: 100%;
}

.sammy-intro {
  text-align: center;
}

.sammy-text {
  font-family: 'Inter', system-ui, sans-serif;
  color: #f2ecff;
  font-size: 1.05rem;
  line-height: 1.82;
  letter-spacing: 0.01em;
}

.sammy-text p {
  margin: 0 0 1em;
  color: inherit;
}

.sammy-text p:last-child {
  margin-bottom: 0;
}

.sammy-intro-text {
  font-size: 2.2rem;
  font-weight: 200;
  letter-spacing: 0.06em;
  color: #ff80b5;
}

/* ── Choices ─────────────────────────────────────────────── */

.sammy-choices {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sammy-choice {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #1a1428;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
  animation: choiceFadeIn 0.5s ease forwards;
  opacity: 0;
  position: relative;
  line-height: 1.5;
  z-index: 1;
  font-weight: 500;
}

.sammy-choice::before {
  display: none;
}

.sammy-choice:hover {
  background: #ffffff;
  border-color: rgba(233, 87, 138, 0.6);
  color: #0d0b14;
  box-shadow: 0 4px 24px rgba(233, 87, 138, 0.28), 0 0 0 2px rgba(233, 87, 138, 0.2);
  transform: translateY(-1px);
}

.sammy-choice:hover::before {
  opacity: 0;
}

.sammy-choice:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 2px 10px rgba(233, 87, 138, 0.08);
}

.sammy-chosen {
  background: rgba(233, 87, 138, 0.9);
  border-color: rgba(233, 87, 138, 1);
  color: #ffffff;
  box-shadow: 0 4px 28px rgba(233, 87, 138, 0.35);
  font-weight: 600;
}

.sammy-unchosen {
  opacity: 0.12;
  pointer-events: none;
  transform: scale(0.98);
}

.sammy-choice:disabled {
  cursor: default;
}

/* Touch-friendly: ensure min height on mobile */
@media (max-width: 640px) {
  .sammy-choice {
    padding: 1.1rem 1.25rem;
    font-size: 1rem;
    min-height: 48px;
  }
}

/* ── Time Gate ───────────────────────────────────────────── */

.sammy-time-gate {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.sammy-time-prompt {
  color: #b0a8c4;
  font-size: 0.85rem;
  font-style: italic;
  letter-spacing: 0.02em;
}

.sammy-time-continue {
  margin-top: 1rem;
  transition: opacity 0.8s ease, border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}

/* ── Breathing Ring ──────────────────────────────────────── */

.breathing-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1.5px solid var(--sammy-pink-light, #f7c5d8);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sammyPulse 3s ease-in-out infinite;
}

.ring-inner {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sammy-pink, #e9578a);
  opacity: 0.6;
}

/* ── Ending / Coda ───────────────────────────────────────── */

.sammy-ending .sammy-text {
  text-align: center;
}

.sammy-coda {
  margin-top: 3rem;
  text-align: center;
}

.sammy-coda-text {
  font-size: 1.1rem;
  color: var(--sammy-text, #2d2d3a);
  margin-bottom: 0.5rem;
}

.sammy-coda-subtext {
  font-size: 0.85rem;
  color: var(--sammy-text-muted, #a0a0b0);
  margin-bottom: 2rem;
}

.sammy-restart {
  margin-top: 1.5rem;
}

.sammy-path-summary {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--sammy-text-muted, #a0a0b0);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sammy-coda-text {
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--text-primary, #e8e6e3);
  letter-spacing: 0.03em;
  margin-bottom: 1rem;
}

.sammy-coda-subtext {
  font-size: 0.8rem;
  color: var(--text-muted, #666);
  max-width: 480px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.sammy-restart {
  margin: 0 auto;
  display: block;
}

.sammy-path-summary {
  margin-top: 2rem;
  font-size: 0.7rem;
  color: #7a6e8a;
  opacity: 0.9;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}


/* ── v2: Lore Fragment ───────────────────────────────────── */

.sammy-fragment-gate {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sammy-fragment-hook {
  background: rgba(233, 87, 138, 0.08);
  border: 1px solid rgba(233, 87, 138, 0.35);
  color: #ff80b5;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  font-style: italic;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.4s ease;
  animation: fragmentGlow 3s ease-in-out infinite, choiceFadeIn 0.5s ease forwards;
  opacity: 0;
  line-height: 1.5;
  position: relative;
}

.sammy-fragment-hook:hover {
  border-color: var(--sammy-pink, #e9578a);
  background: rgba(233, 87, 138, 0.06);
  box-shadow: 0 0 20px rgba(233, 87, 138, 0.1);
}

.fragment-icon {
  opacity: 0.6;
  margin-right: 0.25em;
}

@keyframes fragmentGlow {
  0%, 100% { border-color: rgba(233, 87, 138, 0.15); }
  50%      { border-color: rgba(233, 87, 138, 0.4); }
}

.sammy-fragment-skip {
  opacity: 0.6;
  animation: choiceFadeIn 0.5s ease forwards;
  animation-delay: 300ms;
}

.sammy-fragment-skip:hover {
  opacity: 1;
}


/* ── v2: Atmosphere ──────────────────────────────────────── */

.sammy-atmosphere {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 1.2rem;
}

.sammy-atmosphere .sammy-choices {
  width: min(500px, 100%);
  margin-top: 0.6rem;
}

.sammy-atmosphere-text {
  font-family: 'Inter', system-ui, sans-serif;
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.9;
  color: #c4b8d8;
  letter-spacing: 0.025em;
  max-width: 500px;
}

/* Mood overlay — fullscreen behind everything */
.sammy-mood-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.sammy-mood-overlay.sammy-mood-active {
  opacity: 1;
}

.sammy-mood-tension {
  background: radial-gradient(ellipse at center, transparent 40%, rgba(200, 60, 30, 0.12) 100%);
  animation: moodPulseTension 2s ease-in-out infinite;
}

.sammy-mood-wonder {
  background: radial-gradient(ellipse at 50% 100%, rgba(255, 200, 50, 0.08) 0%, transparent 60%);
}

.sammy-mood-dread {
  background: radial-gradient(ellipse at center, transparent 30%, rgba(80, 80, 80, 0.15) 100%);
  filter: saturate(0.7);
}

.sammy-mood-warmth {
  background: radial-gradient(ellipse at center, rgba(255, 180, 50, 0.06) 0%, transparent 60%);
}

.sammy-mood-mystery {
  background: radial-gradient(ellipse at center, rgba(120, 60, 180, 0.08) 0%, transparent 60%);
  animation: moodPulseMystery 4s ease-in-out infinite;
}

.sammy-mood-volcanic {
  background: radial-gradient(ellipse at 50% 80%, rgba(200, 50, 0, 0.1) 0%, rgba(255, 120, 0, 0.05) 40%, transparent 70%);
  animation: moodPulseVolcanic 1.5s ease-in-out infinite;
}

@keyframes moodPulseTension {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

@keyframes moodPulseMystery {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

@keyframes moodPulseVolcanic {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.02); }
}

/* Kingdom color tints for atmosphere */
.sammy-kingdom-nature   { --mood-accent: rgba(34, 139, 34, 0.08); }
.sammy-kingdom-scholar  { --mood-accent: rgba(30, 60, 150, 0.08); }
.sammy-kingdom-warrior  { --mood-accent: rgba(139, 0, 0, 0.08); }
.sammy-kingdom-mystic   { --mood-accent: rgba(100, 0, 180, 0.08); }
.sammy-kingdom-vulcano  { --mood-accent: rgba(200, 50, 0, 0.1); }


/* ── v2: Cliffhanger ────────────────────────────────────── */

.sammy-cliffhanger .sammy-text {
  text-align: center;
}

.sammy-suspense-fade_to_black {
  animation: cliffFadeToBlack 2s ease forwards;
}

@keyframes cliffFadeToBlack {
  from { background: transparent; }
  to   { background: rgba(0, 0, 0, 0.85); }
}

.sammy-suspense-tremor {
  animation: cliffTremor 0.6s ease-in-out 3;
}

@keyframes cliffTremor {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px) translateY(1px); }
  75%      { transform: translateX(3px) translateY(-1px); }
}

.sammy-suspense-crack {
  position: relative;
}

.sammy-suspense-crack::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(200, 50, 0, 0.6), transparent);
  animation: crackSpread 1.5s ease-out forwards;
  transform: scaleX(0);
}

@keyframes crackSpread {
  to { transform: scaleX(1); }
}

.sammy-suspense {
  text-align: center;
  padding: 2rem 0;
}

.sammy-suspense-text {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.8rem;
  font-weight: 200;
  letter-spacing: 0.08em;
  color: #f2ecff;
  margin-bottom: 0.5rem;
}

/* In fade-to-black, suspense text goes white */
.sammy-suspense-fade_to_black .sammy-suspense-text {
  color: #ffffff;
}

.sammy-suspense-fade_to_black .sammy-suspense-subtext {
  color: rgba(255, 255, 255, 0.5);
}

.sammy-suspense-fade_to_black .sammy-path-summary {
  color: rgba(255, 255, 255, 0.3);
}

.sammy-suspense-fade_to_black .sammy-choice {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
}

.sammy-suspense-fade_to_black .sammy-choice:hover {
  border-color: rgba(255, 255, 255, 0.5);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.sammy-suspense-subtext {
  font-size: 0.85rem;
  color: #b0a8c4;
  letter-spacing: 0.04em;
  margin-bottom: 2rem;
}

.sammy-suspense-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 320px;
  margin: 0 auto;
}

.sammy-suspense-replay,
.sammy-suspense-episodes {
  font-size: 0.9rem;
  padding: 0.8rem 1.2rem;
}


/* ── v2: Whisper ─────────────────────────────────────────── */

.sammy-whisper {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 2rem 0;
}

.sammy-whisper-text {
  font-family: 'Inter', system-ui, sans-serif;
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.85;
  color: #b8aacf;
  max-width: 440px;
  letter-spacing: 0.015em;
}

.sammy-whisper-text p {
  margin: 0 0 0.8em;
}


/* ── v2: Ambient Choice ──────────────────────────────────── */

.sammy-ambient-hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: none;
}

.sammy-ambient-reveal {
  animation: ambientReveal 0.8s ease forwards;
  pointer-events: auto;
}

@keyframes ambientReveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ── v2: Echo / Observation (resolved nodes) ─────────────── */

.sammy-echo {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 2rem 0;
}

.sammy-echo-text {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.8;
  color: #ff80b5;
  max-width: 480px;
  letter-spacing: 0.01em;
}

.sammy-echo-text p {
  margin: 0 0 1em;
}


/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 640px) {
  #sammy-adventure {
    border-radius: 16px;
  }

  .sammy-stage {
    padding: 1.75rem 1.5rem 1.5rem;
  }

  .sammy-text {
    font-size: 1rem;
  }

  .sammy-intro-text {
    font-size: 1.6rem;
  }

  .sammy-choice {
    font-size: 0.95rem;
    padding: 0.9rem 1.1rem;
  }

  .sammy-atmosphere-text {
    font-size: 1rem;
  }

  .sammy-suspense-text {
    font-size: 1.4rem;
  }

  .sammy-whisper-text {
    font-size: 0.9rem;
    max-width: 100%;
  }

  .sammy-echo-text {
    font-size: 0.95rem;
    max-width: 100%;
  }

  .sammy-fragment-hook {
    font-size: 0.85rem;
  }
}

/* ── v4 Widget Reset: readability + cohesion ─────────────────── */

#sammy-adventure {
  position: relative;
  isolation: isolate;
  max-width: 840px;
  border-radius: 24px;
  border: 1px solid rgba(121, 192, 255, 0.28);
  background:
    radial-gradient(520px circle at var(--mouse-x, 50%) var(--mouse-y, 40%), rgba(102, 196, 255, 0.2), transparent 58%),
    linear-gradient(165deg, #0b2343 0%, #123463 55%, #15467f 100%);
  box-shadow:
    0 38px 95px rgba(5, 18, 36, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: visible;
}

#sammy-adventure::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 20%, rgba(248, 110, 166, 0.18), transparent 26%),
    radial-gradient(circle at 88% 82%, rgba(99, 170, 255, 0.16), transparent 28%);
}

.sammy-stage {
  min-height: 340px;
  padding: 2rem 2rem 1.9rem;
  flex: 0 0 auto;
  height: auto;
  overflow: visible;
}

.sammy-episode-header {
  display: block;
  margin: 0;
  padding: 1.3rem 2rem 1rem;
  border-bottom: 1px solid rgba(166, 213, 255, 0.25);
  opacity: 1;
}

.sammy-ep-badge {
  display: inline-block;
  background: rgba(246, 88, 148, 0.18);
  border: 1px solid rgba(255, 175, 208, 0.42);
  color: #ffd9ea;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  border-radius: 999px;
  padding: 0.34rem 0.76rem;
  text-transform: uppercase;
}

.sammy-ep-title {
  margin-top: 0.62rem;
  font-family: 'Playfair Display', serif;
  color: #f2f7ff;
  font-size: clamp(1.08rem, 2.3vw, 1.38rem);
  letter-spacing: 0.01em;
}

.sammy-ep-context {
  margin-top: 0.35rem;
  color: rgba(218, 232, 250, 0.92);
  font-size: 0.93rem;
  line-height: 1.5;
}

.sammy-text,
.sammy-whisper-text,
.sammy-echo-text,
.sammy-atmosphere-text {
  font-family: 'Inter', system-ui, sans-serif;
  color: #eaf3ff;
  font-size: 1.03rem;
  line-height: 1.84;
  letter-spacing: 0.01em;
}

.sammy-text p {
  border-left: 3px solid #ff8dba;
  background: rgba(247, 108, 164, 0.12);
  color: #ffeaf3;
  padding: 0.72rem 0.85rem;
  border-radius: 0 10px 10px 0;
}

.sammy-atmosphere-text,
.sammy-whisper-text,
.sammy-echo-text {
  color: #eef6ff !important;
}

.sammy-atmosphere-text p {
  color: #eef6ff !important;
}

#sammy-adventure .sammy-echo-text p,
#sammy-adventure .sammy-whisper-text p,
#sammy-adventure .sammy-atmosphere-text p {
  color: #eef6ff !important;
}

/* Fallback for legacy/auto-corrected paragraph structure in atmosphere nodes */
#sammy-adventure .sammy-stage > p,
#sammy-adventure .sammy-stage > p > p {
  color: #eef6ff !important;
}

#sammy-adventure .sammy-atmosphere .sammy-atmosphere-text,
#sammy-adventure .sammy-atmosphere .sammy-atmosphere-text p {
  color: #eef6ff !important;
}

#sammy-adventure p p {
  color: #eef6ff !important;
}

.sammy-intro-text {
  font-size: 1.2rem;
  line-height: 1.7;
  color: #f6f8ff;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.sammy-time-prompt,
.sammy-coda-subtext,
.sammy-path-summary,
.sammy-suspense-subtext {
  color: rgba(204, 225, 247, 0.86);
}

.sammy-choice {
  background: rgba(246, 250, 255, 0.96);
  border: 1px solid rgba(197, 221, 248, 0.92);
  color: #123664;
  border-radius: 12px;
  font-size: 0.99rem;
  font-weight: 600;
  padding: 0.95rem 1.2rem;
  line-height: 1.45;
}

.sammy-choice:hover {
  border-color: rgba(246, 88, 148, 0.58);
  color: #0d2d55;
  box-shadow: 0 7px 24px rgba(255, 130, 181, 0.28);
}

#sammy-adventure .sammy-node {
  overflow: visible;
}

.sammy-chosen {
  background: #f55f95;
  border-color: #ff8eb6;
  color: #ffffff;
}

.sammy-unchosen {
  opacity: 0.2;
}

.sammy-coda-text,
.sammy-suspense-text {
  color: #f5f8ff;
}

@media (max-width: 640px) {
  #sammy-adventure {
    max-width: 100%;
    border-radius: 18px;
  }

  .sammy-episode-header {
    padding: 1rem 1.2rem 0.85rem;
  }

  .sammy-stage {
    min-height: 300px;
    padding: 1.35rem 1.2rem 1.3rem;
  }

  .sammy-ep-title {
    font-size: 1.03rem;
  }

  .sammy-text,
  .sammy-whisper-text,
  .sammy-echo-text,
  .sammy-atmosphere-text {
    font-size: 0.98rem;
  }

  .sammy-intro-text {
    font-size: 1.06rem;
  }
}

/* ── Auto-Advance Bar ─────────────────────────────────────── */

.sammy-advance-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 2px;
  margin-top: 1.6rem;
  overflow: hidden;
}

.sammy-advance-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #e879b0 0%, #c4a0ff 100%);
  border-radius: 2px;
}

/* ── Auto-Advance Header Toggle ───────────────────────────── */

.sammy-header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.sammy-auto-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  transition: background 150ms ease;
  outline: none;
}

.sammy-auto-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sammy-auto-toggle:focus-visible {
  outline: 1px solid rgba(246, 88, 148, 0.5);
}

.sammy-toggle-label {
  font-size: 0.63rem;
  letter-spacing: 0.13em;
  color: rgba(200, 220, 250, 0.42);
  text-transform: uppercase;
  transition: color 220ms ease;
  white-space: nowrap;
}

.sammy-auto-toggle.active .sammy-toggle-label {
  color: rgba(255, 215, 235, 0.78);
}

.sammy-toggle-switch {
  width: 32px;
  height: 17px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
  transition: background 240ms ease, border-color 240ms ease;
  flex-shrink: 0;
}

.sammy-auto-toggle.active .sammy-toggle-switch {
  background: rgba(246, 88, 148, 0.52);
  border-color: rgba(246, 88, 148, 0.58);
}

.sammy-toggle-knob {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(190, 205, 228, 0.5);
  top: 2px;
  left: 2px;
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), background 240ms ease;
}

.sammy-auto-toggle.active .sammy-toggle-knob {
  transform: translateX(15px);
  background: #ffffff;
}

@media (max-width: 640px) {
  .sammy-toggle-label {
    display: none;
  }
}
