/* ═══════════════════════════════════════════════════
   Pegasus Voice Tester — Zingly
   Aesthetic: Clean, modern, white/cream/blue
   ═══════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
    --bg:         #f8f7f4;
    --bg-warm:    #f3f1ec;
    --surface:    #ffffff;
    --surface-up: #ffffff;
    --surface-hi: #f0eeea;

    --border:     rgba(0,0,0,.06);
    --border-vis: rgba(0,0,0,.10);
    --border-hi:  rgba(0,0,0,.14);

    --txt:        #1a1a1a;
    --txt-2:      #6b6b6b;
    --txt-3:      #9a9a9a;

    --accent:     #2563eb;
    --accent-light: #3b82f6;
    --accent-dim: rgba(37,99,235,.06);
    --accent-mid: rgba(37,99,235,.12);

    --green:      #16a34a;
    --green-dim:  rgba(22,163,74,.06);
    --red:        #dc2626;
    --red-dim:    rgba(220,38,38,.05);
    --orange:     #ea580c;

    --gold:       #d97706;
    --gold-dim:   rgba(217,119,6,.06);

    --shadow-sm:  0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
    --shadow-md:  0 4px 12px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.04);
    --shadow-lg:  0 8px 24px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
    --shadow-card-hover: 0 12px 32px rgba(37,99,235,.08), 0 4px 12px rgba(0,0,0,.06);

    --r:          16px;
    --r-s:        12px;
    --r-xs:       8px;
    --r-full:     999px;
    --ease:       cubic-bezier(.4,0,.2,1);
    --spring:     cubic-bezier(.175,.885,.32,1.275);
}

/* ── Reset ── */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box }

/* ── Body ── */
body {
    font-family: -apple-system, 'Inter', 'SF Pro Display', 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--txt);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Grain — disabled ── */
.grain { display: none }

/* ══ PIN Gate ══ */
.pin-gate {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.pin-box {
    text-align: center;
    max-width: 380px;
    width: 100%;
    padding: 48px 32px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    margin: 0 24px;
}
.pin-logo {
    height: 28px;
    width: auto;
    opacity: .6;
    margin-bottom: 28px;
}
.pin-box h2 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--txt);
    margin-bottom: 6px;
}
.pin-box > p {
    font-size: 14px;
    color: var(--txt-3);
    margin-bottom: 28px;
}
.pin-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg);
    border: 1.5px solid var(--border-vis);
    border-radius: var(--r-s);
    color: var(--txt);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
    margin-bottom: 16px;
    text-align: center;
    letter-spacing: .12em;
}
.pin-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.pin-input::placeholder {
    color: var(--txt-3);
    letter-spacing: .02em;
}
.btn-pin {
    width: 100%;
    padding: 14px;
    margin-bottom: 16px;
}
.pin-error {
    color: var(--red);
    font-size: 13px;
    font-weight: 500;
}

/* ── App shell ── */
.app {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 40px 64px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* ══ Top bar ══ */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.zingly-logo {
    height: 24px;
    width: auto;
    opacity: .6;
    transition: opacity .3s var(--ease);
}
.zingly-logo:hover { opacity: 1 }

.topbar-center { flex: 1; text-align: center }
.topbar-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--txt-3);
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    box-shadow: var(--shadow-sm);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}
.status-dot.connecting {
    background: var(--orange);
    animation: pulse-glow 1.2s ease-in-out infinite;
}
.status-dot.active {
    background: var(--green);
    animation: pulse-glow 1.6s ease-in-out infinite;
}
.status-dot.error {
    background: var(--red);
}
@keyframes pulse-glow {
    0%,100% { opacity: 1 }
    50% { opacity: .3 }
}

.status-text {
    font-size: 12px;
    color: var(--txt-2);
    font-weight: 500;
    letter-spacing: .01em;
}

/* ══ Hero ══ */
.hero {
    padding: 64px 0 48px;
    text-align: center;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border-vis);
    border-radius: var(--r-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--txt-2);
    letter-spacing: .01em;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}
.hero-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse-glow 2s ease-in-out infinite;
    flex-shrink: 0;
}

