:root {
    --brand: #ff5e00;
    --brand-rgb: 255, 94, 0;
    --brand-soft: #fabd6e;
    --soft-white: #f2f2f7;
    --bg: #080808;
    --panel: rgba(14, 14, 16, 0.82);
    --ink: var(--soft-white);
    --muted: #9a9a9a;
    --ok: #3ecf6e;
    --ok-rgb: 62, 207, 110;
    --bad: #ff5c5c;
    --bad-rgb: 255, 92, 92;
    --white-rgb: 255, 255, 255;
    --black-rgb: 0, 0, 0;
    --tag-bg: rgba(var(--white-rgb), 0.14);
    --tag-border: rgba(var(--white-rgb), 0.25);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    --font-display: "Jura", system-ui, sans-serif;
    --font-body: "Exo 2", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.55 var(--font-body);
}

body {
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(var(--brand-rgb), 0.18), transparent 60%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(var(--brand-rgb), 0.08), transparent 55%),
        var(--bg);
}

a {
    color: var(--brand-soft);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--brand);
    text-decoration: underline;
}

.questions {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto auto 1fr;
    align-items: stretch;
    min-height: 100vh;
    min-height: 100dvh;
    padding:
        max(72px, env(safe-area-inset-top, 0px) + 52px)
        20px
        max(32px, env(safe-area-inset-bottom, 0px));
}

/* Hero */

.hero {
    grid-row: 1;
    width: min(760px, 100%);
    margin: 0 auto;
    text-align: center;
}

.hero__title {
    margin: 0 0 12px;
    font: 700 clamp(2rem, 5vw, 2.75rem)/1.1 var(--font-display);
    letter-spacing: 0.02em;
    color: var(--brand);
    text-shadow: 0 0 40px rgba(var(--brand-rgb), 0.25);
}

.question-row {
    grid-row: 2;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: min(760px, 100%);
    margin: 20px auto 16px;
    min-height: 36px;
}

.question-row[hidden] {
    display: none;
}

.question-row__content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding-inline: 48px;
}

.question-row:not(:has(.section-back)) .question-row__content {
    padding-inline: 0;
}

.question-prompt {
    width: 100%;
    margin: 0;
    text-align: center;
    font: 600 clamp(1.05rem, 2.5vw, 1.25rem)/1.4 var(--font-display);
    letter-spacing: 0.02em;
    color: var(--ink);
    text-wrap: balance;
}

.question-prompt[hidden] {
    display: none;
}

/* Section card */

/* Stage: card over muted chat history */

.stage {
    grid-row: 3;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: min(760px, 100%);
    margin-inline: auto;
    min-height: 0;
}

#section-root {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    min-height: 0;
    padding-block: 8px 16px;
    overflow: visible;
}

#section-root > .section-shell {
    flex-shrink: 0;
}

.section-shell {
    position: relative;
    width: 100%;
}

.section {
    width: 100%;
    margin: 0;
    padding: 24px 22px 22px;
    background: var(--panel);
    border: 1px solid rgba(var(--brand-rgb), 0.18);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: relative;
    overflow: hidden;
}

.section-back {
    appearance: none;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.section-back__icon {
    display: block;
}

.section-back:hover {
    color: var(--ink);
    background: rgba(var(--white-rgb), 0.08);
    border-color: rgba(var(--white-rgb), 0.12);
}

.section-back:focus-visible {
    outline: none;
    color: var(--ink);
    border-color: rgba(var(--brand-rgb), 0.45);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.2);
}

.section::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--brand), transparent);
    opacity: 0.7;
}

.section--enter {
    animation: section-in 0.32s ease both;
}

@keyframes section-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-title {
    margin: 0 0 18px;
    padding: 0 4px;
    font: 600 clamp(1.05rem, 2.5vw, 1.2rem)/1.4 var(--font-display);
    letter-spacing: 0.02em;
    color: var(--ink);
    text-align: center;
}

/* Answer options */

.question-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.question-option {
    appearance: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 12px 18px;
    border: 1px solid var(--tag-border);
    border-radius: var(--radius-sm);
    background: var(--tag-bg);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(var(--black-rgb), 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
        transform 0.14s ease,
        box-shadow 0.14s ease,
        background 0.14s ease,
        border-color 0.14s ease,
        color 0.14s ease,
        text-shadow 0.14s ease;
}

.question-option__label {
    display: block;
    width: 100%;
    font: 500 15px/1.45 var(--font-body);
    text-align: center;
    text-wrap: balance;
}

.question-option--exit {
    padding-inline: 44px;
}

.question-option__icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    flex-shrink: 0;
    opacity: 0.72;
    pointer-events: none;
}

.question-option--exit:hover .question-option__icon,
.question-option--exit:focus-visible .question-option__icon {
    opacity: 1;
}

.question-option:not(.green):not(.red):hover {
    transform: translateY(-2px);
    border-color: rgba(var(--white-rgb), 0.7);
    background: rgba(var(--white-rgb), 0.7);
    color: #000;
    text-shadow: none;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.question-option.green {
    border-color: rgba(var(--ok-rgb), 0.35);
    background: rgba(var(--ok-rgb), 0.08);
    text-shadow: none;
}

.question-option.green:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--ok-rgb), 0.6);
    background: rgba(var(--ok-rgb), 0.16);
    box-shadow: 0 10px 24px rgba(var(--ok-rgb), 0.12);
}

.question-option.red {
    border-color: rgba(var(--bad-rgb), 0.35);
    background: rgba(var(--bad-rgb), 0.07);
    text-shadow: none;
}

