:root {
  --parch: #efe0bd; --parch2: #e3cf9f; --ink: #3a2612; --ink2: #6b4a26; --wood: #5b3a1c; --wood2: #7a5028; --gold: #d8b04a; --gold2: #f5d77a;
  --red: #a8352a; --green: #4f7a2a; --blue: #2f6fdc; --shadow: rgba(20, 10, 0, .55);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0b08; color: var(--ink); font-family: 'Alegreya', Georgia, 'Times New Roman', serif; user-select: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: default; }
.hidden { display: none !important; }
button { font-family: inherit; }

/* ------------------------------------------------ parchment panels */
.panel, .win, .scroll, .load-box, .modal-box {
  background: linear-gradient(180deg, rgba(255, 250, 235, .35), rgba(0, 0, 0, 0) 30%), radial-gradient(ellipse at 30% 20%, #f6ead0, var(--parch) 55%, var(--parch2));
  border: 3px solid var(--wood); border-radius: 6px;
  box-shadow: 0 0 0 2px var(--gold) inset, 0 0 0 4px rgba(90, 58, 28, .6) inset, 0 8px 28px var(--shadow);
}
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50; }
#loading { background: radial-gradient(ellipse at center, #3a2a18, #0d0b08 70%); }
.load-box { padding: 28px 40px; min-width: 380px; text-align: center; }
.title-small { font-family: 'Cinzel', serif; font-weight: 900; font-size: 34px; letter-spacing: 6px; color: var(--wood); }
#load-text { margin: 10px 0 14px; font-style: italic; }
.bar { height: 14px; border: 2px solid var(--wood); border-radius: 7px; background: #d8c290; overflow: hidden; }
#load-bar { height: 100%; width: 0; background: linear-gradient(90deg, #8a5a20, var(--gold2)); transition: width .2s; }

/* ------------------------------------------------ title */
#title { background: radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(0,0,0,.55) 100%); pointer-events: none; }
.title-wrap { text-align: center; pointer-events: auto; margin-top: -4vh; }
.game-title { font-family: 'Cinzel', serif; font-weight: 900; font-size: clamp(54px, 9vw, 120px); letter-spacing: .12em; margin: 0; color: #f8e3a0;
  text-shadow: 0 2px 0 #7a5020, 0 4px 0 #5b3a1c, 0 8px 24px rgba(0,0,0,.8), 0 0 40px rgba(255, 200, 90, .35); }
.game-sub { font-family: 'Cinzel', serif; font-size: clamp(16px, 2vw, 24px); color: #f3e2b5; letter-spacing: .4em; margin: 6px 0 28px; text-shadow: 0 2px 6px #000; }
.scroll.menu { display: inline-flex; flex-direction: column; gap: 8px; padding: 22px 34px; min-width: 300px; }
.scroll.menu button, .btn {
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 17px; letter-spacing: .06em; color: #f8ecd0; cursor: pointer;
  background: linear-gradient(180deg, #8a5a2c, #5b3a1c); border: 2px solid #3a2412; border-radius: 4px; padding: 8px 18px;
  box-shadow: 0 0 0 1px var(--gold) inset, 0 2px 0 #2a1808; text-shadow: 0 1px 1px #000; transition: filter .12s, transform .06s;
}
.scroll.menu button:hover, .btn:hover { filter: brightness(1.18); }
.scroll.menu button:active, .btn:active { transform: translateY(1px); }
.btn.small { font-size: 13px; padding: 4px 10px; }
.btn.red { background: linear-gradient(180deg, #b0402c, #6e1f14); }
.btn.green { background: linear-gradient(180deg, #6a9a3a, #3b5e1a); }
.btn:disabled { filter: grayscale(.8) brightness(.8); cursor: not-allowed; }
.credits { margin-top: 18px; color: #e8d8b0; font-style: italic; text-shadow: 0 1px 3px #000; font-size: 14px; }

/* ------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#topbar { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; }
#clock, #speed { font-family: 'Cinzel', serif; font-weight: 700; color: #f8ecd0; background: rgba(40, 24, 10, .75); border: 2px solid var(--gold); border-radius: 14px; padding: 2px 14px; text-shadow: 0 1px 2px #000; }
#speed { cursor: pointer; }
#nowplaying { color: #f3e2b5; font-style: italic; font-size: 13px; text-shadow: 0 1px 2px #000; opacity: .85; }
#toolbar { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; padding: 7px 10px; border-radius: 10px;
  background: linear-gradient(180deg, #7a5028, #4a2e14); border: 2px solid #2a1808; box-shadow: 0 0 0 1px var(--gold) inset, 0 6px 20px var(--shadow); }
#toolbar button { position: relative; width: 50px; height: 50px; border-radius: 8px; border: 2px solid #2a1808; cursor: pointer; padding: 3px;
  background: radial-gradient(circle at 40% 30%, #f6ead0, #d8c08a); box-shadow: 0 0 0 1px var(--gold) inset; }
#toolbar button:hover { filter: brightness(1.12); }
#toolbar button.on { background: radial-gradient(circle at 40% 30%, #fff6c8, #e8c050); box-shadow: 0 0 0 2px #fff2a0 inset, 0 0 10px #ffd860; }
#toolbar img { width: 38px; height: 38px; pointer-events: none; }
#msgcount { position: absolute; top: -6px; right: -6px; min-width: 18px; padding: 0 4px; font-size: 12px; font-weight: 700; color: #fff; background: var(--red); border-radius: 9px; border: 1px solid #fff; }
#msgcount:empty { display: none; }
#minimap-wrap { position: absolute; top: 10px; right: 10px; padding: 5px; }
#minimap { display: block; cursor: crosshair; border: 1px solid var(--wood); image-rendering: pixelated; }
#objectives { position: absolute; top: 10px; left: 10px; padding: 10px 14px; max-width: 330px; font-size: 14px; }
#objectives h3 { margin: 0 0 6px; font-family: 'Cinzel', serif; font-size: 15px; }
#objectives .obj { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
#objectives .obj.done { color: var(--green); text-decoration: line-through; }
#objectives .obj b { font-variant-numeric: tabular-nums; }
#toasts { position: absolute; left: 12px; bottom: 90px; display: flex; flex-direction: column-reverse; gap: 5px; max-width: 420px; pointer-events: none; }
.toast { pointer-events: auto; cursor: pointer; padding: 6px 12px; border-radius: 6px; font-size: 14px; color: #f8ecd0; background: rgba(40, 24, 10, .85); border-left: 4px solid var(--gold); box-shadow: 0 3px 10px rgba(0,0,0,.4); animation: tin .25s ease-out; }
.toast.war { border-left-color: #e0402a; }
.toast.goal { border-left-color: #7ac040; }
.toast.hint { border-left-color: #6ab0ff; max-width: 420px; font-style: italic; }
.toast.fade { opacity: 0; transition: opacity .8s; }
@keyframes tin { from { transform: translateX(-20px); opacity: 0; } }
#roadhint { position: absolute; top: 46px; left: 50%; transform: translateX(-50%); padding: 5px 14px; border-radius: 12px; background: rgba(40, 24, 10, .85); color: #ffe890; font-size: 14px; }

/* ------------------------------------------------ windows */
#windows { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.win { position: absolute; pointer-events: auto; min-width: 250px; max-width: 560px; font-size: 14px; }
.win .wt { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px 5px 12px; cursor: move;
  background: linear-gradient(180deg, #7a5028, #4a2e14); color: #f8ecd0; font-family: 'Cinzel', serif; font-weight: 700; letter-spacing: .04em; border-bottom: 2px solid var(--gold); border-radius: 3px 3px 0 0; text-shadow: 0 1px 2px #000; }
.win .wx { cursor: pointer; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--gold); background: #6e1f14; color: #fff; font-size: 13px; line-height: 18px; text-align: center; }
.win .wb { padding: 10px 12px 12px; max-height: 72vh; overflow: auto; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.tabs button { flex: 1; font-family: 'Cinzel', serif; font-weight: 700; font-size: 12px; padding: 4px 6px; cursor: pointer; border: 2px solid var(--wood); border-radius: 4px 4px 0 0; background: #d8c290; color: var(--ink); }
.tabs button.on { background: #fff4d8; border-bottom-color: #fff4d8; }
.grid-build { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bcard { position: relative; border: 2px solid #a88850; border-radius: 6px; background: rgba(255, 250, 235, .6); cursor: pointer; text-align: center; padding: 3px 2px 4px; transition: transform .08s, box-shadow .08s; }
.bcard:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.25); border-color: var(--gold); }
.bcard img { width: 72px; height: 72px; display: block; margin: 0 auto; }
.bcard .nm { font-size: 11.5px; font-weight: 600; line-height: 1.1; }
.bcard .cost { font-size: 11px; color: var(--ink2); display: flex; gap: 4px; justify-content: center; align-items: center; }
.bcard .cost img { width: 16px; height: 16px; display: inline; margin: 0; }
.bcard.dis { opacity: .35; pointer-events: none; }
.row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.row.sp { justify-content: space-between; }
.ico { width: 26px; height: 26px; vertical-align: middle; }
.ico.s { width: 18px; height: 18px; }
.stock { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.stock .it { text-align: center; background: rgba(255, 250, 235, .55); border: 1px solid #c8a868; border-radius: 4px; padding: 2px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stock .it img { width: 32px; height: 32px; display: block; margin: 0 auto; }
.stock .it.zero { opacity: .45; }
.meter { height: 10px; border: 1px solid var(--wood); border-radius: 5px; background: #d8c290; overflow: hidden; flex: 1; }
.meter > div { height: 100%; background: linear-gradient(90deg, #6a9a3a, #a8d060); }
.meter.red > div { background: linear-gradient(90deg, #a8352a, #e0703a); }
.portrait { width: 110px; height: 110px; float: left; margin: 0 10px 6px 0; border: 2px solid #a88850; border-radius: 6px; background: radial-gradient(circle at 50% 40%, #fff8e0, #d8c290); }
.muted { color: var(--ink2); font-style: italic; }
.soldiers { display: flex; flex-wrap: wrap; gap: 4px; clear: both; }
.sold { width: 42px; text-align: center; font-size: 11px; background: rgba(255, 250, 235, .55); border: 1px solid #c8a868; border-radius: 4px; padding: 1px; }
.sold img { width: 28px; height: 28px; display: block; margin: 0 auto; }
.hpbar { height: 4px; background: #600; border-radius: 2px; overflow: hidden; } .hpbar > div { height: 100%; background: #4c4; }
.list { display: flex; flex-direction: column; gap: 2px; }
.list .li { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 3px; }
.list .li:nth-child(odd) { background: rgba(255, 250, 235, .45); }
.list .li.link { cursor: pointer; } .list .li.link:hover { background: #fff2c0; }
input[type=range] { accent-color: #8a5a20; width: 140px; }
select, input[type=text], input[type=number] { font-family: inherit; font-size: 14px; background: #fff8e4; border: 1px solid var(--wood); border-radius: 3px; padding: 2px 4px; color: var(--ink); }
.chart { width: 100%; height: 190px; display: block; background: rgba(255, 250, 235, .6); border: 1px solid #c8a868; border-radius: 4px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; margin-top: 4px; } .legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; background: var(--c); }
#tooltip { position: fixed; z-index: 60; pointer-events: none; padding: 4px 9px; font-size: 13px; color: #f8ecd0; background: rgba(30, 18, 8, .92); border: 1px solid var(--gold); border-radius: 4px; max-width: 280px; }

/* ------------------------------------------------ modal dialogs */
#modal { background: rgba(10, 6, 2, .6); z-index: 70; }
.modal-box { padding: 0; width: min(880px, 94vw); max-height: 90vh; display: flex; flex-direction: column; }
.modal-box .mh { font-family: 'Cinzel', serif; font-weight: 900; font-size: 22px; letter-spacing: .08em; text-align: center; padding: 10px; color: #f8ecd0; background: linear-gradient(180deg, #7a5028, #4a2e14); border-bottom: 2px solid var(--gold); text-shadow: 0 1px 2px #000; }
.modal-box .mb { padding: 16px 20px; overflow: auto; }
.modal-box .mf { padding: 10px 16px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid #c8a868; }
.chapters { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.chapters .cl { display: flex; flex-direction: column; gap: 5px; }
.chapters .ch { padding: 8px 10px; border: 2px solid #a88850; border-radius: 5px; cursor: pointer; background: rgba(255,250,235,.55); font-family: 'Cinzel', serif; font-weight: 700; }
.chapters .ch.sel { background: #fff2c0; border-color: var(--gold); }
.chapters .ch.lock { opacity: .45; cursor: not-allowed; }
.chapters .ch .won { color: var(--green); float: right; }
.brief { white-space: pre-wrap; font-size: 16px; line-height: 1.45; }
.brief h2 { font-family: 'Cinzel', serif; margin: 0 0 8px; }
.form { display: grid; grid-template-columns: 180px 1fr; gap: 8px 14px; align-items: center; }
.bigmsg { text-align: center; font-size: 18px; } .bigmsg h1 { font-family: 'Cinzel', serif; font-size: 40px; margin: 6px 0; }
kbd { font-family: inherit; font-weight: 700; background: #fff8e4; border: 1px solid var(--wood); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; }
.help h3 { font-family: 'Cinzel', serif; margin: 12px 0 4px; }
.help p, .help li { line-height: 1.4; }
@media (max-width: 700px) { .grid-build { grid-template-columns: repeat(3, 1fr); } .chapters { grid-template-columns: 1fr; } #minimap-wrap { transform: scale(.7); transform-origin: top right; } }

/* ------------------------------------------------ multiplayer lobby (the front door) */
#lobby { flex-direction: column; gap: 14px; background: radial-gradient(ellipse at center, rgba(0,0,0,.05) 30%, rgba(0,0,0,.55) 100%); z-index: 55; padding: 12px; }
.lb-hero { text-align: center; pointer-events: none; }
.lb-hero .game-title { font-size: clamp(40px, 7vw, 88px); }
.lb-hero .game-sub { margin: 2px 0 0; font-size: clamp(13px, 1.6vw, 19px); }
#lobby.in-room .lb-hero { display: none; }
.lobby-box { max-height: none; user-select: text; transition: width .2s; }
.lobby-box.narrow { width: min(720px, 96vw); }
.lobby-box.wide { width: min(1080px, 96vw); height: min(680px, 80vh); }
#lobby.in-room .lobby-box.wide { height: min(760px, 94vh); }
.lobby-box .mh { display: flex; align-items: center; justify-content: center; position: relative; }
.lb-status { position: absolute; right: 14px; font-family: 'Alegreya', serif; font-weight: 400; font-size: 13px; font-style: italic; letter-spacing: 0; color: #f3e2b5; }
.lb-status.online::before { content: '●'; color: #8fd05a; margin-right: 6px; font-style: normal; }
.lb-status.offline::before { content: '●'; color: #ff7a5a; margin-right: 6px; font-style: normal; }
.lb-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 330px; gap: 16px; padding: 14px 20px; }
.lobby-box.narrow .lb-body { grid-template-columns: 1fr; }
.lb-main { overflow: auto; min-height: 0; padding-right: 4px; }
.lobby-box .mf { justify-content: space-between; align-items: center; }
.lb-foot-l, .lb-foot-r { display: flex; gap: 8px; align-items: center; }
.btn.ghost { background: none; color: var(--ink2); box-shadow: none; border-color: transparent; text-shadow: none; text-decoration: underline; font-family: 'Alegreya', serif; font-weight: 600; letter-spacing: 0; }
.lb-flash { background: #fff0c8; border: 2px solid var(--gold); border-radius: 6px; padding: 7px 12px; margin-bottom: 10px; font-weight: 600; animation: tin .25s ease-out; }
.lb-h { font-family: 'Cinzel', serif; margin: 0; font-size: 22px; }
.lb-h3 { font-family: 'Cinzel', serif; margin: 18px 0 8px; font-size: 16px; }

/* the assistant */
.wz { display: flex; flex-direction: column; align-items: stretch; }
.wz-q { font-family: 'Cinzel', serif; font-weight: 700; font-size: 24px; margin: 4px 0 4px; }
.wz-q.small { font-size: 19px; margin-bottom: 12px; }
.wz-sub { margin: 0 0 14px; color: var(--ink2); font-size: 16px; }
.wz-sub.small { font-size: 14px; margin-top: 14px; line-height: 1.45; }
.wz-input { font-size: 22px !important; padding: 8px 12px !important; border-width: 2px !important; border-radius: 6px !important; }
.wz-steps { display: flex; gap: 6px; margin-bottom: 14px; }
.wz-steps span { flex: 1; text-align: center; font-family: 'Cinzel', serif; font-weight: 700; font-size: 13px; padding: 5px 4px; border-bottom: 3px solid #d8c290; color: #a08858; }
.wz-steps span.on { border-color: var(--wood); color: var(--ink); }
.wz-steps span.done { border-color: var(--green); color: var(--green); cursor: pointer; }
.wz-cards { display: grid; gap: 10px; }
.wz-cards.four { grid-template-columns: repeat(4, 1fr); } .wz-cards.three { grid-template-columns: repeat(3, 1fr); }
.wz-card { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 8px; cursor: pointer; font-family: inherit; color: var(--ink);
  background: rgba(255, 250, 235, .6); border: 2px solid #c8a868; border-radius: 8px; transition: transform .08s, box-shadow .08s, border-color .08s; }
.wz-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.2); border-color: var(--gold); }
.wz-card.on { background: #fff4d0; border-color: var(--wood); box-shadow: 0 0 0 2px var(--gold) inset, 0 4px 12px rgba(0,0,0,.2); }
.wz-card b { font-family: 'Cinzel', serif; font-size: 16px; }
.wz-card .dim { font-size: 13px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.wz-card .hint { font-size: 13px; color: var(--ink2); text-align: center; line-height: 1.25; }
.wz-map { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.wz-map::before { content: ''; width: calc(64px * var(--s)); height: calc(58px * var(--s)); border-radius: 30% 42% 35% 45%; border: 2px solid #3b5e1a;
  background: radial-gradient(circle at 35% 40%, #8fbf55, #5a8a30 60%, #3b6a8a 61%); }
.wz-swatch { width: 100%; height: 64px; border-radius: 6px; border: 1px solid rgba(0,0,0,.3); margin-bottom: 4px; }
.wz-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.wz-row.faded { opacity: .45; }
.wz-lbl { font-weight: 700; min-width: 190px; }
.wz-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.wz-pill { font-family: inherit; font-size: 15px; padding: 5px 12px; border-radius: 16px; cursor: pointer; color: var(--ink); background: rgba(255, 250, 235, .6); border: 2px solid #c8a868; }
.wz-pill:hover { border-color: var(--gold); }
.wz-pill.on { background: var(--wood); color: #f8ecd0; border-color: var(--wood); }
.wz-stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 4px 0 12px; }
.wz-stepper .btn { font-size: 26px; width: 52px; height: 52px; padding: 0; border-radius: 50%; }
.wz-num { font-family: 'Cinzel', serif; font-weight: 900; font-size: 48px; min-width: 60px; text-align: center; }
.wz-seats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.wz-seat { text-align: center; font-size: 13px; font-weight: 700; padding: 8px 2px; border-radius: 6px; border: 2px solid; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wz-seat.you { border-color: #2f6fdc; background: #dbe7fb; }
.wz-seat.ai { border-color: var(--c); background: rgba(255, 250, 235, .7); }
.wz-seat.free { border-style: dashed; border-color: #b8a070; color: #a08858; font-weight: 400; font-style: italic; }
.wz-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { background: rgba(255, 250, 235, .75); border: 1px solid #c8a868; border-radius: 12px; padding: 2px 10px; font-size: 14px; }

/* join or host */
.lb-big { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 14px 16px; cursor: pointer; font-family: inherit; color: #f8ecd0;
  background: linear-gradient(180deg, #6a9a3a, #3b5e1a); border: 2px solid #2a3a12; border-radius: 8px; box-shadow: 0 0 0 1px var(--gold) inset, 0 3px 0 #1a2808; transition: filter .12s; }
.lb-big:hover { filter: brightness(1.12); }
.lb-big > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.lb-big b { font-family: 'Cinzel', serif; font-size: 20px; text-shadow: 0 1px 2px #000; }
.lb-big > span:last-child > span { font-size: 15px; }
.lb-big-i { font-size: 34px; line-height: 1; }
.lb-rooms { display: flex; flex-direction: column; gap: 6px; }
.lb-room { display: grid; grid-template-columns: 1fr 48px 70px; gap: 10px; align-items: center; padding: 8px 10px; border: 2px solid #a88850; border-radius: 6px; background: rgba(255, 250, 235, .6); }
.lb-rn { display: flex; flex-direction: column; min-width: 0; } .lb-rn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.lb-rn .muted { font-size: 13px; }
.lb-rp { font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.lb-empty { padding: 14px 10px; text-align: center; line-height: 1.4; }
.lb-busy { font-size: 13px; margin-top: 4px; }

/* the room */
.lb-room-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.lb-hint { margin: 6px 0 12px; font-size: 15px; color: var(--ink2); }
.lb-seats { display: flex; flex-direction: column; gap: 4px; }
.lb-seat { display: grid; grid-template-columns: 18px 1fr 110px 100px 84px 34px; gap: 8px; align-items: center; padding: 5px 8px; border: 2px solid #c8a868; border-radius: 6px; background: rgba(255, 250, 235, .5); }
.lb-seat.me { border-color: var(--gold); background: #fff4d0; }
.lb-seat.ai { opacity: .85; border-style: dashed; }
.lb-seat.free { display: block; border-style: dotted; background: none; text-align: center; }
.lb-seat .sw, #roster .sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.4); display: inline-block; }
.lb-seat .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-seat .crown { color: #b8860b; }
.lb-seat .rd { font-size: 13px; color: var(--ink2); } .lb-seat .rd.on { color: var(--green); font-weight: 700; }
.lb-seat select { width: 100%; }
.lb-sumrow { display: flex; align-items: flex-start; gap: 10px; margin-top: 6px; } .lb-sumrow .wz-summary { flex: 1; margin-top: 8px; } .lb-sumrow .btn { margin-top: 8px; }
.lb-settings { grid-template-columns: 170px 1fr; margin-top: 12px; padding: 10px; border: 1px solid #c8a868; border-radius: 6px; background: rgba(255, 250, 235, .4); }
.lb-settings select, .lb-settings input[type=number] { max-width: 260px; } .lb-settings input[type=checkbox] { justify-self: start; }

/* chat beside it */
.lb-side { display: flex; flex-direction: column; min-height: 0; border: 2px solid #a88850; border-radius: 6px; background: rgba(255, 250, 235, .45); }
.lb-side-h { font-family: 'Cinzel', serif; font-weight: 700; padding: 6px 10px; border-bottom: 1px solid #c8a868; }
.lb-log { flex: 1; min-height: 0; overflow: auto; padding: 6px 10px; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.lb-log .cl { padding: 1px 0; } .lb-log .t { color: var(--ink2); font-size: 12px; }
.cl.sys { color: var(--ink2); font-style: italic; }
.lb-form { display: flex; gap: 6px; padding: 6px; border-top: 1px solid #c8a868; } .lb-form input { flex: 1; min-width: 0; }
.lb-people { padding: 4px 10px 8px; font-size: 13px; }
code { font-size: 13px; background: #fff8e4; padding: 0 4px; border-radius: 3px; }
@media (max-width: 800px), (max-height: 640px) {
  /* small screens: one column, and the whole box scrolls instead of squeezing its parts */
  #lobby { justify-content: flex-start; overflow: auto; }
  .lb-hero { display: none; }
  .lobby-box.wide, #lobby.in-room .lobby-box.wide { height: auto; }
  .lobby-box { flex: none; }
  .lb-body { display: flex; flex-direction: column; flex: none; }
  .lb-main { overflow: visible; }
  .lb-side { height: 240px; flex: none; }
}
@media (max-width: 800px) {
  .wz-cards.four { grid-template-columns: repeat(2, 1fr); } .wz-cards.three { grid-template-columns: 1fr; }
  .wz-seats { grid-template-columns: repeat(3, 1fr); }
  .wz-lbl { min-width: 0; width: 100%; }
  .lb-seat { grid-template-columns: 14px 1fr 86px 78px 30px; gap: 6px; } .lb-seat .rd { display: none; }
  .lobby-box .mf { flex-wrap: wrap; }
}

/* ------------------------------------------------ in-game chat + players */
#chat { position: absolute; right: 12px; bottom: 86px; width: min(420px, 40vw); pointer-events: none; display: flex; flex-direction: column; gap: 4px; }
#chat-log { display: flex; flex-direction: column; gap: 2px; max-height: 190px; overflow: hidden; font-size: 14px; color: #f8ecd0; text-shadow: 0 1px 2px #000, 0 0 4px #000; overflow-wrap: anywhere; }
#chat-log .cl { background: rgba(30, 18, 8, .55); padding: 2px 8px; border-radius: 4px; align-self: flex-start; max-width: 100%; }
#chat-log .cl.sys { color: #e8d8a8; }
#chat.open { pointer-events: auto; }
#chat.open #chat-log { max-height: 300px; overflow: auto; background: rgba(30, 18, 8, .72); border: 1px solid var(--gold); border-radius: 6px; padding: 6px; }
#chat.open #chat-log .cl { background: none; padding: 1px 2px; }
#chat-input { width: 100%; font-size: 15px; padding: 6px 9px; border: 2px solid var(--gold); background: rgba(255, 248, 228, .95); }
#roster { position: absolute; top: 10px; left: 10px; padding: 7px 10px; font-size: 13px; min-width: 180px; }
#roster .rr { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
#roster .nm { font-weight: 700; } #roster .tg { margin-left: auto; color: var(--ink2); font-style: italic; font-size: 12px; }
#roster .hint { color: var(--ink2); font-size: 12px; margin-top: 3px; }
