/* =========================================================================
   RESPONSIVE TOKENS — Mobile-first cascade (min-width, em units)
   Base tier targets the smallest supported viewport (iPhone SE 1st gen, 320px);
   each breakpoint below progressively enhances the design tokens.

   Breakpoints (em = px / 16):
     Base       0        – minimal mobile (320px, iPhone SE 1)
     23.4375em  375px    – standard smartphones (iPhone SE 2/3)
     26.875em   430px    – large phones / phablets (Pro Max / Plus)
     48em       768px    – tablets portrait (iPad, Galaxy Tab)
     64em       1024px   – tablets landscape / iPad Pro
     80em       1280px   – large tablets / desktop entry
   ========================================================================= */

:root {
  /* Type scale — base tier (320px) */
  --fs-h1: clamp(1.75rem, 6vw, 2rem);
  --fs-h2: 1.375rem;
  --fs-h3: 1.0625rem;
  --fs-body: 0.9375rem;
  --fs-meta: 0.75rem;

  /* Spacing & shape — base tier */
  --radius: 12px;
  --pad: 16px;

  /* Home card thumbnail width — base tier (narrow, gives text room) */
  --card-thumb-w: 108px;

  /* Home card action-button left indent — 0 = full-width (wider) buttons */
  --card-actions-indent: 0rem;

  /* Stats bar chart — base tier (tightest, so 12 bars fit a 320px card) */
  --stat-bar-gap: 0.375rem;
  --stat-bar-max: 0.85rem;

  /* App frame width — base tier fills the viewport */
  --app-max: 100%;

  /* Color tokens (viewport-independent) */
  --bg: #ffffff;
  --fg: #000000;
  --fg-2: #7a7a7a;
  --fg-3: #a8a8a8;
  --meta: #999999;
  --sep: rgba(0, 0, 0, 0.1);
  --sep-soft: rgba(0, 0, 0, 0.06);
  --surface: #f9f9f9;
  --surface-2: #ebebed;
  --accent: #5BB8FF;
  --accent-soft: #d6efff;
  --accent-2: #34d399;
  --accent-3: #ff8a3d;
  --danger: #ef4444;
}

/* 375px — standard smartphones (iPhone SE 2/3, standard models) */
@media (min-width: 23.4375em) {
  :root {
    --fs-h1: clamp(2rem, 6vw, 2.5rem);
    --fs-h2: 1.5rem;
    --fs-h3: 1.125rem;
    --fs-body: 1rem;
    --fs-meta: 0.8rem;
    --radius: 16px;
    --pad: 20px;
    --card-thumb-w: 128px;
    --stat-bar-gap: 0.75rem;
    --stat-bar-max: 1rem;
  }
}

/* 430px — large smartphones / phablets (Pro Max / Plus models) */
@media (min-width: 26.875em) {
  :root {
    --fs-h2: 1.625rem;
    --fs-h3: 1.1875rem;
    --pad: 22px;
    --card-thumb-w: 150px;
    --stat-bar-gap: 0.65rem;
    --stat-bar-max: 1.1rem;
  }
}

/* 768px — tablets portrait (iPad, Galaxy Tab) */
@media (min-width: 48em) {
  :root {
    --fs-h1: clamp(2.25rem, 5vw, 2.75rem);
    --fs-h2: 1.75rem;
    --fs-h3: 1.25rem;
    --fs-body: 1.0625rem;
    --fs-meta: 0.825rem;
    --radius: 20px;
    --pad: 28px;
    --app-max: 100%; /* tablet portrait: fill full viewport width */
    --card-thumb-w: 180px;
    --card-actions-indent: 2rem; /* tablets: narrower buttons (extra room) */
    --stat-bar-gap: 0.85rem;
    --stat-bar-max: 1.25rem; /* tablets: original full bar width */
  }

  /* Tablets: buttons don't fill the card — shorter, right-aligned */
  .card-actions.card-actions--fit { justify-content: flex-end; }
  .card-actions.card-actions--fit .btn { flex: 0 1 auto; min-width: 6.5rem; }
}

/* 1024px — tablets landscape / iPad Pro */
@media (min-width: 64em) {
  :root {
    --fs-h2: 1.875rem;
    --pad: 32px;
    --app-max: 100%; /* tablet landscape / iPad Pro: fill full viewport width */
  }
}

