/* ---------- Base ---------- */
:root{
    --bg: #ffffff;
    --panel: #ffffff;
    --text: #100b0d;
    --muted: #4b5563;
    --line: rgba(15, 23, 42, 0.12);
    --accent: #4f46e5;   /* indigo */
    --accent2: #06b6d4;  /* cyan */
    --shadow: 0 10px 30px rgba(2, 6, 23, 0.08);
    --radius: 14px;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
    line-height: 1.55;
}

/* Centered content with responsive gutters */
.container{
    max-width: 760px;
    margin: 0 auto;
    padding: 56px 24px 80px;
}

@media (max-width: 640px){
    .container{ padding: 28px 16px 56px; }
}

h1{
    letter-spacing: -0.03em;
    font-weight: 600;
    font-size: clamp(28px, 3.4vw, 44px);
    margin: 0 0 14px;
}

p{ color: var(--muted); margin: 0 0 18px; }

/* ---------- Top-right buttons ---------- */
.top-actions{
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 80;
    display: flex;
    gap: 10px;
}

.action-btn{
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    font: 600 12px/1 Inter, system-ui, sans-serif;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(15,23,42,0.04);
}

.action-btn:hover{
    border-color: var(--accent);
    background: rgba(79,70,229,0.04);
}

/* ---------- Overlay / modal ---------- */
dialog.overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

dialog.overlay::backdrop { background: rgba(0,0,0,0.55); }

.overlay-inner {
    box-sizing: border-box;
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    color: var(--text);
    padding: 80px 24px 28px;
    overflow: auto;
}

.overlay-close {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 90;
}

/* ---------- Link buttons under bit text ---------- */
.link-grid{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.link-chip{
    display: inline-flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
}

.link-chip:hover{
    border-color: var(--accent2);
    background: rgba(6,182,212,0.06);
}


/* ---------- Prose / markdown typography ---------- */
.prose {
    color: var(--muted);
    font-size: 16px;
}

.prose p { margin: 0 0 16px; }
.prose strong { color: var(--text); font-weight: 600; }


.prose h2, .prose h3 {
    color: var(--text);
    margin: 22px 0 10px;
    letter-spacing: -0.02em;
}

hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 22px 0;
}

/* ---------- Lists ---------- */
.prose ul{
    list-style: lower-roman;
    padding-left: 40px;
    margin: 0 0 16px;
}

.prose li{
    padding: 6px 0;
    border-bottom: 1px solid rgba(15,23,42,0.06);
}

.prose li:last-child{
    border-bottom: none;
}



/* ---------- Links ---------- */
.prose a,
.prose a:visited{
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid rgba(79,70,229,0.35);
    transition: border-color 120ms ease, color 120ms ease;
}

.prose a:hover{
    color: var(--accent);
    border-bottom-color: rgba(79,70,229,0.85);
}

/* ---------- Map node pills ---------- */
#map .node-pill{
    fill: #ffffff;
    stroke: rgba(15, 23, 42, 0.28);
    stroke-width: 2;
}

/* ---------- Visited Nodes ---------- */
#map .node-pill.visited{
    stroke: var(--accent2);
    stroke-width: 2.5;
    fill: #ffffff;
}

/* ---------- Map edges ---------- */
#map .edge{
    stroke: rgba(15, 23, 42, 0.18);
    stroke-width: 1.5;
}

/* ---------- Visited–visited edges ---------- */
#map .edge.visited{
    stroke: var(--accent2);
    stroke-width: 2;
}


.welcome-flow{
    --arrow-col: 20px; /* reserve space for arrow column (tweak freely) */

    display: grid;
    grid-template-columns: 1fr var(--arrow-col) 1fr;
    align-items: start;
    column-gap: 18px;
}

.welcome-card{
    width: 100%;
    min-width: 0;
    box-sizing: border-box;

    /* guarantees long words/URLs never force column widening */
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Arrow sizing stays inside its reserved column */
.welcome-arrow{
    width: 100%;
    height: 60px;
    justify-self: center;
    align-self: center;
}

/* Mobile: stack */
@media (max-width: 640px){
    .welcome-flow{
        grid-template-columns: 1fr;
        row-gap: 12px;
    }

    .welcome-arrow{
        width: 72px;
        height: 44px;
        justify-self: center;
        transform: rotate(90deg);
    }
}