:root {
  --wood-1: #8a5a2b; --wood-2: #5e3a17; --wood-3: #3a2209; --gold: #e8c46a; --gold-d: #9c7a2c;
  --parch: #d9c39b; --parch-d: #b89b6a; --ink: #241608; --text-bg: #4b2e12;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #000; color: #e3e3e3; font: 15px/1.45 Verdana, Tahoma, sans-serif; }
.hidden { display: none !important; }
#stage { max-width: 1024px; margin: 0 auto; padding: 6px 10px 0; }
.credits { max-width: 1024px; margin: 3px auto 4px; color: #6d5a3c; font-size: 10px; line-height: 1.3; text-align: center; }
/* Everything on one screen: the picture is sized to the window, the text box gives up room
   first (it scrolls inside), and the page itself doesn't scroll on a normal laptop screen. */
:root { --picH: clamp(220px, calc(100vh - 330px), 440px); }
img[data-jxl] { opacity: 0; transition: opacity .25s; }
img.loaded { opacity: 1; }

/* wood + parchment surfaces */
.wood {
  background: linear-gradient(180deg, #9b6630 0%, var(--wood-1) 8%, var(--wood-2) 60%, #4a2b0f 100%);
  border: 3px solid var(--wood-3); border-radius: 26px 26px 14px 14px;
  box-shadow: inset 0 2px 0 #c58a49, inset 0 -3px 8px #0007, 0 6px 24px #000c;
}
.parchment {
  background: radial-gradient(ellipse at 30% 20%, #efe0bf 0%, var(--parch) 55%, var(--parch-d) 100%);
  color: var(--ink); border-radius: 4px; box-shadow: 2px 3px 0 #0005, inset 0 0 18px #8a6a3a66;
}
.btn {
  font: italic 600 17px/1 var(--serif); color: #2a1604; cursor: pointer; padding: 7px 16px; min-width: 110px;
  background: linear-gradient(180deg, #f0d898, #c9a659 55%, #a7843a); border: 2px solid #5a3b10; border-radius: 4px;
  box-shadow: inset 0 1px 0 #fff6, 0 2px 0 #000a;
}
.btn:hover, .btn:focus-visible { background: linear-gradient(180deg, #fff0b8, #ddb96a 55%, #b8943f); outline: none; }
.btn:active { transform: translateY(1px); }
.btn.small { min-width: 0; font-size: 15px; padding: 5px 12px; }
.btn .hk { text-decoration: underline; text-decoration-thickness: 2px; }
.btn.def { border-color: #2d1a03; box-shadow: inset 0 1px 0 #fff6, 0 0 0 2px #e8c46a99, 0 2px 0 #000a; }

/* ---------- logon ---------- */
.logon-art { text-align: center; padding: 4px 0 0; }
.logo-big { width: min(560px, 90%); max-height: max(60px, 13vh); object-fit: contain; }
.graveyard { display: block; margin: 2px auto 8px; width: min(520px, 90%); max-height: max(50px, 11vh); object-fit: contain; border-radius: 6px; }
.logon-box { padding: 14px 18px 10px; }
.logon-cols { display: grid; grid-template-columns: 2fr 3fr; gap: 16px; align-items: start; }
.logon-box form { padding: 10px 16px 14px; }
.logon-box h2 { font: italic 700 21px var(--serif); margin: 0 0 4px; color: #4a2a08; }
.logon-box label { display: block; margin: 4px 0; font-size: 13px; }
/* the new-player form in two columns, so the log-on page fits on one screen */
#newForm { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
#newForm h2, #newForm .btn { grid-column: 1 / -1; justify-self: start; }
#newForm .sex { margin: 4px 0; align-self: end; }
.logon-box input:not([type=radio]) { display: block; width: 100%; margin-top: 2px; padding: 5px 8px; border: 1px solid #7a5a2a; background: #fbf3de; font-size: 15px; border-radius: 3px; }
.sex { display: flex; gap: 14px; margin: 6px 0 8px; }
.skull { display: flex !important; flex-direction: column; align-items: center; cursor: pointer; padding: 4px 10px; border-radius: 6px; border: 2px solid transparent; }
.skull input { position: absolute; opacity: 0; }
.skull img { height: 44px; }
.skull:has(input:checked) { border-color: #6a4512; background: #fff3; }
.error { color: #ff9a7a; font-weight: bold; min-height: 1.2em; margin: 6px 4px 0; }
.error:empty { min-height: 0; margin: 0; }
.server-info, .links { color: var(--gold); margin: 4px 4px 0; font-size: 14px; }
.links a { color: #ffd98a; }

/* ---------- game layout ---------- */
#game { padding: 8px 18px 10px; display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
/* map, newspaper and tables size themselves; the rest share the window with the text box */
#game.on-flow { height: auto; max-height: calc(100vh - 34px); }
#game > * { flex: none; }
#game.wood-bg, #game { background: linear-gradient(180deg, #9b6630 0%, var(--wood-1) 6%, var(--wood-2) 70%, #44270c 100%);
  border: 3px solid var(--wood-3); border-radius: 60px 60px 16px 16px / 34px 34px 16px 16px; box-shadow: inset 0 2px 0 #c58a49, 0 6px 24px #000c; }
.topbar { display: flex; align-items: center; gap: 16px; min-height: 46px; }
.logo { height: 40px; }
.location { flex: 1; font: italic 20px var(--serif); color: var(--gold); text-shadow: 1px 1px 0 #000; }
.snd { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #4a2a08; cursor: pointer; font-size: 18px; line-height: 1;
  background: radial-gradient(circle at 40% 35%, #f0d898, #b08a3a); box-shadow: 0 2px 0 #000a; }
.snd.off { filter: grayscale(1) brightness(.7); }
.exit { width: 46px; height: 46px; border-radius: 50%; border: 3px solid #4a1f08; cursor: pointer;
  background: radial-gradient(circle at 40% 35%, #f08a4a, #b2441a 55%, #6c2208); color: #ffd9a8; font: italic 15px var(--serif); box-shadow: 0 2px 0 #000a; }

.main-area { display: grid; grid-template-columns: minmax(270px, 1fr) auto; gap: 18px; margin: 6px 0 8px; align-items: stretch; }
.card { padding: 12px 14px 10px; position: relative; font-size: 14px; }
/* tight: a long message needs the room, so the side panel packs itself smaller */
#game.tight .card { padding: 8px 12px 6px; }
#game.tight .card-info { font-size: 12px; line-height: 1.25; margin-bottom: 4px; }
#game.tight .card-body { grid-template-columns: 40px 1fr; gap: 2px 10px; }
#game.tight .luck-tube { height: 70px; margin-top: 3px; }
#game.tight .luck-best, #game.tight .luck-worst { display: none; }
#game.tight .nums dt { font-size: 13px; } #game.tight .nums dd { font-size: 21px; }
#game.tight .tags { font-size: 13px; gap: 4px 10px; }
#game.tight .card::after { display: none; }
.card::after { content: ""; position: absolute; right: 0; bottom: 0; width: 34px; height: 34px;
  background: linear-gradient(135deg, transparent 50%, #a8885499 50%, #e8d6b0 70%); border-radius: 0 0 4px 0; }
.card-info { font-size: 13px; line-height: 1.3; margin-bottom: 6px; white-space: pre-line; }
.card-info:empty { display: none; }
.card-body { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto auto; gap: 4px 12px; }
.luck { grid-row: 1 / span 3; position: relative; text-align: center; font: bold 10px/1.1 Verdana; padding-top: 2px; }
.luck-tube { width: 16px; height: 120px; margin: 6px auto 0; background: #111; border-radius: 8px; position: relative; overflow: hidden; border: 2px solid #3a2a10; }
.luck-fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, #8a2a08, #c86a1a 50%, #f0c46a); transition: height .4s; }
.luck-best, .luck-worst { position: absolute; left: 36px; font: italic 10px Verdana; }
.luck-best { top: 30px; } .luck-worst { top: 138px; }
.nums { display: grid; grid-template-columns: 1fr auto; margin: 0; align-items: center; }
.nums dt { font-size: 14px; } .nums dd { margin: 0; font: 28px/1.1 Georgia, serif; text-align: right; min-width: 2.2ch; }
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 15px; }
.tags > span:first-child { width: 100%; }
.tag img { height: 20px; vertical-align: middle; margin-right: 3px; } .tag b { font-weight: normal; font-size: 13px; }
.extra { grid-column: 1 / span 2; font-size: 12px; margin-top: 4px; }
.extra .hp { height: 10px; background: #2a1408; border-radius: 4px; overflow: hidden; margin: 2px 0 6px; }
.extra .hp i { display: block; height: 100%; background: linear-gradient(90deg, #2a6fd0, #7ab0ff); }
.extra .hp.him i { background: linear-gradient(90deg, #a01010, #ff5a4a); }

.frame { margin: 0; padding: 10px; justify-self: end; border-radius: 6px; background: linear-gradient(135deg, #6b4520, #3d230a 60%, #5a3815);
  box-shadow: inset 0 0 0 2px #2a1604, inset 0 0 12px #000, 0 3px 0 #000a; }
.pic { position: relative; aspect-ratio: 550 / 400; height: min(var(--picH), calc((min(100vw, 1024px) - 360px) / 1.375)); width: auto;
  background: #000; overflow: hidden; border: 2px solid #1d0f03; }
.pic img:not([src]) { display: none; }
.pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.overlay { position: absolute; left: 12px; bottom: 10px; color: #ffff33; font: 16px Verdana; text-shadow: 1px 1px 2px #000, 0 0 4px #000; white-space: pre-line; }

.textbox { position: relative; border-radius: 6px; padding: 8px 16px; flex: 0 1 auto !important; min-height: 64px; display: flex; flex-direction: column; overflow: hidden; background: linear-gradient(180deg, #6a4220, var(--text-bg)); box-shadow: inset 0 2px 8px #000c, 0 1px 0 #a0703a; }
.text { flex: 1 1 auto; min-height: 4.5em; overflow-y: auto; scrollbar-width: thin; white-space: pre-wrap; color: #ffff33; font-size: 16px; line-height: 1.5; outline: none; }
.text a { color: #ffbbff; }
.chat-form { display: flex; gap: 8px; margin-top: 8px; }
.chat-form input { flex: 1; padding: 6px 8px; background: #2b1a08; color: #fff; border: 1px solid #a07a3a; border-radius: 3px; font-size: 15px; }
.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px 10px; margin-top: 8px; }

/* map */
.main-area.map { grid-template-columns: 1fr; min-height: 0; margin: 4px 0 8px; }
.map-view { display: flex; justify-content: center; }
.map-wrap { position: relative; width: fit-content; border: 3px solid #2a1604; border-radius: 8px; overflow: hidden;
  box-shadow: 0 0 0 2px #8a5a2a, 0 4px 14px #000c; }
/* as wide as the game, but never taller than the window, so the whole map and the buttons fit */
.map-wrap img { display: block; width: auto; height: auto; max-width: 100%; max-height: max(280px, calc(100vh - 290px)); }
/* on the map the text box only says "Where to?" */
#game.on-map .text { min-height: 0; }
#game.on-map .textbox { min-height: 0; }
#game.on-map .textbox { padding: 6px 16px; }
#game.on-map .buttons { margin-top: 8px; }
#hotspots a { position: absolute; border-radius: 10px; }
#hotspots a:hover, #hotspots a:focus { background: #ffe9a033; box-shadow: 0 0 0 2px #ffe9a0aa; outline: none; }
#hotspots a span { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); white-space: nowrap; background: #000c; color: var(--gold);
  font: italic 14px var(--serif); padding: 2px 8px; border-radius: 4px; display: none; }
#hotspots a:hover span, #hotspots a:focus span { display: block; }
#hotspots a.below span { bottom: auto; top: 100%; margin-top: 4px; }
#hotspots a.at-left span { left: 0; transform: none; }
#hotspots a.at-right span { left: auto; right: 0; transform: none; }

/* newspaper */
.main-area.paper { grid-template-columns: 1fr; }
.paper-view { display: grid; grid-template-columns: 26% 1fr; gap: 16px; padding: 12px; border-radius: 6px;
  background: #5a1e18 url() repeat; background-image: var(--brick); background-size: 240px 56px; }
.plaques { display: flex; flex-direction: column; gap: 14px; }
.plaque { background: linear-gradient(180deg, #d9bd86, #b59460); color: #1d1206; padding: 8px 12px 12px; border-radius: 3px; box-shadow: 3px 4px 0 #0007; }
.plaque h3 { margin: 0 0 6px; font: 16px Verdana; border-bottom: 1px solid #5a4020; padding-bottom: 4px; }
.plaque p { margin: 0; font-size: 13px; }
.paper { background: linear-gradient(135deg, #fff, #e8e8e8); color: #000; padding: 8px 16px 10px; border: 3px double #444; box-shadow: 6px 8px 0 #0008; }
.masthead { display: block; width: 100%; max-width: 380px; margin: 0 auto; }
.paper-sub { display: flex; justify-content: space-between; font: italic 13px var(--serif); border-top: 1px solid #000; border-bottom: 1px solid #000; margin: 4px 0 8px; padding: 2px 0; color: #7a5a3a; }
.paper-text { white-space: pre-wrap; font: 14px/1.45 Georgia, serif; max-height: max(160px, calc(100vh - 330px)); overflow-y: auto; }

/* tables (rankings, stats) */
.table-view { padding: 12px 18px; max-height: calc(100vh - 230px); overflow-y: auto; }
/* long lists (rankings, rival parlors, network towns) scroll inside their box; the heading and column titles stay put */
.list-scroll { max-height: max(200px, calc(100vh - 330px)); overflow-y: auto; scrollbar-gutter: stable;
  border: 1px solid #a8885466; border-radius: 4px; scrollbar-color: #7a5326 #d9c294; scrollbar-width: auto; }
.list-scroll::-webkit-scrollbar { width: 14px; }
.list-scroll::-webkit-scrollbar-track { background: #d9c294; border-radius: 4px; }
.list-scroll::-webkit-scrollbar-thumb { background: #7a5326; border-radius: 7px; border: 3px solid #d9c294; }
.list-scroll thead th { position: sticky; top: 0; z-index: 1; background: #e4d0a4; }
.dialog-box .list-scroll { max-height: max(220px, calc(100vh - 260px)); }
.main-area.table { grid-template-columns: 1fr; }
.table-view h2 { margin: 0 0 8px; font: italic 23px var(--serif); }
.table-view table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-view th { text-align: left; border-bottom: 2px solid #5a3a10; padding: 4px 6px; }
.table-view td { padding: 3px 6px; border-bottom: 1px solid #a8885455; }
.table-view td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-view .f { color: #a0208a; } .table-view .m { color: #1a3a8a; }
.table-view .on { color: #1d6a1d; font-weight: bold; }
/* stats: two columns of name/value pairs so the whole sheet fits */
.stats-grid { display: grid; grid-template-columns: max-content 1fr max-content 1fr; gap: 3px 14px; font-size: 13.5px; }
.stats-grid dd { min-width: 0; overflow-wrap: anywhere; }
.sheet { white-space: pre-wrap; font: 14.5px/1.5 Verdana, sans-serif; }
.stats-grid dt { font-weight: bold; } .stats-grid dd { margin: 0; }

/* dialogs */
.dialog { position: fixed; inset: 0; background: #0009; display: grid; place-items: center; z-index: 10; }
.dialog-box { width: min(560px, 92vw); padding: 18px 20px; }
.dialog-box.wide { width: min(800px, 94vw); max-height: 86vh; overflow: auto; }
#dialogPrompt { margin: 0 0 10px; white-space: pre-wrap; font-size: 15px; }
.dialog-box input, .dialog-box textarea { width: 100%; padding: 7px 9px; font-size: 16px; background: #fbf3de; border: 1px solid #7a5a2a; border-radius: 3px; font-family: inherit; }
.dialog-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* phones and small windows: let the page scroll normally */
@media (max-width: 760px), (max-height: 520px) {
  #game, #game.on-flow { max-height: none; height: auto; }
  .pic { height: auto; width: 100%; }
  .card { max-height: none; }
  .frame { justify-self: stretch; }
  .stats-grid { grid-template-columns: max-content 1fr; }
}
@media (max-width: 760px) {
  .logon-cols, .main-area, .paper-view, #newForm { grid-template-columns: 1fr; }
  .main-area > .frame { order: -1; }
  #game { border-radius: 24px 24px 10px 10px; padding: 10px; }
  .nums dd { font-size: 26px; }
  .btn { min-width: 0; font-size: 15px; }
}

/* notes for the sysop: forgot password / contact */
.forgot { margin: 6px 0 0; font-size: 13px; }
.forgot a { color: #6a3a0a; }
.note-form label { display: block; margin: 6px 0; font-size: 14px; }
.note-form input, .note-form textarea { display: block; width: 100%; margin-top: 2px; padding: 5px 8px; border: 1px solid #7a5a2a; background: #fbf3de; font: 15px var(--sans, Verdana, sans-serif); border-radius: 3px; box-sizing: border-box; }
.note-form .stone, #newForm .stone { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.note-form .stone img, #newForm .stone img { border-radius: 26px 26px 4px 4px; box-shadow: 2px 3px 6px rgba(0,0,0,.45); background: #444; }
.note-form .stone > div, #newForm .stone > div { flex: 1; min-width: 200px; }
.note-form .stone input { text-transform: uppercase; letter-spacing: 4px; font-weight: bold; }
.note-form .error { min-height: 1em; }

/* where a cafe line came from (a linked town): black on brown */
.town-tag { display: inline-block; background: #b8925a; color: #000; font-size: .85em; font-weight: bold; padding: 0 6px; margin-right: 4px; border-radius: 3px; line-height: 1.35; vertical-align: 1px; box-shadow: inset 0 -1px 0 #7a5a2a; }
