:root {
    --bg: #f3ede3;
    --bg-deep: #ebe2d4;
    --surface: rgba(255, 250, 244, 0.72);
    --surface-strong: rgba(255, 252, 247, 0.92);
    --surface-dark: rgba(23, 26, 31, 0.88);
    --ink: #181b21;
    --ink-soft: #555c67;
    --line: rgba(24, 27, 33, 0.08);
    --line-strong: rgba(24, 27, 33, 0.14);
    --teal: #117a8b;
    --teal-deep: #0b5569;
    --coral: #ff8c61;
    --gold: #b78b49;
    --success: #1b946a;
    --danger: #c95a4c;
    --shadow-lg: 0 32px 80px rgba(26, 31, 38, 0.14);
    --shadow-md: 0 18px 40px rgba(26, 31, 38, 0.1);
    --shadow-sm: 0 10px 24px rgba(26, 31, 38, 0.08);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(17, 122, 139, 0.16), transparent 34%),
        radial-gradient(circle at right 15% top 20%, rgba(255, 140, 97, 0.18), transparent 28%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)),
        repeating-linear-gradient(
            135deg,
            transparent 0,
            transparent 22px,
            rgba(255, 255, 255, 0.18) 22px,
            rgba(255, 255, 255, 0.18) 23px
        );
    mix-blend-mode: soft-light;
    opacity: 0.55;
}

.page-shell {
    width: min(1440px, calc(100vw - 48px));
    margin: 0 auto;
    padding: 48px 0 56px;
    position: relative;
}

.ambient {
    position: absolute;
    border-radius: 999px;
    filter: blur(28px);
    opacity: 0.58;
    pointer-events: none;
}

.ambient-a {
    width: 180px;
    height: 180px;
    top: 40px;
    right: 4%;
    background: rgba(17, 122, 139, 0.18);
}

.ambient-b {
    width: 220px;
    height: 220px;
    top: 420px;
    left: -60px;
    background: rgba(255, 140, 97, 0.18);
}

.ambient-c {
    width: 160px;
    height: 160px;
    bottom: 40px;
    right: 10%;
    background: rgba(183, 139, 73, 0.18);
}

.hero,
.workspace-grid {
    position: relative;
    z-index: 1;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
    gap: 28px;
    margin-bottom: 28px;
    align-items: stretch;
}

.hero-copy,
.hero-side,
.panel {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-xl);
    position: relative;
}

.hero-copy {
    padding: 32px 34px;
    overflow: hidden;
}

.hero-copy::after {
    content: "";
    position: absolute;
    right: -48px;
    top: -48px;
    width: 200px;
    height: 200px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.42), transparent 68%);
}

.hero-side {
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
}

.hero-brand {
    display: flex;
    align-items: center;
    gap: 18px;
}

.hero-logo {
    width: 78px;
    height: 78px;
    filter: drop-shadow(0 16px 30px rgba(17, 122, 139, 0.16));
}

.hero-kicker,
.eyebrow,
.hero-note-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--teal);
}

.hero-kicker::before,
.eyebrow::before,
.hero-note-label::before {
    content: "";
    width: 12px;
    height: 1px;
    background: currentColor;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: "Cormorant Garamond", serif;
    letter-spacing: -0.03em;
}

h1 {
    font-size: clamp(2.8rem, 5vw, 4.8rem);
    line-height: 0.92;
    margin-top: 8px;
}

h2 {
    font-size: clamp(2rem, 2.4vw, 2.7rem);
    line-height: 1;
}

h3 {
    font-size: 1.55rem;
    line-height: 1.05;
}

.hero-summary,
.hero-note p,
.session-empty p,
.logs-empty p,
.field-tip,
.metric-footnote,
.page-banner,
.detail-empty,
.log-meta,
.header-row,
.copy-hint {
    color: var(--ink-soft);
}

.hero-summary {
    max-width: 56ch;
    margin: 24px 0 0;
    font-size: 1.04rem;
    line-height: 1.75;
}

.hero-actions,
.quick-actions,
.modal-actions,
.stream-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-actions {
    margin-top: 28px;
}

.btn,
.icon-btn,
.text-link {
    appearance: none;
    border: none;
    background: none;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
    font: inherit;
}

.btn {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border: 1px solid transparent;
}

.btn:hover,
.icon-btn:hover,
.text-link:hover {
    transform: translateY(-1px);
}

.btn:disabled,
.icon-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-deep) 100%);
    color: #fff;
    box-shadow: 0 14px 30px rgba(17, 122, 139, 0.22);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.58);
    color: var(--ink);
    border-color: rgba(24, 27, 33, 0.08);
}