.question-option.red:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--bad-rgb), 0.55);
    background: rgba(var(--bad-rgb), 0.14);
    box-shadow: 0 10px 24px rgba(var(--bad-rgb), 0.1);
}

.question-option:active {
    transform: translateY(0);
}

.question-option:focus-visible {
    outline: none;
}

.question-option:not(.green):not(.red):focus-visible {
    box-shadow: 0 0 0 3px rgba(var(--white-rgb), 0.28);
}

.question-option.green:focus-visible {
    box-shadow: 0 0 0 3px rgba(var(--ok-rgb), 0.35);
}

.question-option.red:focus-visible {
    box-shadow: 0 0 0 3px rgba(var(--bad-rgb), 0.35);
}

/* Feedback form */

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}

.feedback-textarea {
    width: 100%;
    min-height: 140px;
    resize: vertical;
    padding: 14px 16px;
    border: 1px solid rgba(var(--brand-rgb), 0.28);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.35);
    color: var(--ink);
    font: inherit;
    line-height: 1.5;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.feedback-textarea::placeholder {
    color: var(--muted);
}

.feedback-textarea:focus {
    outline: none;
    border-color: rgba(var(--brand-rgb), 0.55);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.2);
}

.feedback-submit {
    appearance: none;
    align-self: center;
    margin: 0;
    padding: 12px 28px;
    border: 1px solid rgba(var(--brand-rgb), 0.4);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(var(--brand-rgb), 0.22), rgba(var(--brand-rgb), 0.12));
    color: var(--ink);
    font: 600 15px/1 var(--font-display);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}

.feedback-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    background: linear-gradient(180deg, rgba(var(--brand-rgb), 0.32), rgba(var(--brand-rgb), 0.18));
    box-shadow: 0 10px 24px rgba(var(--brand-rgb), 0.2);
}

.feedback-submit:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Terminal / contact blocks */

.terminal-blocks {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
}

.terminal-block {
    margin: 0;
    padding: 0 8px;
    font: 400 1.05rem/1.55 var(--font-body);
    color: var(--muted);
    text-align: center;
    max-width: 36em;
}

.terminal-block--lead {
    font: 600 1.15rem/1.4 var(--font-display);
    color: var(--ink);
}

.terminal-block a {
    color: var(--brand-soft);
    font-weight: 700;
    border-bottom: 1px solid rgba(var(--brand-rgb), 0.35);
    text-decoration: none;
}

.terminal-block a:hover {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

/* History: muted terminal log, bottom-left */

.history {
    display: none;
    position: fixed;
    left: max(16px, env(safe-area-inset-left, 0px));
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
    z-index: 0;
    width: min(540px, calc(100vw - 32px));
    max-height: calc(
        100dvh
        - max(72px, env(safe-area-inset-top, 0px) + 52px)
        - max(18px, env(safe-area-inset-bottom, 0px))
    );
    overflow: hidden;
    pointer-events: none;
    opacity: 0.38;
    font: 400 12px/1.55 ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    color: rgba(255, 255, 255, 0.55);
    text-align: left;
}

.history.is-visible {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.history__log {
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font: inherit;
    color: inherit;
    flex-shrink: 0;
}

.history__line {
    margin: 0;
    padding: 0;
}

.history__who {
    color: rgba(var(--brand-rgb), 0.55);
    font-weight: 600;
}

.history__who--guest {
    color: rgba(255, 255, 255, 0.42);
}

.history__line--input .history__who {
    color: rgba(255, 255, 255, 0.42);
}

.history__cursor {
    display: inline-block;
    color: rgba(var(--brand-rgb), 0.65);
    animation: history-cursor 1s step-end infinite;
}

@keyframes history-cursor {
    50% {
        opacity: 0;
    }
}

.points {
    display: none;
}

/* Language switcher */

.lang-switch {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 5px 6px;
    border: 1px solid rgba(var(--brand-rgb), 0.3);
    border-radius: 999px;
    background: rgba(8, 8, 8, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10;
}

.lang-switch__sep {
    opacity: 0.35;
    font-size: 12px;
    user-select: none;
}

.lang-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 6px 11px;
    border-radius: 999px;
    cursor: pointer;
    font: 600 12px/1 var(--font-display);
    letter-spacing: 0.08em;
    transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn:hover {
    color: var(--ink);
}

.lang-btn.active {
    background: var(--brand);
    color: #000;
}

@media (max-width: 560px) {
    .questions {
        padding:
            max(56px, env(safe-area-inset-top, 0px) + 48px)
            14px
            max(24px, env(safe-area-inset-bottom, 0px));
    }

    .hero {
        margin-bottom: 8px;
    }

    #section-root {
        justify-content: flex-start;
        overflow: visible;
    }

    .section {
        padding: 20px 14px 16px;
    }

    .question-option {
        min-height: 48px;
        padding: 11px 14px;
    }

    .question-option--exit {
        padding-inline: 40px;
    }

    .question-option__icon {
        right: 12px;
        width: 16px;
        height: 16px;
    }

    .question-option__label {
        font-size: 14px;
    }

    .history {
        width: calc(100vw - 28px);
        max-height: calc(
            100dvh
            - max(56px, env(safe-area-inset-top, 0px) + 48px)
            - max(14px, env(safe-area-inset-bottom, 0px))
        );
        left: max(14px, env(safe-area-inset-left, 0px));
        bottom: max(14px, env(safe-area-inset-bottom, 0px));
        font-size: 11px;
        line-height: 1.5;
        opacity: 0.34;
    }
}

@media (prefers-reduced-motion: reduce) {
    .section--enter {
        animation: none;
    }

    .question-option,
    .feedback-submit {
        transition: none;
    }

    .history__cursor {
        animation: none;
        opacity: 1;
    }
}