.hero h1 {
    font-size: clamp(42px, 6vw, 64px);
    font-weight: 800;
    letter-spacing: -.045em;
    line-height: 1.05;
    color: var(--txt);
    margin-bottom: 20px;
    font-family: 'Inter', -apple-system, 'SF Pro Display', sans-serif;
    text-wrap: balance;
}
.hero h1 em {
    font-style: normal;
    display: inline;
    background: linear-gradient(135deg, var(--accent) 0%, #818cf8 50%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradient-shift 6s ease infinite;
}
@keyframes gradient-shift {
    0%,100% { background-position: 0% 50% }
    50% { background-position: 100% 50% }
}

.hero-sub {
    max-width: 440px;
    margin: 0 auto;
    font-size: 15px;
    color: var(--txt-2);
    line-height: 1.7;
    font-weight: 400;
    letter-spacing: -.005em;
}

/* ══ Voice Grid ══ */
.voice-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.tier-label {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 6px 0 2px;
    color: var(--txt-3);
}
.tier-label:not(:first-child) {
    margin-top: 8px;
}
.tier-label-primary { color: var(--accent) }
.tier-label-secondary { color: var(--gold) }
.tier-label-alternative { color: var(--txt-3) }

/* ── Voice Card ── */
.voice-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    padding: 28px 24px 24px;
    cursor: pointer;
    transition: all .25s var(--ease);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.voice-card:hover {
    border-color: var(--accent-mid);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
}
.voice-card:active { transform: translateY(0); transition-duration: .1s }

.voice-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1.5px var(--accent), var(--shadow-md);
    background: linear-gradient(180deg, rgba(37,99,235,.02) 0%, var(--surface) 100%);
}
.voice-card.has-rating { border-color: var(--border) }
.voice-card.disabled {
    opacity: .4;
    pointer-events: none;
}

/* card interior */
.voice-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}
.voice-name {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--txt);
}

.voice-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--r-xs);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.voice-badge.recommended,
.voice-badge.tier-primary {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-mid);
}
.voice-badge.tier-secondary {
    background: var(--gold-dim);
    color: var(--gold);
    border: 1px solid rgba(217,119,6,.15);
}
.voice-badge.tier-alternative {
    background: rgba(0,0,0,.03);
    color: var(--txt-3);
    border: 1px solid var(--border-vis);
}
.voice-badge.female {
    background: rgba(0,0,0,.03);
    color: var(--txt-2);
}
.voice-badge.male {
    background: rgba(0,0,0,.03);
    color: var(--txt-2);
}

.voice-gender {
    font-size: 13px;
    color: var(--txt-3);
    font-weight: 400;
    margin-bottom: 20px;
}

.voice-card-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--txt-2);
    border-top: 1px solid var(--border);
    transition: color .3s var(--ease);
}
.voice-card:hover .voice-card-action { color: var(--accent) }
.voice-card.active .voice-card-action {
    color: var(--red);
    border-top-color: var(--red-dim);
}
.voice-card.active:hover {
    border-color: var(--red);
    box-shadow: 0 0 0 1.5px var(--red), var(--shadow-md);
}
.voice-card-action .icon { font-size: 14px; line-height: 1 }

/* star rating on card */

/* ══ TTS Settings ══ */
.voice-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}


/* ══ Call Panel ══ */
.call-panel {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    padding: 56px 48px;
    text-align: center;
    margin-top: 32px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
.call-panel::after {
    content: '';
    position: absolute;
    top: -40%;
    left: 10%;
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse, rgba(37,99,235,.04) 0%, transparent 70%);
    pointer-events: none;
}
.call-panel.speaking::after {
    background: radial-gradient(ellipse, rgba(22,163,74,.04) 0%, transparent 70%);
}

.call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 44px;
    position: relative;
    z-index: 1;
}
.call-voice-name {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--txt);
}
.call-voice-gender {
    font-size: 13px;
    color: var(--txt-3);
    margin-top: 2px;
}
.call-timer {
    font-size: 36px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.03em;
    color: var(--txt);
}

/* Pulse visualizer */
.call-visualizer {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 36px;
    z-index: 1;
}
.pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid var(--accent);
    opacity: 0;
    animation: ring-expand 2.4s ease-out infinite;
}
.pulse-ring.delay { animation-delay: 1.2s }
.pulse-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 40px rgba(37,99,235,.2);
    animation: dot-breathe 2.4s ease-in-out infinite;
}

.call-panel.listening .pulse-dot {
    background: var(--accent);
    box-shadow: 0 0 40px rgba(37,99,235,.2);
}
.call-panel.listening .pulse-ring { border-color: var(--accent) }
.call-panel.speaking .pulse-dot {
    background: var(--green);
    box-shadow: 0 0 40px rgba(22,163,74,.2);
    animation-duration: 1.2s;
}
.call-panel.speaking .pulse-ring {
    border-color: var(--green);
    animation-duration: 1.4s;
}

@keyframes ring-expand {
    0% { transform: scale(.5); opacity: .35 }
    100% { transform: scale(1.4); opacity: 0 }
}
@keyframes dot-breathe {
    0%,100% { transform: scale(1); opacity: 1 }
    50% { transform: scale(1.08); opacity: .85 }
}

