:root {
    --paper: #f7f2ea;
    --linen: #fdfbf7;
    --ink: #2c1d11;
    --amber: #d97706;
    --mocha: #4a2c11;
    --latte: #eadcc9;
    --teal: #0f766e;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        radial-gradient(circle at 8% 18%, rgba(74, 44, 17, .05) 0, transparent 19%),
        repeating-linear-gradient(135deg, transparent 0 118px, rgba(44, 29, 17, .07) 118px 120px, transparent 120px 238px),
        linear-gradient(to right, rgba(44, 29, 17, .04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(44, 29, 17, .04) 1px, transparent 1px);
    background-size: 100% 100%, 240px 240px, 24px 24px, 24px 24px;
    font-family: "Outfit", system-ui, sans-serif;
    line-height: 1.65;
}

a { color: inherit; }

.shell { width: min(980px, calc(100% - 28px)); margin-inline: auto; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 2px solid var(--ink);
    background: rgba(253, 251, 247, .96);
    backdrop-filter: blur(10px);
}

.header-row { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 42px; height: 42px; border: 2px solid var(--ink); border-radius: 12px; box-shadow: 2px 2px 0 var(--ink); background: #fff8eb; }
.brand-name { font-family: "Fraunces", Georgia, serif; font-weight: 900; letter-spacing: .035em; line-height: 1; }
.brand-name span { color: #b45309; }
.brand-sub { display: block; margin-top: 3px; color: #6b5a4b; font-size: 11px; }

.header-actions, .header-nav { display: flex; align-items: center; gap: 8px; }
.header-nav a, .small-button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border: 2px solid var(--ink);
    border-radius: 11px;
    background: var(--linen);
    box-shadow: 2px 2px 0 var(--ink);
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}
.header-nav a:hover, .small-button:hover { background: #fde7bd; transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.small-button.play { color: #fff; background: var(--amber); }

.page-main { padding: 46px 0 64px; }
.breadcrumbs { margin: 0 0 12px; color: #765c46; font-size: 12px; font-weight: 700; }
.breadcrumbs a { text-underline-offset: 3px; }

.content-card {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--ink);
    border-radius: 22px;
    background: rgba(253, 251, 247, .98);
    box-shadow: 6px 6px 0 var(--ink);
}
.content-card::after {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    right: -48px;
    top: 42px;
    border: 10px solid rgba(74, 44, 17, .09);
    border-radius: 50%;
    pointer-events: none;
}

.article-hero { padding: 38px 42px 30px; border-bottom: 2px dashed #b9a691; background: linear-gradient(145deg, #fffdf8, #f5e8d5); }
.eyebrow { margin: 0 0 10px; color: #92400e; font: 800 12px/1.2 "Space Grotesk", monospace; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; line-height: 1.15; }
h1 { max-width: 760px; margin: 0; font-size: clamp(34px, 6vw, 58px); letter-spacing: -.025em; }
.lead { max-width: 760px; margin: 18px 0 0; color: #594535; font-size: 18px; line-height: 1.65; }

.article-grid { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 38px; padding: 34px 42px 46px; }
.toc { align-self: start; position: sticky; top: 90px; padding: 16px; border: 2px solid var(--ink); border-radius: 16px; background: #f4e6d3; box-shadow: 3px 3px 0 var(--ink); }
.toc p { margin: 0 0 8px; font: 900 12px/1.2 "Space Grotesk", monospace; text-transform: uppercase; letter-spacing: .07em; }
.toc a { display: block; padding: 5px 0; color: #664a34; font-size: 13px; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.article-copy { min-width: 0; font-size: 17px; }
.article-copy h2 { margin: 44px 0 13px; font-size: 30px; }
.article-copy h2:first-child { margin-top: 0; }
.article-copy h3 { margin: 28px 0 8px; font-size: 21px; }
.article-copy p { margin: 0 0 18px; }
.article-copy ul, .article-copy ol { padding-left: 24px; margin: 0 0 22px; }
.article-copy li { margin: 8px 0; }
.article-copy a { color: #9a4f0a; font-weight: 700; text-underline-offset: 3px; }

.note, .tip {
    margin: 24px 0;
    padding: 18px 20px;
    border: 2px solid var(--ink);
    border-radius: 16px;
    background: #fff1c9;
    box-shadow: 3px 3px 0 var(--ink);
}
.tip { background: #e6f4f1; }
.note strong, .tip strong { font-family: "Space Grotesk", monospace; }

.feature-grid, .symbol-grid, .chapter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 24px 0; }
.feature, .symbol, .chapter { padding: 17px; border: 2px solid #6d5847; border-radius: 15px; background: #fffdfa; }
.feature h3, .symbol h3, .chapter h3 { margin: 0 0 7px; font-size: 18px; }
.feature p, .symbol p, .chapter p { margin: 0; color: #655142; font-size: 14px; }
.symbol-mark { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 10px; border: 2px solid var(--ink); border-radius: 11px; background: #f8d98b; font: 900 17px/1 "Space Grotesk", monospace; box-shadow: 2px 2px 0 var(--ink); }

.mini-board { display: grid; grid-template-columns: repeat(4, 46px); gap: 5px; width: max-content; margin: 24px auto; padding: 10px; border: 2px solid var(--ink); border-radius: 15px; background: #e9dcc9; box-shadow: 4px 4px 0 var(--ink); }
.mini-cell { width: 46px; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid #aa9782; border-radius: 7px; background: #fffdf8; font: 900 14px/1 "Space Grotesk", monospace; }
.mini-cell.patch-a { background: #0f766e; color: white; border-color: var(--ink); }
.mini-cell.patch-b { background: #d97706; color: white; border-color: var(--ink); }
.mini-cell.patch-c { background: #8b4513; color: white; border-color: var(--ink); }

details { margin: 10px 0; border: 2px solid #8b735f; border-radius: 13px; background: #fffdfa; }
summary { padding: 13px 15px; cursor: pointer; font-weight: 800; }
details > div { padding: 0 15px 15px; color: #5c493a; }

.cta { margin-top: 38px; padding: 24px; border: 2px solid var(--ink); border-radius: 18px; background: var(--mocha); color: #fff8eb; }
.cta h2 { margin: 0 0 8px; color: white; }
.cta p { margin-bottom: 16px; }
.cta a { display: inline-flex; padding: 10px 15px; border: 2px solid #fff8eb; border-radius: 11px; background: #f6b73c; color: var(--ink); box-shadow: 3px 3px 0 #fff8eb; text-decoration: none; }

.legal-meta { margin: 0 0 24px; color: #765c46; font-size: 14px; }
.data-delete { margin: 24px 0; padding: 20px; border: 2px solid var(--ink); border-radius: 15px; background: #fff0f0; }
.data-delete button { padding: 10px 14px; border: 2px solid var(--ink); border-radius: 10px; background: #fecaca; color: #7f1d1d; font: 800 14px "Outfit", sans-serif; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.delete-status { margin: 10px 0 0; font-weight: 700; }

.site-footer { padding: 14px 0 18px; border-top: 2px solid var(--ink); background: #fbf8f3; color: #675747; font-size: 12px; }
.footer-row, .footer-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px 12px; text-align: center; }
.footer-row strong { color: var(--ink); font-family: "Fraunces", Georgia, serif; }
.support-link { color: #9a4f0a; font-weight: 800; text-underline-offset: 3px; }
.support-link:hover { color: var(--amber); }
.footer-links { margin-top: 7px; }
.footer-links a { text-underline-offset: 3px; }

@media (max-width: 760px) {
    .shell { width: min(100% - 20px, 680px); }
    .brand-sub, .header-nav { display: none; }
    .header-row { min-height: 60px; }
    .brand img { width: 38px; height: 38px; }
    .brand-name { font-size: 15px; }
    .article-hero { padding: 28px 22px 24px; }
    h1 { font-size: clamp(31px, 10vw, 45px); }
    .lead { font-size: 16px; }
    .article-grid { display: block; padding: 26px 22px 36px; }
    .toc { position: static; margin-bottom: 28px; }
    .article-copy { font-size: 16px; }
    .article-copy h2 { font-size: 27px; }
    .feature-grid, .symbol-grid, .chapter-grid { grid-template-columns: 1fr; }
    .mini-board { grid-template-columns: repeat(4, 39px); }
    .mini-cell { width: 39px; }
}
