/* Base de KokoGo. Cada pantalla trae su diseño exacto en su propio código. */
html, body { margin: 0; height: 100%; background: #F2F2F7; }
body { overscroll-behavior: none; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
a { color: #16141F; } a:hover { color: #E8402F; }
button, a { -webkit-touch-callout: none; }
input, textarea, select { font-size: 16px; }

#app { position: fixed; inset: 0; overflow: hidden; background: #FFFFFF; }
/* En computadora se ve como un iPhone de 390 × 844 */
@media (min-width: 600px) and (min-height: 700px) {
  body { background: #E5E5EA; }
  #app { inset: auto; left: 50%; top: 50%; width: 390px; height: min(844px, calc(100vh - 32px)); transform: translate(-50%, -50%); border-radius: 44px; box-shadow: 0 30px 80px rgba(22, 20, 31, .25), 0 0 0 10px #16141F; }
}

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); box-sizing: border-box; animation: in .18s ease; }
.screen > .root { flex: 1; min-height: 0; }
.scroll { overflow-y: auto !important; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.hscroll { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap !important; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { flex-shrink: 0; }
.tabbar { padding-bottom: max(24px, env(safe-area-inset-bottom)) !important; height: auto !important; min-height: 84px; }
@keyframes in { from { opacity: .4; } }

/* Mantener presionado */
.hold { touch-action: none; -webkit-user-select: none; user-select: none; transition: transform .12s ease; }
.hold.on { transform: scale(.94); }

/* Hoja que sube desde abajo (mismo estilo de la app) */
.sheet { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; font-family: -apple-system, Inter, sans-serif; color: #16141F; }
.sheet .shade { position: absolute; inset: 0; background: rgba(22, 20, 31, .35); animation: fade .2s ease; }
.sheet .panel { position: relative; background: #FFFFFF; border-radius: 28px 28px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); max-height: 88%; overflow-y: auto; animation: up .26s cubic-bezier(.2, .8, .2, 1); box-sizing: border-box; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #D9D7E0; margin: 0 auto 14px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.toast { position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 60; background: #16141F; color: #FFFFFF; font: 600 15px -apple-system, Inter, sans-serif; padding: 12px 18px; border-radius: 22px; width: max-content; max-width: calc(100% - 48px); box-sizing: border-box; text-align: center; line-height: 1.35; animation: fade .2s ease; }

/* Campos de texto con el estilo de la app */
.field { height: 54px; border-radius: 27px; border: 1.5px solid #D9D7E0; background: #FFFFFF; padding: 0 20px; font: 500 17px -apple-system, Inter, sans-serif; color: #16141F; outline: none; width: 100%; box-sizing: border-box; }
.field:focus { border-color: #16141F; }
textarea.field { height: 96px; border-radius: 20px; padding: 14px 18px; resize: none; }
.legal h2 { font-size: 18px; margin: 22px 0 6px; }
.legal p, .legal li { font-size: 15px; line-height: 1.55; color: #5D5A6B; }
.legal ul { padding-left: 20px; margin: 6px 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes boxIn { from { opacity: 0; transform: scale(.92); } }
@keyframes handTap { 0%, 100% { transform: translate(10px, 14px) scale(1); } 45% { transform: translate(0, 0) scale(1); } 55% { transform: translate(0, 0) scale(.88); } 70% { transform: translate(0, 0) scale(1); } }

/* ---------- Conversación en vivo: botón, "escuchando" y Koko ---------- */
.kk-mic { position: relative; overflow: visible; transition: width .2s ease, height .2s ease, background .2s ease, transform .12s ease; }
.kk-mic.breathe:not(:disabled):not(.on):not(.live) { animation: kkBreathe 2s ease-in-out infinite alternate; }
.kk-mic.live { width: 88px !important; height: 88px !important; border-radius: 44px !important; background: #FF4D3D !important; animation: none; }
.kk-mic .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid #FF4D3D; opacity: 0; pointer-events: none; }
.kk-mic.live .ring { animation: kkRing 1.6s ease-out infinite; }
.kk-mic.live .ring + .ring { animation-delay: .8s; }
@keyframes kkBreathe { from { transform: scale(1); } to { transform: scale(1.12); } }
@keyframes kkRing { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.5); opacity: 0; } }
.kk-card { transition: background .2s ease, border-color .2s ease; }
.kk-card.live { background: #FFF5F3 !important; border: 3px solid #FF4D3D !important; padding: 23px !important; }
.kk-dot { display: inline-block; animation: kkCaret 1s steps(1) infinite; }
.kk-cursor { display: inline-block; width: 2px; height: .95em; margin-left: 3px; vertical-align: -0.1em; background: #FF4D3D; animation: kkCaret 1s steps(1) infinite; }
@keyframes kkCaret { 50% { opacity: 0; } }
.kk-bars { display: flex; align-items: center; gap: 3px; height: 30px; }
.kk-bars i { display: block; width: 4px; height: 4px; border-radius: 2px; background: #FF4D3D; transition: height .08s linear; }
.kk-tip { position: absolute; right: 0; bottom: calc(100% + 12px); background: #16141F; color: #FFFFFF; font-size: 13px; font-weight: 600; line-height: 1.3; padding: 8px 12px; border-radius: 12px; width: max-content; max-width: 220px; box-shadow: 0 6px 16px rgba(22, 20, 31, .25); animation: fade .2s ease; pointer-events: none; z-index: 3; }
.kk-tip::after { content: ''; position: absolute; right: 32px; top: 100%; border: 6px solid transparent; border-top-color: #16141F; }

.koko { position: absolute; left: 50%; top: 50%; width: 120px; height: 128px; margin: -53px 0 0 -60px; overflow: visible; pointer-events: none; z-index: 2; animation: kkFloat 2.4s ease-in-out infinite; }
.koko .look { transition: transform .25s ease; }
.koko[data-look="a"] .look { transform: translateY(4px); }
.koko[data-look="b"] .look { transform: translateY(-4px); }
.koko .ojos { transform-box: fill-box; transform-origin: center; animation: kkWink 4s infinite; }
.koko.talk .audifono { animation: kkPhones .5s steps(1) infinite; }
.koko .wave { opacity: 0; fill: none; stroke: #FF4D3D; stroke-width: 4; stroke-linecap: round; }
.koko[data-look="a"] .wave.a, .koko[data-look="b"] .wave.b { animation: kkSound 1.2s ease-out infinite; }
.koko .wave.w2 { animation-delay: .4s !important; }
.koko .wave.w3 { animation-delay: .8s !important; }
.koko .wave.a { --to: -14px; }
.koko .wave.b { --to: 14px; }
@keyframes kkFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes kkWink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes kkPhones { 0% { fill: #FFD23F; } 50% { fill: #FFF1A6; } }
@keyframes kkSound { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: .9; } 100% { opacity: 0; transform: translateY(var(--to)); } }
@media (prefers-reduced-motion: reduce) { .koko, .koko *, .kk-mic, .kk-mic .ring { animation: none !important; } }
/* Conectando: coral clarito con un círculo girando (en cuanto escucha, pasa al coral normal) */
.kk-mic.live.connecting { background: #FFB3A8 !important; box-shadow: 0 8px 18px rgba(255, 77, 61, 0.2) !important; }
.kk-mic.connecting .ring { animation: none !important; }
.kk-spin { display: block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.45); border-top-color: #FFFFFF; animation: spin .8s linear infinite; box-sizing: border-box; }
/* Tarjetas del traductor: el texto se desliza en su propia área; el degradado avisa que hay más abajo */
.kk-card { --card-bg: #FFFFFF; }
.kk-card.live { --card-bg: #FFF5F3; }
.kk-scroll { scrollbar-width: none; }
.kk-scroll::-webkit-scrollbar { display: none; }
.kk-fade { position: absolute; left: 0; right: 0; bottom: 0; height: 32px; pointer-events: none; opacity: 0; transition: opacity .2s ease; background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--card-bg)); }
