/* ================================================================
   CROWN & HEARTH — medieval UI
   Parchment, oak, bronze and candlelight. Pure CSS, no external assets.
   ================================================================ */
:root {
  --parch:      #e9dcbe;
  --parch-2:    #ddcaa4;
  --parch-3:    #d3bd91;
  --ink:        #2e2114;
  --ink-soft:   #4c3a24;
  --oak:        #3b2a17;
  --oak-2:      #56401f;
  --bronze:     #8a6a35;
  --bronze-lt:  #c9a55a;
  --gold:       #c9a227;
  --gold-lt:    #e8cf7a;
  --blood:      #7a1f1f;
  --forest:     #31532f;
  --night:      #17110a;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: Georgia, "Palatino Linotype", "Book Antiqua", "Times New Roman", serif,
               "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, #3a2c1a 0%, transparent 60%),
    repeating-linear-gradient(45deg, #241a0e 0 2px, #221809 2px 6px),
    #221809;
  min-height: 100vh;
}

/* ---------------- scrollbars ---------------- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #241a0e; }
::-webkit-scrollbar-thumb { background: var(--bronze); border: 2px solid #241a0e; border-radius: 6px; }

/* ---------------- layout ---------------- */
#wrap { max-width: 1280px; margin: 0 auto; padding: 10px 14px 30px; }
#main { display: flex; gap: 14px; align-items: flex-start; }
#side {
  flex: 0 0 220px; position: sticky; top: 10px;
  background: linear-gradient(180deg, var(--oak-2), var(--oak) 60%, #2c1f10);
  border: 2px solid #1d140a; border-radius: 8px;
  box-shadow: inset 0 0 24px rgba(0,0,0,.65), 0 4px 14px rgba(0,0,0,.5);
  padding: 10px 8px; display: flex; flex-direction: column; gap: 2px;
}
#content { flex: 1 1 auto; min-width: 0; }

/* ---------------- banner ---------------- */
#banner {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background:
    linear-gradient(180deg, rgba(255,235,190,.09), rgba(0,0,0,.25)),
    linear-gradient(180deg, var(--oak-2), var(--oak) 55%, #291d0e);
  border: 2px solid #1d140a; border-radius: 8px;
  padding: 10px 16px; margin-bottom: 12px;
  box-shadow: inset 0 1px 0 rgba(255,220,150,.15), 0 4px 16px rgba(0,0,0,.55);
}
.banner-left { display: flex; gap: 12px; align-items: center; }
.game-title {
  font-size: 1.7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-lt);
  text-shadow: 0 2px 0 #000, 0 0 18px rgba(201,162,39,.35); font-weight: bold;
}
.game-sub { color: #cbb78a; font-style: italic; font-size: .85rem; letter-spacing: .06em; }

.char-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.char-portrait img { border: 2px solid var(--bronze); border-radius: 6px; background: #1c1409; box-shadow: 0 2px 8px rgba(0,0,0,.6); object-fit: cover; }
img.ph.avatar { object-fit: cover; }
.char-name { color: #f1e3bb; font-size: 1.05rem; font-weight: bold; letter-spacing: .03em; }
.char-title { color: var(--gold-lt); font-size: .8rem; font-style: italic; margin-left: 6px; }
.char-sub { color: #cdbb90; font-size: .78rem; }
.char-sub .loc { color: #e5d4a5; }
.char-sub.dim { color: #a08e68; }
.char-sub .sky { color: #9ec4d8; }
.char-vitals { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.char-gold {
  color: var(--gold-lt); font-size: 1.25rem; font-weight: bold; text-shadow: 0 1px 0 #000;
  background: rgba(0,0,0,.35); border: 1px solid var(--bronze); border-radius: 6px; padding: 6px 10px;
}
.coin { color: var(--gold); font-size: .8em; margin-left: 2px; }

/* ---------------- nav ---------------- */
.navl {
  display: block; padding: 7px 10px; border-radius: 5px; text-decoration: none;
  color: #d9c69a; font-size: .92rem; letter-spacing: .02em;
  border: 1px solid transparent;
}
.navl:hover { background: rgba(255,220,150,.08); color: #f4e6bd; border-color: rgba(201,162,39,.35); }
.navl.on {
  background: linear-gradient(180deg, #6b5227, #4a3618);
  color: var(--gold-lt); border-color: #241a0c; font-weight: bold;
  box-shadow: inset 0 1px 0 rgba(255,225,160,.25);
}
.navl.logout { color: #d49a8a; }
.navl.locked { opacity: .55; cursor: not-allowed; }
.nav-sep { height: 1px; background: linear-gradient(90deg, transparent, var(--bronze), transparent); margin: 8px 4px; }
.nav-who { color: #9d8a61; font-size: .75rem; padding: 4px 10px; font-style: italic; }
.badge { background: var(--blood); color: #ffe9d9; border-radius: 10px; padding: 0 6px; font-size: .72rem; }

/* ---------------- panels ---------------- */
.panel {
  background:
    radial-gradient(600px 200px at 20% 0%, rgba(255,250,230,.35), transparent 60%),
    linear-gradient(180deg, var(--parch) 0%, var(--parch-2) 100%);
  border: 2px solid var(--oak); border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,.45), inset 0 0 60px rgba(120,90,40,.18);
  margin-bottom: 14px; position: relative; overflow: hidden;
}
.panel::before, .panel::after {
  content: "❧"; position: absolute; color: rgba(90,66,30,.35); font-size: 1.1rem; pointer-events: none;
}
.panel::before { top: 4px; left: 8px; }
.panel::after { bottom: 4px; right: 8px; transform: rotate(180deg); }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(59,42,23,.92), rgba(59,42,23,.78));
  padding: 7px 14px; border-bottom: 2px solid #241a0c;
}
.panel-head h2 {
  margin: 0; color: var(--gold-lt); font-size: 1.08rem; letter-spacing: .08em; text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0,0,0,.6);
}
.panel-head img { border-radius: 4px; border: 1px solid var(--bronze); }
.panel-body { padding: 14px 16px; }
.panel.dark .panel-body { background: rgba(30,22,10,.06); }

h3.sec {
  margin: 18px 0 8px; color: var(--ink-soft); letter-spacing: .05em; font-size: 1rem;
  border-bottom: 1px solid rgba(80,58,28,.4); padding-bottom: 4px; text-transform: uppercase;
}
h3.sec:first-child { margin-top: 2px; }

/* ---------------- text ---------------- */
a { color: #6b4a17; }
a:hover { color: var(--blood); }
.dim { color: #7a6647; }
.small { font-size: .82rem; }
.muted { color: #6d5a3d; font-style: italic; }
.flavor { font-style: italic; color: #5d4a2e; line-height: 1.5; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
b, strong { color: #241a0c; }

/* ---------------- buttons ---------------- */
form.inline { display: inline-block; margin: 2px 3px 2px 0; }
.btn {
  font-family: inherit; font-size: .88rem; letter-spacing: .04em; cursor: pointer;
  color: #f3e7c9; background: linear-gradient(180deg, #7c5c2c, #55401e 60%, #443316);
  border: 1px solid #2b1f0d; border-radius: 5px; padding: 6px 13px;
  box-shadow: inset 0 1px 0 rgba(255,225,160,.3), 0 2px 4px rgba(0,0,0,.35);
  text-shadow: 0 1px 0 rgba(0,0,0,.5);
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #b08d3c, #8a6a25 60%, #6e541c); color: #fff5dc; }
.btn.danger  { background: linear-gradient(180deg, #8f3535, #6e2323 60%, #571a1a); color: #ffe6de; text-shadow: 0 1px 1px rgba(0,0,0,.75); }
.btn.good    { background: linear-gradient(180deg, #4d7a3d, #3a5f2d 60%, #2e4c23); color: #edf7e2; text-shadow: 0 1px 1px rgba(0,0,0,.7); }
.btn.magic   { background: linear-gradient(180deg, #5c4d9e, #453a78 60%, #372e60); color: #f0eaff; text-shadow: 0 1px 1px rgba(0,0,0,.7); }
.btn.donator {
  display: block; width: 100%; box-sizing: border-box;
  font-size: 1.05rem; font-weight: 700; letter-spacing: .06em;
  padding: 12px 16px; border-radius: 8px;
  background: linear-gradient(180deg, #7a4fd0, #5b2ea8 55%, #43207f);
  color: #f7f0ff; border-color: #2a1454;
}
nav#side .btn.donator {
  display: inline-block; width: auto; margin: 4px 10px 8px;
  font-size: .88rem; font-weight: 600; padding: 6px 13px;
  background: linear-gradient(180deg, #4d7a3d, #3a5f2d 60%, #2e4c23);
  color: #edf7e2; border-color: #1e3316;
}
.donator-offer { text-align: center; margin: 14px auto 4px; max-width: 240px; }
.donator-offer img { display: block; margin: 0 auto 10px; border-radius: 10px; border: 1px solid #6e5428; }
.donator-offer p { margin: 8px 0 0; }
.btn.small   { font-size: .78rem; padding: 3px 9px; }
.btn:disabled, .btn.dis { filter: grayscale(.7) brightness(.75); cursor: not-allowed; }
a.btn { display: inline-block; text-decoration: none; }

/* ---------------- tables ---------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th {
  background: linear-gradient(180deg, var(--oak-2), var(--oak));
  color: var(--gold-lt); text-align: left; padding: 6px 9px; font-size: .8rem;
  letter-spacing: .06em; text-transform: uppercase; border-bottom: 2px solid #241a0c;
}
.tbl td { padding: 6px 9px; border-bottom: 1px solid rgba(80,58,28,.25); vertical-align: middle; }
.tbl tr:nth-child(even) td { background: rgba(120,90,40,.07); }
.tbl tr:hover td { background: rgba(201,162,39,.12); }
.tbl .num { text-align: right; }

/* ---------------- lists & grids ---------------- */
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.c3, .grid.c4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

.bld-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 8px 0 16px;
}
@media (max-width: 900px) { .bld-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .bld-grid { grid-template-columns: 1fr; } }
a.bld-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  border: 2px solid var(--oak);
  border-radius: 8px;
  background:
    radial-gradient(280px 80px at 20% 0%, rgba(255,250,230,.4), transparent 60%),
    linear-gradient(180deg, var(--parch) 0%, var(--parch-2) 100%);
  box-shadow: 0 4px 14px rgba(0,0,0,.35), inset 0 0 40px rgba(120,90,40,.16);
}
a.bld-card::before, a.bld-card::after {
  content: "❧"; position: absolute; color: rgba(90,66,30,.35); font-size: .95rem; pointer-events: none; z-index: 1;
}
a.bld-card::before { top: 4px; left: 8px; }
a.bld-card::after { bottom: 4px; right: 8px; transform: rotate(180deg); }
a.bld-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 16px rgba(201,162,39,.4), inset 0 0 40px rgba(120,90,40,.12);
  filter: brightness(1.04);
}
.bld-card img.ph {
  width: calc(100% - 16px);
  height: 110px;
  object-fit: cover;
  display: block;
  margin: 12px 8px 0;
  background: #1c1409;
  border: 1px solid var(--bronze);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.bld-card-t {
  display: block;
  margin: 8px 0 0;
  padding: 6px 14px 2px;
  font-weight: bold;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: .92rem;
  color: var(--oak);
  text-shadow: 0 1px 0 rgba(255,248,225,.5);
}
.bld-card .small {
  padding: 0 14px 12px;
  font-style: italic;
  color: #6d5a3d;
}
.bld-hero img.ph {
  width: 100%;
  max-width: 600px;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 2px solid var(--oak);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  background: #1c1409;
}

/* building cards on the city page */
.bcard {
  display: flex; gap: 10px; align-items: center;
  background: rgba(255,248,225,.4); border: 1px solid rgba(90,66,30,.5); border-radius: 6px;
  padding: 8px 10px; text-decoration: none; color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.bcard:hover { border-color: var(--gold); box-shadow: 0 2px 8px rgba(201,162,39,.35); background: rgba(255,248,225,.7); }
.bcard img { border-radius: 4px; border: 1px solid #6a4f26; flex: 0 0 auto; }
.bcard .bname { font-weight: bold; letter-spacing: .02em; }
.bcard .bdesc { font-size: .78rem; color: #6d5a3d; font-style: italic; }
.bcard .bowner { font-size: .74rem; color: var(--forest); }
.hcard { margin-top: 4px; }
.hcard img { width: 120px; height: 80px; object-fit: cover; }
.duty-list { margin: 8px 0 12px 1.2em; }
.duty-list li { margin: 6px 0; }
.duty-completed { color: #3a5f2d; }
.duty-in_progress { font-weight: bold; }
.duty-available { color: #6b4a17; }

/* creature cards */
.ccard {
  background: rgba(255,248,225,.45); border: 1px solid rgba(90,66,30,.5); border-radius: 6px;
  padding: 8px; text-align: center; font-size: .8rem;
}
.ccard img { border-radius: 4px; border: 1px solid #6a4f26; }
.ccard-name { font-weight: bold; margin-top: 4px; }
.ccard-stats { color: #6d5a3d; font-size: .78rem; }
.ccard-desc { font-style: italic; font-size: .72rem; color: #7a6647; margin-top: 3px; }
.tier { background: var(--oak); color: var(--gold-lt); border-radius: 3px; padding: 0 4px; font-size: .68rem; }
.t1 .tier { background: #6b6b52; } .t2 .tier { background: #4d6b8f; }
.t3 .tier { background: #6b4d8f; } .t4 .tier { background: #8f4d4d; } .t5 .tier { background: #8f7a2d; }

/* item chips & quality */
.chip {
  display: inline-flex; align-items: center; gap: 4px; margin: 2px 3px 2px 0;
  background: rgba(255,248,225,.5); border: 1px solid rgba(90,66,30,.45);
  border-radius: 4px; padding: 2px 7px; font-size: .82rem;
}
.chip img { border-radius: 2px; }
.q1 { color: #3a5f2d; } .q2 { color: #4d3a8f; } .q3 { color: #8f6a1d; font-weight: bold; }
.chip.q1 { border-color: #6f8f5a; } .chip.q2 { border-color: #7a6ab8; }
.chip.q3 { border-color: var(--gold); box-shadow: 0 0 6px rgba(201,162,39,.5); }

/* ---------------- bars ---------------- */
.bar {
  position: relative; height: 14px; min-width: 90px;
  background: #1d1409; border: 1px solid #000; border-radius: 7px; overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.8);
}
.bar-fill { height: 100%; }
.bar.hp .bar-fill   { background: linear-gradient(180deg, #b33, #7a1f1f); }
.bar.en .bar-fill   { background: linear-gradient(180deg, #d9a53c, #8a6a25); }
.bar.food .bar-fill { background: linear-gradient(180deg, #6f9c4e, #41632c); }
.bar.food.warn .bar-fill { background: linear-gradient(180deg, #c9a23a, #7c5f1d); }
.bar.food.bad .bar-fill  { background: linear-gradient(180deg, #b3453a, #6e211a); }
.bar.fat .bar-fill { background: linear-gradient(180deg, #8a7ab8, #4d3a8f); }
.bar.fat.warn .bar-fill { background: linear-gradient(180deg, #c9a23a, #7c5f1d); }
.bar.fat.bad .bar-fill  { background: linear-gradient(180deg, #b3453a, #6e211a); }
.bar.xp .bar-fill   { background: linear-gradient(180deg, #7b9ec9, #3a5f8a); }
.bar-label {
  position: absolute; inset: 0; text-align: center; font-size: .62rem; line-height: 14px;
  color: #f5ecd2; text-shadow: 0 1px 1px #000; letter-spacing: .04em;
}
.bar.big { height: 20px; } .bar.big .bar-label { line-height: 20px; font-size: .72rem; }

/* ---------------- flashes ---------------- */
.flash {
  border-radius: 6px; padding: 9px 14px; margin-bottom: 10px; font-size: .92rem;
  border: 1px solid; box-shadow: 0 2px 8px rgba(0,0,0,.25);
  background: linear-gradient(180deg, #efe2c0, #e2d0a5); border-color: #a08850; color: var(--ink);
}
.flash.good  { background: linear-gradient(180deg,#dfe8cd,#cddcb4); border-color:#7c9457; }
.flash.error { background: linear-gradient(180deg,#eccfc4,#dcb3a4); border-color:#a05040; color:#4c1712; }
.flash.warn  { background: linear-gradient(180deg,#f0e0b8,#e3cf97); border-color:#b09040; }
.flash.level { background: linear-gradient(180deg,#f3e3ac,#e5cd7e); border-color:var(--gold); color:#4a3a10; box-shadow: 0 0 14px rgba(201,162,39,.55); font-weight: bold; }
.flash.info  { background: linear-gradient(180deg,#dbe3ee,#c6d2e3); border-color:#7088a8; color:#22303f; }

/* ---------------- combat ---------------- */
.combat-arena { display: flex; gap: 16px; justify-content: space-between; align-items: stretch; flex-wrap: wrap; }
.combat-side { flex: 1 1 300px; }
.combat-vs { align-self: center; font-size: 2rem; color: var(--blood); text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.stack-row {
  display: flex; gap: 8px; align-items: center; padding: 6px 8px; margin-bottom: 6px;
  background: rgba(255,248,225,.45); border: 1px solid rgba(90,66,30,.5); border-radius: 6px;
}
.stack-row.dead { opacity: .45; filter: grayscale(.8); }
.stack-row.target { border-color: var(--blood); box-shadow: 0 0 8px rgba(122,31,31,.5); }
.stack-row .bar { min-width: 70px; }
.combat-log {
  max-height: 320px; overflow-y: auto; background: rgba(35,26,12,.07);
  border: 1px solid rgba(90,66,30,.4); border-radius: 6px; padding: 10px 12px;
  font-size: .86rem; line-height: 1.55;
}
.log-line { border-bottom: 1px dotted rgba(90,66,30,.25); padding: 2px 0; }
.log-line.round { color: var(--bronze); font-weight: bold; letter-spacing: .08em; text-transform: uppercase; font-size: .75rem; border-bottom: 1px solid rgba(90,66,30,.4); }
.log-line.player b { color: #2f4d24; }
.log-line.enemy b { color: var(--blood); }
.log-line.spell { color: #4d3a8f; }
.log-line.win { color: #6b5210; font-weight: bold; font-size: 1rem; }
.log-line.lose { color: var(--blood); font-weight: bold; font-size: 1rem; }
.dmg { color: var(--blood); font-weight: bold; }
.heal { color: var(--forest); font-weight: bold; }
.kill { color: #9c2b2b; font-weight: bold; }
.combat-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }

.farm-incident {
  margin: 12px 0; padding: 10px 12px;
  background: rgba(255,248,225,.55); border: 1px solid rgba(90,66,30,.55); border-radius: 6px;
}

/* ---------------- chat ---------------- */
.chat-box {
  background: rgba(35,26,12,.06); border: 1px solid rgba(90,66,30,.4); border-radius: 6px;
  padding: 8px 12px; max-height: 240px; overflow-y: auto; font-size: .86rem;
}
.chat-line { padding: 2px 0; border-bottom: 1px dotted rgba(90,66,30,.2); }
.chat-who { font-weight: bold; color: #5d431f; }
.chat-time { color: #9a865f; font-size: .72rem; }
.chat-form { display: flex; gap: 6px; margin-top: 8px; }
.chat-form input[type=text] { flex: 1; }

/* ---------------- forms ---------------- */
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  font-family: inherit; font-size: .9rem; color: var(--ink);
  background: #f4ecd6; border: 1px solid #8a6a35; border-radius: 4px; padding: 6px 9px;
  box-shadow: inset 0 1px 3px rgba(80,58,20,.25);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(201,162,39,.6); }
label { font-size: .85rem; color: var(--ink-soft); }

/* ---------------- stat blocks ---------------- */
.stat-row { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px dotted rgba(90,66,30,.25); font-size: .9rem; }
.stat-l { flex: 0 0 150px; color: #6d5a3d; }
.stat-v { font-weight: bold; }
.stat-x { color: #7a6647; font-size: .8rem; font-style: italic; }
.pstat {
  display: inline-block; min-width: 92px; text-align: center; margin: 3px;
  background: rgba(255,248,225,.5); border: 1px solid rgba(90,66,30,.5); border-radius: 6px; padding: 6px 10px;
}
.pstat .pv { font-size: 1.35rem; font-weight: bold; color: #3b2a17; display: block; }
.pstat .pl { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #7a6647; }

/* equipment paperdoll */
.equip-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.eslot {
  border: 1px dashed rgba(90,66,30,.6); border-radius: 6px; padding: 8px; text-align: center;
  background: rgba(255,248,225,.3); font-size: .82rem; min-height: 92px;
}
.eslot .sl { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #8a744d; margin-bottom: 4px; }
.eslot img { border-radius: 4px; border: 1px solid #6a4f26; }

/* inventory rows */
.inv-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-bottom: 1px dotted rgba(90,66,30,.25); }
.inv-item img { border-radius: 3px; border: 1px solid #6a4f26; }
.inv-name { flex: 1; }
.inv-sub { font-size: .75rem; color: #7a6647; }

/* world map */
.worldmap {
  position: relative; width: 100%; aspect-ratio: 3/2;
  background:
    url('../img/locations/realmmap.jpg') center / cover no-repeat;
  border: 3px solid var(--oak); border-radius: 8px; overflow: visible;
  box-shadow: inset 0 0 40px rgba(40,25,10,.35);
}
.wm-dot {
  position: absolute; transform: translate(-50%, -50%); text-align: center; text-decoration: none; color: var(--ink);
  z-index: 2;
}
.wm-dot:hover { z-index: 30; }
.wm-dot .dot {
  width: 14px; height: 14px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b08d3c, #55401e);
  border: 2px solid #241a0c; box-shadow: 0 2px 4px rgba(0,0,0,.5);
}
.wm-dot.city .dot { width: 18px; height: 18px; background: radial-gradient(circle at 35% 35%, #d9b45c, #7a5c22); }
.wm-dot.here .dot { box-shadow: 0 0 0 4px rgba(201,162,39,.55), 0 2px 4px rgba(0,0,0,.5); }
.wm-dot .nm { font-size: .68rem; background: rgba(240,230,200,.92); border-radius: 3px; padding: 0 3px; margin-top: 2px; display: inline-block; box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.wm-dot:hover .nm { background: var(--gold-lt); }
.wm-tip {
  display: none; position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%); width: 260px; max-width: 70vw;
  text-align: left; z-index: 40; pointer-events: none;
  background: #f7efd8; color: #3b2a17; border: 2px solid #6a4f26;
  border-radius: 6px; padding: 8px 10px;
  box-shadow: 0 6px 18px rgba(20,12,4,.45);
  font-size: .78rem; line-height: 1.35; font-weight: normal;
}
.wm-dot.tip-below .wm-tip { bottom: auto; top: calc(100% + 8px); }
.wm-dot:hover .wm-tip { display: block; }
.wm-tip b { display: block; font-size: .9rem; color: #3b2a17; margin-bottom: 2px; }
.wm-tip i { display: block; font-style: italic; color: #6d5a3d; font-size: .72rem; margin-bottom: 6px; }
.wm-tip-body { display: block; }
.wm-tip-known { display: block; margin-top: 6px; color: #5d431f; font-size: .72rem; }

/* wilderness walk (placeholder until from→to art) */
.walk-scene {
  position: relative; width: 100%; min-height: 280px; aspect-ratio: 16/9;
  background: repeating-linear-gradient(-12deg, #2a1e12 0 18px, #23180e 18px 36px);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 3px solid var(--oak); border-radius: 8px; overflow: hidden;
  box-shadow: inset 0 0 50px rgba(0,0,0,.45);
}
.walk-scene.has-art { background-color: #1a140c; }
.walk-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #cbb892; text-align: center;
  letter-spacing: .08em; text-transform: uppercase; font-size: .85rem;
  background: rgba(20,14,8,.25);
}
.walk-ph .small { text-transform: none; letter-spacing: 0; margin-top: 8px; color: #a8946c; }

/* location cards (wilderness) */
.lcard {
  display: block; text-decoration: none; color: var(--ink);
  background: rgba(255,248,225,.4); border: 1px solid rgba(90,66,30,.5); border-radius: 6px;
  padding: 8px 10px; margin-bottom: 8px;
}
.lcard:hover { border-color: var(--gold); box-shadow: 0 2px 8px rgba(201,162,39,.35); }
.lcard .lname { font-weight: bold; }
.lcard .lmeta { font-size: .78rem; color: #6d5a3d; }
.danger { letter-spacing: 2px; color: var(--blood); font-size: .8rem; }
.danger.safe { color: var(--forest); }

/* misc */
.herald { font-style: italic; color: #5d4a2e; }
.rule { border: 0; border-top: 1px solid rgba(90,66,30,.35); margin: 12px 0; }
.tag {
  display: inline-block; font-size: .7rem; letter-spacing: .05em; text-transform: uppercase;
  background: var(--oak); color: var(--gold-lt); border-radius: 3px; padding: 1px 6px; margin-right: 4px;
}
.tag.green { background: var(--forest); } .tag.red { background: var(--blood); } .tag.purple { background: #4d3a8f; }
.tag.gold { background: #7a5c14; }
.foot-note { font-size: .75rem; color: #8a744d; font-style: italic; margin-top: 8px; }
#foot { text-align: center; color: #8a744d; font-size: .75rem; padding: 18px 12px 22px; }
#foot .foot-tag, .gate-foot-tag {
  margin: 12px 0 0; font-style: italic; color: #8a744d; font-size: .75rem;
}

/* Field-manual footer — oak plaque + bronze tiles */
.codex-nav {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin: 0 auto; max-width: 920px;
}
.codex-kicker {
  font-size: .68rem; letter-spacing: .28em; text-transform: uppercase;
  color: #c9a55a; font-style: normal;
}
.codex-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.codex-link {
  display: inline-flex; align-items: center; gap: 7px;
  min-width: 7.2rem; justify-content: center;
  padding: 8px 14px 9px;
  background:
    linear-gradient(180deg, rgba(255,220,150,.12), rgba(0,0,0,.28)),
    linear-gradient(180deg, #56401f, #3b2a17 70%, #291d0e);
  border: 1px solid #c9a55a;
  border-radius: 6px;
  color: #f1e3bb !important;
  text-decoration: none !important;
  font-style: normal !important;
  font-size: .82rem;
  letter-spacing: .04em;
  box-shadow: inset 0 1px 0 rgba(255,230,170,.2), 0 2px 6px rgba(0,0,0,.4);
}
.codex-link:hover {
  color: #fff8dc !important;
  border-color: #e8cf7a;
  background:
    linear-gradient(180deg, rgba(255,230,160,.22), rgba(0,0,0,.2)),
    linear-gradient(180deg, #6a5028, #43301a 70%, #2c1f10);
  box-shadow: inset 0 1px 0 rgba(255,240,190,.35), 0 0 12px rgba(201,162,39,.28);
}
.codex-i {
  width: 14px; height: 14px; display: inline-block;
  background: currentColor;
  -webkit-mask: center / contain no-repeat;
          mask: center / contain no-repeat;
  opacity: .9;
}
.codex-i-scroll { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M3 2h8a2 2 0 012 2v9H5a2 2 0 01-2-2V2zm2 2v8h7V4H5z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M3 2h8a2 2 0 012 2v9H5a2 2 0 01-2-2V2zm2 2v8h7V4H5z'/></svg>"); }
.codex-i-swords { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M2 2l5 5-1.5 1.5L2 4.5 2 2zm12 0v2.5L10.5 8.5 9 7l5-5zM6.5 9.5L4 14h2l2-3 3 3h2l-3.5-4.5L8 11z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M2 2l5 5-1.5 1.5L2 4.5 2 2zm12 0v2.5L10.5 8.5 9 7l5-5zM6.5 9.5L4 14h2l2-3 3 3h2l-3.5-4.5L8 11z'/></svg>"); }
.codex-i-star { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M8 1l1.8 4.6L15 6.2l-3.5 3.2L12.4 15 8 12.6 3.6 15l.9-5.6L1 6.2l5.2-.6z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M8 1l1.8 4.6L15 6.2l-3.5 3.2L12.4 15 8 12.6 3.6 15l.9-5.6L1 6.2l5.2-.6z'/></svg>"); }
.codex-i-folk { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M8 2a2.5 2.5 0 110 5 2.5 2.5 0 010-5zM3 14c0-3 2.2-5 5-5s5 2 5 5H3z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M8 2a2.5 2.5 0 110 5 2.5 2.5 0 010-5zM3 14c0-3 2.2-5 5-5s5 2 5 5H3z'/></svg>"); }
.codex-i-banner { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M3 1h2v14H3V1zm3 1h8l-2 3 2 3H6V2z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M3 1h2v14H3V1zm3 1h8l-2 3 2 3H6V2z'/></svg>"); }
.codex-i-map { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M1 3l5-1 4 1 5-1v11l-5 1-4-1-5 1V3zm5 0v10l4 1V4L6 3z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M1 3l5-1 4 1 5-1v11l-5 1-4-1-5 1V3zm5 0v10l4 1V4L6 3z'/></svg>"); }

.gate-foot { margin-top: 22px; font-size: .75rem; color: #8a744d; }
.gate-foot .codex-kicker { color: #8a6a35; }
.gate-foot .codex-link { font-size: .78rem; min-width: 6.4rem; }

#cr-info-foot {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background:
    linear-gradient(180deg, rgba(255,220,150,.08), transparent 40%),
    linear-gradient(180deg, #2c1f10, #17110a);
  border-top: 2px solid #8a6a35;
  box-shadow: 0 -8px 24px rgba(0,0,0,.45);
  padding: 10px 16px 12px;
  font-family: Georgia, "Palatino Linotype", serif;
}
#cr-info-foot .codex-kicker { color: #e8cf7a; }
@media (max-width: 640px) {
  .codex-link { min-width: 0; padding: 7px 10px; font-size: .75rem; }
  #cr-info-foot { padding: 8px 8px 10px; }
}

/* images: placeholders get an oak frame */
img.ph { image-rendering: auto; background: #241a0c; }

/* ---------------- gate pages ---------------- */
.gate-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.gate {
  width: 100%; max-width: 560px;
  background: linear-gradient(180deg, var(--parch), var(--parch-2));
  border: 3px solid var(--oak); border-radius: 10px; padding: 34px 38px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6), inset 0 0 80px rgba(120,90,40,.2);
  text-align: center; position: relative;
}
.gate.wide { max-width: 860px; text-align: left; }
.gate-crest { margin-bottom: 6px; }
.gate-title {
  margin: 0; font-size: 2.1rem; letter-spacing: .18em; text-transform: uppercase; color: #3b2a17;
  text-shadow: 0 1px 0 rgba(255,250,230,.7);
}
.gate-tagline { font-style: italic; color: #6d5a3d; margin: 4px 0 22px; }
.gate form { text-align: left; }
.gate .row { margin-bottom: 12px; }
.gate input[type=text], .gate input[type=password], .gate input[type=email], .gate select { width: 100%; }
.gate .flash { text-align: left; }

/* creation wizard */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin: 12px 0; }
.pick {
  display: block; text-decoration: none; color: var(--ink); text-align: left;
  background: rgba(255,248,225,.45); border: 2px solid rgba(90,66,30,.5); border-radius: 8px;
  padding: 10px 12px; cursor: pointer;
}
.pick:hover { border-color: var(--gold); box-shadow: 0 3px 10px rgba(201,162,39,.4); background: rgba(255,248,225,.75); }
.pick.sel { border-color: var(--gold); background: linear-gradient(180deg,#f6e9bd,#ead9a4); box-shadow: 0 0 12px rgba(201,162,39,.55); }
.pick .pt { font-weight: bold; letter-spacing: .03em; }
.pick .pd { font-size: .8rem; color: #6d5a3d; font-style: italic; margin-top: 3px; }
.pick .pm { font-size: .75rem; color: #4d3a8f; margin-top: 4px; }
.rarity-0 { }
.rarity-1 .pt::after { content: " ◆"; color: #4d6b8f; }
.rarity-2 .pt::after { content: " ◆◆"; color: #6b4d8f; }
.step-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 6px; }
.step-no {
  flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--oak); color: var(--gold-lt);
  display: flex; align-items: center; justify-content: center; font-weight: bold; border: 2px solid var(--bronze);
}

/* deep-wild terrain map */
.deep-map-wrap { text-align: center; }
.deep-map-label { font-size: .72rem; letter-spacing: .3em; color: #8a744d; margin: 4px 0; }
.deep-map {
  display: inline-grid;
  grid-template-columns: repeat(7, 52px);
  grid-template-rows: repeat(7, 52px);
  gap: 1px;
  background: #2a1c10;
  padding: 2px;
  border: 2px solid var(--oak);
  border-radius: 6px;
  box-shadow: inset 0 0 12px rgba(20,10,0,.45);
}
.deep-map .dcell {
  position: relative;
  width: 52px; height: 52px;
  overflow: hidden;
  background: #1a120a;
}
.deep-map .dcell img.dtile {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.deep-map .dcell.dense img.dtile { filter: brightness(.72) saturate(1.15); }
.deep-map .dcell.fog { display: flex; align-items: center; justify-content: center; background: #1c140c; }
.deep-map .dmark {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font: bold 14px/1 Georgia, serif;
  color: #fff8dc;
  text-shadow: 0 0 3px #000, 0 1px 2px #000;
  pointer-events: none;
}
.deep-map .dcell.you { outline: 2px solid #c9a227; outline-offset: -2px; z-index: 1; }
.deep-map .dcell.you .dmark { color: #ffe27a; font-size: 16px; }
.deep-map-legend { margin-top: 8px; }

/* ---------------- responsive ---------------- */
@media (max-width: 960px) {
  #main { flex-direction: column; }
  #side { position: static; flex: none; width: 100%; flex-direction: row; flex-wrap: wrap; }
  .navl { flex: 1 1 auto; text-align: center; }
  .nav-sep, .nav-who { display: none; }
  .char-vitals { display: flex; min-width: 140px; width: 100%; }
}

.codex-i-scales { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M8 1h1v2h4l-2 4a3 3 0 01-6 0L3 3h4V1h1zM2 14h12v1H2v-1zm5-1h2V8H7v5z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M8 1h1v2h4l-2 4a3 3 0 01-6 0L3 3h4V1h1zM2 14h12v1H2v-1zm5-1h2V8H7v5z'/></svg>"); }

.cr-legal { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; margin-top: 8px; }
.cr-legal a, .cr-legal button {
  color: #c9a55a; background: none; border: 0; padding: 0;
  font: inherit; font-size: .75rem; cursor: pointer; text-decoration: underline;
}
#cr-info-foot .cr-legal a, #cr-info-foot .cr-legal button { color: #e8cf7a; }

.legal-wrap { max-width: 920px; margin: 0 auto; padding: 18px 16px 120px; }
.legal-kicker { margin: 0 0 8px; letter-spacing: .14em; text-transform: uppercase; font-size: .78rem; }
.legal-wrap .manual-card {
  background: linear-gradient(180deg, #e9dcbe, #ddcaa4);
  border: 2px solid #1d140a; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
  padding: 22px 26px 32px; color: #2e2114;
}
.legal-wrap .manual-card h1 {
  margin: 0 0 6px; font-size: 1.55rem; letter-spacing: .08em;
  text-transform: uppercase; color: #3b2a17;
}
.legal-wrap .manual-card .lede { font-style: italic; color: #4c3a24; margin: 0 0 18px; }
.legal-wrap .manual-card h2 {
  font-size: 1.15rem; margin: 1.4em 0 .5em; border-bottom: 1px solid #c9a55a; padding-bottom: 4px;
}
.legal-wrap .manual-card p, .legal-wrap .manual-card li { line-height: 1.45; }
.legal-wrap .manual-card table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: .6em 0 1em; }
.legal-wrap .manual-card th, .legal-wrap .manual-card td {
  border: 1px solid #c4ad7a; padding: 5px 7px; text-align: left; vertical-align: top;
}
.legal-wrap .manual-card th { background: #d3bd91; }
.legal-wrap .manual-card a { color: #5a3e12; }

.cr-consent {
  position: fixed; z-index: 10050; left: 16px; right: 16px; bottom: 16px;
  max-width: 720px; margin: 0 auto; max-height: 70vh; overflow: auto;
  background: linear-gradient(180deg, #e9dcbe, #ddcaa4);
  border: 2px solid #1d140a; border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  padding: 14px 16px 16px; color: #2e2114;
  font-family: Georgia, "Palatino Linotype", serif; font-size: .92rem;
}
body:has(#cr-info-foot) .cr-consent { bottom: 132px; }
.cr-consent[hidden] { display: none !important; }
.cr-consent p { margin: 0 0 8px; line-height: 1.4; }
.cr-consent-links a { color: #5a3e12; }
.cr-consent-actions, .cr-consent-settings { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cr-consent button {
  font: inherit; cursor: pointer; color: #f3e7c9;
  background: linear-gradient(180deg, #7c5c2c, #55401e 60%, #443316);
  border: 1px solid #c9a55a; border-radius: 6px; padding: 7px 12px;
}
.cr-consent button.primary {
  background: linear-gradient(180deg, #b08d3c, #8a6a25 60%, #6e541c); color: #fff5dc;
}
.cr-consent-settings { margin-top: 10px; }
.cr-consent-settings[hidden] { display: none !important; }
.cr-consent-settings label { display: flex; gap: 8px; align-items: flex-start; flex: 1 1 240px; }
