/* AI Personality Builder interface styles.
   Covers the shared shell, screen layouts, and motion/audio companion visuals. */

:root {
    --bg: #070A12;
    --panel: rgba(255, 255, 255, 0.06);
    --panel-2: rgba(255, 255, 255, 0.10);
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.68);
    --line: rgba(255, 255, 255, 0.14);
    --accent: #72F7D6;
    /* soft utopian mint */
    --accent-2: #7AA7FF;
    /* calm blue */
    --danger: #FF6B6B;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
    --radius: 18px;
    --radius-2: 24px;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: radial-gradient(1200px 900px at 20% 10%, rgba(122, 167, 255, 0.16), transparent 60%),
        radial-gradient(900px 900px at 80% 30%, rgba(114, 247, 214, 0.10), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    overflow: hidden;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

canvas {
    display: block;
}

/* Shared shell */

.ui {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 32px 18px 76px;
    overflow: hidden;
}

.app-footer {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 45;
    width: min(92vw, 980px);
    box-sizing: border-box;
    text-align: center;
    pointer-events: none;
    color: rgba(255, 255, 255, 0.42);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panel {
    position: relative;
    z-index: 1;
    width: min(980px, 92vw);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.05));
    border: 1px solid var(--line);
    border-radius: var(--radius-2);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
}

.heartbeat-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(90vw, 1080px);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%) scale(0.86);
    border-radius: 999px;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    background:
        radial-gradient(circle, rgba(114, 247, 214, 0.28) 0%, rgba(114, 247, 214, 0.18) 18%, rgba(122, 167, 255, 0.14) 36%, rgba(122, 167, 255, 0.06) 54%, transparent 74%);
    filter: blur(34px);
}

.heartbeat-glow.heartbeat-glow-pulse {
    animation: heartbeatGlowPulse 430ms ease-out;
}

@keyframes heartbeatGlowPulse {
    0% {
        opacity: 0.1;
        transform: translate(-50%, -50%) scale(0.86);
    }

    35% {
        opacity: 0.44;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

.opening-intro {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    background: rgba(4, 6, 12, 1);
    opacity: 1;
    transition: opacity 1000ms ease;
}

.opening-intro-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    filter: blur(10px);
    transition: opacity 900ms ease, transform 900ms ease, filter 900ms ease;
}

.opening-intro-visible .opening-intro-copy {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

.opening-intro-exit {
    opacity: 0;
    pointer-events: none;
}

.opening-intro-exit .opening-intro-copy {
    opacity: 0;
    transform: translateY(-8px) scale(1.02);
    filter: blur(12px);
}

.opening-intro-title {
    width: min(92vw, 960px);
    text-align: center;
    color: rgba(255, 255, 255, 0.96);
    font-size: clamp(42px, 7vw, 92px);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-shadow: 0 0 36px rgba(114, 247, 214, 0.18);
}

.opening-intro-sub {
    text-align: center;
    color: rgba(255, 255, 255, 0.58);
    font-size: clamp(12px, 1.8vw, 16px);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Shared panel structure */

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 14px 24px;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.brand h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 0 24px rgba(114, 247, 214, 0.12);
}

.brand .sub {
    font-size: 13px;
    color: var(--muted);
}

.badge {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding-left: 14px;
    border-left: 1px solid var(--line);
    color: rgba(255, 255, 255, 0.62);
    align-self: stretch;
    display: flex;
    align-items: center;
}

.panel-body {
    padding: 22px 24px 24px 24px;
}

.row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.title-copy {
    margin-bottom: 28px;
}

.title-intro {
    text-align: center;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.consent-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    margin-left: auto;
    margin-right: auto;
}

p {
    margin: 10px 0;
    color: var(--muted);
    line-height: 1.55;
}

.hr {
    height: 1px;
    background: var(--line);
    margin: 18px 0;
}

.btn {
    appearance: none;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.92);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
    user-select: none;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.20);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn.primary {
    border-color: rgba(114, 247, 214, 0.35);
    background: rgba(114, 247, 214, 0.12);
}

.btn.primary:hover {
    background: rgba(114, 247, 214, 0.18);
    border-color: rgba(114, 247, 214, 0.50);
}

.checkbox {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 0;
}

.checkbox + .checkbox {
    padding-top: 4px;
}

.checkbox label {
    color: rgba(255, 255, 255, 0.82);
    font-size: 13px;
    line-height: 1.35;
}

/* Robot registration popup */

.popup-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    box-sizing: border-box;
    overflow-y: auto;
    background: rgba(7, 10, 18, 0.58);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 20;
}

