*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --apug-brick: #A8353A;
    --apug-red-3: #892A36;
    --apug-red-4: #5B262B;
    --apug-brand-muted: rgba(168, 53, 58, 0.12);
    --apug-taupe-1: #EDEBE8;
}

body {
    margin: 0;
}

h1,
h2,
p {
    margin: 0;
}

button,
input {
    font: inherit;
}

img {
    display: block;
    max-width: 100%;
}

.hidden {
    display: none;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-family: Inter, sans-serif;
    background-color: var(--apug-taupe-1);
    color: #1f2937;
}

@media (min-width: 640px) {
    .page {
        padding: 2rem;
    }
}

.card {
    width: 100%;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

.card--narrow {
    max-width: 28rem;
    padding: 2rem;
    text-align: center;
}

.card--chat {
    max-width: 36rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: #ffffff;
    color: var(--apug-brick);
    border-bottom: 3px solid var(--apug-brick);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.app-header-logo {
    position: absolute;
    left: 1rem;
    width: 45px;
    height: 45px;
}

.app-header-title {
    text-align: center;
}

.app-header-title h1 {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 700;
}

.app-header-title p {
    font-size: 0.875rem;
    line-height: 1.25rem;
    opacity: 0.9;
}

.chat {
    flex-grow: 1;
    height: 70vh;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.msg-row {
    display: flex;
    justify-content: flex-start;
}

.msg-row--end {
    justify-content: flex-end;
}

.msg {
    padding: 0.75rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.msg--bot {
    background-color: var(--apug-brand-muted);
    color: #000000;
    border-radius: 0 1rem 1rem 1rem;
    max-width: 85%;
}

.msg--bot a {
    color: var(--apug-red-3);
}

.msg--bot p + p {
    margin-top: 0;
}

.msg--user {
    background-color: #ffffff;
    color: #1f2937;
    border-radius: 1rem 1rem 0 1rem;
    max-width: 85%;
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.msg--loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.msg--outcome {
    max-width: 32rem;
    border-radius: 0 1rem 1rem 1rem;
}

.msg strong {
    font-weight: 600;
}

.polling-panel {
    padding: 1rem;
    background-color: var(--apug-brand-muted);
    border-top: 1px solid rgba(168, 53, 58, 0.25);
    color: var(--apug-red-4);
}

.polling-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.polling-detail {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    line-height: 1rem;
    opacity: 0.9;
}

.progress-track {
    width: 100%;
    height: 0.5rem;
    margin-top: 0.5rem;
    border-radius: 9999px;
    background-color: rgba(168, 53, 58, 0.2);
}

.progress-fill {
    height: 0.5rem;
    border-radius: 9999px;
    background-color: var(--apug-brick);
    transition: width 1000ms linear;
}

.input-bar {
    padding: 1rem;
    border-top: 1px solid #e5e7eb;
}

.input-row {
    display: flex;
    gap: 0.75rem;
}

.field {
    flex-grow: 1;
    min-width: 0;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    transition: border-color 150ms, box-shadow 150ms;
}

.field:focus {
    border-color: var(--apug-brick);
    outline: none;
    box-shadow: 0 0 0 2px rgba(168, 53, 58, 0.25);
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border: 0;
    border-radius: 0.75rem;
    background-color: var(--apug-brick);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    transition: background-color 150ms;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--apug-red-3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-primary svg {
    width: 1.25rem;
    height: 1.25rem;
}

.error-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: #ef4444;
}

.card--narrow .error-text {
    margin-top: 1rem;
}

.spin,
.spin--sm {
    animation: spin 1s linear infinite;
}

.spin {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--apug-brick);
    flex-shrink: 0;
}

.spin circle {
    opacity: 0.25;
}

.spin path {
    opacity: 0.75;
}

.spin--sm {
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    border-bottom: 2px solid var(--apug-brick);
    flex-shrink: 0;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes bot-shake {
    0% { transform: translateY(-40px); opacity: 0; }
    40% { transform: translateY(0); opacity: 1; }
    55% { transform: translateX(12px); }
    65% { transform: translateX(0); }
    80% { transform: translateX(12px); }
    100% { transform: translateX(0); }
}

.shake-once {
    animation: bot-shake 0.8s ease;
}

.verify-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto;
}

.spinner {
    border: 4px solid rgba(168, 53, 58, 0.2);
    border-top: 4px solid var(--apug-brick);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 1.5rem auto;
}

.brand-heading {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 700;
    color: var(--apug-brick);
}

.verify-lead {
    margin-bottom: 1.5rem;
    color: #4b5563;
}

.verify-form {
    margin-top: 2rem;
}

.turnstile-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.brand-link {
    color: var(--apug-brick);
    text-decoration: underline;
}

.brand-link:hover {
    color: var(--apug-red-3);
}

.help {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    text-align: left;
}

.help ul {
    list-style-type: disc;
    margin: 0.5rem 0 1rem 1.5rem;
    padding: 0;
}

.help li {
    margin-bottom: 0.25rem;
}
