:root {
    color-scheme: dark;
    --bg: #101215;
    --bg-top: #16191d;
    --surface: rgba(255, 255, 255, 0.02);
    --surface-strong: #1b2026;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #f2efe9;
    --muted: #ada79d;
    --accent: #9aaaba;
    --accent-strong: #e7ebf0;
    --success: #99b5a2;
    --danger: #cb978c;
    --max-width: 1200px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Public Sans", "Avenir Next", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top, rgba(154, 170, 186, 0.08), transparent 34rem),
        linear-gradient(180deg, #121418 0%, #101215 100%);
    line-height: 1.6;
}

.site-backdrop {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.site-backdrop::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.014) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
    background-size: 144px 144px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.28), transparent 82%);
}

::selection {
    background: rgba(154, 170, 186, 0.28);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

h1,
h2,
h3,
p,
dl,
dd {
    margin: 0;
}

h1,
h2,
h3 {
    line-height: 1.06;
    letter-spacing: -0.035em;
}

h1 {
    font-size: clamp(3rem, 7vw, 5rem);
}

h2 {
    font-size: clamp(1.35rem, 3vw, 2rem);
}

h3 {
    font-size: 1.05rem;
}

code,
pre,
.brand-mark,
.wallet-status,
.session-status,
.solved-stamp,
.runbook-step-num,
.card-label {
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
}

code,
pre {
    color: var(--accent-strong);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
}

code {
    display: inline-block;
    max-width: 100%;
    padding: 0.18rem 0.42rem;
    overflow-wrap: anywhere;
}

pre {
    padding: 1rem;
    overflow-x: auto;
}

:focus-visible {
    outline: 2px solid rgba(154, 170, 186, 0.85);
    outline-offset: 2px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border);
    background: rgba(18, 21, 25, 0.84);
    backdrop-filter: blur(10px);
}

.header-inner,
.page-shell {
    width: min(calc(100% - 2rem), var(--max-width));
    margin: 0 auto;
}

.header-inner {
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.brand-mark {
    color: var(--accent-strong);
    font-size: 0.9rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 4.5rem;
    color: var(--muted);
    transition: color 160ms ease;
}

.nav-link::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: transparent;
    transition: background-color 160ms ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active {
    color: var(--text);
}

.nav-link:hover::after,
.nav-link:focus-visible::after,
.nav-link.is-active::after {
    background: var(--accent);
}

.wallet-auth {
    position: relative;
    display: flex;
    align-items: center;
}

.wallet-auth-button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.8rem;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        color 160ms ease;
}

.wallet-auth-button:hover,
.wallet-auth-button:focus-visible,
.button:hover,
.button:focus-visible {
    border-color: rgba(154, 170, 186, 0.34);
    background: rgba(255, 255, 255, 0.03);
}

.wallet-auth-button {
    min-width: 0;
    max-width: 14rem;
    justify-content: flex-start;
    text-align: left;
    gap: 0.6rem;
    padding-inline: 0.85rem 1rem;
}

.wallet-auth-indicator {
    width: 0.52rem;
    height: 0.52rem;
    border-radius: 999px;
    background: rgba(154, 170, 186, 0.42);
    flex: none;
}

.wallet-auth-button.is-connected .wallet-auth-indicator {
    background: var(--success);
}

.wallet-auth-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.button-primary {
    background: rgba(154, 170, 186, 0.12);
}

.button-danger {
    color: #f1d9d4;
    border-color: rgba(203, 151, 140, 0.26);
}

.wallet-auth-menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    min-width: 11rem;
    padding: 0.35rem;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    z-index: 10;
}

.wallet-auth-menu-button {
    display: block;
    width: 100%;
    padding: 0.72rem 0.8rem;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.wallet-auth-menu-button:hover,
.wallet-auth-menu-button:focus-visible {
    background: rgba(255, 255, 255, 0.04);
}

.wallet-auth-feedback {
    position: absolute;
    top: calc(100% + 3.2rem);
    right: 0;
    max-width: 16rem;
    font-size: 0.86rem;
    color: var(--danger);
}

.wallet-auth mysten-dapp-kit-connect-modal {
    --background: #171b21;
    --foreground: var(--text);
    --primary: #9aaaba;
    --primary-foreground: #111418;
    --secondary: #1c2129;
    --secondary-foreground: var(--text);
    --border: rgba(255, 255, 255, 0.12);
    --accent: rgba(154, 170, 186, 0.12);
    --accent-foreground: var(--text);
    --muted: #171b21;
    --muted-foreground: var(--muted);
    --popover: #1b2028;
    --popover-foreground: var(--text);
    --ring: rgba(154, 170, 186, 0.45);
    --radius: 12px;
    --font-sans: "Public Sans", "Avenir Next", "Segoe UI", sans-serif;
}

.page-shell {
    padding: 2.5rem 0 4rem;
}

.content-stage {
    display: grid;
    gap: 2rem;
}

.page-home {
    position: relative;
    min-height: 100dvh;
}

.page-home .page-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.page-home .content-stage {
    display: block;
}

.home-wordmark {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    text-align: center;
    pointer-events: none;
}

.home-wordmark-copy {
    display: grid;
    gap: 0.85rem;
    pointer-events: auto;
}

.home-wordmark h1 {
    font-size: clamp(4rem, 14vw, 10rem);
    letter-spacing: -0.08em;
}

.home-wordmark p {
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.2rem);
    letter-spacing: 0.01em;
}

