:root {
  --bg: #17130e;
  --panel: #241d15;
  --panel-2: #2e251b;
  --line: #4a3c2a;
  --ink: #efe5cf;
  --ink-2: #b9a98a;
  --gold: #d2a24c;
  --red: #c0533f;
  --green: #7fae5a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.hidden { display: none !important; }
h1, h2 { font-family: "IM Fell English SC", Georgia, serif; font-weight: 400; margin: 0; letter-spacing: .02em; }
h1 { font-size: 64px; color: var(--gold); line-height: 1; }
h2 { font-size: 36px; color: var(--gold); }
.sub { color: var(--ink-2); font-family: "IM Fell English", Georgia, serif; font-style: italic; margin: 6px 0 0; }
.blurb { margin: 18px 0 22px; }
button { font: inherit; background: var(--gold); color: #1b140b; border: 0; border-radius: 6px; padding: 9px 16px; cursor: pointer; font-weight: 600; }
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
label { display: block; margin: 10px 0; color: var(--ink-2); font-size: 13px; }
input { display: block; width: 100%; margin-top: 4px; font: inherit; color: var(--ink); background: #120e0a; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; }
input:focus { outline: 2px solid var(--gold); outline-offset: 0; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.err { color: var(--red); min-height: 1.4em; margin: 10px 0 0; }

.screen { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 32px 16px;
  background: radial-gradient(ellipse at 50% 20%, #2b2217 0%, var(--bg) 70%); }
.card { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }

.pickwrap { width: min(1280px, 100%); }
.pickgrid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; margin: 18px 0; align-items: start; }
.mapbox { position: relative; border-radius: 6px; overflow: hidden; box-shadow: 0 14px 40px rgba(0,0,0,.45); }
.mapbox > img { display: block; width: 100%; height: auto; }
.maplayer { position: absolute; inset: 0; }
.mk { position: absolute; transform: translate(-8px, -8px); display: flex; align-items: center; gap: 5px; background: none; border: 0; padding: 0; color: #3a2a14; font: 400 16px "IM Fell English", Georgia, serif; cursor: pointer; }
.mk:hover { filter: none; }
.mk .dot { width: 16px; height: 16px; flex: none; border-radius: 50%; background: #8b2b1e; border: 2px solid #f4e8c8; box-shadow: 0 0 0 1px #5c4a32; }
.mk .lbl { white-space: nowrap; text-shadow: 0 0 3px #efe3c2, 0 0 3px #efe3c2, 0 0 2px #efe3c2; }
.mk:hover .dot, .mk:focus-visible .dot { background: #b8402c; }
.mk.on .dot { background: #d2a24c; box-shadow: 0 0 0 3px #8b2b1e; }
.mk.on .lbl { font-weight: 700; }
.town { position: absolute; transform: translate(-5px, -5px); display: flex; align-items: center; gap: 5px; pointer-events: none; color: #2d2416; font: 17px "IM Fell English SC", Georgia, serif; text-shadow: 0 0 3px #efe3c2, 0 0 3px #efe3c2; white-space: nowrap; }
.town i { width: 10px; height: 10px; flex: none; background: #2d2416; transform: rotate(45deg); }
.region { position: absolute; transform: translate(-50%, -50%); pointer-events: none; letter-spacing: .4em; color: rgba(70, 52, 30, .5); font: 22px "IM Fell English SC", Georgia, serif; white-space: nowrap; }
.seaname { position: absolute; transform: translate(-50%, -50%); pointer-events: none; color: rgba(45, 66, 66, .75); font: italic 20px "IM Fell English", Georgia, serif; white-space: nowrap; }
.locator { position: absolute; left: 14px; top: 14px; width: 18%; border: 2px solid #5c4a32; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.locator img { display: block; width: 100%; height: auto; }
.locbox { position: absolute; border: 2px solid #8b2b1e; background: rgba(139, 43, 30, .12); }
.manorinfo { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; min-height: 200px; }
.manorinfo .hint { color: var(--ink-2); font-style: italic; margin: 0; }
.manorinfo .nm { font: 30px "IM Fell English SC", Georgia, serif; color: var(--gold); line-height: 1.1; }
.manorinfo .de { color: var(--ink-2); font: italic 16px "IM Fell English", Georgia, serif; margin-top: 2px; }
.manorinfo .fam { margin: 12px 0 4px; font-weight: 600; }
.manorinfo p { margin: 8px 0 0; font-size: 14px; color: var(--ink); }
.manorinfo .k { color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-top: 12px; }
@media (max-width: 900px) {
  .pickgrid { grid-template-columns: 1fr; }
  .mk { font-size: 13px; transform: translate(-6px, -6px); }
  .mk .dot { width: 12px; height: 12px; }
  .town, .region, .seaname { font-size: 13px; }
}
#charForm { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
#charForm label { flex: 1 1 260px; margin: 0; }
#charForm .err { flex-basis: 100%; }

#game { position: fixed; inset: 0; display: flex; }
#view { flex: 1 1 0; min-width: 0; height: 100%; display: block; background: #000; cursor: crosshair; image-rendering: pixelated; }
#side { flex: 0 0 330px; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
#side header { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.who { font-family: "IM Fell English SC", Georgia, serif; font-size: 24px; color: var(--gold); line-height: 1.1; }
.rank { color: var(--ink); font-size: 13px; margin-top: 2px; }
.where { color: var(--ink-2); font-size: 12px; margin-top: 4px; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tools button { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); font-weight: 500; padding: 7px 8px; text-align: left; font-size: 13px; }
.tools button.on { border-color: var(--gold); color: var(--gold); }
.tools button:last-child { grid-column: span 2; }
kbd { font: 11px ui-monospace, monospace; background: #120e0a; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-right: 4px; color: var(--ink-2); }
.exam { padding: 10px 14px; font-size: 13px; min-height: 64px; border-bottom: 1px solid var(--line); color: var(--ink); font-family: "IM Fell English", Georgia, serif; font-size: 15px; }
.log { flex: 1 1 auto; overflow-y: auto; padding: 8px 14px; font-size: 13px; min-height: 0; }
.log div { margin: 2px 0; overflow-wrap: anywhere; }
.log .sys { color: var(--ink-2); font-style: italic; }
.log b { color: var(--gold); font-weight: 600; }
#chatForm { padding: 8px 12px; border-top: 1px solid var(--line); }
#chatForm input { margin: 0; }
.help { padding: 8px 14px 12px; font-size: 11.5px; color: var(--ink-2); }
.help a { color: var(--ink-2); }
.banner { position: fixed; top: 16px; left: calc(50% - 165px); transform: translateX(-50%); background: rgba(20,14,8,.92); border: 1px solid var(--gold); color: var(--ink); padding: 10px 18px; border-radius: 8px; }

@media (max-width: 760px) {
  #game { flex-direction: column; }
  #side { flex: 0 0 42%; border-left: 0; border-top: 1px solid var(--line); }
  .banner { left: 50%; }
  h1 { font-size: 48px; }
}