.btn-tertiary,
.btn-ghost {
    background: rgba(255, 255, 255, 0.36);
    color: var(--ink);
    border: 1px solid rgba(24, 27, 33, 0.08);
}

.btn-ghost.is-active {
    background: rgba(17, 122, 139, 0.12);
    color: var(--teal-deep);
    border-color: rgba(17, 122, 139, 0.22);
}

.btn-ghost.danger {
    color: var(--danger);
}

.icon-btn {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(24, 27, 33, 0.08);
    font-size: 0.92rem;
}

.text-link {
    color: var(--teal-deep);
    font-weight: 600;
}

.status-pill {
    min-height: 48px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(24, 27, 33, 0.08);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    width: fit-content;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(24, 27, 33, 0.2);
    box-shadow: 0 0 0 8px rgba(24, 27, 33, 0.04);
}

.status-dot.status-connected {
    background: var(--success);
    box-shadow: 0 0 0 8px rgba(27, 148, 106, 0.12);
}

.status-dot.status-connecting {
    background: var(--gold);
    box-shadow: 0 0 0 8px rgba(183, 139, 73, 0.12);
    animation: pulse 1.6s ease infinite;
}

.status-dot.status-disconnected {
    background: var(--danger);
    box-shadow: 0 0 0 8px rgba(201, 90, 76, 0.12);
}

.hero-note {
    padding: 20px 22px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.36));
    border: 1px solid rgba(24, 27, 33, 0.08);
}

.hero-note p {
    margin: 12px 0 0;
    line-height: 1.7;
}

.page-banner {
    margin-bottom: 24px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: rgba(201, 90, 76, 0.1);
    border: 1px solid rgba(201, 90, 76, 0.14);
}

.hidden {
    display: none !important;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 468px minmax(0, 1fr);
    gap: 28px;
}

.session-panel,
.session-live,
.session-code-block,
.field-card,
.metric-card {
    min-width: 0;
}

.panel {
    padding: 28px;
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.14));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.session-empty,
.logs-empty {
    border-radius: var(--radius-lg);
    padding: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.3));
    border: 1px solid rgba(24, 27, 33, 0.08);
}

.empty-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: rgba(17, 122, 139, 0.1);
    color: var(--teal-deep);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 16px;
}

.session-live {
    display: grid;
    gap: 16px;
}

.session-code-block,
.field-card,
.curl-card,
.metric-card,
.log-card,
.search-shell {
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.54);
    border: 1px solid rgba(24, 27, 33, 0.08);
}

.session-code-block,
.field-card,
.curl-card {
    padding: 18px;
    overflow: hidden;
}

.session-label,
.metric-label,
.field-label {
    display: block;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 10px;
}

.session-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

.mono {
    font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
}

.field-value,
.code-preview {
    margin: 0;
    line-height: 1.7;
}

