:root {
    color-scheme: light;
    --bg: #f7f3ef;
    --surface: #fffdf9;
    --surface-strong: #ffffff;
    --ink: #26211d;
    --muted: #756d66;
    --soft: #e7ded5;
    --line: #d8cbc0;
    --accent: #2f6f68;
    --accent-strong: #1d504b;
    --accent-soft: #d7ebe7;
    --rose: #a9505d;
    --rose-soft: #f4dde1;
    --gold: #c9852d;
    --shadow: 0 24px 70px rgba(59, 45, 35, 0.14);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100%;
    margin: 0;
    background:
        radial-gradient(circle at 18% 8%, rgba(215, 235, 231, 0.92), transparent 34rem),
        linear-gradient(135deg, #f7f3ef 0%, #f2ebe3 55%, #edf4f1 100%);
    color: var(--ink);
}

button {
    font: inherit;
}

button:focus-visible,
summary:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(47, 111, 104, 0.3);
    outline-offset: 3px;
}

.demo-shell {
    width: min(1120px, calc(100% - 24px));
    margin: 0 auto;
    padding: 14px 0 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
}

.brand,
.topbar-actions,
.streak-counter,
.status-card,
.summary-card-header,
.panel-heading {
    display: flex;
    align-items: center;
}

.brand {
    gap: 10px;
}

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 14px;
    background: var(--accent);
    color: white;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(47, 111, 104, 0.26);
}

.brand strong {
    display: block;
    font-size: 1rem;
}

.brand span,
.section-label,
.turn-count,
.summary-source,
.turn-label,
.debug-row span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
}

