:root {
    --bg: #f6f3eb;
    --surface: #ffffff;
    --ink: #202020;
    --muted: #5c5c5c;
    --line: #c8c1b3;
    --link: #1f5f48;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: var(--link);
    text-decoration: underline;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
}

input,
textarea {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
}

input:focus,
textarea:focus {
    outline: 1px solid var(--link);
    border-color: var(--link);
}

.page-shell {
    width: min(980px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0 2.5rem;
}

.hero-panel {
    display: block;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.hero-copy {
    max-width: 48rem;
}

.hero-meta {
    display: none;
}

.eyebrow {
    margin: 0 0 0.35rem;
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0 0 0.5rem;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

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

h2 {
    font-size: 1.35rem;
}

h3 {
    font-size: 1.05rem;
}

p {
    margin: 0 0 0.75rem;
}

blockquote {
    margin: 0 0 1rem;
    padding-left: 0.9rem;
    border-left: 3px solid var(--line);
    color: var(--muted);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0 1rem;
}

th,
td {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--surface);
}

.app-grid {
    display: grid;
    gap: 1.5rem;
}

.panel,
.subpanel,
.resource-card,
.message-card,
.wiki-entry,
.stat-card,
.meta-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.panel {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.panel-heading,
.subpanel-heading {
    margin-bottom: 0.75rem;
}

.dashboard-bar {
    display: block;
}

.session-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 0.5rem;
}

.top-links {
    margin: 0 0 1.25rem;
}

.secondary-button,
.action-link,
.hub-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--link);
    text-decoration: underline;
    text-transform: none;
    letter-spacing: normal;
}

.hub-grid {
    display: grid;
    gap: 0.75rem;
}

.main-links {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
}

.hub-link {
    display: block;
}

.hub-link h2,
.hub-link h3 {
    margin-bottom: 0.2rem;
    color: var(--link);
}

.hub-link p:last-child {
    color: var(--ink);
}

label {
    display: block;
    margin-bottom: 0.85rem;
}

.message-form {
    max-width: 42rem;
}

.message-board,
.resource-sections,
.wiki-grid,
.wiki-sections {
    display: grid;
    gap: 1rem;
}

.message-card,
.resource-card,
.wiki-entry {
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.message-meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.resource-card ul {
    margin: 0.5rem 0 0 1.2rem;
    padding: 0;
}

.resource-card li + li {
    margin-top: 0.35rem;
}

.gallery-grid {
    display: grid;
    gap: 0.5rem;
}

.gallery-wall {
    display: block;
    columns: 4 160px;
    column-gap: 0.35rem;
    max-height: 70vh;
    overflow-y: auto;
    padding: 0.35rem;
    border: 1px solid var(--line);
    background: var(--surface);
}

.gallery-card {
    display: inline-block;
    width: 100%;
    margin: 0 0 0.35rem;
    overflow: hidden;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.gallery-button {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
}

.gallery-image {
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    object-fit: cover;
}

.gallery-copy {
    display: none;
}

.lightbox-dialog {
    width: min(92vw, 960px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
}

.lightbox-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.lightbox-close {
    width: auto;
    margin: 0.5rem 0.5rem 0 auto;
}

.lightbox-dialog img {
    max-height: 72vh;
    width: 100%;
    object-fit: contain;
    background: #f0ede6;
}

.lightbox-caption {
    padding: 0.75rem;
}

.empty-state {
    color: var(--muted);
}

.tree-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tree-stage {
    position: relative;
    height: 70vh;
    min-height: 520px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #171717;
}

.tree-svg {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
}

.tree-svg.is-dragging {
    cursor: grabbing;
}

.tree-link {
    stroke: rgba(104, 84, 255, 0.45);
    stroke-width: 1.5;
}

.tree-node circle {
    fill: #0d0d0d;
    stroke: rgba(255, 255, 255, 0.35);
    stroke-width: 1.4;
}

.tree-node.is-root circle {
    fill: #5238d9;
    stroke: rgba(255, 255, 255, 0.7);
}

.tree-node.is-active circle {
    stroke: #ffffff;
    stroke-width: 2.2;
}

.tree-node text {
    fill: rgba(255, 255, 255, 0.92);
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
}

.tree-node.is-muted circle,
.tree-node.is-muted text {
    opacity: 0.35;
}

.tree-help {
    margin-top: 0.75rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.tree-info {
    display: grid;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}

.tree-info p {
    margin: 0;
}

.site-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
}

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

    .gallery-wall {
        columns: 2 120px;
        max-height: 62vh;
    }

    .session-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .main-links {
        grid-template-columns: 1fr;
    }
}