.call-state-text {
    font-size: 15px;
    color: var(--txt-2);
    font-weight: 400;
    margin-bottom: 36px;
    position: relative;
    z-index: 1;
}
.call-actions {
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* ══ Buttons ══ */
.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: var(--r-full);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s var(--ease);
    letter-spacing: -.005em;
}
.btn:hover {
    background: var(--accent-light);
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(37,99,235,.2);
}
.btn:active { transform: scale(.98); transition-duration: .1s }
.btn:disabled { opacity: .3; cursor: not-allowed; transform: none }

.btn-end {
    background: var(--red);
    padding: 14px 48px;
    font-size: 15px;
    font-weight: 500;
}
.btn-end:hover {
    background: #ef4444;
    box-shadow: 0 4px 16px rgba(220,38,38,.2);
}

.btn-skip {
    background: transparent;
    color: var(--txt-2);
    border: 1.5px solid var(--border-vis);
    padding: 10px 28px;
}
.btn-skip:hover {
    border-color: var(--border-hi);
    color: var(--txt);
    background: var(--surface-hi);
}

/* ══ Rating ══ */
.rating-panel {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    padding: 56px 48px;
    text-align: center;
    margin-top: 32px;
    box-shadow: var(--shadow-md);
}
.rating-panel h3 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--txt);
    margin-bottom: 4px;
}
.rating-voice-name {
    font-size: 14px;
    color: var(--txt-3);
    margin-bottom: 32px;
}

.stars {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}
.star-btn {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--txt-3);
    transition: all .15s var(--spring);
    padding: 4px;
    line-height: 1;
}
.star-btn:hover { transform: scale(1.25) }
.star-btn.filled { color: var(--gold) }

.feedback-input {
    width: 100%;
    max-width: 360px;
    margin: 16px auto 20px;
    display: block;
    padding: 12px 14px;
    font-size: 13px;
    font-family: inherit;
    color: var(--txt);
    background: var(--bg);
    border: 1.5px solid var(--border-vis);
    border-radius: var(--r-xs);
    resize: vertical;
    outline: none;
    transition: border-color .2s var(--ease);
}
.feedback-input:focus {
    border-color: var(--accent-mid);
}
.feedback-input::placeholder {
    color: var(--txt-3);
}

.rating-actions { display: flex; justify-content: center; gap: 12px }

.btn-submit {
    background: var(--accent);
    padding: 12px 36px;
    font-size: 15px;
    font-weight: 500;
}
.btn-submit:hover {
    background: #2563eb;
    box-shadow: 0 4px 16px rgba(37,99,235,.2);
}

/* ══ Error Banner ══ */
.error-banner {
    background: var(--red-dim);
    color: var(--red);
    padding: 14px 20px;
    border-radius: var(--r-s);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(220,38,38,.1);
}
.error-banner .dismiss {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--red);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    opacity: .5;
    transition: opacity .2s;
}
.error-banner .dismiss:hover { opacity: 1 }

/* ══ Footer ══ */
footer {
    margin-top: auto;
    padding: 0 0 8px;
}
.footer-rule {
    height: 1px;
    background: var(--border);
    margin-bottom: 24px;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
.footer-logo { height: 16px; width: auto; opacity: .3 }
.footer-text {
    font-size: 11px;
    color: var(--txt-3);
    letter-spacing: .01em;
}

/* ══ Utility ══ */
.hidden { display: none !important }

/* ══ Animations — staggered entrance ══ */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(12px) }
    to { opacity: 1; transform: translateY(0) }
}
.voice-card {
    animation: fade-up .5s var(--ease) both;
}
.voice-card:nth-child(1) { animation-delay: .04s }
.voice-card:nth-child(2) { animation-delay: .08s }
.voice-card:nth-child(3) { animation-delay: .12s }
.voice-card:nth-child(4) { animation-delay: .16s }
.voice-card:nth-child(5) { animation-delay: .20s }
.voice-card:nth-child(6) { animation-delay: .24s }

/* ══ Responsive ══ */
@media (max-width: 768px) {
    .voice-grid { grid-template-columns: repeat(2, 1fr); }
    .app { padding: 0 24px 48px }
    .hero h1 { font-size: 36px }
    .hero { padding: 48px 0 36px; }
    .call-panel, .rating-panel { padding: 36px 24px }
    .topbar-center { display: none }
    .pin-box { padding: 36px 24px }
}
@media (max-width: 480px) {
    .voice-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 30px; }
    .call-timer { font-size: 24px }
    .call-panel, .rating-panel { padding: 32px 20px }
    .hero-eyebrow { gap: 8px }
    .footer-inner { flex-direction: column; gap: 8px }
}