.topbar-actions {
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.streak-counter {
    gap: 8px;
    min-height: 32px;
    padding: 0 11px;
    border: 1px solid rgba(201, 133, 45, 0.35);
    border-radius: 999px;
    background: rgba(255, 253, 249, 0.78);
    color: #704714;
    font-weight: 800;
}

.streak-flame {
    position: relative;
    width: 14px;
    height: 18px;
    border-radius: 12px 12px 12px 3px;
    background: linear-gradient(160deg, #f0b23d, #c95f35);
    transform: rotate(45deg);
}

.streak-flame::after {
    position: absolute;
    inset: 5px 4px 3px 5px;
    border-radius: 8px 8px 8px 2px;
    background: #ffe2a4;
    content: "";
}

.clear-button,
.text-button,
.ghost-button {
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 800;
}

.clear-button {
    min-height: 32px;
    padding: 0 2px;
}

.hero-workspace {
    display: grid;
    grid-template-columns: minmax(320px, 0.76fr) minmax(430px, 1.24fr);
    gap: 14px;
    margin-top: 12px;
    align-items: stretch;
}

.conversation-panel,
.transcript-panel,
.summary-card,
.debug-body {
    border: 1px solid rgba(216, 203, 192, 0.82);
    border-radius: 18px;
    background: rgba(255, 253, 249, 0.84);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.conversation-panel {
    display: flex;
    min-height: 492px;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    padding: clamp(18px, 2.2vw, 26px);
}

.intro-block {
    max-width: 620px;
}

.hero-heading {
    margin-bottom: 10px;
    font-size: clamp(1.65rem, 2.45vw, 2.45rem);
    line-height: 1.08;
}

.mode-copy {
    margin: 0 0 8px;
    color: var(--accent-strong);
    font-size: 0.92rem;
    font-weight: 800;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 760px;
    margin-bottom: 10px;
    font-size: clamp(1.85rem, 3.3vw, 3.3rem);
    line-height: 1;
    letter-spacing: 0;
}

.intro-block p:last-child {
    max-width: 630px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.starter-prompt {
    padding: 14px 16px;
    border: 1px solid rgba(47, 111, 104, 0.22);
    border-radius: 14px;
    background: var(--accent-soft);
}

.starter-prompt span {
    display: block;
    margin-bottom: 5px;
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.starter-prompt p {
    margin: 0;
    color: var(--ink);
    font-size: 1.02rem;
    font-weight: 750;
    line-height: 1.4;
}

.session-selector {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr);
    gap: 5px 12px;
    align-items: center;
}

.session-selector label {
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 800;
}

.session-selector select {
    width: 100%;
    min-height: 42px;
    padding: 0 36px 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-strong);
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-weight: 750;
}

.session-selector select:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.session-selector span {
    grid-column: 2;
    color: var(--muted);
    font-size: 0.78rem;
}

.status-card {
    gap: 11px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-strong);
}

.status-card span {
    display: block;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.status-card strong {
    display: block;
    margin-top: 3px;
    line-height: 1.28;
    font-size: 0.92rem;
}

.status-orb {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--line);
}

.status-orb.connecting,
.status-orb.thinking {
    background: var(--gold);
    animation: pulse 1.4s ease-in-out infinite;
}

.status-orb.listening {
    background: var(--accent);
    box-shadow: 0 0 0 8px rgba(47, 111, 104, 0.13);
}

.status-orb.speaking {
    background: var(--rose);
    box-shadow: 0 0 0 8px rgba(169, 80, 93, 0.12);
}

.session-controls {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
    min-height: 46px;
    padding: 0 15px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 850;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.primary-button {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: white;
    box-shadow: 0 16px 32px rgba(47, 111, 104, 0.22);
}

.secondary-button {
    border: 1px solid var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.danger-button {
    border: 1px solid var(--rose);
    background: var(--rose);
    color: white;
    box-shadow: 0 16px 32px rgba(169, 80, 93, 0.18);
}

.ghost-button {
    border: 1px solid var(--line);
    background: white;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.privacy-note,
.error-banner,
.success-banner {
    border-radius: 16px;
    padding: 11px 13px;
    line-height: 1.42;
    font-size: 0.9rem;
}

.privacy-note {
    background: rgba(215, 235, 231, 0.62);
    color: #33514d;
}

.error-banner {
    background: var(--rose-soft);
    color: #76323e;
    font-weight: 750;
}

.success-banner {
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 750;
}

.transcript-panel {
    display: flex;
    min-height: 492px;
    flex-direction: column;
    padding: 18px;
}

.panel-heading,
.summary-card-header {
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.chat-heading-actions,
.chat-footer-controls {
    display: flex;
    align-items: center;
    gap: 9px;
}

.chat-heading-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.chat-start-button {
    min-height: 40px;
    padding: 0 14px;
}

.chat-footer-controls {
    min-height: 58px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--soft);
}

.chat-footer-controls .primary-button,
.chat-footer-controls .secondary-button,
.chat-footer-controls .danger-button,
.chat-footer-controls .ghost-button {
    min-height: 40px;
}

h2 {
    margin-bottom: 0;
    font-size: clamp(1.2rem, 1.7vw, 1.55rem);
    line-height: 1.05;
    letter-spacing: 0;
}

.transcript-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding-right: 4px;
}

.empty-transcript {
    display: grid;
    min-height: 350px;
    place-items: center;
    border: 1px dashed var(--line);
    border-radius: 18px;
    color: var(--muted);
    text-align: center;
}

.turn {
    width: min(82%, 520px);
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: white;
}

.turn p {
    margin-bottom: 0;
    line-height: 1.55;
}

.voice-hints-toggle {
    margin-top: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 850;
}

.voice-hints-panel {
    margin-top: 8px;
    padding: 9px 10px;
    border: 1px solid rgba(47, 111, 104, 0.22);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.58);
    color: var(--muted);
    font-size: 0.76rem;
}

.voice-hints-panel ul {
    display: grid;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.voice-hints-panel code {
    color: var(--accent-strong);
    white-space: normal;
}

.turn-user {
    align-self: flex-start;
}

.turn-piphany {
    align-self: flex-end;
    border-color: rgba(47, 111, 104, 0.28);
    background: var(--accent-soft);
}

.turn.is-partial {
    opacity: 0.72;
}

.summary-area {
    margin-top: 14px;
}

.summary-card {
    padding: 18px;
}

.summary-source {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(231, 222, 213, 0.72);
}

.journal-entry {
    padding: 14px;
    border-radius: 14px;
    background: white;
    line-height: 1.55;
}

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

.summary-grid > div,
.follow-up,
.practitioner-draft {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.62);
    padding: 14px;
}

h3 {
    margin-bottom: 10px;
    font-size: 0.96rem;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tag-list li {
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.86rem;
    font-weight: 800;
}

.follow-up,
.practitioner-draft {
    margin-top: 12px;
}

.follow-up p,
.practitioner-draft p {
    margin-bottom: 0;
    line-height: 1.65;
}

.practitioner-draft summary {
    cursor: pointer;
    font-weight: 850;
}

.summary-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 0;
    color: var(--muted);
    font-weight: 800;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}

.debug-panel {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.debug-body {
    padding: 12px;
}

.latency-card {
    border: 1px solid rgba(216, 203, 192, 0.82);
    border-radius: 16px;
    background: rgba(255, 253, 249, 0.78);
    box-shadow: 0 16px 42px rgba(59, 45, 35, 0.1);
    padding: 14px;
}

.latency-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.connection-pill {
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 850;
}

.latency-empty {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.latency-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.latency-row {
    display: flex;
    min-height: 44px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid rgba(216, 203, 192, 0.78);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
}

.latency-row span {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
}

.latency-row strong {
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.05;
}

.debug-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.debug-body ol {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 22px;
}

.debug-body li {
    color: var(--muted);
    line-height: 1.45;
}

.debug-body li strong {
    margin-left: 8px;
    color: var(--ink);
}

.debug-body li em {
    display: block;
    color: var(--muted);
    font-style: normal;
}

.prompt-lab-shell {
    padding-bottom: 48px;
}

.prompt-lab-intro {
    max-width: 780px;
    margin: 42px 0 22px;
}

.prompt-lab-intro h1 {
    max-width: 720px;
}

.prompt-lab-intro > p:last-child {
    max-width: 700px;
    color: var(--muted);
    line-height: 1.6;
}

.prompt-lab-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.7fr);
    gap: 14px;
    align-items: start;
}

.prompt-editor-card,
.prompt-history-card {
    border: 1px solid rgba(216, 203, 192, 0.82);
    border-radius: 18px;
    background: rgba(255, 253, 249, 0.88);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    padding: clamp(18px, 2.2vw, 26px);
}

.prompt-history-card {
    position: sticky;
    top: 14px;
}

.prompt-field {
    display: grid;
    gap: 7px;
    margin-top: 22px;
}

.prompt-field label,
.steering-fieldset legend {
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 850;
}

.prompt-field p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.prompt-field textarea,
.prompt-field input[type="text"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-strong);
    color: var(--ink);
    font: inherit;
    line-height: 1.5;
}

.prompt-field textarea {
    min-height: 130px;
    padding: 14px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.84rem;
}

.prompt-field input[type="text"] {
    min-height: 44px;
    padding: 0 12px;
}

.steering-fieldset {
    display: grid;
    gap: 10px;
    margin: 24px 0 0;
    padding: 0;
    border: 0;
}

.steering-fieldset legend {
    margin-bottom: 10px;
}

.steering-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.68);
    cursor: pointer;
}