/* 1280px — large tablets / desktop entry */
@media (min-width: 80em) {
  :root {
    --fs-h1: clamp(2.5rem, 4vw, 3rem);
    --pad: 36px;
    --app-max: 100%; /* desktop entry: fill viewport, room for 2-col grid */
    --card-actions-indent: 0rem;
  }

  /* Desktop entry: cards laid out in a 2-column grid */
  .app .cards { display: grid; grid-template-columns: repeat(2, 1fr); align-items: start; }

  /* Desktop entry: stats widgets in a 2-column grid */
  .app .stats-body { display: grid; grid-template-columns: repeat(2, 1fr); align-items: start; }
}

*, *::before, *::after { margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--fg); font-family: "Inter", system-ui, sans-serif; }
body { overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }

.app {
  position: relative;
  min-height: 100dvh;
  max-width: var(--app-max);
  margin: 0 auto;
  background: var(--bg);
}

.screen { display: none; min-height: 100dvh; padding: 32px var(--pad) 40px; box-sizing: border-box; }
.screen--active { display: block; animation: fade 0.28s ease both; }
.screen[data-screen="scenario"] { padding: 0; position: relative; overflow: hidden; }
.screen[data-screen="home"] { padding: 0 0 40px; background: var(--surface); }
.screen[data-screen="stats"] { background: var(--surface); }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* HOME */
.home-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 5rem;
  padding: 0 1.5rem;
  box-shadow: 0 8px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 1rem;
  transition: transform 0.3s ease;
  will-change: transform;
}
/* Mobile top bar: hide on scroll down, reveal on scroll up (toggled from JS) */
.home-header--hidden { transform: translateY(-100%); }
/* Tablets and up: keep the bar pinned (no auto-hide) */
@media (min-width: 48em) {
  .home-header--hidden { transform: none; }
}
.home-title { font-size: var(--fs-h2); font-weight: 600; letter-spacing: -0.01em; }
.home-sub { color: var(--fg-2); font-size: var(--fs-body); margin-top: 6px; }
.home-header-actions { position: relative; display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }

.context-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--sep);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px;
  z-index: 20;
}
.context-menu[hidden] { display: none; }
.context-menu-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: var(--fs-body);
  color: var(--fg);
  text-decoration: none;
}
.context-menu-item:hover, .context-menu-item:active { background: var(--surface); }

.cards { display: flex; flex-direction: column; gap: 16px; padding: 0 0.5rem; }
.card {
  background: #ffffff;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--sep-soft);
  display: flex;
  flex-direction: row;
  align-items: stretch;
}
.card-thumb {
  position: relative;
  flex: 0 0 var(--card-thumb-w);
  align-self: stretch;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #1d1d1d, #2a2a2a);
  overflow: hidden;
}
.card-body { flex: 1; min-width: 0; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb--placeholder { display: flex; align-items: center; justify-content: center; }
.card-thumb--placeholder svg { opacity: 0.55; }
.card-body { padding: 16px 18px 18px; }
.card-title { font-size: var(--fs-h3); font-weight: 600; }
.card-desc { font-size: var(--fs-meta); color: var(--fg-2); margin-top: 6px; line-height: 1.45; }
.card-actions { display: flex; gap: 10px; margin-top: 16px; margin-left: var(--card-actions-indent); }
.card-actions .btn { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  transition: transform 0.1s ease, background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #3fa6f0; box-shadow: 0 2px 8px rgba(91, 184, 255, 0.25); }
.btn--ghost { background: #fff; color: var(--accent); border: 2px solid var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); color: #3fa6f0; border-color: #3fa6f0; }
.btn--danger { background: var(--danger); color: #fff; }

.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; color: var(--fg); }
.icon-btn:hover, .icon-btn:active { background: rgba(0,0,0,0.06); }

/* Sub header (Stats etc.) */
.sub-header { display: flex; align-items: center; gap: 8px; padding: 16px 0 8px; }
.sub-title { font-size: var(--fs-h2); font-weight: 600; }

/* STATS */
.screen[data-screen="stats"] { padding: 0 0 40px; }
.home-header--stats { justify-content: flex-start; gap: 8px; padding-left: 1rem; }
.stats-body { display: flex; flex-direction: column; gap: 16px; padding: 0 0.5rem; }
.stat-card {
  background: #ffffff;
  border: 1px solid var(--sep-soft);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
}
.stat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--fg);
}
.stat-card-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--fg-3);
  flex-shrink: 0;
}
.stat-chips { display: inline-flex; gap: 8px; }
.stat-chip {
  min-width: 52px;
  padding: 6px 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--sep);
  text-align: center;
  line-height: 1.1;
  color: #ffffff;
}
.stat-chip--low  { background: var(--danger); border-color: transparent; }
.stat-chip--mid  { background: var(--accent-3); border-color: transparent; }
.stat-chip--high { background: var(--accent-2); border-color: transparent; }
.stat-chip-label {
  font-size: 0.65rem;
  color: #ffffff;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  opacity: 0.9;
}
.stat-chip-value {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  margin-top: 2px;
}
.stat-chip-value svg { width: 12px; height: 12px; }

