@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Manrope:wght@400;500;700;800&display=swap");

:root {
    --bg: #f6f1ea;
    --surface: rgba(255, 252, 247, 0.96);
    --surface-strong: #ffffff;
    --surface-soft: #fff7ee;
    --line: rgba(77, 56, 34, 0.12);
    --line-strong: rgba(242, 140, 27, 0.24);
    --ink: #28343d;
    --muted: #6d7880;
    --brand: #f28c1b;
    --brand-deep: #ce6f0a;
    --brand-soft: #fff0dc;
    --success: #28715e;
    --danger: #bd4b43;
    --shadow: 0 28px 60px rgba(49, 34, 17, 0.1);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 20px;
}

body {
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(242, 140, 27, 0.12), rgba(242, 140, 27, 0) 28%),
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0) 30%),
        linear-gradient(180deg, #fbf6ef 0%, #f3ede4 100%);
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 24%),
        linear-gradient(transparent 96%, rgba(77, 56, 34, 0.028) 96%);
    background-size: auto, 100% 26px;
}

.page-shell {
    position: relative;
    width: min(1200px, calc(100vw - 36px));
    margin: 24px auto 40px;
    display: grid;
    gap: 20px;
}

.brand-header,
.hero-panel,
.panel,
.speaker-card,
.segment-card,
.overview-card {
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.brand-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 22px 26px;
    border-radius: var(--radius-xl);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 248, 240, 0.95)),
        linear-gradient(135deg, rgba(242, 140, 27, 0.07), rgba(242, 140, 27, 0));
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.brand-mark {
    flex: 0 0 120px;
    color: var(--brand);
}

.brand-mark svg {
    display: block;
    width: 100%;
    height: auto;
}

.brand-text {
    display: grid;
    gap: 2px;
}

.brand-name,
.brand-subtitle,
.hero-panel h1,
.panel h2,
.report-preview h3 {
    font-family: "Cormorant Garamond", "Georgia", serif;
}

.brand-name {
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 0.94;
    color: var(--brand);
    letter-spacing: 0.03em;
}

.brand-subtitle {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    line-height: 1.05;
    color: var(--brand);
}

.brand-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-weight: 800;
    white-space: nowrap;
}

.brand-status.is-ready {
    background: rgba(40, 113, 94, 0.1);
    color: var(--success);
    border-color: rgba(40, 113, 94, 0.15);
}

.brand-status.is-partial {
    background: rgba(242, 140, 27, 0.14);
    color: var(--brand-deep);
    border-color: rgba(242, 140, 27, 0.18);
}

.brand-status.is-offline {
    background: rgba(189, 75, 67, 0.1);
    color: var(--danger);
    border-color: rgba(189, 75, 67, 0.16);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.95fr);
    gap: 20px;
    padding: 30px;
    border-radius: var(--radius-xl);
    background:
        radial-gradient(circle at right top, rgba(242, 140, 27, 0.16), rgba(242, 140, 27, 0) 34%),
        linear-gradient(135deg, rgba(255, 252, 247, 0.98), rgba(255, 248, 240, 0.96));
}

.eyebrow,
.kicker {
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-weight: 800;
    color: var(--brand-deep);
}

.hero-panel h1,
.panel h2 {
    margin: 12px 0 0;
    color: #27323a;
}

.hero-panel h1 {
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 0.93;
    max-width: 11ch;
}

.hero-panel p {
    max-width: 58ch;
    margin: 16px 0 0;
    font-size: 1rem;
    line-height: 1.7;
    color: #5f6b74;
}

.hero-panel-grid {
    display: grid;
    gap: 14px;
}

.overview-card {
    padding: 18px 18px 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 247, 236, 0.96));
}

.overview-card span {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-deep);
    font-weight: 800;
}

.overview-card strong {
    display: block;
    margin-top: 14px;
    font-size: 1rem;
}

.overview-card p {
    margin: 8px 0 0;
    font-size: 0.93rem;
    line-height: 1.6;
    color: var(--muted);
}

.flash {
    padding: 15px 18px;
    border-radius: var(--radius-md);
    font-weight: 700;
    border: 1px solid transparent;
}

.flash.success {
    background: rgba(40, 113, 94, 0.1);
    color: var(--success);
    border-color: rgba(40, 113, 94, 0.15);
}

.flash.error {
    background: rgba(189, 75, 67, 0.1);
    color: var(--danger);
    border-color: rgba(189, 75, 67, 0.15);
}

.workspace,
.transcript-layout,
.speakers-grid {
    display: grid;
    gap: 20px;
}

.workspace {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.transcript-layout {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.72fr);
    align-items: start;
}

.speakers-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.panel {
    padding: 24px;
    border-radius: var(--radius-xl);
}

.form-panel,
.result-hub,
.registry-panel {
    position: relative;
    overflow: hidden;
}

.form-panel::before,
.result-hub::before,
.registry-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--brand) 0%, rgba(242, 140, 27, 0.25) 100%);
}

.panel-header,
.section-heading,
.speaker-card-top,
.segment-top,
.email-card-top,
.report-preview-top,
.recorder-top,
.recorder-meter-top,
.recorder-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.section-heading.compact {
    margin-bottom: 8px;
}

.panel h2 {
    font-size: 2rem;
    line-height: 0.98;
}

.panel h3 {
    margin: 0;
    font-size: 1.14rem;
    color: #27323a;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-deep);
    border: 1px solid rgba(242, 140, 27, 0.16);
    font-size: 0.82rem;
    font-weight: 800;
}

.pill-muted {
    background: rgba(109, 120, 128, 0.12);
    color: var(--muted);
    border-color: rgba(109, 120, 128, 0.16);
}

