/* ============================================================
   v2 — Interfaz de entrevista (rediseño Figma) con orbe waveform
   ============================================================ */

/* ---- Tipografía Sundry (del repo) ---- */
@font-face {
    font-family: 'Sundry';
    src: url('sundry/Sundry-Regular.otf') format('opentype');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Sundry';
    src: url('sundry/Sundry-Medium.otf') format('opentype');
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Sundry';
    src: url('sundry/Sundry-Bold.otf') format('opentype');
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Sundry';
    src: url('sundry/Sundry-Super.otf') format('opentype');
    font-weight: 800; font-style: normal; font-display: swap;
}

/* ---- Paleta ---- */
:root {
    --bg-yellow:   #E9FA4D;
    --navy:        #0A1A4F;
    --blue:        #2C57FE;
    --blue-dark:   #1E3FC4;
    --red:         #F0392B;
    --white:       #FFFFFF;
    --gray-ctrl:   #2C2F45;
    --subtitle-bg: rgba(255, 255, 255, 0.28);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    height: 100%;
    font-family: 'Sundry', system-ui, sans-serif;
    background: var(--bg-yellow);
    color: var(--navy);
}

/* Contenedor: mobile-first, centrado como columna en pantallas grandes */
.screen {
    position: relative;
    width: 100%;
    max-width: 430px;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    background: var(--bg-yellow);
}

/* ---- Header ---- */
.v2-header {
    padding-top: env(safe-area-inset-top);
    text-align: center;
    position: relative;
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 40px;
}
.header-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.2px;
}
.header-logo {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
}
.header-status {
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
}
.live-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: #25D366;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6);
    animation: livePulse 2s ease-out infinite;
}
@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}
.live-sep  { opacity: 0.5; }
.live-timer { font-variant-numeric: tabular-nums; }

/* ---- Fila de pills ---- */
.pills-row {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.pill-question {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--blue);
    color: var(--white);
    font-weight: 700;
    font-size: 16px;
    padding: 12px 20px;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(44, 87, 254, 0.30);
}
.pill-spark { flex: none; }
.pill-link {
    color: var(--blue);
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    white-space: nowrap;
}

/* ---- Cámara del candidato (PiP) ---- */
.user-cam {
    position: absolute;
    top: 132px;
    right: 20px;
    width: 116px;
    height: 150px;
    border-radius: 18px;
    overflow: hidden;
    border: 4px solid var(--bg-yellow);
    background: #11131f;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 5;
}
.user-cam video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: none;
}
.user-cam.has-video video { display: block; }
.user-cam-placeholder {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.55);
}
.user-cam.has-video .user-cam-placeholder { display: none; }

/* ---- Orbe visualizador ---- */
.orb-card {
    position: relative;
    margin-top: 22px;
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: 28px;
    overflow: hidden;
    background: radial-gradient(120% 120% at 50% 40%, #1A0B3A 0%, #0A0420 70%, #060214 100%);
    /* borde glow morado del Figma */
    box-shadow:
        0 0 0 2px rgba(176, 64, 240, 0.55),
        0 0 36px rgba(176, 64, 240, 0.45),
        0 18px 40px rgba(0, 0, 0, 0.30);
}
.orb-canvas {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    display: block;
}
.orb-tag {
    position: absolute;
    left: 16px; bottom: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--white);
    padding: 7px 14px 7px 10px;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.orb-tag-logo { width: 20px; height: 20px; }
.orb-tag-bars { color: var(--blue); }
.orb-tag-name { font-weight: 700; font-size: 15px; color: var(--navy); }

/* Barras del tag "Candy": animación de ecualizador cuando está hablando */
.orb-tag-bars rect {
    transform-box: fill-box;
    transform-origin: center;
    transform: scaleY(0.55);
    transition: transform 0.2s ease;
}
.orb-tag.speaking .orb-tag-bars rect {
    animation: tagEq 0.7s ease-in-out infinite;
}
.orb-tag.speaking .orb-tag-bars rect:nth-child(1) { animation-delay: 0.00s; }
.orb-tag.speaking .orb-tag-bars rect:nth-child(2) { animation-delay: 0.18s; }
.orb-tag.speaking .orb-tag-bars rect:nth-child(3) { animation-delay: 0.36s; }
.orb-tag.speaking .orb-tag-bars rect:nth-child(4) { animation-delay: 0.18s; }
.orb-tag.speaking .orb-tag-bars rect:nth-child(5) { animation-delay: 0.00s; }
@keyframes tagEq {
    0%, 100% { transform: scaleY(0.4); }
    50%      { transform: scaleY(1); }
}

/* ---- Subtítulos ---- */
.subtitles-card {
    margin-top: 22px;
    background: var(--subtitle-bg);
    border-radius: 22px;
    padding: 20px 22px;
}
.subtitles-label {
    font-size: 13px;
    font-weight: 500;
    color: rgba(10, 26, 79, 0.6);
    margin-bottom: 6px;
}
.subtitles-text {
    font-size: 19px;
    line-height: 1.3;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.2px;
    max-height: 5.2em;          /* ~4 líneas; el resto va scrolleando */
    overflow: hidden;
}
/* Palabra a palabra: las ya dichas en navy, las pendientes atenuadas */
.subtitles-text .said    { color: var(--navy); }
.subtitles-text .pending { color: rgba(10, 26, 79, 0.32); }

/* ---- Barra de controles ---- */
.controls-bar {
    margin-top: auto;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--navy);
    border-radius: 999px;
    padding: 12px 16px;
    box-shadow: 0 12px 30px rgba(10, 26, 79, 0.35);
}
.ctrl {
    flex: none;
    width: 52px; height: 52px;
    border: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease;
}
.ctrl:active { transform: scale(0.92); }
.ctrl-yellow { background: var(--bg-yellow); color: var(--blue); }
.ctrl-gray   { background: var(--gray-ctrl); color: var(--bg-yellow); }
.ctrl-red    { background: var(--red); color: var(--white); }
.ctrl.is-off { filter: grayscale(0.5) brightness(0.85); opacity: 0.7; }