.field-value {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(24, 27, 33, 0.07);
    font-size: 0.95rem;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.session-panel .meta-grid {
    grid-template-columns: minmax(0, 1fr);
}

.metric-card {
    padding: 16px 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.metric-card strong,
.mini-stat strong {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 6px;
    line-height: 1.28;
    overflow-wrap: anywhere;
}

.metric-footnote {
    display: block;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.session-panel .metric-card strong {
    font-size: 1.45rem;
}

.session-panel .metric-card:nth-child(2) strong {
    font-size: 1.15rem;
    line-height: 1.45;
}

.session-panel .metric-card:nth-child(2) .metric-footnote {
    max-width: 24ch;
}

.field-head,
.stream-toolbar,
.log-card-head,
.log-actions,
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.session-panel .field-head {
    align-items: center;
}

.session-panel .quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-tip,
.metric-footnote {
    font-size: 0.88rem;
}

.code-preview {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(23, 26, 31, 0.92);
    color: #f5f2ed;
    font-size: 0.87rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.code-preview.large {
    max-height: 420px;
}

.stream-panel {
    display: flex;
    flex-direction: column;
    min-height: 820px;
}

.stream-header {
    margin-bottom: 18px;
}

.stream-toolbar {
    margin-bottom: 18px;
    align-items: stretch;
    flex-wrap: wrap;
}

.search-shell {
    flex: 1 1 280px;
    padding: 12px 16px;
    display: grid;
    gap: 8px;
}

.search-shell span {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.search-shell input {
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    color: var(--ink);
}

.stream-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.mini-stat {
    min-width: 118px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.48);
    border: 1px solid rgba(24, 27, 33, 0.08);
}

.mini-stat span {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.logs-viewport {
    min-height: 520px;
    flex: 1;
}

.logs-list {
    display: grid;
    gap: 14px;
}

.log-card {
    padding: 18px;
    box-shadow: var(--shadow-sm);
    animation: liftIn 0.45s ease both;
}

.log-card-head {
    align-items: flex-start;
    margin-bottom: 14px;
}

.log-lead {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.method-badge {
    min-width: 74px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.method-get {
    background: linear-gradient(135deg, #3a7df0 0%, #2a62c9 100%);
}

.method-post {
    background: linear-gradient(135deg, #1b946a 0%, #0f7f57 100%);
}

.method-put {
    background: linear-gradient(135deg, #d29a36 0%, #b77519 100%);
}

.method-delete {
    background: linear-gradient(135deg, #c95a4c 0%, #a53f32 100%);
}

.method-other {
    background: linear-gradient(135deg, #697280 0%, #4d5664 100%);
}

.log-path {
    font-weight: 600;
    word-break: break-all;
}

.log-meta {
    font-size: 0.9rem;
    white-space: nowrap;
}

.log-actions {
    margin-bottom: 14px;
    justify-content: flex-start;
}

.detail-block {
    margin-top: 10px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.44);
    border: 1px solid rgba(24, 27, 33, 0.07);
    overflow: hidden;
}

.detail-block summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.detail-block summary::-webkit-details-marker {
    display: none;
}

.detail-block summary::after {
    content: "+";
    color: var(--ink-soft);
}

.detail-block[open] summary::after {
    content: "−";
}

.detail-content {
    padding: 0 14px 14px;
}

.headers-grid {
    display: grid;
    gap: 8px;
}

.header-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.92rem;
}

.header-key {
    color: var(--teal-deep);
    font-weight: 700;
}

.detail-empty {
    margin: 0;
    font-size: 0.92rem;
}

.toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    display: grid;
    gap: 10px;
    z-index: 40;
}

.toast {
    min-width: 240px;
    max-width: 340px;
    padding: 14px 16px;
    border-radius: 18px;
    color: #fff;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.25s ease both;
}

.toast-success {
    background: linear-gradient(135deg, #1b946a 0%, #0f7f57 100%);
}

.toast-error {
    background: linear-gradient(135deg, #c95a4c 0%, #a53f32 100%);
}

.toast-info {
    background: linear-gradient(135deg, #117a8b 0%, #0b5569 100%);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 18, 23, 0.48);
    backdrop-filter: blur(6px);
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(920px, calc(100vw - 28px));
    margin: 72px auto 0;
    padding: 24px;
    border-radius: 28px;
    background: var(--surface-strong);
    border: 1px solid rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-lg);
}

.modal-head {
    margin-bottom: 16px;
}

.reveal {
    animation: liftIn 0.72s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.reveal-delay-1 {
    animation-delay: 0.08s;
}

.reveal-delay-2 {
    animation-delay: 0.16s;
}

.reveal-delay-3 {
    animation-delay: 0.24s;
}

@keyframes pulse {
    0%, 100% { opacity: 0.78; }
    50% { opacity: 1; }
}

@keyframes liftIn {
    from {
        opacity: 0;
        transform: translateY(22px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1180px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .stream-panel {
        min-height: 0;
    }
}

@media (max-width: 860px) {
    .page-shell {
        width: min(100vw - 24px, 1440px);
        padding-top: 24px;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .hero-copy,
    .hero-side,
    .panel {
        border-radius: 24px;
    }

    .stream-header,
    .stream-toolbar,
    .panel-header,
    .log-card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .meta-grid {
        grid-template-columns: 1fr;
    }

    .modal-card {
        margin-top: 20px;
        padding: 18px;
    }
}

@media (max-width: 560px) {
    body {
        font-size: 15px;
    }

    .hero-copy,
    .hero-side,
    .panel {
        padding: 20px;
    }

    .hero-brand {
        align-items: flex-start;
    }

    .hero-logo {
        width: 62px;
        height: 62px;
    }

    .session-code-row,
    .field-head,
    .quick-actions,
    .hero-actions,
    .stream-actions {
        width: 100%;
    }

    .btn,
    .icon-btn {
        width: 100%;
    }

    .session-panel .quick-actions {
        grid-template-columns: 1fr;
    }

    .mini-stat,
    .status-pill {
        width: 100%;
    }

    .log-lead {
        flex-direction: column;
        align-items: flex-start;
    }
}
