:root {
    --bg-0: #03060f;
    --bg-1: #081120;
    --bg-2: #101b39;
    --panel-bg: rgba(7, 14, 30, 0.76);
    --border: rgba(0, 247, 255, 0.2);
    --border-strong: rgba(0, 247, 255, 0.38);
    --text: #ebf7ff;
    --muted: #8fa7c2;
    --accent: #00f7ff;
    --accent-2: #ff4db8;
    --accent-3: #8b5dff;
    --success: #60f7cb;
    --danger: #ff7d9f;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    height: 100%;
}

body {
    position: relative;
    margin: 0;
    height: 100vh;
    padding: 20px;
    overflow: hidden;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(0, 247, 255, 0.14), transparent 28%),
        radial-gradient(circle at 85% 16%, rgba(255, 77, 184, 0.16), transparent 24%),
        linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 50%, var(--bg-2) 100%);
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body::before {
    background:
        radial-gradient(circle at 20% 20%, rgba(0, 247, 255, 0.12), transparent 18%),
        radial-gradient(circle at 80% 0%, rgba(139, 93, 255, 0.12), transparent 18%);
    filter: blur(18px);
    opacity: 0.85;
}

body::after {
    background: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 30px 30px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
}

.page-backdrop,
.page-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.page-backdrop {
    background: radial-gradient(circle at center, transparent 0 54%, rgba(0, 0, 0, 0.44) 100%);
}

.page-grid {
    background:
        linear-gradient(135deg, rgba(0, 247, 255, 0.1), transparent 30%),
        linear-gradient(315deg, rgba(255, 77, 184, 0.08), transparent 36%);
    opacity: 0.55;
}

.app-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, 100%);
    margin: 0 auto;
    height: calc(100vh - 64px);
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.app-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
}

.app-intro-copy {
    max-width: 780px;
}

.app-status-row {
    display: grid;
    gap: 8px;
    justify-items: start;
    flex: 0 0 auto;
    min-width: 0;
}

.workspace-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.workspace-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(8, 18, 34, 0.9), rgba(6, 14, 27, 0.84));
    color: var(--text);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.workspace-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 247, 255, 0.32);
    box-shadow: 0 0 24px rgba(0, 247, 255, 0.12);
}

.workspace-toggle:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 247, 255, 0.16), 0 0 24px rgba(0, 247, 255, 0.16);
}

.eyebrow,
.panel-label,
.field-label {
    display: inline-block;
    margin-bottom: 10px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.app-intro h1,
.panel-head h2 {
    margin: 0;
    line-height: 1.05;
}

.app-intro h1 {
    font-size: clamp(2.6rem, 6vw, 4.8rem);
    text-shadow: 0 0 32px rgba(0, 247, 255, 0.16);
}

.hero-text,
.panel-head p,
.status-pill,
.log-empty,
.message-text,
select,
input,
option {
    font-size: 0.98rem;
}

.hero-text,
.panel-head p,
.log-empty {
    margin: 12px 0 0;
    line-height: 1.7;
    color: var(--muted);
}

.workspace-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 24px;
    flex: 1 1 auto;
    height: 0;
    align-items: stretch;
    min-height: 0;
    overflow: hidden;
    transition: grid-template-columns 180ms ease;
}

.workspace-layout.controls-collapsed {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

.control-rail {
    display: grid;
    gap: 18px;
    height: 100%;
    align-content: start;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 247, 255, 0.2) rgba(255, 255, 255, 0.03);
    transition: opacity 160ms ease;
}

.control-rail::-webkit-scrollbar {
    width: 10px;
}

.control-rail::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
}

.control-rail::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(0, 247, 255, 0.2);
}

.workspace-layout.controls-collapsed .control-rail {
    display: none;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.workspace-layout.controls-collapsed .receive-column {
    grid-column: 1 / -1;
}

.panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(12, 21, 41, 0.95), var(--panel-bg));
    box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 247, 255, 0.08), transparent 24%, transparent 76%, rgba(255, 77, 184, 0.07));
    pointer-events: none;
}

.panel::after {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: calc(var(--radius-xl) - 10px);
    pointer-events: none;
}

.panel-head,
.field-stack,
.message-log,
.status-card {
    position: relative;
    z-index: 1;
}

.control-rail > .panel,
.receive-column {
    padding: 24px;
}

.panel-head {
    margin-bottom: 18px;
}

.panel-head h2 {
    font-size: clamp(1.35rem, 2vw, 1.85rem);
}

.status-card {
    margin-bottom: 18px;
    padding: 20px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(6, 15, 30, 0.88), rgba(10, 24, 45, 0.72));
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(0, 247, 255, 0.08);
    color: var(--text);
}

.status-pill::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 14px currentColor;
}

.status-pill.is-pending {
    color: #7ce5ff;
}

.status-pill.is-ready {
    color: var(--success);
}

.status-pill.is-live {
    color: var(--accent-2);
}

.status-pill.is-error {
    color: var(--danger);
}

.field-stack {
    margin-bottom: 14px;
}

input,
select {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(5, 14, 28, 0.94), rgba(10, 18, 35, 0.82));
    color: var(--text);
    padding: 15px 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

input::placeholder {
    color: #6f85a5;
}

.id-input {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.92rem;
    line-height: 1.6;
    border-color: rgba(139, 93, 255, 0.28);
    box-shadow: inset 0 0 26px rgba(139, 93, 255, 0.12);
}

