:root {
    --page: #f6f6f7;
    --surface: #ffffff;
    --text: #333333;
    --muted: #6b7280;
    --line: #e3e6ea;
    --accent: #0a73c9;
    --accent-soft: #e6f2fc;
    --glow: #7cc4f8;
    --error: #b3261e;
    --ok: #1e7a45;
    --radius-pill: 999px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", sans-serif;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

/* Buttons set their own display, which would otherwise override the hidden attribute. */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font: 16px/1.5 var(--font);
    color: var(--text);
    background:
        radial-gradient(55% 40% at 58% 8%, rgb(124 196 248 / 45%), transparent 70%),
        radial-gradient(35% 30% at 22% 12%, rgb(150 225 240 / 35%), transparent 70%), var(--page);
    background-attachment: fixed;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Top bar ---------- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem clamp(1rem, 3vw, 2.5rem);
}

.wordmark {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    font-size: 1.35rem;
    font-weight: 600;
    text-decoration: none;
}

.wordmark-mark {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.wordmark-tag {
    padding: 0.1rem 0.6rem;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 500;
}

.account {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.account form {
    margin: 0;
}

.account-status {
    color: var(--muted);
    font-size: 0.9rem;
}

.account-status[data-linked="true"] {
    color: var(--ok);
}

.pill-button {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text);
    font: 500 0.95rem var(--font);
    text-decoration: none;
    cursor: pointer;
}

.pill-button.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

/* ---------- Side rail ---------- */

.rail {
    position: fixed;
    top: 50%;
    left: clamp(0.75rem, 2vw, 2.5rem);
    transform: translateY(-50%);
    display: grid;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    border-radius: 32px;
    background: var(--surface);
    box-shadow: 0 6px 24px rgb(20 40 80 / 8%);
}

.rail-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #4b5563;
    cursor: pointer;
}

.rail-button:hover,
.rail-button[aria-expanded="true"] {
    background: var(--accent-soft);
    color: var(--accent);
}

.rail-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* ---------- The stage ---------- */

.stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    max-width: 46rem;
    /* Centred in what is left of the window under the top bar. */
    min-height: calc(100vh - 5.5rem);
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
    text-align: center;
}

.greeting {
    margin: 0;
    font-size: 32px;
    font-weight: 400;
    line-height: 40px;
    color: var(--text);
}

.exchange {
    display: grid;
    gap: 0.75rem;
    width: 100%;
}

.said {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.answer {
    margin: 0;
    font-size: clamp(1.4rem, 2.6vw, 1.9rem);
    line-height: 1.35;
}

/* Cards show what Alexa just said, never more. */
.card {
    padding: 1rem 1.25rem;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 6px 24px rgb(20 40 80 / 8%);
    text-align: left;
}

.card ul {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.card li {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
}

.card .detail {
    color: var(--muted);
    font-size: 0.95rem;
}

.card .big {
    font-size: 2.4rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.status {
    flex: none;
    padding: 0.1rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
}

.status[data-status="open"] {
    background: #e6f0fb;
    color: #1f4f8a;
}

.status[data-status="progress"] {
    background: #fdf1e3;
    color: #8a5a1f;
}

.status[data-status="closed"] {
    background: #e5f4ea;
    color: #1f6a44;
}

/* What a tool's MCP App shows, in the place of the card. */
.app {
    width: 100%;
}

.app-frame {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 6px 24px rgb(20 40 80 / 8%);
}

/* Laid out at full width so the app can measure itself, but invisible until it has something to show. */
.app-frame[data-empty="true"] {
    opacity: 0;
}

/* ---------- The microphone ---------- */

.voice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mic {
    position: relative;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #1f9bf0, #0a5fb5);
    color: #ffffff;
    box-shadow: 0 10px 30px rgb(10 115 201 / 35%);
    cursor: pointer;
}

.mic svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

/* The ring around the microphone says what Alexa is doing. */
.mic::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 3px solid transparent;
}

.voice[data-state="listening"] .mic::after {
    border-color: var(--glow);
    animation: pulse 1.2s ease-in-out infinite;
}

.voice[data-state="thinking"] .mic::after {
    border-color: var(--glow) transparent var(--glow) transparent;
    animation: spin 1s linear infinite;
}

.voice[data-state="speaking"] .mic::after {
    border-color: var(--glow);
    animation: breathe 1.6s ease-in-out infinite;
}

@keyframes pulse {
    50% {
        transform: scale(1.12);
        opacity: 0.4;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes breathe {
    50% {
        transform: scale(1.05);
        opacity: 0.6;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mic::after {
        animation: none !important;
    }
}

.type-toggle {
    position: absolute;
    left: calc(100% + 0.75rem);
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: #4b5563;
    cursor: pointer;
}

.type-toggle[aria-expanded="true"] {
    border-color: var(--accent);
    color: var(--accent);
}

.type-toggle svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.hint {
    margin: -0.5rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

/* ---------- Typing, for accessibility ---------- */

.ask {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: min(100%, 40rem);
    padding: 0.5rem 0.5rem 0.5rem 1.5rem;
    border-radius: var(--radius-pill);
    background: var(--surface);
    box-shadow:
        0 0 0 1px rgb(124 196 248 / 60%),
        0 8px 30px rgb(10 115 201 / 18%);
}

.ask input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font: 1.1rem var(--font);
}

.ask-send {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    cursor: pointer;
}

.ask-send svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* ---------- Example ---------- */

.example {
    margin: 0;
    color: var(--muted);
}

.example q {
    color: var(--text);
}

/* ---------- Behind the scenes ---------- */

.scenes {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(26rem, 100%);
    padding: 1.25rem;
    overflow: auto;
    background: var(--surface);
    box-shadow: -8px 0 30px rgb(20 40 80 / 12%);
    text-align: left;
}

.scenes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scenes h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.muted {
    color: var(--muted);
    font-size: 0.9rem;
}

.trace {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.turn {
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.turn .said-line {
    font-weight: 600;
}

.turn .meta {
    color: var(--muted);
    font-size: 0.8rem;
}

.call {
    margin-top: 0.4rem;
    font-size: 0.85rem;
}

.call code {
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 0.8rem;
    word-break: break-word;
}

.call .name {
    color: var(--accent);
    font-weight: 600;
}

.call[data-error="true"] .name {
    color: var(--error);
}

/* The proof that a report was filed: it opens as a city's system would read it. */
.call .record-link {
    display: inline-block;
    margin-top: 0.3rem;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
}

/* ---------- Small screens ---------- */

@media (max-width: 1100px) {
    .rail {
        top: auto;
        bottom: 1rem;
        left: 50%;
        transform: translateX(-50%);
        grid-auto-flow: column;
        padding: 0.4rem 0.75rem;
    }

    .stage {
        padding-bottom: 6rem;
    }
}

@media (max-width: 720px) {
    .wordmark-tag,
    .account-status {
        display: none;
    }

    .greeting {
        font-size: 26px;
        line-height: 32px;
    }
}
