:root {
  --parchment: #efe4cb;
  --parchment-hi: #f8f0dc;
  --ink: #42301e;
  --ink-soft: #6d5738;
  --line: #cbb894;
  --accent: #8a5a34;
  --accent-hi: #a26c3f;
  --danger: #8c2f2f;
  --danger-bg: #f6dede;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }

/* The page ground lives on <html> so it covers the full scroll height without
   background-attachment: fixed, which fails to repaint on long pages in some
   embedded browsers and leaves black bands behind the content. */
html {
  background:
    radial-gradient(ellipse at 50% 0, #fbf4e4 0%, transparent 55vh),
    linear-gradient(#f3ead6, #e9dcbf 60vh, #e9dcbf);
  background-repeat: no-repeat;
  background-color: #e9dcbf;
  min-height: 100%;
}

body {
  margin: 0;
  padding: 0 1.25rem 4rem;
  font: 15px/1.55 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color: var(--ink);
  background: transparent;
  min-height: 100vh;
}

header, main, footer { max-width: 62rem; margin: 0 auto; }
header { padding: 2.5rem 0 1.5rem; text-align: center; }
h1 { margin: 0 0 .35rem; font-size: 2rem; letter-spacing: .01em; }
h2 { margin: 0 0 .25rem; font-size: 1.5rem; }
h3 { margin: 1.75rem 0 .5rem; font-size: 1.05rem; text-transform: uppercase;
     letter-spacing: .08em; color: var(--ink-soft); }
.lede { margin: 0; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.small { font-size: .86rem; }

section {
  background: var(--parchment);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 #fff8 inset, 0 6px 22px -14px #42301e88;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ---- dropzone ---- */
#dropzone {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  padding: 2.25rem 1rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: #fdf8ec80;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
  color: var(--ink-soft);
}
#dropzone:hover, #dropzone:focus-visible { border-color: var(--accent); background: #fdf8ecd0; }
#dropzone.dragover { border-color: var(--accent); background: #f6e9cf; }
#dropzone strong { color: var(--ink); font-size: 1.05rem; font-weight: 600; }
#dropzone code { background: #0000000d; padding: 0 .25em; border-radius: 3px; }
#filename { font-size: .9rem; color: var(--accent); margin-top: .4rem; min-height: 1.2em; }

/* ---- form ---- */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.25rem; }
@media (max-width: 34rem) { .fields { grid-template-columns: 1fr; } }
label { display: block; font-size: .88rem; color: var(--ink-soft); }
input[type=text] {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem;
  font: inherit; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; background: #fffdf6;
}
input[type=text]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

fieldset { border: 0; padding: 0; margin: 1.25rem 0 0; }
legend { font-size: .88rem; color: var(--ink-soft); padding: 0; }
#quality-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: .5rem; }
@media (max-width: 34rem) { #quality-options { grid-template-columns: 1fr; } }
.quality {
  display: block; padding: .7rem .8rem; border: 1px solid var(--line);
  border-radius: 8px; background: #fffdf6; cursor: pointer;
}
.quality:has(input:checked) { border-color: var(--accent); background: #f7ecd7; box-shadow: 0 0 0 1px var(--accent); }
.quality input { margin-right: .4rem; accent-color: var(--accent); }
.quality b { font-weight: 600; }
.quality span { display: block; font-size: .8rem; color: var(--ink-soft); margin-top: .2rem; }

button, .button {
  display: inline-block; margin-top: 1.4rem; padding: .65rem 1.4rem;
  font: inherit; font-weight: 600; color: #fdf6e6;
  background: var(--accent); border: 1px solid #00000022; border-radius: 7px;
  cursor: pointer; text-decoration: none; transition: background .15s;
}
button:hover:not(:disabled), .button:hover { background: var(--accent-hi); }
button:disabled { opacity: .45; cursor: not-allowed; }
.ghost, button.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.ghost:hover, button.ghost:hover { background: #00000008; }
.button span { font-weight: 400; opacity: .8; font-size: .85em; }

/* ---- progress ---- */
#progress { margin-top: 1.5rem; }
.bar { height: 9px; background: #00000012; border-radius: 99px; overflow: hidden; }
.fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-hi));
        border-radius: 99px; transition: width .25s ease; }
#progress-msg { margin: .6rem 0 0; font-weight: 600; }
#progress p.small { margin: .2rem 0 0; }

.error {
  margin-top: 1.25rem; padding: .8rem 1rem; border-radius: 8px;
  background: var(--danger-bg); border: 1px solid #d8a6a6; color: var(--danger);
}

/* ---- result ---- */
#preview-wrap { text-align: center; margin: -.25rem 0 1.25rem; }
#preview {
  max-width: 100%; max-height: 72vh; width: auto; height: auto; border-radius: 6px;
  box-shadow: 0 10px 30px -18px #42301ecc; border: 1px solid var(--line);
}
.downloads { display: flex; flex-wrap: wrap; gap: .7rem; }
.downloads .button { margin-top: .5rem; }

#warnings { margin-top: 1.5rem; padding: .9rem 1rem; border-radius: 8px;
            background: #fbf1d8; border: 1px solid #dcc79a; }
#warnings h3 { margin: 0 0 .4rem; }
#warning-list { margin: 0; padding-left: 1.15rem; font-size: .9rem; }
#warning-list li + li { margin-top: .35rem; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.1rem; margin: 0; }
dt { color: var(--ink-soft); font-size: .9rem; }
dd { margin: 0; font-variant-numeric: tabular-nums; }

#grid-advice { margin-top: 1rem; padding: .9rem 1rem; border-left: 3px solid var(--accent);
               background: #fdf8ec; border-radius: 0 8px 8px 0; }
#grid-advice b { display: block; margin-bottom: .25rem; }
#foundry-steps { padding-left: 1.25rem; }
#foundry-steps li { margin-bottom: .4rem; }
.assumption { font-size: .88rem; color: var(--ink-soft); font-style: italic;
              border-top: 1px solid var(--line); padding-top: .8rem; }

.layers { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.layers li { padding: .2rem .6rem; border: 1px solid var(--line); border-radius: 99px;
             background: #fffdf6; font-size: .85rem; }
.layers li.zero { opacity: .45; }
.layers b { font-variant-numeric: tabular-nums; }

footer { text-align: center; padding-top: .5rem; }

/* ---- style picker ---- */
#style-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; margin-top: .5rem; }
@media (max-width: 52rem) { #style-options { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 34rem) { #style-options { grid-template-columns: 1fr 1fr; } }
.style-card {
  display: flex; flex-direction: column; gap: .3rem; padding: .65rem .7rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fffdf6; cursor: pointer;
}
.style-card:has(input:checked) { border-color: var(--accent); background: #f7ecd7; box-shadow: 0 0 0 1px var(--accent); }
.style-card input { position: absolute; opacity: 0; pointer-events: none; }
.style-card:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.swatch { display: flex; height: 22px; border-radius: 4px; overflow: hidden; border: 1px solid #0002; }
.swatch i { flex: 1; }
.style-card b { font-weight: 600; }
.style-card .blurb { font-size: .78rem; color: var(--ink-soft); line-height: 1.35; }

.row { display: grid; grid-template-columns: 3fr 2fr; gap: 1.2rem; }
@media (max-width: 52rem) { .row { grid-template-columns: 1fr; } }
#framing-options { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .5rem; }

/* ---- walls, doors & lights ---- */
.vtt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem 1.4rem;
       padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: #fdf8ec; }
@media (max-width: 46rem) { .vtt { grid-template-columns: 1fr; } }
.vtt-col { display: flex; flex-direction: column; gap: .45rem; }
.vtt-head { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.vtt label.check { display: flex; align-items: center; gap: .45rem; color: var(--ink); font-size: .9rem; }
.vtt label.check input { accent-color: var(--accent); }
.vtt label.inline { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
                    color: var(--ink); font-size: .9rem; }
.vtt select { font: inherit; padding: .25rem .4rem; border: 1px solid var(--line); border-radius: 5px;
              background: #fffdf6; color: var(--ink); }
.vtt-summary { font-size: .9rem; margin: .8rem 0 0; font-variant-numeric: tabular-nums; }
details.howto { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: .7rem; }
details.howto summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); }
details.howto ol { padding-left: 1.2rem; font-size: .92rem; }
details.howto li { margin-bottom: .5rem; }

/* ---- account & plans ---- */
header { position: relative; }
.account { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
           gap: .4rem .7rem; margin-bottom: .6rem; font-size: .9rem; }
.plan-badge { padding: .15rem .55rem; border-radius: 999px; background: var(--accent);
              color: #fffaf0; font-size: .78rem; letter-spacing: .04em; }
.account .who { color: var(--ink); }
.small-btn { padding: .3rem .75rem; font-size: .85rem; }
.button.patreon { background: #c0392b; border-color: #a93226; }
.warn { color: #9a3b1b; }
label.locked { opacity: .55; cursor: not-allowed; }
label.locked input { cursor: not-allowed; }
.lock { display: block; margin-top: .25rem; font-size: .76rem; color: var(--accent); }
.locked-note { padding: .9rem 1rem; border: 1px dashed var(--line); border-radius: 8px;
               background: #fdf8ec; }
.locked-note p { margin: 0 0 .5rem; }
a.upgrade { font-weight: 600; color: var(--accent); }

/* ---- sign-in gate, plan card, plan table ---- */
.gate { max-width: 46rem; margin: 0 auto; padding: 1.6rem 1.8rem; border: 1px solid var(--line);
        border-radius: 10px; background: #fffaf0e6; }
.gate h2 { margin-top: 0; }
.gate .button.patreon { display: inline-block; margin: .4rem 0 .6rem; }
.plan-card { margin-bottom: 1.2rem; padding: .9rem 1rem; border: 1px solid var(--line);
             border-radius: 8px; background: #fdf8ec; }
.plan-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
.plan-left { margin-left: auto; font-size: .9rem; color: var(--ink-soft);
             font-variant-numeric: tabular-nums; }
.plan-left.out { color: #9a3b1b; font-weight: 600; }
.plan-facts { margin: .6rem 0 0; padding-left: 1.1rem; font-size: .9rem; columns: 2 16rem; }
.plan-facts li { margin-bottom: .2rem; }
details.compare { margin-top: .6rem; }
details.compare summary { cursor: pointer; font-size: .9rem; color: var(--accent); font-weight: 600; }
.plan-table-wrap { overflow-x: auto; margin: .6rem 0; }
.plan-table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.plan-table th, .plan-table td { padding: .45rem .6rem; border-bottom: 1px solid var(--line);
                                 text-align: left; vertical-align: top; }
.plan-table th[scope=row] { color: var(--ink-soft); font-weight: 500; white-space: nowrap; }
.plan-table .current { background: #f3e3c4; }
.plan-table .you { display: block; font-size: .72rem; font-weight: 400; color: var(--accent); }
.render-note { margin: .2rem 0 .7rem; font-size: .9rem; color: var(--ink-soft); }
.render-note.out { color: #9a3b1b; }

/* ---- brand ---- */
.brand { margin: 0 0 .1rem; font-size: .78rem; letter-spacing: .22em; text-transform: uppercase;
         color: var(--accent); text-align: center; }
footer a { color: var(--ink-soft); }

/* ---- downloads note & library ---- */
.dl-note { margin: .4rem 0 0; min-height: 1.2em; }
.saved { margin: .2rem 0 .4rem; color: #3f6b35; font-size: .9rem; }
.guest-note { margin: .5rem 0 0; }
.library { margin-top: 2rem; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
                gap: 1rem; margin-top: .8rem; }
.library-card { border: 1px solid var(--line); border-radius: 8px; background: #fffdf6;
                padding: .6rem; display: flex; flex-direction: column; gap: .35rem; }
.library-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 5px;
                    border: 1px solid var(--line); background: #efe3c8; }
.library-card h4 { margin: .2rem 0 0; font-size: 1rem; }
.library-card p { margin: 0; }
.library-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .3rem; }
.small-btn.danger { color: #9a3b1b; border-color: #d6a58f; }

/* ---- style pack, editions, labels & places ---- */
.pack-option { display: flex; align-items: flex-start; gap: .5rem; margin: .4rem 0 .6rem;
               font-size: .9rem; color: var(--ink); }
.pack-option input { margin-top: .2rem; accent-color: var(--accent); }
#style-options.dimmed { opacity: .45; pointer-events: none; }
.pack { padding: 1.4rem; border: 1px solid var(--line); border-radius: 10px; background: #fffaf0e6; }
.pack h2 { margin-top: 0; }
.pack-grid, .editions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
                             gap: .8rem; margin: .8rem 0; }
.feature { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 8px; background: #fdf8ec;
           margin-bottom: 1rem; }
.feature > p:first-child { margin-top: 0; }
#preview-link { position: relative; display: inline-block; }
#preview-link.pinning { cursor: crosshair; outline: 3px dashed var(--accent); outline-offset: 3px; }
.pin-layer { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -50%); min-width: 1.35rem; height: 1.35rem;
       padding: 0 .25rem; border-radius: 999px; background: #96492a; color: #fffaf0;
       font-size: .75rem; font-weight: 700; line-height: 1.35rem; text-align: center;
       border: 2px solid #fffaf0; box-shadow: 0 1px 3px #0006; }
.lbl-districts { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
                 gap: .5rem .8rem; margin: .6rem 0; }
.lbl-districts label { display: flex; flex-direction: column; gap: .15rem; }
.lbl-places-head { display: flex; align-items: center; justify-content: space-between;
                   margin: .8rem 0 .3rem; }
.lbl-places { padding-left: 1.4rem; margin: 0 0 .8rem; }
.lbl-places li { margin-bottom: .35rem; }
.lbl-places li select, .lbl-places li input { font: inherit; padding: .25rem .4rem;
  border: 1px solid var(--line); border-radius: 5px; background: #fffdf6; margin-right: .35rem; }
.lbl-places li input { width: min(16rem, 50%); }