.stat-chart {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr auto;
  column-gap: 8px;
  row-gap: 6px;
}
.stat-chart-ylabel {
  grid-column: 1 / 3;
  grid-row: 1;
  font-size: 0.72rem;
  color: var(--meta);
}
.stat-chart-plot {
  grid-column: 2;
  grid-row: 2;
  height: calc(120px + 1rem);
  display: flex;
  align-items: flex-end;
  gap: var(--stat-bar-gap);
  padding-left: 1rem;
  padding-bottom: 0.5rem;
  border-left: 1px solid var(--sep);
  border-bottom: 1px solid var(--sep);
}
.stat-bar-col {
  flex: 1 1 0;
  min-width: 0;
  max-width: var(--stat-bar-max);
  background: var(--accent);
  border-radius: 999px;
  transform-origin: bottom;
  animation: barGrow 0.5s ease both;
}
@keyframes barGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.stat-chart-xlabel {
  grid-column: 2;
  grid-row: 3;
  font-size: 0.72rem;
  color: var(--meta);
  text-align: right;
}

/* INITIAL CASE */
.screen[data-screen="initial"] {
  padding: 0;
  background-image: url('img/roleplay_bg_1.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.screen[data-screen="initial"].screen--active {
  display: flex;
  align-items: center;
  justify-content: center;
}
.screen[data-screen="initial"]:not(.screen--active) {
  display: none;
}
.initial-dialog {
  width: calc(100% - 2rem);
  margin: 1rem;
  padding: 0.5rem;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.initial-wrap { padding: 1rem 1rem 1.25rem; display: flex; flex-direction: column; gap: 14px; }
.initial-title { font-size: var(--fs-h2); font-weight: 600; }
.initial-divider { height: 2px; background: var(--sep); margin: 6px 0 4px; }
.initial-block-label { font-size: var(--fs-meta); color: var(--meta); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.initial-block-text { font-size: var(--fs-body); color: var(--fg-2); line-height: 1.5; }
.initial-actions { display: flex; gap: 10px; margin-top: 24px; padding: 0 1rem; }
.initial-actions .btn { flex: 1; }

/* SCENARIO */
[data-screen="scenario"] { background: #000; }
.avatar-layer {
  position: absolute; inset: 0;
  background-color: #0a0a0a;
  background-image: url('img/roleplay_bg_1.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  transition: transform 0.4s ease;
}
.avatar-layer--speaking { animation: avatarPulse 1.8s ease-in-out infinite; }
@keyframes avatarPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.012); } }

.avatar-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: avatarBreathe 3.6s ease-in-out infinite;
}
.avatar-frame {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 82%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  opacity: 1;
}
@keyframes avatarBreathe {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

.scenario-gradient { position: absolute; left: 0; right: 0; pointer-events: none; z-index: 1; }
.scenario-gradient--top { top: 0; height: 30%; background: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0)); }
.scenario-gradient--bottom { bottom: 0; height: 36%; background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0)); }

/* Score bar replica */
.scoreBar {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 3;
  display: flex; align-items: stretch; justify-content: space-between;
  padding-top: max(1rem, env(safe-area-inset-top));
}
.scoreBar-pills {
  display: flex; flex-direction: column; gap: 1rem;
  padding-left: 1rem;
}
.sb-row { display: flex; align-items: center; }
.sb-row--trust { gap: 1rem; }