.steering-option:has(input:checked) {
    border-color: rgba(47, 111, 104, 0.5);
    background: var(--accent-soft);
}

.steering-option input {
    margin-top: 4px;
    accent-color: var(--accent);
}

.steering-option span {
    color: var(--muted);
    font-size: 0.83rem;
    line-height: 1.42;
}

.steering-option strong {
    display: block;
    margin-bottom: 2px;
    color: var(--ink);
    font-size: 0.9rem;
}

.version-save-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--soft);
}

.compact-field {
    margin-top: 0;
}

.version-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.version-list li {
    display: grid;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.7);
}

.version-list strong,
.version-list span,
.version-list small {
    display: block;
}

.version-list strong {
    line-height: 1.3;
}

.version-list span,
.version-list small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.76rem;
}

.version-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.version-actions .secondary-button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.8rem;
}

.danger-text {
    color: var(--rose);
}

.empty-version-history {
    padding: 28px 16px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    color: var(--muted);
    line-height: 1.5;
    text-align: center;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(38, 33, 29, 0.52);
    backdrop-filter: blur(8px);
    z-index: 900;
}

.feedback-modal {
    width: min(620px, 100%);
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    padding: clamp(18px, 3vw, 28px);
    border: 1px solid rgba(216, 203, 192, 0.92);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 30px 90px rgba(38, 33, 29, 0.32);
}

.feedback-modal-header,
.feedback-status,
.feedback-modal-actions {
    display: flex;
    align-items: center;
}

.feedback-modal-header {
    justify-content: space-between;
    gap: 16px;
}

.modal-close {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: white;
    color: var(--ink);
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

.feedback-spoken-prompt {
    display: grid;
    gap: 5px;
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--accent-soft);
}

.feedback-spoken-prompt span {
    color: var(--accent-strong);
    font-size: 0.74rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.feedback-spoken-prompt strong {
    line-height: 1.45;
}

.feedback-status {
    gap: 11px;
    margin-top: 14px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
}

.feedback-status strong,
.feedback-status span {
    display: block;
}

.feedback-status div > span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.feedback-draft-field {
    margin-top: 16px;
}

.feedback-draft-field > span {
    color: var(--muted);
    font-size: 0.74rem;
    text-align: right;
}

.feedback-modal-actions {
    justify-content: flex-end;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.feedback-privacy {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.45;
    text-align: center;
}

#blazor-error-ui {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: none;
    max-width: min(460px, calc(100% - 36px));
    padding: 14px 18px;
    border-radius: 14px;
    background: #7d2633;
    color: white;
    box-shadow: var(--shadow);
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    margin-left: 12px;
    cursor: pointer;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.18);
        opacity: 0.62;
    }
}

@media (max-width: 900px) {
    .demo-shell {
        width: min(100% - 22px, 720px);
        padding-top: 14px;
    }

    .topbar,
    .hero-workspace,
    .summary-grid,
    .latency-grid,
    .prompt-lab-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        display: grid;
    }

    .topbar-actions {
        justify-content: flex-start;
    }

    .hero-workspace {
        display: grid;
    }

    .prompt-history-card {
        position: static;
    }

    .conversation-panel,
    .transcript-panel {
        min-height: auto;
    }

    .transcript-panel {
        max-height: none;
    }

    .empty-transcript {
        min-height: 260px;
    }

    .turn {
        width: 92%;
    }

    .chat-heading-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 540px) {
    .demo-shell {
        width: min(100% - 16px, 520px);
    }

    .conversation-panel,
    .transcript-panel,
    .summary-card {
        border-radius: 16px;
        padding: 14px;
    }

    h1 {
        font-size: 1.95rem;
    }

    .session-selector {
        grid-template-columns: 1fr;
    }

    .session-selector span {
        grid-column: 1;
    }

    .version-save-row {
        grid-template-columns: 1fr;
    }

    .modal-backdrop {
        align-items: end;
        padding: 8px;
    }

    .feedback-modal {
        max-height: calc(100vh - 16px);
        border-radius: 18px;
        padding: 16px;
    }

    .primary-button,
    .secondary-button,
    .danger-button,
    .ghost-button {
        width: 100%;
    }
}