.popup-card {
    width: min(480px, calc(100vw - 48px));
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.05));
    box-shadow: var(--shadow);
    padding: 22px;
}

.popup-title {
    font-size: 18px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.96);
}

.popup-body {
    margin: 10px 0 0;
    color: rgba(255, 255, 255, 0.76);
}

.popup-field {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.popup-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.82);
}

.popup-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.92);
    padding: 12px 14px;
    font-size: 14px;
    outline: none;
}

.popup-input::placeholder {
    color: rgba(255, 255, 255, 0.36);
}

.popup-input:focus {
    border-color: rgba(114, 247, 214, 0.42);
    box-shadow: 0 0 0 3px rgba(114, 247, 214, 0.08);
}

.popup-error {
    min-height: 18px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--danger);
}

.popup-actions {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* Shared progress and loader states */

.progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    width: 100%;
    margin-bottom: 10px;
}

.progress .bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--line);
    overflow: hidden;
}

.progress .fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(122, 167, 255, 0.65), rgba(114, 247, 214, 0.65));
}

.progress .label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.78);
    text-align: center;
}

.loader {
    margin-top: 14px;
    width: 100%;
    border-radius: 999px;
    height: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--line);
    overflow: hidden;
}

.loader .loader-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(122, 167, 255, 0.65), rgba(114, 247, 214, 0.65));
    transition: width 60ms linear;
}

.processing-meta {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: rgba(255, 255, 255, 0.70);
    font-size: 12px;
}

.task-list {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-line {
    font-size: 14px;
    line-height: 1.45;
    transition: color 180ms ease, opacity 180ms ease;
}

.task-line.task-pending {
    color: rgba(255, 255, 255, 0.42);
}

.task-line.task-active {
    color: rgba(255, 255, 255, 0.92);
}

.task-line.task-complete {
    color: rgba(255, 255, 255, 0.92);
}

/* Scenario screen */

.question {
    margin-top: 20px;
    font-size: 22px;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.25;
    text-align: center;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.question-main {
    line-height: 1.25;
}

.question-robot {
    margin-top: 14px;
    line-height: 1.25;
}

.robot-name {
    color: var(--accent);
    font-weight: 700;
}

.options {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.option-card {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    display: grid;
    place-items: center;
    min-height: 0;
    padding: 16px 24px;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
    position: relative;
    overflow: hidden;
}

.option-card:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.option-card.selected {
    border-color: rgba(114, 247, 214, 0.55);
    background: rgba(114, 247, 214, 0.12);
}

.option-card .txt {
    text-align: center;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.90);
    line-height: 1.35;
    max-width: 720px;
}

.footer {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.center-footer {
    justify-content: center;
}

.small {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.70);
}

/* Results and summary copy */

.profile-copy {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
    padding: 22px 24px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    text-align: center;
}

.profile-copy p {
    margin: 0;
}

.profile-paragraph {
    color: rgba(255, 255, 255, 0.84);
    font-size: 16px;
    line-height: 1.7;
    text-wrap: pretty;
}

.profile-summary {
    color: rgba(255, 255, 255, 0.78);
}

.profile-paragraph strong {
    color: var(--accent);
    font-weight: 700;
}

@media (max-width: 760px) {
    .options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .popup-overlay {
        padding: 16px;
    }

    .popup-card {
        width: 100%;
        padding: 18px;
    }

    .popup-actions {
        flex-direction: row;
        align-items: stretch;
    }

    .popup-actions .btn {
        flex: 1 1 0;
    }
}
