:root {
  --bg-window: #12141c;
  --bg-panel: #1b1f2a;
  --text-main: #ffffff;
  --accent: #4fc3f7;
  --color-idle: #4fc3f7;
  --color-listening: #66bb6a;
  --color-thinking: #ffb74d;
  --color-speaking: #4fc3f7;
  --color-success: #81c784;
  --color-retry: #ff8a65;
}

/* Sin esto, [hidden] no gana contra .screen{display:flex} de abajo: el
   navegador SÍ tiene una regla [hidden]{display:none} por defecto, pero
   cualquier regla de autor con la misma o mayor prioridad la pisa, así que
   los <section hidden> se seguían viendo apilados uno debajo del otro. */
[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg-window);
  color: var(--text-main);
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  overflow-x: hidden;
}

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.waiting-card {
  background: var(--bg-panel);
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.waiting-card h1 {
  color: var(--accent);
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.waiting-card p {
  font-size: 1.2rem;
  line-height: 1.5;
}

.waiting-spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  border-radius: 50%;
  border: 8px solid rgba(79, 195, 247, 0.25);
  border-top-color: var(--accent);
  animation: spin 1.1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  text-align: left;
  font-size: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-list li {
  background: rgba(79, 195, 247, 0.1);
  border-radius: 12px;
  padding: 10px 16px;
}

#screen-main {
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
  padding: 32px 16px 48px;
}

.camera-notice {
  background: rgba(255, 138, 101, 0.15);
  border: 1px solid var(--color-retry);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.95rem;
  max-width: 600px;
  text-align: center;
}

.face-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Cara de KIPI --- */
.kipi-face {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: var(--color-idle);
  transition: background-color 0.4s ease;
  box-shadow: 0 0 40px rgba(79, 195, 247, 0.35);
}

.kipi-eye {
  position: absolute;
  top: 70px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-window);
  transition: transform 0.2s ease;
}

.kipi-eye--left { left: 62px; }
.kipi-eye--right { right: 62px; }

.kipi-mouth {
  position: absolute;
  left: 50%;
  top: 130px;
  width: 90px;
  height: 45px;
  transform: translateX(-50%);
  border-bottom: 8px solid var(--bg-window);
  border-radius: 0 0 50px 50px;
  transition: all 0.25s ease;
}

.kipi-sparkle {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.6rem;
}

/* Estado: idle -> ya son los valores por defecto */
.kipi-face--idle { background: var(--color-idle); }
.kipi-face--idle .kipi-mouth {
  border-bottom: 8px solid var(--bg-window);
  border-top: none;
  border-radius: 0 0 50px 50px;
  height: 30px;
}

/* Estado: listening -> verde, ojos pulsando */
.kipi-face--listening { background: var(--color-listening); }
.kipi-face--listening .kipi-eye {
  animation: kipi-pulse-eye 1s ease-in-out infinite;
}
.kipi-face--listening .kipi-eye--right {
  animation-delay: 0.15s;
}
@keyframes kipi-pulse-eye {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.45); }
}

/* Estado: thinking -> naranja, boca de puntos animados (el texto de los puntos
   se actualiza desde app.js, ciclando "." -> ".." -> "...") */
.kipi-face--thinking { background: var(--color-thinking); }
.kipi-face--thinking .kipi-mouth {
  border: none;
  height: 30px;
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  color: var(--bg-window);
  letter-spacing: 4px;
}

/* Estado: speaking -> cian, boca ovalada abre/cierra */
.kipi-face--speaking { background: var(--color-speaking); }
.kipi-face--speaking .kipi-mouth {
  border: none;
  background: var(--bg-window);
  border-radius: 50%;
  height: 20px;
  width: 55px;
  animation: kipi-talk 0.4s ease-in-out infinite;
}
@keyframes kipi-talk {
  0%, 100% { height: 12px; }
  50% { height: 38px; }
}

/* Estado: success -> verde claro, sonrisa */
.kipi-face--success { background: var(--color-success); }
.kipi-face--success .kipi-mouth {
  border: none;
  border-bottom: 8px solid var(--bg-window);
  border-radius: 0 0 55px 55px;
  height: 40px;
  width: 100px;
}

/* Estado: retry -> naranja rojizo, boca invertida (animosa) */
.kipi-face--retry { background: var(--color-retry); }
.kipi-face--retry .kipi-mouth {
  border: none;
  border-top: 8px solid var(--bg-window);
  border-radius: 55px 55px 0 0;
  height: 20px;
  top: 145px;
}

.subtitle {
  font-size: 1.5rem;
  text-align: center;
  max-width: 700px;
  min-height: 2.2em;
}

.activity-view {
  width: 100%;
  max-width: 700px;
  background: var(--bg-panel);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
}

.activity-instruction {
  font-size: 1.6rem;
  margin: 0 0 16px;
}

.activity-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.activity-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.5);
}

.activity-shape {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-shape svg {
  width: 100%;
  height: 100%;
}

.manual-response {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: center;
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 16px;
  max-width: 500px;
}

.manual-response label {
  font-size: 1rem;
}

.manual-response input {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
}

.kipi-button {
  background: var(--accent);
  color: #12141c;
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kipi-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(79, 195, 247, 0.4);
}

.kipi-button--big {
  font-size: 1.5rem;
  padding: 18px 48px;
}

.kipi-button--small {
  font-size: 1rem;
  padding: 10px 20px;
}