.ctrl-skip {
    flex: 1;
    height: 52px;
    border: none;
    border-radius: 999px;
    background: var(--white);
    color: var(--navy);
    font-family: inherit;
    font-weight: 700;
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.12s ease;
}
/* Espaciador izquierdo del mismo ancho que el chevron: equilibra el grupo
   [espaciador][texto][chevron] para que el TEXTO quede centrado de verdad. */
.ctrl-skip::before {
    content: "";
    width: 18px;
    flex: none;
}
.ctrl-skip svg { flex: none; }
.ctrl-skip:active { transform: scale(0.97); }
.ctrl-divider {
    width: 1.5px;
    height: 34px;
    background: rgba(255, 255, 255, 0.22);
    flex: none;
}

/* Móviles estrechos: compactar la barra para que el colgar caiga DENTRO
   de la barra azul con margen simétrico. Los círculos no pueden encoger
   (deben ser redondos), así que reducimos tamaños/gaps según el ancho. */
@media (max-width: 430px) {
    .screen { padding-left: 14px; padding-right: 14px; }
    .controls-bar { gap: 7px; padding: 8px 8px; }
    .ctrl { width: 46px; height: 46px; }
    .ctrl-skip { height: 46px; font-size: 15px; }
    .ctrl-skip::before { width: 15px; }
    .ctrl-skip svg { width: 16px; height: 16px; }
    .ctrl-divider { height: 28px; }
}
@media (max-width: 390px) {
    .screen { padding-left: 12px; padding-right: 12px; }
    .controls-bar { gap: 6px; padding: 7px 7px; }
    .ctrl { width: 43px; height: 43px; }
    .ctrl-skip { height: 43px; font-size: 14px; }
    .ctrl-skip::before { width: 13px; }
}
@media (max-width: 340px) {
    .controls-bar { gap: 5px; }
    .ctrl { width: 40px; height: 40px; }
    .ctrl-skip { height: 40px; font-size: 13px; }
}

/* ---- Overlay de inicio (datos del candidato) ---- */
.start-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--bg-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.start-overlay.hidden { display: none; }
.start-card {
    width: 100%;
    max-width: 360px;
    text-align: center;
}
.start-logo { width: 56px; height: 56px; margin-bottom: 14px; }
.start-title { font-size: 26px; font-weight: 800; color: var(--navy); letter-spacing: -0.4px; }
.start-sub { margin-top: 6px; font-size: 15px; color: rgba(10, 26, 79, 0.6); font-weight: 500; }
.start-instructions {
    margin: 16px auto 0;
    max-width: 300px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--navy);
    font-weight: 700;
    text-align: center;
}
.start-instructions[hidden] { display: none; }

/* ---- Overlay de pausa (control desde la app) ---- */
.pause-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    /* Semi-transparente: se ve la entrevista por debajo, con desenfoque suave. */
    background: rgba(10, 26, 79, 0.55);
    -webkit-backdrop-filter: blur(7px);
    backdrop-filter: blur(7px);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}
.pause-overlay.visible { display: flex; }
.pause-card { max-width: 320px; }
.pause-icon { color: var(--bg-yellow); margin-bottom: 16px; }
.pause-icon[hidden] { display: none; }
.pause-count {
    font-size: 76px;
    font-weight: 800;
    line-height: 1;
    color: var(--bg-yellow);
    margin-bottom: 14px;
    font-variant-numeric: tabular-nums;
}
.pause-count[hidden] { display: none; }
.pause-title { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; }
.pause-sub { margin-top: 10px; font-size: 15px; line-height: 1.5; font-weight: 500; opacity: 0.85; }
.start-form { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.start-form input {
    width: 100%;
    height: 52px;
    border: 2px solid rgba(10, 26, 79, 0.15);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.45);
    padding: 0 18px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    color: var(--navy);
    outline: none;
    transition: border-color 0.15s ease;
}
.start-form input::placeholder { color: rgba(10, 26, 79, 0.4); }
.start-form input:focus { border-color: var(--blue); }
.start-btn {
    margin-top: 6px;
    height: 54px;
    border: none;
    border-radius: 999px;
    background: var(--blue);
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: 17px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(44, 87, 254, 0.30);
    transition: transform 0.12s ease;
}
.start-btn:active { transform: scale(0.97); }
.start-btn:disabled { opacity: 0.6; cursor: default; }
.start-error { margin-top: 12px; color: var(--red); font-size: 14px; font-weight: 600; min-height: 18px; }

/* En desktop: marco tipo teléfono para que no se vea estirado */
@media (min-width: 600px) {
    body {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 24px;
    }
    .screen {
        min-height: auto;
        height: min(880px, 94vh);
        border-radius: 40px;
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
        overflow: hidden;
    }
}