select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--accent) 50%),
        linear-gradient(135deg, var(--accent) 50%, transparent 50%);
    background-position:
        calc(100% - 20px) calc(50% - 4px),
        calc(100% - 13px) calc(50% - 4px);
    background-size: 7px 7px, 7px 7px;
    background-repeat: no-repeat;
    padding-right: 44px;
}

input[type="button"] {
    cursor: pointer;
    padding: 11px 16px;
    border-radius: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background:
        linear-gradient(90deg, rgba(0, 247, 255, 0.18), rgba(139, 93, 255, 0.18)),
        linear-gradient(180deg, rgba(9, 20, 40, 0.96), rgba(8, 15, 30, 0.92));
    border-color: var(--border-strong);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0 22px rgba(0, 247, 255, 0.1);
}

.control-rail input[type="button"] {
    margin-top: -2px;
}

input:hover:not(:disabled),
select:hover:not(:disabled),
input[type="text"]:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(0, 247, 255, 0.36);
}

input:focus-visible,
select:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 247, 255, 0.16), 0 0 24px rgba(0, 247, 255, 0.16);
}

input[type="button"]:hover:not(:disabled) {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 30px rgba(0, 247, 255, 0.18);
}

input:disabled,
select:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

.receive-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    min-width: 0;
}

.message-log {
    min-height: 0;
    height: 100%;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 247, 255, 0.24) rgba(255, 255, 255, 0.04);
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(4, 10, 20, 0.92), rgba(8, 16, 31, 0.86)),
        linear-gradient(135deg, rgba(0, 247, 255, 0.06), transparent 30%);
}

.message-log::-webkit-scrollbar {
    width: 10px;
}

.message-log::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
}

.message-log::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(0, 247, 255, 0.24);
}

.log-empty {
    margin: 0;
}

.message-entry {
    position: relative;
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(0, 247, 255, 0.12);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(8, 20, 39, 0.9), rgba(6, 14, 27, 0.74));
}

.message-entry:last-child {
    margin-bottom: 0;
}

.explorer-card {
    padding-top: 18px;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.explorer-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.entry-type-blockheader::before {
    background: linear-gradient(90deg, rgba(0, 247, 255, 0.95), rgba(83, 175, 255, 0.55));
}

.entry-type-tx::before {
    background: linear-gradient(90deg, rgba(255, 77, 184, 0.92), rgba(139, 93, 255, 0.6));
}

.entry-type-unknown::before {
    background: linear-gradient(90deg, rgba(140, 160, 180, 0.8), rgba(140, 160, 180, 0.25));
}

.entry-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.entry-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.76rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    background: rgba(255, 255, 255, 0.03);
}

.entry-type-blockheader .entry-badge {
    color: #78f3ff;
    background: rgba(0, 247, 255, 0.08);
}

.entry-type-tx .entry-badge {
    color: #ff8fda;
    background: rgba(255, 77, 184, 0.08);
}

.entry-type-unknown .entry-badge {
    color: #b3c3d4;
    background: rgba(149, 166, 186, 0.08);
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-width: 0;
}

.entry-cell {
    display: grid;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(8, 17, 34, 0.92), rgba(6, 13, 25, 0.74));
}

.entry-cell-raw,
.entry-footer {
    grid-column: 1 / -1;
}

.entry-label {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.entry-value,
.entry-raw {
    min-width: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
}

.entry-hash,
.entry-raw,
.entry-footer .entry-value {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.82rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.entry-footer {
    display: grid;
    min-width: 0;
    overflow: hidden;
}

.entry-raw {
    margin: 0;
    white-space: pre-wrap;
}

.message-stamp {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

.message-text {
    margin: 0;
    color: var(--text);
    word-break: break-word;
}

@media (max-width: 900px) {
    body {
        height: auto;
        min-height: 100vh;
        padding: 14px 12px 24px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .app-intro {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 14px;
    }

    .app-intro-copy {
        max-width: none;
    }

    .app-status-row {
        width: 100%;
        padding: 14px 16px;
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 18px;
        background: linear-gradient(180deg, rgba(8, 18, 35, 0.88), rgba(9, 20, 39, 0.72));
    }

    .workspace-toolbar {
        display: block;
        margin-bottom: 12px;
    }

    .workspace-toggle {
        width: 100%;
        min-height: 52px;
    }

    .app-shell {
        width: 100%;
        height: auto;
        min-height: 0;
    }

    .workspace-layout {
        grid-template-columns: 1fr;
        flex: 0 0 auto;
        height: auto;
        gap: 16px;
        overflow: visible;
    }

    .workspace-layout.controls-collapsed {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .control-rail {
        height: auto;
        gap: 16px;
        overflow: visible;
        padding-right: 0;
    }

    .control-rail > .panel,
    .receive-column {
        padding: 20px;
    }

    input,
    select {
        font-size: 16px;
        min-height: 52px;
    }

    input[type="button"] {
        min-height: 50px;
    }

    .message-log {
        min-height: 320px;
        height: auto;
        max-height: none;
    }

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

@media (max-width: 560px) {
    body {
        padding: 12px 10px 20px;
    }

    .app-intro h1 {
        max-width: none;
    }

    .app-status-row {
        padding: 12px 14px;
    }

    .control-rail > .panel,
    .receive-column {
        padding: 18px;
    }

    .status-card,
    .message-log {
        padding: 14px;
    }

    input,
    select {
        min-height: 48px;
        padding: 13px 14px;
    }

    .entry-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