.home-socials {
    display: flex;
    justify-content: center;
    gap: 0.9rem;
    margin-top: 0.5rem;
}

.home-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition:
        color 160ms ease,
        transform 160ms ease;
}

.home-social-link:hover,
.home-social-link:focus-visible {
    color: var(--text);
    transform: translateY(-1px);
}

.home-social-link svg {
    width: 2.1rem;
    height: 2.1rem;
}

.home-social-link img {
    width: 2.1rem;
    height: 2.1rem;
    display: block;
}

.flash-stack {
    display: grid;
    gap: 0.65rem;
}

.flash-message {
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.flash-success {
    border-color: rgba(153, 181, 162, 0.36);
}

.flash-error {
    border-color: rgba(203, 151, 140, 0.36);
}

.page-lead,
.section-shell,
.detail-main,
.catalog-list {
    display: grid;
    gap: 1rem;
}

.page-lead {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 2rem;
    align-items: end;
    padding: 2.5rem 0 1.75rem;
    border-bottom: 1px solid var(--border);
}

.hero-copy {
    display: grid;
    gap: 1rem;
}

.hero-actions,
.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.hero-panel {
    padding-left: 1.5rem;
    border-left: 1px solid var(--border);
    display: grid;
    gap: 1rem;
}

.hero-metric {
    display: grid;
    gap: 0.25rem;
}

.hero-metric + .hero-metric {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.metric-value {
    font-size: clamp(1.7rem, 4vw, 2.5rem);
    line-height: 1;
}

.metric-label,
.detail-note {
    color: var(--muted);
}

.section-shell {
    padding-top: 1.5rem;
}

.feature-grid,
.principle-grid,
.runbook-shell,
.catalog-grid {
    display: grid;
    gap: 0;
    border-top: 1px solid var(--border);
}

.feature-card,
.principle-card,
.runbook-step,
.challenge-card {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.feature-card,
.principle-card {
    display: block;
}

.catalog-list {
    gap: 2rem;
}

.catalog-section {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.catalog-sidebar {
    padding-top: 1rem;
    display: grid;
    gap: 0.35rem;
}

.catalog-count {
    color: var(--muted);
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
}

.challenge-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding-left: 1rem;
    transition:
        color 160ms ease,
        border-color 160ms ease,
        background-color 160ms ease,
        padding-left 160ms ease;
}

.challenge-card::before {
    content: "";
    position: absolute;
    top: 0.9rem;
    bottom: 0.9rem;
    left: 0;
    width: 2px;
    background: transparent;
    transition: background-color 160ms ease;
}

.challenge-card:hover,
.challenge-card:focus-visible {
    color: var(--accent-strong);
    border-color: var(--border-strong);
    background: linear-gradient(90deg, rgba(154, 170, 186, 0.05), transparent 70%);
    padding-left: 1.25rem;
}

.challenge-card:hover::before,
.challenge-card:focus-visible::before {
    background: var(--accent);
}

.challenge-card-main,
.challenge-card-foot {
    display: grid;
    gap: 0.35rem;
}

.challenge-card-title {
    display: block;
}

.challenge-card-title h3 {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.55rem;
}

.challenge-card-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.8rem;
}

.challenge-solve-count {
    display: inline-block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.challenge-card-summary {
    color: var(--muted);
    font-size: 0.94rem;
    max-width: 48rem;
}

.solved-stamp,
.session-status,
.wallet-status {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.solved-stamp {
    color: var(--success);
    border-color: rgba(153, 181, 162, 0.32);
}

.challenge-card-arrow {
    color: var(--accent);
    font-size: 1.2rem;
    line-height: 1;
}

.challenge-card.is-solved::before {
    background: rgba(153, 181, 162, 0.65);
}

.detail-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 2.5rem;
    align-items: start;
}

.detail-main {
    gap: 1.5rem;
}

.detail-title-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
}

.detail-title-actions {
    display: flex;
    gap: 0.8rem;
    padding-top: 0.25rem;
}

.page-copy,
.session-card dd,
.status-banner p:not(.card-label) {
    color: var(--muted);
}

.panel,
.wallet-summary,
.detail-aside,
.hero-panel {
    background: none;
    border-radius: 0;
}

.wallet-summary,
.status-banner {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.pseudonym-form {
    display: grid;
    gap: 0.65rem;
}

.pseudonym-form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.text-input {
    min-height: 2.8rem;
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
}

.text-input:focus-visible {
    border-color: rgba(154, 170, 186, 0.45);
    outline: none;
}

.pseudonym-form-help {
    color: var(--muted);
    font-size: 0.82rem;
}

.detail-aside {
    position: sticky;
    top: 6.5rem;
    border-top: 0;
    padding-top: 0;
    padding-left: 0;
}

.detail-actions {
    flex-direction: column;
}

.detail-actions .launch-form,
.detail-actions .button {
    width: 100%;
}

.session-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1.75rem;
    border-top: 1px solid var(--border);
}

.session-card {
    display: grid;
    gap: 0.4rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.session-card dt,
.card-label {
    color: var(--muted);
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.session-card.emphasis {
    border-color: rgba(154, 170, 186, 0.24);
}

.session-status {
    color: var(--accent);
}

.status-banner {
    display: grid;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.status-banner.is-success {
    border-color: rgba(153, 181, 162, 0.34);
}

.solve-history {
    border-top: 1px solid var(--border);
}

.solve-history-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    transition: color 160ms ease;
}

.solve-history-entry:hover,
.solve-history-entry:focus-visible {
    color: var(--accent-strong);
}

.solve-history-entry-static {
    transition: none;
}

.solve-history-entry-static:hover,
.solve-history-entry-static:focus-visible {
    color: inherit;
}

.solve-history-main {
    display: grid;
    gap: 0.25rem;
}

.solve-history-address {
    font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.solve-history-meta,
.solve-history-time {
    color: var(--muted);
    font-size: 0.82rem;
}

.solve-history-time {
    white-space: nowrap;
    text-align: right;
}

.runbook-step {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
}

.getting-started-list {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding-left: 1.25rem;
}

.getting-started-list li {
    color: var(--text);
}

.getting-started-list a {
    color: #7fd4ff;
    text-decoration: underline;
    text-decoration-color: rgba(127, 212, 255, 0.45);
    text-underline-offset: 0.18em;
}

.getting-started-list a:hover,
.getting-started-list a:focus-visible {
    color: #b8ebff;
    text-decoration-color: currentColor;
}

.runbook-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    min-height: 72px;
    border: 1px solid var(--border);
    color: var(--accent-strong);
    font-size: 1rem;
}

.launch-form {
    margin: 0;
}

@media (max-width: 960px) {
    .header-inner,
    .header-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-inner {
        padding: 0.8rem 0;
    }

    .site-nav {
        gap: 1rem;
    }

    .nav-link {
        min-height: auto;
        padding-bottom: 0.5rem;
    }

    .page-shell {
        padding-top: 1.75rem;
    }

    .hero-grid,
    .catalog-section,
    .detail-shell {
        grid-template-columns: 1fr;
    }

    .catalog-section {
        gap: 1rem;
    }

    .hero-panel,
    .detail-aside {
        padding-left: 0;
    }

    .detail-aside {
        position: static;
        padding-top: 1rem;
    }
}

@media (max-width: 720px) {
    .header-inner,
    .page-shell {
        width: min(calc(100% - 1rem), var(--max-width));
    }

    h1 {
        font-size: clamp(2.4rem, 14vw, 3.5rem);
    }

    .wallet-auth {
        width: 100%;
    }

    .wallet-auth-button {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .hero-actions,
    .challenge-card,
    .challenge-card-main,
    .challenge-card-foot {
        display: grid;
    }

    .hero-actions .button,
    .detail-actions .button,
    .detail-actions .launch-form {
        width: 100%;
    }

    .pseudonym-form-row {
        grid-template-columns: 1fr;
    }

    .solve-history-entry {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .solve-history-time {
        text-align: left;
    }

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

    .runbook-step {
        grid-template-columns: 56px minmax(0, 1fr);
    }

    .runbook-step-num {
        width: 56px;
        min-height: 56px;
    }
}