.stack-form {
    display: grid;
    gap: 14px;
}

.stack-form label {
    display: grid;
    gap: 8px;
}

.stack-form span,
.result-audio span {
    font-size: 0.85rem;
    font-weight: 800;
    color: #4d5b64;
}

.stack-form input[type="text"],
.stack-form input[type="file"] {
    width: 100%;
    min-height: 52px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(77, 56, 34, 0.12);
    background: rgba(255, 255, 255, 0.96);
    font: inherit;
    color: var(--ink);
}

.stack-form input[type="text"]:focus,
.stack-form input[type="file"]:focus {
    outline: none;
    border-color: rgba(242, 140, 27, 0.4);
    box-shadow: 0 0 0 4px rgba(242, 140, 27, 0.08);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    color: #ffffff;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
    box-shadow: 0 16px 28px rgba(242, 140, 27, 0.24);
}

.button.secondary {
    color: var(--brand-deep);
    background: #fff6eb;
    border-color: rgba(242, 140, 27, 0.18);
}

.button.subtle {
    color: var(--muted);
    background: #f7f2ec;
    border-color: rgba(77, 56, 34, 0.08);
}

.button.danger {
    color: var(--danger);
    background: rgba(189, 75, 67, 0.08);
    border-color: rgba(189, 75, 67, 0.14);
}

.button.small {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.82rem;
}

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

.recorder {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 249, 241, 0.96), rgba(255, 243, 228, 0.96));
    border: 1px solid rgba(242, 140, 27, 0.12);
}

.recorder-top strong {
    font-size: 1rem;
    color: #27323a;
}

.recorder-status,
.recorder-hint,
.muted,
.speaker-card span {
    color: var(--muted);
    line-height: 1.6;
}

.recorder-status {
    font-size: 0.84rem;
    font-weight: 700;
}

.recorder-meter {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2f3940 0%, #4b321d 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.recorder-badge,
.recorder-timer {
    color: #fff5ea;
    font-size: 0.82rem;
    font-weight: 800;
}

.recorder-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.recorder-badge::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.42);
}

.recorder.is-recording .recorder-badge::before {
    background: #ff6d54;
    box-shadow: 0 0 0 8px rgba(255, 109, 84, 0.12);
    animation: pulse-record 1.2s ease infinite;
}

.recorder-wave {
    width: 100%;
    height: 96px;
    display: block;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.08));
}

.recorder-actions {
    flex-wrap: wrap;
}

.recorder-preview,
.result-audio audio {
    width: 100%;
}

.result-hub {
    scroll-margin-top: 18px;
}

.result-audio {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.report-preview {
    display: grid;
    gap: 14px;
}

.report-frame {
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(77, 56, 34, 0.12);
    background: #ffffff;
    box-shadow: 0 16px 30px rgba(45, 32, 16, 0.08);
}

.report-frame iframe {
    width: 100%;
    min-height: 620px;
    border: 0;
    display: block;
    background: #ffffff;
}

.segments {
    display: grid;
    gap: 12px;
}

.segment-card,
.speaker-card {
    padding: 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 241, 0.96));
}

.segment-top span {
    font-size: 0.84rem;
    color: var(--muted);
}

.segment-card p {
    margin: 10px 0 0;
    line-height: 1.72;
}

.email-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, #fff7ec 0%, #fff1e0 100%);
    border: 1px solid rgba(242, 140, 27, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.speaker-card strong {
    font-size: 1rem;
}

.json-box {
    margin: 0;
    padding: 16px;
    border-radius: 16px;
    overflow-x: auto;
    background: #2d3941;
    color: #f4f1eb;
    font-size: 0.88rem;
}

.mobile-dock {
    display: none;
}

code {
    font-family: "SFMono-Regular", "Menlo", monospace;
}

@media (max-width: 1080px) {
    .hero-panel,
    .workspace,
    .transcript-layout {
        grid-template-columns: 1fr;
    }

    .hero-panel h1 {
        max-width: none;
    }
}

@media (max-width: 720px) {
    body {
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }

    .page-shell {
        width: min(100vw - 16px, 100%);
        margin: 12px auto 22px;
        gap: 14px;
    }

    .brand-header,
    .hero-panel,
    .panel {
        padding: 18px;
        border-radius: 24px;
    }

    .brand-header,
    .brand-lockup,
    .panel-header,
    .section-heading,
    .speaker-card-top,
    .segment-top,
    .email-card-top,
    .report-preview-top,
    .recorder-top,
    .recorder-meter-top,
    .recorder-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .brand-mark {
        flex-basis: 96px;
    }

    .brand-name {
        font-size: 2.4rem;
    }

    .brand-subtitle {
        font-size: 1.4rem;
    }

    .hero-panel h1 {
        font-size: 2.5rem;
    }

    .button,
    .pill {
        width: 100%;
    }

    .mobile-dock {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        z-index: 20;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        padding: 10px;
        border-radius: 22px;
        background: rgba(40, 52, 61, 0.94);
        backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 18px 36px rgba(20, 22, 25, 0.24);
    }

    .mobile-dock a {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        min-height: 44px;
        padding: 8px 6px;
        border-radius: 14px;
        color: #fff7ef;
        text-decoration: none;
        font-size: 0.76rem;
        font-weight: 800;
        text-align: center;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }
}

@keyframes pulse-record {
    0% {
        transform: scale(0.92);
        box-shadow: 0 0 0 0 rgba(255, 109, 84, 0.24);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(255, 109, 84, 0);
    }
    100% {
        transform: scale(0.92);
        box-shadow: 0 0 0 0 rgba(255, 109, 84, 0);
    }
}