.sb-indicator { display: flex; align-items: center; gap: 0.5rem; }

.sb-icon {
  width: 2rem; height: 2rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
}
.sb-icon img {
  width: 60%; height: 60%; display: block;
  filter: brightness(0) invert(1);
}
.sb-icon--trust { background: #45C1FF; }
.sb-icon--interest { background: #39E4BC; }

.sb-bar {
  display: inline-block;
  height: 1rem;
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.sb-bar--trust { width: 5rem; }
.sb-bar--interest { width: 13.5rem; }

.sb-bar-fill {
  display: block;
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  border-radius: 999px;
  transition: width 0.7s cubic-bezier(.4,.2,.2,1);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.07);
}
.sb-bar-fill--trust { background: #45C1FF; }
.sb-bar-fill--orange { background: #FF9F40; z-index: 1; }
.sb-bar-fill--green { background: #39E4BC; z-index: 2; }

.scoreBar-time {
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 500;
  padding: 0 1rem 0 1.5rem;
  border-radius: 999rem 0 0 999rem;
  display: flex; align-items: center;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Countdown overlay */
.countdown {
  position: absolute; inset: 0;
  z-index: 5;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  opacity: 1;
  transition: opacity 0.6s cubic-bezier(.4,.2,.2,1);
}
.countdown.is-fading { opacity: 0; }
.countdown[hidden] { display: none; }
.countdown-num {
  position: absolute;
  font-size: 6rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  line-height: 1;
  color: #ffffff;
  transform: translateX(60vw);
  opacity: 0;
  transition: transform 0.7s cubic-bezier(.4,.2,.2,1), opacity 0.7s cubic-bezier(.4,.2,.2,1);
  will-change: transform, opacity;
}
.countdown-num.is-in { transform: translateX(0); opacity: 1; }
.countdown-num.is-out { transform: translateX(-60vw); opacity: 0; }

/* Speaking pill */
.speaking-pill {
  position: absolute; left: 50%; bottom: 130px;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--fg);
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--sep-soft);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 999px; background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(52,211,153,0.55);
  animation: dotPulse 1.4s ease-out infinite;
}
@keyframes dotPulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,0.55); } 100% { box-shadow: 0 0 0 14px rgba(52,211,153,0); } }

/* Scenario actions — bottom bar */
.scenario-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6.25rem; /* 6rem button − 0.75rem overlap + 1rem gutter below */
  z-index: 3;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  padding: 0 1rem;
  /* Safe-area gutter: keeps the round buttons clear of the home indicator /
     bottom screen edge on notched phones (buttons are align-items:flex-start,
     so the bar grows downward and the cluster is pushed up, never clipped). */
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(102,102,102,0.2));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.action-btn {
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.12s ease;
}
.action-btn img {
  height: auto;
  filter: brightness(0) invert(1);
  pointer-events: none;
}
/* Main round buttons (mic + hangup) */
.action-btn--mic,
.action-btn--hangup {
  width: 6rem;
  height: 6rem;
  border-radius: 999px;
  margin-top: -0.75rem; /* overlap bar top */
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.07);
}
.action-btn--mic img,
.action-btn--hangup img { width: 2.25rem; }
/* Mic — unmuted */
.action-btn--mic { background: #737373; }
.action-btn--mic:active { background: #B3B3B3; }
/* Mic — muted */
.action-btn--mic.is-muted { background: #B3B3B3; }
.action-btn--mic.is-muted:active { background: #B5B5B5; }
/* Mic icon swap */
.action-btn--mic .icon-mic-off { display: none; }
.action-btn--mic.is-muted .icon-mic-on { display: none; }
.action-btn--mic.is-muted .icon-mic-off { display: inline-block; }
/* Hang up */
.action-btn--hangup { background: #FF7662; }
.action-btn--hangup:active { background: #E56D5B; }
/* Burger — right aligned, ghost until pressed */
.action-btn--burger {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 5rem;
  height: 5rem;
  border-radius: 0.75rem;
  background: transparent;
}
.action-btn--burger img { width: 2rem; }
.action-btn--burger:active { background: rgba(0,0,0,0.4); }
/* Burger icon swap (menu closed → open) */
.action-btn--burger .icon-burger-close { display: none; }
.action-btn--burger.is-open .icon-burger-open { display: none; }
.action-btn--burger.is-open .icon-burger-close { display: inline-block; }

/* Scenario overflow menu — anchored above the burger, bottom-right */
.scenario-menu {
  position: absolute;
  right: 1rem;
  bottom: 6rem;
  width: 12.25rem;
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,0.22);
  overflow: hidden;
  z-index: 4;
  transform-origin: bottom right;
  animation: menuPop 0.16s cubic-bezier(.2,.7,.3,1) both;
}
.scenario-menu[hidden] { display: none; }
.scenario-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 3rem;
  padding: 0 1.25rem;
  font-size: var(--fs-body);
  color: var(--fg-2);
  text-align: left;
  text-decoration: none;
  background: transparent;
  border-bottom: 1px solid var(--sep-soft);
}
.scenario-menu-item:last-child { border-bottom: none; }
.scenario-menu-item:active { background: var(--surface); }
.scenario-menu-ext { flex: 0 0 auto; color: var(--fg); }
@keyframes menuPop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Center dialogs (scenario menu → Idioma / Caso inicial / Salir) */
.dialog-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.dialog-overlay[hidden] { display: none; }
.dialog-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); animation: fade 0.18s ease both; }
.dialog {
  position: relative;
  width: calc(100% - 2rem);
  max-width: 30rem;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  padding: 0.5rem;
  animation: dialogPop 0.2s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes dialogPop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.dialog-header { padding: 1rem 1rem 0; font-size: var(--fs-h2); font-weight: 600; color: var(--fg); }
.dialog-body { padding: 0.75rem 1rem 0; display: flex; flex-direction: column; gap: 14px; }
.dialog-text { font-size: var(--fs-body); color: var(--fg-2); line-height: 1.5; }
.dialog-footer { display: flex; gap: 10px; margin-top: 24px; padding: 0 1rem 1rem; }
.dialog-footer .btn { flex: 1; }
.dialog-footer--end { justify-content: flex-end; }
.dialog-footer--end .btn { flex: 0 0 auto; min-width: 7rem; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* Radio rows (Idioma dialog) */
.radio-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.radio-row input { position: absolute; opacity: 0; pointer-events: none; }
.radio-mark {
  flex: 0 0 auto;
  width: 1.25rem; height: 1.25rem;
  border-radius: 999px;
  border: 2px solid var(--fg-3);
  position: relative;
  transition: border-color 0.15s ease;
}
.radio-row input:checked + .radio-mark { border-color: var(--accent); }
.radio-row input:checked + .radio-mark::after {
  content: ""; position: absolute; inset: 3px;
  border-radius: 999px; background: var(--accent);
}
.radio-label { font-size: var(--fs-body); color: var(--fg); }
.radio-row.is-disabled { cursor: default; }
.radio-row.is-disabled .radio-label { color: var(--fg-3); }
.radio-row.is-disabled .radio-mark { border-color: var(--sep); }

/* REPORT — analytics dashboard */
.screen[data-screen="report"] { padding: 0; background: #F4F7F9; }

/* Sticky top bar */
.report-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem var(--pad);
  background: rgba(244, 247, 249, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.report-topbar-title { font-size: var(--fs-h2); font-weight: 700; color: #0f172a; }
.report-topbar-actions { display: flex; align-items: center; gap: 2px; }
.report-icon-btn {
  width: 2.5rem; height: 2.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  color: #45C1FF;
}
.report-icon-btn:hover, .report-icon-btn:active { background: rgba(255,255,255,0.9); }
.report-icon-btn svg { width: 1.5rem; height: 1.5rem; }

.report-scroll { padding: 0.25rem var(--pad) 2.5rem; }
.report-dashboard { max-width: 72rem; margin-inline: auto; }

/* Total banner — bg driven by score bucket */
.report-total {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  color: #ffffff;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
.report-total-label { font-size: 1.5rem; font-weight: 700; }
.report-total-value { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.02em; }
.report-total--high { background: #39E4BC; }
.report-total--mid  { background: #FF9F40; }
.report-total--low  { background: #FF7662; }

/* Collapsible sections */
.report-section { margin-bottom: 0.5rem; }
.report-section-head {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 0.75rem 0;
}
.report-section-title { font-size: 1.125rem; font-weight: 700; color: #45C1FF; }
.report-chevron { width: 1.25rem; height: 1.25rem; color: #45C1FF; transition: transform 0.2s ease; }
.report-section.is-collapsed .report-chevron { transform: rotate(180deg); }

/* Widget grid — dashboard on wide screens, single column on mobile */
.report-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.75rem;
  padding-bottom: 0.75rem;
}
.report-widgets[hidden] { display: none; }

/* Widget card */
.rw {
  background: #ffffff;
  border: 1px solid var(--sep-soft);
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.rw-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.rw-head-left { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.rw-icon { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; object-fit: contain; }
.rw-title { font-size: 0.875rem; font-weight: 700; color: #0f172a; }
.rw-score { font-size: 1.625rem; font-weight: 800; line-height: 1; flex: 0 0 auto; letter-spacing: -0.02em; }
.rw-face { width: 1.6rem; height: 1.6rem; flex: 0 0 auto; object-fit: contain; }
.rw-body { margin-top: 0.5rem; font-size: 0.8125rem; line-height: 1.55; color: #737373; }
.rw-score--high { color: #39E4BC; }
.rw-score--mid  { color: #FF9F40; }
.rw-score--low  { color: #FF7662; }

/* SHEET */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); animation: fade 0.18s ease both; }
.sheet-panel {
  position: relative;
  width: 100%;
  max-width: var(--app-max);
  background: #181818;
  border-radius: 22px 22px 0 0;
  padding: 10px 14px max(20px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 2px;
  animation: sheetUp 0.22s cubic-bezier(.2,.7,.3,1) both;
  border-top: 1px solid var(--sep-soft);
}
.sheet-panel--center {
  margin-bottom: 18px; border-radius: 22px;
  padding: 20px 22px;
}
@keyframes sheetUp { from { transform: translateY(20%); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 38px; height: 4px; background: rgba(255,255,255,0.25); border-radius: 999px; margin: 6px auto 12px; }
.sheet-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 16px 12px;
  font-size: 1rem;
  color: var(--fg);
  border-radius: 12px;
  text-align: left;
}
.sheet-item:active { background: rgba(255,255,255,0.05); }
.sheet-item--danger { color: var(--danger); }

.confirm-title { font-size: 1.1rem; font-weight: 600; }
.confirm-text { font-size: 0.92rem; color: var(--fg-2); margin-top: 8px; line-height: 1.45; }
.confirm-actions { display: flex; gap: 10px; margin-top: 18px; }
.confirm-actions .btn { flex: 1; }

/* Notice */
.notice {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 60;
  background: rgba(20,20,20,0.95);
  border: 1px solid var(--sep-soft);
  color: var(--fg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.86rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  animation: noticeIn 0.25s ease both;
}
.notice[hidden] { display: none; }
@keyframes noticeIn { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* =========================================================================
   RESPONSIVE — INITIAL CASE · SCENARIO · REPORT
   Mobile-first: the base rules above target the smallest phone. These
   breakpoints scale the three flow screens up for large phones, tablets and
   desktop, mirroring the token breakpoints (23.4375 / 26.875 / 48 / 80em).
   ========================================================================= */

/* ---- Large phones (≥430px): a little more breathing room ---- */
@media (min-width: 26.875em) {
  /* INITIAL CASE */
  .initial-wrap { gap: 16px; padding: 1.25rem 1.25rem 1.5rem; }
  .initial-actions { margin-top: 28px; }
}

/* ---- Tablets and up (≥768px) ---- */
@media (min-width: 48em) {
  /* INITIAL CASE — dialog settles into a centred modal card, not full-bleed */
  .initial-dialog { width: 100%; max-width: 30rem; padding: 0.75rem; }
  .initial-actions { margin-top: 32px; }

  /* SCENARIO — larger tap targets; cluster stays centred, burger pinned right */
  .action-btn--mic,
  .action-btn--hangup { width: 6.5rem; height: 6.5rem; }
  .action-btn--mic img,
  .action-btn--hangup img { width: 2.5rem; }
  .scenario-actions { height: 7rem; gap: 1.5rem; }
}
