:root {
    color-scheme: dark;
    --bg: #0f172a;
    --panel: #1e293b;
    --text: #f8fafc;
    --muted: #94a3b8;
    --line: #334155;
    --primary: #6366f1;
    --primary-strong: #818cf8;
    --secondary: #2dd4bf;
    --danger: #f43f5e;
    --warn: #f59e0b;
    --surface: #172033;
    --input: #111b2e;
    --primary-soft: #282d5e;
    --secondary-soft: #153f43;
    --notice: #3c2c12;
}

html[data-theme="light"] {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #0f172a;
    --muted: #5f6b7a;
    --line: #d7dee8;
    --primary: #4f46e5;
    --primary-strong: #3730a3;
    --secondary: #0f766e;
    --danger: #be123c;
    --warn: #9a6700;
    --surface: #eef2f7;
    --input: #ffffff;
    --primary-soft: #e8e7ff;
    --secondary-soft: #dff5f1;
    --notice: #fff8e6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.topbar,
.section-head,
.userbar,
.toolbar,
.two-cols {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar,
.section-head {
    justify-content: space-between;
}

.topbar {
    margin-bottom: 22px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 34px;
    line-height: 1.05;
}

h2 {
    font-size: 20px;
    line-height: 1.2;
}

.eyebrow {
    color: var(--secondary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(20, 24, 32, .04);
}

.notice {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
}

.notice.warn {
    color: var(--warn);
    background: var(--notice);
    border-color: var(--warn);
}

.auth-panel {
    min-height: 62vh;
    display: grid;
    place-items: center;
}

.auth-panel .panel {
    width: min(420px, 100%);
}

.grid {
    display: grid;
    gap: 14px;
}

.metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 14px;
}

.metric {
    min-height: 104px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.tabbar {
    display: flex;
    gap: 2px;
    min-height: 46px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}

.tab {
    min-width: max-content;
    min-height: 45px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--muted);
    padding: 10px 15px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.tab.active {
    color: var(--primary-strong);
    border-bottom-color: var(--primary);
}

.tab-view {
    display: grid;
    gap: 16px;
}

.tab-view[hidden] {
    display: none;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    overflow: hidden;
}

.metric-strip .metric {
    min-width: 0;
    min-height: 96px;
    padding: 15px;
    border-right: 1px solid var(--line);
}

.metric-strip .metric:last-child {
    border-right: 0;
}

.metric-date {
    font-size: 16px !important;
    line-height: 1.25 !important;
}

.workspace-section {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.two-panel-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 16px;
    align-items: start;
}

.wide-section {
    min-width: 0;
}

.technical-details {
    margin-top: 12px;
}

.technical-details summary {
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.technical-details .json-box {
    margin-top: 10px;
}

.filter-grid {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) repeat(5, minmax(120px, 1fr)) auto;
    gap: 10px;
    align-items: end;
    margin: 16px 0 8px;
}

.filter-submit {
    min-width: 96px;
}

.check-row {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    color: var(--text);
}

.check-row input[type="checkbox"] {
    width: 19px;
    min-height: 19px;
    height: 19px;
    margin: 0;
    accent-color: var(--primary);
}

.data-list {
    display: grid;
    margin-top: 12px;
    border-top: 1px solid var(--line);
}

.data-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.data-row > div:first-child {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.data-row span {
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.data-row.compact {
    padding: 9px 0;
}

/* Le nom affiche declenche l'edition du contact : pas de bouton
   supplementaire dans la ligne, l'affordance passe par le survol. */
.inline-edit {
    border: 0;
    
    padding: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.inline-edit::after {
    content: ' \270E';
    opacity: 0;
    transition: opacity .12s ease-in-out;
}

.inline-edit:hover,
.inline-edit:focus-visible {
    color: var(--primary-strong);
    border-bottom-color: var(--primary-strong);
}

.inline-edit:hover::after,
.inline-edit:focus-visible::after,
.inline-edit[aria-expanded="true"]::after {
    opacity: 1;
}

.data-row.editing {
    border-bottom: 0;
}

.user-edit[hidden] { display: none !important; }

.user-edit {
    padding: 4px 0 16px;
    border-bottom: 1px solid var(--line);
}

.pagination {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
}

.rating-select {
    width: 78px;
    min-height: 40px;
}

.rating-badge,
.status-chip {
    display: inline-flex;
    align-items: center;
    width: max-content;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.button.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.button.danger-outline {
    border-color: #e5b8b5;
    color: var(--danger);
    background: var(--panel);
}

.button:disabled,
.button.busy {
    cursor: wait;
    opacity: .6;
}

.pack-detail {
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.preview-table {
    display: grid;
    gap: 5px;
    overflow-x: auto;
}

.preview-table > div {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 5px;
}

.preview-table span {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.settings-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

fieldset {
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

legend {
    padding: 0 6px;
    font-weight: 900;
}

.metric span {
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    font-size: 32px;
    line-height: 1;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 14px;
    margin-bottom: 14px;
}

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

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--input);
    color: var(--text);
    font: inherit;
    min-height: 42px;
    padding: 10px 11px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(99, 102, 241, .22);
    border-color: var(--primary);
}

.button {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel);
    color: var(--text);
    min-height: 40px;
    padding: 9px 13px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-strong);
}

.button.ghost {
    background: transparent;
}

.button.danger {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.theme-toggle {
    min-width: 82px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--secondary);
}

.theme-symbol {
    width: 18px;
    font-size: 18px;
    line-height: 1;
}

.status {
    min-height: 20px;
    color: var(--muted);
    font-size: 13px;
}

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

.status.ok {
    color: var(--primary);
}

.json-box {
    min-height: 340px;
    max-height: 520px;
    overflow: auto;
    background: #101820;
    color: #edf7f4;
    border-radius: 8px;
    padding: 14px;
    font-size: 12px;
    line-height: 1.5;
}

.toolbar {
    margin: 16px 0;
    align-items: stretch;
}

.toolbar input {
    flex: 1;
}

.pack-list {
    display: grid;
    gap: 10px;
}

.settings-panel {
    margin-top: 14px;
}

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

.pack-item {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 8px;
    padding: 14px;
}

.pack-main {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.pack-title {
    font-weight: 900;
}

.pack-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
}

.badge {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 8px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 860px) {
    .metrics,
    .layout,
    .settings-grid,
    .settings-columns,
    .two-panel-layout {
        grid-template-columns: 1fr;
    }

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

    .metric-strip .metric {
        border-right: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
    }

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

    .filter-search,
    .filter-submit {
        grid-column: 1 / -1;
    }

    .topbar,
    .section-head,
    .pack-main,
    .toolbar,
    .two-cols {
        align-items: stretch;
        flex-direction: column;
    }

    .userbar {
        flex-wrap: wrap;
    }

    .data-row {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .shell {
        width: min(100% - 20px, 1180px);
        padding-top: 18px;
    }

    h1 {
        font-size: 28px;
    }

    .filter-grid,
    .metric-strip {
        grid-template-columns: 1fr;
    }

    .metric-strip .metric {
        min-height: 78px;
        border-right: 0;
    }

    .workspace-section,
    .panel {
        padding: 14px;
    }
}

/* Public presentation */
.public-page {
    background: var(--bg);
}

.public-main {
    min-height: 100vh;
    overflow: hidden;
}

.public-container {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.public-header {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    background: var(--bg);
}

.public-brand {
    display: inline-flex;
    align-items: baseline;
    gap: 9px;
    color: var(--text);
    text-decoration: none;
}

.public-brand strong {
    font-size: 24px;
}

.public-brand span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.public-nav {
    display: flex;
    align-items: center;
    gap: 22px;
}

.public-nav > a:not(.button) {
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.public-hero {
    position: relative;
    height: min(620px, calc(100svh - 180px));
    min-height: 500px;
    isolation: isolate;
    overflow: hidden;
    background: #22333b;
}

.public-hero > img,
.hero-shade {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.public-hero > img {
    z-index: -2;
    object-fit: cover;
    object-position: center;
}

.hero-shade {
    z-index: -1;
    background: rgba(8, 17, 22, .42);
}

.hero-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    color: #fff;
    padding-bottom: 28px;
}

.hero-kicker {
    max-width: 660px;
    margin-bottom: 12px;
    color: #d8f1eb;
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
}

.hero-content h1 {
    font-size: 68px;
    line-height: 1;
}

.hero-lead {
    max-width: 650px;
    margin-top: 20px;
    color: #f7fbfa;
    font-size: 20px;
    line-height: 1.55;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 27px;
}

.hero-button {
    min-height: 48px;
    padding: 12px 18px;
    border-color: #64748b;
    background: rgba(15, 23, 42, .9);
    color: #fff;
}

.hero-button.primary {
    border-color: #f59e0b;
    background: #f59e0b;
    color: #0f172a;
}

.hero-button.primary:hover {
    background: #fbbf24;
}

.hero-proof {
    width: min(720px, 100%);
    margin-top: 28px;
    color: #fff;
    border-top: 1px solid rgba(255, 255, 255, .42);
}

.hero-proof-title {
    display: block;
    padding-top: 10px;
    color: #fbbf24;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.hero-proof-items {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 9px;
}

.hero-proof-items div {
    display: grid;
    gap: 2px;
}

.hero-proof-items strong {
    font-size: 13px;
}

.hero-proof-items span {
    color: #dce5ea;
    font-size: 12px;
    line-height: 1.35;
}

.public-band {
    padding: 76px 0;
    background: var(--bg);
}

.public-heading {
    max-width: 760px;
}

.public-heading h2 {
    font-size: 38px;
    line-height: 1.13;
}

.public-heading > p:last-child {
    margin-top: 15px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.65;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin-top: 52px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.feature-item {
    min-width: 0;
    padding: 26px 24px 30px;
    border-right: 1px solid var(--line);
}

.feature-item:first-child {
    padding-left: 0;
}

.feature-item:last-child {
    padding-right: 0;
    border-right: 0;
}

.feature-mark {
    width: 46px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
    border-radius: 5px;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.mark-green { background: #2dd4bf; color: #0f172a; }
.mark-yellow { background: #f59e0b; color: #0f172a; }
.mark-red { background: #f43f5e; }
.mark-blue { background: #6366f1; }

.feature-item h3,
.public-release-list h3,
.release-item h3,
.access-form h3 {
    margin: 0;
    font-size: 19px;
    line-height: 1.25;
}

.feature-item p {
    margin-top: 12px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.network-band {
    background: var(--panel);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.network-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, .75fr);
    gap: 70px;
    align-items: end;
}

.network-intro > p {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
}

.network-rail {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 48px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.network-rail article {
    min-width: 0;
    padding: 25px 26px 28px;
    border-right: 1px solid var(--line);
}

.network-rail article:first-child {
    padding-left: 0;
}

.network-rail article:last-child {
    padding-right: 0;
    border-right: 0;
}

.network-rail article > span {
    display: block;
    margin-bottom: 18px;
    color: var(--secondary);
    font-size: 12px;
    font-weight: 900;
}

.network-rail h3,
.competition-layout h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
}

.network-rail p {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.competition-layout {
    display: grid;
    grid-template-columns: minmax(260px, .65fr) minmax(0, 1.35fr);
    gap: 70px;
    margin-top: 58px;
}

.competition-points {
    display: grid;
    border-top: 1px solid var(--line);
}

.competition-points p {
    display: grid;
    grid-template-columns: minmax(165px, .45fr) minmax(0, 1fr);
    gap: 20px;
    padding: 17px 0;
    border-bottom: 1px solid var(--line);
}

.competition-points span {
    color: var(--muted);
    line-height: 1.55;
}

.competition-points .future-point strong {
    color: var(--warn);
}

.audience-band {
    background: var(--bg);
}

.audience-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 48px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.audience-grid article {
    min-width: 0;
    padding: 26px 24px 30px;
    border-right: 1px solid var(--line);
}

.audience-grid article:first-child {
    padding-left: 0;
}

.audience-grid article:last-child {
    padding-right: 0;
    border-right: 0;
}

.audience-grid article > span {
    display: block;
    min-height: 32px;
    color: var(--warn);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.audience-grid h3 {
    margin: 0;
    font-size: 19px;
    line-height: 1.3;
}

.audience-grid p {
    margin-top: 11px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.community-band {
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.community-layout,
.access-layout {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(420px, 1.15fr);
    gap: 80px;
    align-items: start;
}

.community-points {
    display: grid;
    border-top: 1px solid var(--line);
}

.community-points p {
    display: grid;
    grid-template-columns: minmax(150px, .45fr) minmax(0, 1fr);
    gap: 20px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.community-points span {
    color: var(--muted);
    line-height: 1.55;
}

.applications-band {
    background: #111827;
    color: #fff;
}

.light-heading .eyebrow {
    color: #f0bf3b;
}

.light-heading > p:last-child {
    color: #c9d3d9;
}

.public-release-list {
    display: grid;
    margin-top: 44px;
    border-top: 1px solid #3d4a53;
}

.public-release-list article {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 30px;
    padding: 25px 0;
    border-bottom: 1px solid #3d4a53;
}

.public-release-list p {
    max-width: 680px;
    margin-top: 8px;
    color: #c9d3d9;
    line-height: 1.55;
}

.platform-label {
    display: block;
    margin-bottom: 5px;
    color: #f0bf3b;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.release-locked {
    border-color: #6b7881;
    background: transparent;
    color: #fff;
}

.access-band {
    background: var(--surface);
}

.access-copy {
    position: sticky;
    top: 30px;
}

.security-note {
    display: grid;
    gap: 6px;
    margin-top: 28px;
    padding: 16px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.security-note span,
.form-help,
.download-intro {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.auth-workspace {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.auth-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--line);
}

.auth-switch button {
    min-height: 48px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.auth-switch button.active {
    border-bottom-color: var(--primary);
    color: var(--primary-strong);
}

.access-form {
    padding: 24px;
}

.access-form[hidden] {
    display: none;
}

.public-footer {
    padding: 25px 0;
    background: #090e19;
    color: #fff;
}

.public-footer .public-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.public-footer span {
    color: #b8c3c9;
    font-size: 13px;
}

/* Authenticated releases */
.download-intro {
    margin-top: 14px;
}

.release-list {
    display: grid;
    margin-top: 14px;
    border-top: 1px solid var(--line);
}

.release-item {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.release-platform {
    min-height: 44px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--secondary-soft);
    color: var(--secondary);
    font-size: 12px;
    font-weight: 900;
}

.release-copy {
    min-width: 0;
}

.release-copy p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.release-copy code {
    display: block;
    margin-top: 7px;
    color: #4a5563;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.release-history {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "head action"
        "meta action"
        "hash action";
    align-items: center;
    gap: 5px 18px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.history-item.is-latest {
    border-color: var(--primary);
    background: var(--panel);
}

.history-head {
    grid-area: head;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
}

.history-head h4 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
}

.badge-latest {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

.history-meta {
    grid-area: meta;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.history-item code {
    grid-area: hash;
    color: #4a5563;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.history-action {
    grid-area: action;
    display: grid;
    place-items: center;
}

@media (max-width: 640px) {
    .history-item {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "head"
            "meta"
            "hash"
            "action";
        gap: 10px;
    }

    .history-action {
        justify-items: start;
    }
}

@media (max-width: 900px) {
    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .audience-grid article,
    .audience-grid article:first-child,
    .audience-grid article:last-child {
        padding: 24px;
        border-right: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
    }

    .audience-grid article:nth-child(2n) {
        border-right: 0;
    }

    .feature-item,
    .feature-item:first-child,
    .feature-item:last-child {
        padding: 24px;
        border-right: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
    }

    .feature-item:nth-child(2n) {
        border-right: 0;
    }

    .community-layout,
    .access-layout,
    .network-intro,
    .competition-layout {
        grid-template-columns: 1fr;
        gap: 38px;
    }

    .access-copy {
        position: static;
    }
}

@media (max-width: 640px) {
    .public-container,
    .public-header {
        width: min(100% - 24px, 1180px);
    }

    .public-header {
        min-height: 64px;
    }

    .public-brand span,
    .public-nav > a:not(.button) {
        display: none;
    }

    .public-nav [data-theme-label] {
        display: none;
    }

    .public-nav .theme-toggle {
        min-width: 42px;
        width: 42px;
        padding: 8px;
    }

    .public-nav {
        gap: 8px;
    }

    .public-hero {
        height: 620px;
        min-height: 0;
    }

    .public-hero > img {
        object-position: 58% center;
    }

    .hero-shade {
        background: rgba(7, 15, 20, .55);
    }

    .hero-content {
        justify-content: flex-end;
        padding-bottom: 42px;
    }

    .hero-content h1 {
        font-size: 48px;
    }

    .hero-lead {
        font-size: 17px;
        line-height: 1.5;
    }

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

    .hero-proof {
        margin-top: 20px;
    }

    .hero-proof-title {
        display: none;
    }

    .hero-proof-items {
        gap: 10px;
        margin-top: 10px;
    }

    .hero-proof-items strong,
    .hero-proof-items span {
        font-size: 11px;
    }

    .public-band {
        padding: 54px 0;
    }

    .public-heading h2 {
        font-size: 30px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        margin-top: 35px;
    }

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

    .audience-grid article,
    .audience-grid article:first-child,
    .audience-grid article:last-child {
        padding: 22px 0;
        border-right: 0;
    }

    .feature-item,
    .feature-item:first-child,
    .feature-item:last-child {
        padding: 22px 0;
        border-right: 0;
    }

    .community-points p,
    .competition-points p,
    .public-release-list article,
    .release-item {
        grid-template-columns: 1fr;
    }

    .network-rail {
        grid-template-columns: 1fr;
    }

    .network-rail article,
    .network-rail article:first-child,
    .network-rail article:last-child {
        padding: 22px 0;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .network-rail article:last-child {
        border-bottom: 0;
    }

    .release-item {
        align-items: stretch;
    }

    .release-platform {
        width: 90px;
    }

    .release-locked {
        width: 100%;
    }

    .access-form {
        padding: 18px;
    }

    .public-footer .public-container {
        align-items: flex-start;
        flex-direction: column;
    }
}

.brain-games-band {
    background: var(--panel);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.brain-games-public-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr);
    gap: clamp(28px, 5vw, 72px);
    align-items: center;
}

.brain-games-visual img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #11181d;
}

.brain-games-public-list {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

.brain-games-public-list p {
    display: grid;
    gap: 3px;
    margin: 0;
    padding-left: 14px;
    border-left: 3px solid var(--secondary);
}

.brain-games-public-list span {
    color: var(--muted);
}

.game-category-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 14px 0;
    scrollbar-width: thin;
}

.game-category {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.game-category span {
    margin-left: 4px;
    color: var(--text);
}

.game-category:hover,
.game-category.active {
    border-color: var(--secondary);
    color: var(--text);
    background: var(--secondary-soft);
}

.brain-game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.brain-game-item {
    position: relative;
    display: grid;
    grid-template-columns: 7px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    gap: 10px 12px;
    min-height: 190px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.brain-game-item.planned {
    opacity: 0.72;
}

.brain-game-mark {
    grid-row: 1 / -1;
    width: 7px;
    border-radius: 3px;
    background: #38d6c5;
}

.brain-game-mark[data-game-color="attention"] { background: #ffb020; }
.brain-game-mark[data-game-color="memory"] { background: #e879f9; }
.brain-game-mark[data-game-color="logic"] { background: #60a5fa; }
.brain-game-mark[data-game-color="speed"] { background: #f87171; }
.brain-game-mark[data-game-color="planning"] { background: #38d6c5; }
.brain-game-mark[data-game-color="calculation"] { background: #a3e635; }
.brain-game-mark[data-game-color="language"] { background: #fbbf24; }
.brain-game-mark[data-game-color="perception"] { background: #c084fc; }

.brain-game-copy {
    min-width: 0;
}

.brain-game-copy > span {
    color: var(--secondary);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.brain-game-copy h3 {
    margin: 6px 0;
    font-size: 18px;
}

.brain-game-copy p {
    margin: 0 0 12px;
    color: var(--muted);
}

.brain-game-copy strong {
    font-size: 13px;
}

.brain-game-copy small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.brain-game-item > .button,
.brain-game-item > .status-chip {
    grid-column: 2;
    justify-self: start;
}

.game-leaderboard {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
    .brain-games-public-layout {
        grid-template-columns: 1fr;
    }

    .brain-games-visual {
        order: 2;
    }

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

/* Shared community feed */
.community-workspace {
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
}

.community-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px auto;
    gap: 10px;
    align-items: end;
    margin-top: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.community-message {
    grid-row: span 2;
}

.community-composer textarea {
    min-height: 118px;
    resize: vertical;
}

.community-scope {
    display: flex;
    gap: 0;
    margin-top: 16px;
}

.community-scope .button {
    border-radius: 0;
}

.community-scope .button:first-child {
    border-radius: 6px 0 0 6px;
}

.community-scope .button:last-child {
    border-radius: 0 6px 6px 0;
}

.community-scope .button.active {
    color: var(--secondary);
    border-color: var(--secondary);
    background: var(--secondary-soft);
}

.community-feed {
    display: grid;
    gap: 10px;
}

.community-post {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.community-post header {
    display: flex;
    gap: 10px;
    align-items: center;
}

.community-post header > div:nth-child(2) {
    min-width: 0;
    flex: 1;
}

.community-post h3 {
    margin: 0;
    font-size: 15px;
}

.community-post header p,
.community-post-tools,
.community-reactions > span {
    color: var(--muted);
    font-size: 12px;
}

.community-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--primary);
    font-weight: 900;
}

.community-avatar.small {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    font-size: 12px;
}

.community-post-tools {
    display: flex;
    gap: 4px;
}

.icon-action {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    color: var(--muted);
    background: transparent;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.icon-action:hover {
    color: var(--text);
    background: var(--panel);
}

.icon-action.danger {
    color: var(--danger);
}

.community-post-copy {
    margin-top: 13px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.community-achievement {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 13px;
    padding: 12px;
    border-left: 4px solid var(--warn);
    border-radius: 6px;
    background: var(--panel);
}

.community-achievement span {
    color: var(--warn);
    font-size: 12px;
    font-weight: 800;
}

.community-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.reaction {
    min-height: 34px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--muted);
    background: transparent;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.reaction:hover,
.reaction.active {
    color: var(--secondary);
    border-color: var(--secondary);
    background: var(--secondary-soft);
}

.community-comments {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.community-comment {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.community-comment > div {
    min-width: 0;
    flex: 1;
}

.community-comment strong {
    color: var(--secondary);
    font-size: 12px;
}

.community-comment p {
    margin-top: 2px;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.community-comment-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 10px;
}

@media (max-width: 700px) {
    .community-composer {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .community-message {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .community-achievement {
        flex-direction: column;
    }
}
