/* Bellmarch: lantern-lit parchment over a pixel world. */
:root {
  --ink: #14110c;
  --ink2: #221c14;
  --ink3: #2e261b;
  --line: #4a3e2c;
  --paper: #eadfc4;
  --dim: #b0a284;
  --faint: #7a6e58;
  --gold: #e0b050;
  --gold2: #f4d488;
  --red: #d05040;
  --green: #70b860;
  --blue: #7aa8d8;
  --pix: "Pixelify Sans", ui-monospace, monospace;
  --serif: "Alegreya", Georgia, serif;
  /* The interface style (body[data-ui], see "Interface styles" at the end) sets these. */
  --head: var(--pix);
  --bg: 20, 17, 12;
  --bg0: 10, 8, 6;
  --bg2: 26, 21, 15;
  --bg3: 40, 30, 16;
  --selrgb: 60, 46, 22;
  --edge: #0a0806;
  --deep: #0e0c08;
  --on: #5a3a14;
  --sel: #2e2214;
  --pri: #7a4a18;
  --pri-ink: #fff3d8;
  --h1sh: #5a3410;
  --h1glow: rgba(240, 180, 80, 0.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--paper); font: 16px/1.4 var(--serif); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#view { position: fixed; inset: 0; image-rendering: pixelated; touch-action: none; cursor: crosshair; }
button { font: 600 15px var(--pix); color: var(--paper); background: var(--ink3); border: 2px solid var(--line); border-radius: 3px; padding: 7px 12px; cursor: pointer; touch-action: manipulation; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35); }
button:hover:not(:disabled) { border-color: var(--gold); }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--pri); border-color: var(--gold); color: var(--pri-ink); }
button.small { padding: 4px 9px; font-size: 13px; }
button.on { border-color: var(--gold2); background: var(--on); }
button small { display: block; font-size: 12px; opacity: 0.6; font-weight: 400; }
input, select { font: 16px var(--pix); color: var(--paper); background: var(--ink2); border: 2px solid var(--line); border-radius: 3px; padding: 6px 8px; }
input:focus, select:focus { outline: none; border-color: var(--gold); }
.fine { font-size: 13px; color: var(--dim); margin: 6px 0; }
.kicker { font: 600 12px var(--pix); text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); margin: 14px 0 6px; }
.row { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }

/* ---------- title and lobby ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; z-index: 5;
  background: radial-gradient(ellipse at 50% 40%, rgba(var(--bg), 0.35), rgba(var(--bg), 0.92)); }
.card { width: min(520px, 100%); background: rgba(var(--bg2), 0.94); border: 2px solid var(--line); outline: 2px solid var(--edge); padding: 22px 24px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); margin: auto; }
.card.wide { width: min(640px, 100%); }
.card h1 { font: 700 54px/1 var(--head); color: var(--gold2); margin: 6px 0 10px; letter-spacing: 0.02em; text-shadow: 3px 3px 0 var(--h1sh), 0 0 24px var(--h1glow); }
.card .lede { color: var(--paper); margin: 0 0 16px; }
.card label { display: block; font: 600 14px var(--pix); color: var(--dim); }
.card label input:not([type]) { display: block; width: 100%; margin-top: 4px; }
.card input[type="checkbox"], .card input[type="radio"] { accent-color: var(--gold); width: 16px; height: 16px; margin: 0; }
.join input { width: 96px; text-transform: uppercase; letter-spacing: 0.25em; text-align: center; }
.lobby-head { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.code { font: 700 44px/1 var(--pix); letter-spacing: 0.2em; color: var(--gold2); margin: 0; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.colors button { width: 36px; height: 36px; padding: 0; border-width: 3px; }
.colors button.taken { opacity: 0.25; }
.colors button.mine { border-color: #fff; }
.roster { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.roster li { display: flex; align-items: center; gap: 8px; font: 15px var(--pix); padding: 4px 8px; background: var(--ink2); }
.roster li i { width: 12px; height: 12px; display: inline-block; border: 1px solid #000; }
.roster li .tag { margin-left: auto; font-size: 12px; color: var(--dim); }
.rules { margin-top: 12px; display: grid; gap: 8px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode { border: 2px solid var(--line); padding: 8px 10px; cursor: pointer; background: var(--ink2); }
.mode:has(input:checked) { border-color: var(--gold); background: var(--sel); }
.mode { display: block; }
.mode b { font: 700 15px var(--pix); color: var(--paper); }
.mode small { display: block; font: 13px/1.3 var(--serif); color: var(--dim); margin-top: 4px; }
.mode input { accent-color: var(--gold); }
.check[hidden] { display: none !important; }
.check { display: flex !important; align-items: center; gap: 8px; font-size: 14px !important; }
.check select { margin-left: auto; }
.check small { font: 13px var(--serif); color: var(--faint); }
.rules.locked { opacity: 0.6; pointer-events: none; }
.chat { margin-top: 12px; }
.chat ul { list-style: none; margin: 0 0 6px; padding: 6px 8px; height: 92px; overflow-y: auto; background: var(--ink2); font-size: 14px; }
.chat input { width: 100%; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#hud > * { pointer-events: auto; }
#top { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 8px; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 16px); pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; font: 600 14px var(--pix); background: rgba(var(--bg), 0.82); border: 2px solid var(--line); padding: 3px 8px; pointer-events: auto; }
.chip b { font-weight: 600; }
.chip.wx:empty { display: none; }
.chip.wx { color: #cfd8e8; }
#t-day { cursor: pointer; }
#t-day.held { color: #e8c878; }
.ico { width: 12px; height: 12px; display: inline-block; image-rendering: pixelated; }
.ico.coin { background: radial-gradient(circle at 40% 40%, #ffe890 0 25%, #e0b040 30% 60%, #8a6018 65%); border-radius: 50%; }
.ico.food { background: linear-gradient(#c88a4a 0 40%, #8a5a2a 40%); border-radius: 50% 50% 2px 2px; }
.ico.morale { background: #d84848; clip-path: polygon(50% 100%, 0 35%, 15% 5%, 50% 25%, 85% 5%, 100% 35%); }
.ico.renown { background: #e0c060; clip-path: polygon(50% 0, 63% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 78%, 20% 100%, 30% 60%, 0 38%, 37% 35%); }
.ico.herbs { background: #60b050; clip-path: polygon(50% 0, 90% 40%, 55% 100%, 45% 100%, 10% 40%); }
.ico.feather { background: linear-gradient(135deg, #ffe080, #f06020); clip-path: polygon(80% 0, 100% 20%, 30% 100%, 10% 100%, 0 90%); }
.low { color: var(--red); }
#journal { position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 36px); left: 8px; max-width: min(380px, calc(100% - 16px)); background: rgba(var(--bg), 0.82); border: 2px solid var(--line); padding: 5px 30px 6px 10px; cursor: pointer; }
#journal b { display: block; font: 600 12px var(--pix); color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; }
#journal span { font-size: 14px; }
#j-danger { display: block; font: 600 12px var(--pix); font-style: normal; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }
#j-danger.d0, #j-danger.d1 { color: #90c070; } #j-danger.d2 { color: #e0a040; } #j-danger.d3 { color: #e05040; }
#b-follow.on { background: var(--gold); color: #1a1408; }
#j-arrow { position: absolute; right: 8px; top: 50%; margin-top: -9px; font-style: normal; color: var(--gold2); font-size: 16px; line-height: 18px; transition: transform 0.3s; }
#band { position: absolute; right: 8px; top: max(8px, env(safe-area-inset-top)); list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; width: 168px; max-height: calc(100% - 140px); overflow-y: auto; }
#band li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 6px; background: rgba(var(--bg), 0.82); border: 2px solid var(--line); border-left-width: 4px; padding: 2px 6px 3px; font: 13px var(--pix); cursor: pointer; }
#band li.sel { border-color: var(--gold2); }
#band li.downed { opacity: 0.6; }
#band li .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#band li .lv { font-size: 12px; color: var(--dim); }
#band li .lv.tp { color: var(--gold2); }
#band li .hb { grid-column: 2 / -1; height: 3px; background: #3a1a14; }
#band li .pp { grid-row: 1 / span 2; width: 24px; height: 27px; margin-left: -4px; border: 1px solid rgba(0,0,0,0.5); }
#bb-who .bbp { float: left; width: 36px; height: 40px; margin: -2px 8px 0 0; border: 1px solid rgba(0,0,0,0.5); }
#band li .hb i { display: block; height: 100%; background: var(--green); }
#banner { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); font: 700 24px var(--pix); color: var(--gold2); text-shadow: 2px 2px 0 #000; background: rgba(var(--bg), 0.7); padding: 6px 16px; border: 2px solid var(--line); pointer-events: none; text-align: center; white-space: nowrap; }
#banner small { display: block; font: 13px var(--serif); color: var(--paper); text-shadow: none; }
#region { position: absolute; top: 9%; left: 50%; transform: translateX(-50%); font: 700 26px var(--pix); color: #f4e6c0; text-shadow: 2px 2px 0 #000, 0 0 12px rgba(0, 0, 0, 0.8); pointer-events: none; text-align: center; white-space: nowrap; letter-spacing: 1px; }
#region small { display: block; font: italic 14px var(--serif); color: var(--paper); margin-top: 2px; }
#region.show { animation: regionIn 5.2s ease both; }
@keyframes regionIn { 0% { opacity: 0; transform: translate(-50%, -6px); } 12%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.ico.cargo { background: linear-gradient(#a07a4a 0 30%, #6a4a2a 30% 36%, #a07a4a 36%); border-radius: 2px; }
#p-title small { display: block; font: italic 12px var(--serif); color: var(--muted, #b0a080); font-weight: 400; }
table.trade { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
table.trade th { text-align: left; font-weight: 600; color: var(--gold2); padding: 3px 4px; border-bottom: 1px solid var(--line); }
table.trade td { padding: 3px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); white-space: nowrap; }
table.trade td:first-child { white-space: normal; }
table.trade button { min-width: 38px; padding: 2px 6px; }
table.trade button.x5 { min-width: 0; margin-left: 2px; opacity: 0.85; }
#t-cargo.low { color: #ff9060; }
#note { position: absolute; bottom: 132px; left: 50%; transform: translateX(-50%); background: rgba(var(--bg), 0.92); border: 2px solid var(--gold); padding: 6px 14px; font: 15px var(--pix); pointer-events: none; text-align: center; max-width: 90%; }
#log { position: absolute; left: 8px; bottom: 64px; list-style: none; margin: 0; padding: 0; width: min(420px, calc(100% - 190px)); font-size: 14px; pointer-events: none; display: flex; flex-direction: column; justify-content: flex-end; }
#log li { background: rgba(var(--bg), 0.7); padding: 2px 8px; margin-top: 2px; border-left: 3px solid var(--line); animation: fade 14s forwards; }
#log li.story { border-left-color: var(--gold); color: #f4e4b8; }
#log li.day { border-left-color: var(--blue); }
#log li.bad { border-left-color: var(--red); }
#log li.chat { border-left-color: var(--c, var(--dim)); }
#log li.chat b { color: var(--c); font: 600 13px var(--pix); }
@keyframes fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }
#hud.chatting #log li { animation: none; opacity: 1; }
#acts { position: absolute; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-start; pointer-events: none; }
#acts button { pointer-events: auto; }
#b-near { order: -1; }
#chatbox { position: absolute; left: 8px; bottom: 112px; width: min(420px, calc(100% - 16px)); }
#chatbox input { width: 100%; }

/* Battle bar. */
#battlebar { position: absolute; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "who acts side" "valor valor valor"; gap: 6px 8px; align-items: end; background: rgba(var(--bg), 0.9); border: 2px solid var(--line); padding: 6px 8px; }
#bb-who { font: 14px var(--pix); min-width: 150px; }
#bb-who b { display: block; font-size: 16px; color: var(--gold2); }
#bb-who .pips { color: var(--dim); font-size: 12px; }
#bb-acts { display: flex; gap: 5px; flex-wrap: wrap; }
#bb-acts button { font-size: 13px; padding: 5px 9px; position: relative; }
#bb-acts button.arm { border-color: var(--gold2); background: var(--on); }
#bb-acts button .cd { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; font-size: 10px; border-radius: 8px; padding: 0 4px; }
#bb-side { display: flex; gap: 6px; align-items: end; }
#hud.fight #acts, #hud.fight #log { display: none; }
#hud.fight #band { max-height: calc(100% - 200px); }

/* ---------- dialog ---------- */
#dialog { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(var(--bg0), 0.75) 40%); cursor: pointer; }
.dlg { width: min(720px, 100%); background: rgba(var(--bg2), 0.97); border: 2px solid var(--gold); outline: 2px solid var(--edge); padding: 14px 18px 10px; }
#d-who { font: 700 16px var(--pix); color: var(--gold2); display: block; min-height: 4px; }
#d-text { font: 18px/1.45 var(--serif); margin: 6px 0 8px; }
#d-text.narr { font-style: italic; color: var(--dim); }
#d-choices { display: grid; gap: 6px; margin-bottom: 6px; }
#d-choices button { text-align: left; font-size: 15px; }
#d-hint { color: var(--faint); font: 12px var(--pix); }

/* ---------- panel ---------- */
#panel { position: fixed; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(var(--bg0), 0.45); }
.pcard { width: min(760px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; background: rgba(var(--bg2), 0.97); border: 2px solid var(--line); outline: 2px solid var(--edge); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); }
.pcard header { display: flex; align-items: center; padding: 10px 14px 6px; gap: 8px; }
.pcard h2 { font: 700 22px var(--head); color: var(--gold2); margin: 0; flex: 1; }
#p-close { padding: 2px 10px; }
#p-tabs { display: flex; gap: 4px; padding: 0 14px; flex-wrap: wrap; border-bottom: 2px solid var(--line); }
#p-tabs button { border-bottom: none; border-radius: 3px 3px 0 0; box-shadow: none; font-size: 14px; padding: 5px 10px; background: var(--ink2); }
#p-tabs button.on { background: var(--ink3); border-color: var(--gold); color: var(--gold2); }
#p-body { overflow-y: auto; padding: 12px 14px 16px; }
#p-body p { margin: 4px 0 10px; }
#p-body h3 { font: 600 15px var(--pix); color: var(--gold); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.list { display: grid; gap: 6px; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; background: var(--ink2); border: 2px solid var(--line); padding: 6px 8px; }
.item.click { cursor: pointer; }
.item.click:hover { border-color: var(--gold); }
.item .nm { font: 600 15px var(--pix); }
.item .sub { font-size: 13px; color: var(--dim); }
.item .acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.portrait { width: 40px; height: 45px; object-fit: cover; image-rendering: auto; background: #1a2414; border: 0; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0; }
.tag { font: 12px var(--pix); padding: 1px 6px; border: 1px solid var(--line); background: var(--ink3); color: var(--dim); }
.tag.good { color: #a8e090; border-color: #3a5a2a; }
.tag.bad { color: #f0a090; border-color: #6a2a20; }
.tag.gold { color: var(--gold2); border-color: #6a5020; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; font: 14px var(--pix); margin: 6px 0; }
.stats div { background: var(--ink2); padding: 3px 8px; }
.stats b { color: var(--gold2); float: right; font-weight: 600; }
.sheet-head { display: flex; gap: 12px; align-items: center; }
.sheet-head canvas { width: 64px; height: 80px; }
.sheet-head .nm { font: 700 20px var(--pix); color: var(--gold2); }
.bio { font-style: italic; color: var(--dim); }
.price { font: 600 13px var(--pix); color: var(--gold2); white-space: nowrap; }
.report li { margin: 4px 0; }
#mapc { width: 100%; max-width: 560px; aspect-ratio: 1; image-rendering: pixelated; display: block; margin: 0 auto; border: 2px solid var(--line); background: var(--deep); }
.legend { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; font: 12px var(--pix); color: var(--dim); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 3px; vertical-align: -1px; }
#link-lost { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 9; background: var(--red); color: #fff; font: 14px var(--pix); padding: 4px 12px; margin: 0; }

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .card h1 { font-size: 42px; }
  .modes { grid-template-columns: 1fr; }
  .wide-only { display: none !important; }
  #band { width: 132px; }
  #band li { font-size: 12px; }
  #log { width: calc(100% - 156px); font-size: 13px; bottom: 58px; }
  #battlebar { grid-template-columns: 1fr auto; }
  #bb-who { grid-column: 1 / -1; min-width: 0; }
  #bb-who b { display: inline; margin-right: 8px; }
  #banner { font-size: 18px; }
  #region { font-size: 18px; white-space: normal; width: 90%; }
  table.trade td:last-child, table.trade th:last-child { font-size: 11px; max-width: 110px; }
  #note { bottom: 150px; }
  .item { grid-template-columns: auto 1fr; }
  .item .acts { grid-column: 1 / -1; justify-content: flex-start; }
  #d-text { font-size: 16px; }
}
@media (max-height: 480px) {
  #band { max-height: calc(100% - 100px); }
  #journal { padding: 3px 7px; font-size: 11px; max-width: 44vw; }
  #journal span { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 720px) {
  #journal { max-width: calc(100% - 156px); }
  #journal span { font-size: 13px; }
}
@media (pointer: coarse) {
  button small, #d-hint { display: none; }
}

/* The march: fatigue, food days, groups in sight. */
.ico.fatigue { background: radial-gradient(circle at 60% 40%, transparent 0 34%, #c8c0e0 36% 60%, transparent 62%); }
.chip small { font: 500 12px var(--pix); opacity: 0.75; }
.chip .meter { width: 38px; height: 6px; background: #2a2620; border: 1px solid #000; display: inline-block; position: relative; }
.chip .meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #8ab060; }
#t-fat-chip.tired .meter i { background: #e0b040; }
#t-fat-chip.spent .meter i { background: #d05040; }
#t-fat-chip.spent { border-color: #a04030; }
#t-food-chip.low { border-color: #a04030; }
#b-wait.on { background: #5a4a2a; border-color: #e0c060; }
.threat { display: inline-block; padding: 1px 6px; font: 600 12px var(--pix); border: 1px solid; margin-left: 4px; }
.threat.t0 { color: #a0d090; border-color: #507040; }
.threat.t1 { color: #e0d080; border-color: #806a30; }
.threat.t2 { color: #f0a050; border-color: #905020; }
.threat.t3 { color: #ff6050; border-color: #a03020; }
.foes { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
.foes span { font: 500 12px var(--pix); background: rgba(0,0,0,0.3); padding: 2px 6px; border: 1px solid var(--line); }
button.danger { background: #5a2420; border-color: #a04030; }
* { font-variant-ligatures: none; }

/* ---------- world map, minimap, journal, peoples ---------- */
#region em { display: block; font: 600 13px var(--pix); font-style: normal; color: var(--gold2); letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 2px; }
#region { border-bottom: 3px solid var(--cc, transparent); padding: 4px 18px 6px; background: radial-gradient(ellipse at center, rgba(var(--bg), 0.72) 0%, rgba(var(--bg), 0) 72%); }
#mini { position: absolute; right: 8px; bottom: calc(max(8px, env(safe-area-inset-bottom)) + 50px); width: 132px; height: 132px; image-rendering: pixelated; cursor: pointer; filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.6)); }
#hud.fight #mini { display: none; }
#band { max-height: calc(100% - 290px); }
.mapwrap { position: relative; }
#mapc.big { aspect-ratio: auto; max-width: none; width: 100%; height: auto; cursor: grab; touch-action: none; image-rendering: auto; }
#mapc.big:active { cursor: grabbing; }
.mapzoom { position: absolute; right: 8px; top: 8px; display: grid; gap: 4px; }
.mapzoom button { width: 30px; height: 30px; padding: 0; font: 700 16px var(--pix); }
.legend i.ring { background: none; border: 2px solid #fff; border-radius: 50%; }
.legend i.kb { background: linear-gradient(90deg, #1e120a 50%, #d6aa5a 50%); }
.legend i.fb { background: repeating-linear-gradient(90deg, #ecdeb4 0 2px, transparent 2px 4px); }
.tag.ware { color: #14110c; background: var(--cc); border-color: rgba(0, 0, 0, 0.5); font-weight: 600; }
.cult { color: var(--cc); font-style: normal; font-weight: 600; }
table.trade tr.grp td { font: 600 12px var(--pix); color: var(--gold); text-transform: uppercase; letter-spacing: 0.12em; padding-top: 8px; border-bottom: 1px solid var(--line); }
.mood { color: var(--gold2); }
.goal { background: var(--ink3); border-left: 3px solid var(--gold); padding: 6px 10px; }
/* Round 72: the journal's Great contracts. */
section.gc { border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 6px; padding: 8px 10px; margin: 8px 0 12px; background: rgba(0, 0, 0, 0.18); }
section.gc.won { border-left-color: var(--green, #7fb26a); opacity: 0.85; }
section.gc.lost { border-left-color: var(--red, #d0644e); opacity: 0.7; }
section.gc .gch { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
section.gc .gch b { font: 600 16px var(--pix); color: var(--gold2); }
section.gc .gcs { font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); white-space: nowrap; }
section.gc .gcs.now { color: var(--gold2); border-color: var(--gold); }
section.gc .gcs.won { color: var(--green, #7fb26a); border-color: currentColor; }
section.gc .gcs.lost { color: var(--red, #d0644e); border-color: currentColor; }
section.gc .gco { font-style: italic; margin: 6px 0; font-size: 14px; }
section.gc .gco small { font-style: normal; color: var(--dim); }
ol.gcsteps { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; }
ol.gcsteps li { display: grid; grid-template-columns: 18px 1fr; gap: 6px; align-items: start; font-size: 14px; }
ol.gcsteps li > i { width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--dim); box-sizing: border-box; }
ol.gcsteps li.done { color: var(--dim); }
ol.gcsteps li.done > span { text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.25); }
ol.gcsteps li.done > i { background: var(--green, #7fb26a); border-color: var(--green, #7fb26a); }
ol.gcsteps li.now > i { background: var(--gold2); border-color: var(--gold2); box-shadow: 0 0 6px var(--gold); }
ol.gcsteps li.now > span { color: var(--paper, #f0e6d0); font-weight: 600; }
ol.gcsteps li.next { opacity: 0.75; }
ol.gcsteps .gcw { display: block; font-weight: 400; color: var(--gold2); margin-top: 1px; }
ol.gcsteps .gcb { font-style: normal; font-size: 12px; color: #ff9070; white-space: nowrap; }
section.gc .gcr, section.gc .gcf { font-size: 13px; margin-top: 6px; }
section.gc .gcr > span, section.gc .gcf > span:first-child { font: 600 12px var(--pix); text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); margin-right: 4px; }
section.gc .gcf > span:first-child { color: var(--gold2); text-transform: none; letter-spacing: 0; font: 600 13px var(--ui, var(--serif)); }
section.gc .gcf small { display: block; color: var(--dim); }
section.gc .gcj summary { cursor: pointer; font-size: 12px; color: var(--dim); margin-top: 6px; }
ol.chapters { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
ol.chapters li { border: 2px solid var(--line); padding: 4px 8px; font-size: 13px; background: var(--ink2); }
ol.chapters li b { display: block; font: 600 12px var(--pix); color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; }
ol.chapters li.done { border-color: #6a5020; }
ol.chapters li.done b { color: var(--gold); }
ol.chapters li.now { border-color: var(--gold2); box-shadow: 0 0 0 1px var(--gold2) inset; }
ol.chapters li.now b { color: var(--gold2); }
ol.chapters li.todo { opacity: 0.55; }
ul.notes { margin: 4px 0; padding-left: 18px; }
ul.notes li { margin: 2px 0; }
.powers { display: grid; gap: 10px; margin-top: 8px; }
.power { border: 2px solid var(--line); border-left: 4px solid var(--pc); padding: 6px 10px; background: var(--ink2); }
.power .pn { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.power .pn b { font: 600 15px var(--pix); color: var(--pc); }
.power .pn small { color: var(--dim); }
.power .pn .pw { margin-left: auto; font: 13px var(--pix); color: var(--paper); }
.power .bar { position: relative; height: 10px; background: var(--deep); border: 1px solid var(--line); margin: 6px 0 2px; }
.power .bar i { position: absolute; top: 0; bottom: 0; background: var(--pc); }
.power .bar em { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: var(--paper); opacity: 0.6; }
.item .sw { width: 14px; align-self: stretch; border: 1px solid rgba(0, 0, 0, 0.5); background: var(--ink3); }
.item.unknown { opacity: 0.5; }
.item .nm small { font: 12px var(--pix); color: var(--dim); margin-left: 6px; }
@media (max-width: 700px) {
  #mini { width: 96px; height: 96px; }
  #band { max-height: calc(100% - 250px); }
}

/* The company's bands */
.bandflag { width: 18px; height: 26px; background: var(--bc); clip-path: polygon(0 0, 100% 0, 100% 80%, 50% 100%, 0 80%); border: 0; align-self: center; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35); }

/* Ability icons, the plain attack and Valor */
#bb-who { grid-area: who; } #bb-acts { grid-area: acts; } #bb-side { grid-area: side; }
#bb-acts button.ic, #bb-valor button.ic { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 3px; }
#battlebar button.ic img { width: 32px; height: 32px; image-rendering: pixelated; display: block; flex: none; }
#battlebar button.ic kbd { position: absolute; bottom: -5px; left: -4px; font: 10px var(--pix); background: #1a140c; color: var(--dim); border: 1px solid var(--line); padding: 0 3px; }
#battlebar button.ic.def { box-shadow: 0 0 0 1px var(--gold2) inset; }
#battlebar button.ic:disabled img { filter: grayscale(1) brightness(0.6); }
#bb-valor { grid-area: valor; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 5px; }
#bb-valor .valor { display: flex; align-items: center; gap: 6px; font: 13px var(--pix); color: #c8a8ff; }
#bb-valor .valor b { color: #d8c0ff; }
#bb-valor .vp { display: inline-flex; gap: 3px; }
#bb-valor .vp i { width: 10px; height: 14px; background: #2a1e38; border: 1px solid #5a4078; transform: skewX(-12deg); }
#bb-valor .vp i.on { background: linear-gradient(#e0c8ff, #9a60e0); border-color: #e8d8ff; box-shadow: 0 0 6px #a070f0; }
#bb-valor .vp i.half { background: linear-gradient(transparent 50%, #9a60e0 50%); border-color: #a080d0; }
#bb-valor button.ic.used { opacity: 0.4; }
#bb-valor .valor img.way { width: 20px; height: 20px; image-rendering: pixelated; }
#bb-valor .valor small { color: var(--dim); }
#bb-valor .vabs { display: flex; gap: 5px; flex-wrap: wrap; }
#bb-valor button.ic { position: relative; font-size: 12px; border-color: #5a4078; }
#bb-valor button.ic img { width: 26px; height: 26px; }
#bb-valor button.ic em { font-style: normal; font: 11px var(--pix); color: #e0c8ff; background: #3a2456; border-radius: 6px; padding: 0 4px; }
#bb-valor button.ic.arm { background: #3a2456; border-color: #c8a8ff; }
@media (max-width: 760px) {
  #battlebar button.ic span { display: none; }
  #battlebar button.ic { padding: 3px; }
  #bb-valor .valor small { display: none; }
}
@media (max-width: 720px) {
  #battlebar { grid-template-areas: "who who" "acts side" "valor valor"; }
}

/* Warband picker */
.warbands { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 6px 0 12px; }
.wb { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 8px 10px; background: rgba(var(--bg3), 0.75); border: 1px solid var(--line); border-radius: 4px; color: inherit; cursor: pointer; font: inherit; }
.wb:hover { border-color: #a08050; }
.wb.mine { border-color: var(--gold2); box-shadow: 0 0 0 1px var(--gold2) inset; background: rgba(var(--selrgb), 0.85); }
.wb b { font-family: "Pixelify Sans", monospace; color: var(--gold2); font-size: 15px; }
.wb small { color: var(--dim); line-height: 1.3; }
.wbfigs { display: flex; gap: 2px; align-items: flex-end; min-height: 44px; }
.wbfigs img { height: 44px; width: auto; image-rendering: pixelated; }
.wbtags { display: flex; flex-wrap: wrap; gap: 3px; }
.wbtags i { font-style: normal; font-size: 12px; padding: 1px 5px; background: rgba(244, 212, 136, 0.12); border-radius: 3px; color: #e8d8b0; }
.wbstock { font-size: 12px; color: #b8d0a0; }
.wbwho { font-size: 12px; color: #90b0e0; }
.wbwho::before { content: "also: "; opacity: 0.7; }
select[data-fit] { max-width: 150px; font-size: 12px; }
.modic { width: 12px; height: 12px; border-radius: 2px; align-self: center; background: #8a96a8; }
.modic.weapon { background: #c0a050; }
@media (max-width: 600px) { .warbands { grid-template-columns: 1fr 1fr; } .wbfigs img { height: 34px; } }
.feat { margin-left: 6px; padding: 0 4px; border: 1px solid #6a5a3a; border-radius: 3px; font-size: 12px; color: #e8d8a8; background: rgba(var(--bg3), 0.6); }
.feat.up { border-color: #c9a24a; color: #ffe39a; }

/* ---------- phones: how much the screen shows, the big pause button, zoom thumbs ---------- */
#fab { position: absolute; right: 12px; top: calc(50% - 150px); width: 64px; height: 64px; border-radius: 50%; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: rgba(var(--bg3), 0.92); border: 3px solid var(--gold2); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5); z-index: 3; }
#fab[hidden] { display: none; }
#fab i { width: 18px; height: 20px; background: linear-gradient(90deg, var(--gold2) 0 35%, transparent 35% 65%, var(--gold2) 65%); }
#fab.paused i { background: var(--gold2); clip-path: polygon(10% 0, 100% 50%, 10% 100%); }
#fab span { font: 600 12px var(--pix); color: var(--paper); }
#fab.paused { border-color: #80e080; animation: fabPulse 1.4s ease-in-out infinite; }
@keyframes fabPulse { 50% { box-shadow: 0 0 0 6px rgba(128, 224, 128, 0.25); } }
#fabzoom { display: none; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); flex-direction: column; gap: 8px; }
#fabzoom button { width: 44px; height: 44px; font: 700 22px var(--pix); padding: 0; border-radius: 50%; background: rgba(var(--bg), 0.85); }
@media (pointer: coarse) { #fabzoom { display: flex; } #b-zin, #b-zout { display: none; } }
#hud.hud-compact #log, #hud.hud-compact #mini { display: none; }
#hud.hud-compact #journal span { display: none; }
#hud.hud-compact #journal { padding: 3px 26px 3px 8px; }
#hud.hud-compact #band { width: 112px; }
#hud.hud-compact #band li { font-size: 12px; padding: 1px 4px 2px; }
#hud.hud-compact #band li .lv { display: none; }
/* Compact keeps the day, the weather and the two things a march runs on: coin and rations. */
#hud.hud-compact .chip:not(:first-child):not(:nth-child(2)):not(:nth-child(3)):not(.keep) { display: none; }
#hud.hud-clean #log, #hud.hud-clean #mini, #hud.hud-clean #journal, #hud.hud-clean #band, #hud.hud-clean #top { display: none; }
#hud.hud-clean #acts button:not(#b-near):not(#b-zlvl):not(#b-zin):not(#b-zout) { display: none; }
#battlebar.folded #bb-valor, #battlebar.folded #bb-who .pips, #battlebar.folded #bb-who .feat { display: none; }
#battlebar.folded #bb-acts button.ic span { display: none; }
#battlebar.folded #bb-acts button.ic { padding: 3px; }
@media (pointer: coarse) {
  #bb-acts button, #bb-side button, #acts button { min-height: 40px; min-width: 40px; }
  #battlebar button.ic img { width: 36px; height: 36px; }
}
@media (max-width: 720px) {
  #band { top: calc(max(8px, env(safe-area-inset-top)) + 72px); }
  #acts { gap: 4px; }
  #acts button { padding: 4px 8px; font-size: 13px; }
  #hud.hud-compact #battlebar { padding: 4px 6px; }
  #hud.hud-compact #bb-valor .valor small, #hud.hud-compact #bb-valor .valor img.way { display: none; }
}

/* Phones: the fight bar is one slim row of icons; the rest opens with ⋯ */
#bb-more { display: none; }
#bb-more em { font-style: normal; font: 600 10px var(--pix); color: #e0c8ff; background: #3a2456; border-radius: 6px; padding: 0 4px; margin-left: 3px; }
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  #battlebar { grid-template-columns: 1fr auto; grid-template-areas: "acts side"; padding: 4px; gap: 4px; left: 4px; right: 4px; align-items: center; }
  #battlebar.more { grid-template-areas: "who who" "valor valor" "acts side"; }
  #bb-who, #bb-valor, #bb-fold, #bb-acts .sec { display: none !important; }
  #battlebar.more #bb-who, #battlebar.more #bb-autoall { display: block !important; }
  #battlebar.more #bb-valor, #battlebar.more #bb-acts .sec { display: flex !important; }
  #bb-more { display: inline-flex; align-items: center; min-width: 40px; min-height: 40px; justify-content: center; font-size: 18px; }
  #battlebar.more #bb-more { background: #3a2456; border-color: #c8a8ff; }
  #bb-acts { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  #bb-acts::-webkit-scrollbar { display: none; }
  #battlebar #bb-acts button.ic { padding: 2px; position: relative; flex: none; min-width: 0; min-height: 0; }
  #battlebar #bb-acts button.ic img { width: 34px; height: 34px; }
  #battlebar #bb-acts button.ic span:not(.cd), #battlebar button.ic kbd { display: none; }
  #battlebar #bb-acts .cd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 16px var(--pix); color: #fff; text-shadow: 1px 1px 0 #000; }
  #bb-side { display: flex; gap: 4px; align-items: center; }
  #bb-go { padding: 4px 10px; min-height: 40px; }
  #bb-go small { display: none; }
  #battlebar.rt #bb-go { display: none; }
  #battlebar.folded #bb-acts .sec { display: none !important; }
}


/* ---------- Interface styles (body[data-ui], picked in Style; style.js) ----------
 * lantern: warm parchment and gold, the first look.
 * iron:    black iron, bone text, tarnished brass, rivets at the corners.
 * blood:   near black with a crimson edge and blackletter titles.
 * moon:    cold night blue and silver.
 */
body[data-ui="lantern"] { --bg: 18, 14, 10; --bg2: 22, 18, 12; }

body[data-ui="iron"] {
  --ink: #0b0c0e; --ink2: #15171a; --ink3: #1f2226; --line: #3f444c; --paper: #dcd6c6; --dim: #9c978a; --faint: #6c6a64;
  --gold: #b49a62; --gold2: #e2d0a0; --red: #b8403a;
  --bg: 11, 12, 14; --bg0: 4, 4, 6; --bg2: 16, 17, 20; --bg3: 30, 32, 36; --selrgb: 44, 40, 32;
  --edge: #000; --deep: #08090a; --on: #3a3226; --sel: #24211b; --pri: #5a1a16; --pri-ink: #f4e6d8;
  --h1sh: #000; --h1glow: rgba(180, 150, 90, 0.18);
  --head: "IM Fell English SC", var(--serif);
}
body[data-ui="iron"] :is(.card, .pcard, .dlg, #battlebar) {
  background-image:
    radial-gradient(circle at 8px 8px, #9aa0a8 0 1.5px, #3a3e44 2px 3px, transparent 3.5px),
    radial-gradient(circle at calc(100% - 8px) 8px, #9aa0a8 0 1.5px, #3a3e44 2px 3px, transparent 3.5px),
    radial-gradient(circle at 8px calc(100% - 8px), #9aa0a8 0 1.5px, #3a3e44 2px 3px, transparent 3.5px),
    radial-gradient(circle at calc(100% - 8px) calc(100% - 8px), #9aa0a8 0 1.5px, #3a3e44 2px 3px, transparent 3.5px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px);
  border-color: #4a5058; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 14px 44px rgba(0, 0, 0, 0.8);
}
body[data-ui="iron"] button { background: linear-gradient(#262a2f, #1a1c20); border-color: #444a52; }
body[data-ui="iron"] button.primary { background: linear-gradient(#6a2018, #451410); border-color: #b49a62; }
body[data-ui="iron"] .card h1, body[data-ui="iron"] .pcard h2 { letter-spacing: 0.04em; font-weight: 400; }

body[data-ui="blood"] {
  --ink: #070505; --ink2: #120c0c; --ink3: #1e1313; --line: #4a1c1a; --paper: #e8ddd6; --dim: #a8968f; --faint: #6e5e58;
  --gold: #c8473a; --gold2: #f06a52; --red: #e04a3a; --green: #8ab070;
  --bg: 9, 6, 6; --bg0: 2, 1, 1; --bg2: 14, 9, 9; --bg3: 34, 16, 14; --selrgb: 60, 20, 18;
  --edge: #000; --deep: #050303; --on: #4a1612; --sel: #2a100e; --pri: #7a1610; --pri-ink: #ffe8e0;
  --h1sh: #2a0606; --h1glow: rgba(220, 60, 40, 0.35);
  --head: "Pirata One", var(--serif);
}
body[data-ui="blood"] :is(.card, .pcard, .dlg) { border-color: #2a1010; box-shadow: inset 0 3px 0 #8a1c14, inset 0 0 0 1px #000, inset 0 0 60px rgba(120, 10, 0, 0.12), 0 14px 44px #000; }
body[data-ui="blood"] .card h1 { font-weight: 400; font-size: 64px; }
body[data-ui="blood"] .pcard h2 { font-weight: 400; font-size: 26px; }
body[data-ui="blood"] .chip, body[data-ui="blood"] #band li { border-color: #3a1614; }

body[data-ui="moon"] {
  --ink: #090d14; --ink2: #101722; --ink3: #1a2332; --line: #33445a; --paper: #dfe6ef; --dim: #93a2b6; --faint: #627086;
  --gold: #8cb8e0; --gold2: #dce9fa; --blue: #8cb8e0;
  --bg: 9, 13, 20; --bg0: 3, 5, 9; --bg2: 13, 19, 28; --bg3: 24, 34, 50; --selrgb: 30, 46, 70;
  --edge: #02040a; --deep: #060a10; --on: #213450; --sel: #182436; --pri: #20406a; --pri-ink: #eef4ff;
  --h1sh: #0a1830; --h1glow: rgba(140, 184, 224, 0.35);
  --head: "Cinzel", var(--serif);
}
body[data-ui="moon"] :is(.card, .pcard, .dlg) { box-shadow: inset 0 0 0 1px #02040a, inset 0 0 0 3px rgba(140, 184, 224, 0.14), 0 14px 44px rgba(0, 0, 0, 0.75); }
body[data-ui="moon"] .card h1 { font-weight: 600; font-size: 48px; letter-spacing: 0.08em; }

/* ---------- World filters (body[data-grade]): a grade on the picture plus a vignette and grain ---------- */
#grade { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
body[data-grade="dusk"] #view { filter: brightness(0.86) saturate(0.8) contrast(1.06); }
body[data-grade="dusk"] #grade { background: radial-gradient(ellipse at 50% 50%, transparent 52%, rgba(6, 4, 10, 0.55) 100%); }
body[data-grade="grim"] #view { filter: brightness(0.76) saturate(0.5) contrast(1.14); }
body[data-grade="grim"] #grade { background: radial-gradient(ellipse at 50% 48%, transparent 40%, rgba(0, 0, 0, 0.78) 100%), linear-gradient(rgba(30, 40, 60, 0.14), rgba(30, 40, 60, 0.14)); }
body[data-grade="grim"] #grade::after { content: ""; position: absolute; inset: 0; opacity: 0.09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(3) infinite; }
@keyframes grain { 33% { background-position: 40px 70px; } 66% { background-position: 110px 20px; } }
body[data-grade="tale"] #view { filter: sepia(0.42) saturate(0.7) brightness(0.84) contrast(1.08); }
body[data-grade="tale"] #grade { background: radial-gradient(ellipse at 50% 50%, transparent 46%, rgba(30, 16, 4, 0.6) 100%); }
body[data-grade="night"] #view { filter: brightness(0.72) saturate(0.55) hue-rotate(-12deg) contrast(1.1); }
body[data-grade="night"] #grade { background: radial-gradient(ellipse at 50% 50%, transparent 44%, rgba(2, 6, 18, 0.7) 100%), linear-gradient(rgba(20, 40, 90, 0.16), rgba(20, 40, 90, 0.16)); }
@media (prefers-reduced-motion: reduce) { #grade::after { animation: none; } }

#b-style-title { position: fixed; top: max(10px, env(safe-area-inset-top)); right: 10px; z-index: 7; }
body:has(#title[hidden]):has(#lobby[hidden]) #b-style-title { display: none; }

/* Copilot on: a steady glow on the button and a thin line on the bar. */
#bb-autoall.on { background: var(--on); border-color: var(--gold2); box-shadow: 0 0 10px var(--h1glow); }
#battlebar.copilot { border-top-color: var(--gold); }

/* ---------- the camp screen ---------- */
/* Round 67: the camp itself is the map behind (campmap.js); the panel stands beside it, no veil. */
#panel.campview { background: none; pointer-events: none; justify-content: flex-end; align-items: flex-start; padding: 64px 12px 84px; }
#panel.campview .pcard { pointer-events: auto; width: min(430px, 100%); max-height: 100%; }
@media (max-width: 720px) {
  #panel.campview { align-items: flex-end; justify-content: center; padding: 0 6px 62px; }
  #panel.campview .pcard { width: 100%; max-height: 44vh; }
}
.item.kit .kitlv { display: flex; gap: 3px; align-self: center; width: 40px; flex-wrap: wrap; }
.item.kit .kitlv i { width: 8px; height: 12px; border: 1px solid var(--line); background: var(--ink2); transform: skewX(-10deg); }
.item.kit .kitlv i.on { background: var(--gold); border-color: var(--gold2); }

/* The talent tree on a sellsword's sheet. */
.skills { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.skill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 2px; border: 1px solid var(--line); background: rgb(var(--bg2)); font-size: 13px; }
.skill img, .node img { width: 28px; height: 28px; image-rendering: pixelated; flex: none; }
.tree { display: flex; flex-direction: column; gap: 6px; }
.tier { border-left: 2px solid var(--line); padding: 2px 0 4px 14px; position: relative; }
.tier::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; background: rgb(var(--bg)); border: 2px solid var(--line); transform: rotate(45deg); }
.tier .tl { font: 12px var(--pix); color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.tree .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; }
.tree .or { align-self: center; font: 12px var(--pix); color: var(--dim); padding: 0 2px; }
.node { flex: 1 1 200px; display: flex; gap: 6px; align-items: flex-start; padding: 5px 6px; border: 1px solid var(--line); background: rgb(var(--bg2)); position: relative; min-width: 0; }
.node b { display: block; font-size: 14px; }
.node small { display: block; font-size: 12px; color: var(--dim); line-height: 1.25; }
.node em { position: absolute; right: 4px; top: 3px; font: normal 12px var(--pix); color: var(--dim); }
.node .dot { width: 10px; height: 10px; margin: 4px 9px; flex: none; border: 2px solid var(--dim); transform: rotate(45deg); }
.node button { margin-top: 4px; }
.node.own { border-color: var(--gold); background: rgb(var(--selrgb)); }
.node.own .dot { background: var(--gold); border-color: var(--gold); }
.node.open { border-color: var(--gold); box-shadow: 0 0 6px var(--h1glow); }
.node.lock { opacity: 0.62; }
.node.shut { opacity: 0.32; filter: grayscale(1); }
.node.shut b { text-decoration: line-through; }
.tree .gen .node { flex-basis: 160px; }
.paths { align-items: stretch; }
.path { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px dashed var(--line); min-width: 0; }
.path .ph b { font: 700 16px var(--pix); color: var(--gold2); display: block; }
.path .ph small { display: block; font-size: 12px; color: var(--dim); }
.path .ph button { margin: 4px 0 2px; }
.path.own { border-style: solid; border-color: var(--gold); }
.path.open { border-color: var(--gold); }
.path.shut { opacity: 0.4; filter: grayscale(1); }
.gold { color: var(--gold2); }
.path .node { flex: none; }
/* Promotion paths on the sheet (two or three side by side; stacked when the panel is narrow). Scoped
   to .tree so the captain's .paths grid further down does not reach them. */
.tree .row.promos { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.tree .row.promos .path { flex: none; border: 1px dashed var(--line); background: none; padding: 6px; }
.tree .row.promos .path.open { border-color: var(--gold); }
.tree .row.promos .path.own { border: 2px solid var(--gold); }
.path .ph small.pfx { color: var(--gold2); margin-top: 2px; }
.mercy { margin: 8px 0; padding: 6px 8px; border: 1px solid #6a5a3a; background: rgba(60, 44, 24, 0.35); }
.mercy h4 { margin: 0 0 4px; color: #e8c060; }
.seasky { margin: 6px 0; padding: 5px 8px; border-left: 3px solid #6a7a8a; background: rgba(30, 40, 54, 0.35); }
.seasky.fair { border-color: #7ab070; }
.seasky.rough { border-color: #d0a040; }
.seasky.storm { border-color: #d05040; background: rgba(70, 24, 20, 0.35); }
.item .flow { color: #9ab08a; }
.item .short { color: #e08060; }
.item.lack { border-color: #8a4a3a; }
.chains { width: 32px; height: 32px; flex: none; background: radial-gradient(circle at 35% 50%, transparent 5px, #8a8a90 5px 7px, transparent 7px), radial-gradient(circle at 65% 50%, transparent 5px, #6a6a70 5px 7px, transparent 7px); }
/* Hover preview of a blow in a fight. */
#dmgtip { position: fixed; z-index: 40; pointer-events: none; padding: 4px 8px; background: rgba(var(--bg0), 0.92); border: 1px solid var(--line); font-size: 13px; line-height: 1.35; color: var(--paper); max-width: 220px; }
#dmgtip b { font-family: var(--pix); color: var(--gold2); }
#dmgtip em { font-style: normal; color: #ff9a80; font-weight: 700; }
#dmgtip small { color: var(--dim); }
#dmgtip .kill { color: #ff5a40; font-family: var(--pix); }
#dmgtip .maybe { color: var(--gold); font-family: var(--pix); }

/* The Kingdoms tab: the realms by sort, under the map. */
.realmlist h3 { margin: 12px 0 4px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.8; }
.realmlist ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.realmlist li { border-left: 4px solid var(--kc); padding: 2px 0 2px 8px; }
.realmlist li small { opacity: 0.75; }
.realmlist li p.fine { margin: 2px 0 0; }

/* The living market: stock, workshops, word from the roads. */
.trade td.stock { color: var(--dim); text-align: right; padding-right: 8px; }
.trade td.stock.low { color: #e07a5a; }
.trade td.stock.high { color: #9ac46a; }
.idle { color: #e07a5a; }
p.shops { margin: 4px 0 8px; }
ul.tradenews { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 3px; font-size: 13px; }
ul.tradenews small { opacity: 0.65; margin-right: 4px; }

/* The wars in the journal. */
.war { border-left: 3px solid var(--dim); padding: 2px 0 6px 10px; margin: 8px 0; }
.war h3 { margin: 4px 0; }
.rival { border-left: 3px solid #a03028; padding: 2px 0 6px 10px; margin: 8px 0; }
.rival h3 { margin: 4px 0; }
.rival.slain { opacity: 0.55; border-left-color: var(--dim); }
.taunt { color: #e0a080; }
.warbar { position: relative; height: 8px; border: 1px solid #000; margin: 6px 0; display: flex; }
.warbar i { display: block; height: 100%; }
.warbar em { display: block; height: 100%; flex: 1; }


/* Riding into a settlement (main.js arrive): the name over the street in the people's colour. */
#arrive { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 11vh; pointer-events: auto; cursor: pointer; z-index: 6; text-align: center; color: #f4e6c0; }
#arrive > * { opacity: 0; }
#arrive.show > * { animation: arIn 4.3s ease both; }
#arrive.show > em { animation-delay: 0.15s; } #arrive.show > b { animation-delay: 0.3s; } #arrive.show > small { animation-delay: 0.9s; } #arrive.show > .ar-skip { animation-delay: 1.6s; }
#arrive .ar-crest { width: 34px; height: 44px; margin-bottom: 6px; filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.7)); }
#arrive .ar-crest i { display: block; width: 100%; height: 100%; background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.25)), var(--cc); clip-path: polygon(0 0, 100% 0, 100% 72%, 50% 100%, 0 72%); border-top: 4px solid #e8c868; }
#arrive em { font: 600 13px var(--pix); font-style: normal; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold2, #e8c868); text-shadow: 1px 1px 0 #000; }
#arrive b { font: 700 46px var(--pix); letter-spacing: 2px; text-shadow: 3px 3px 0 #000, 0 0 22px rgba(0, 0, 0, 0.85); border-bottom: 3px solid var(--cc); padding: 0 22px 4px; margin: 2px 0 8px; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 70%); }
#arrive small { font: italic 17px var(--serif); max-width: 560px; text-shadow: 1px 1px 0 #000, 0 0 10px rgba(0, 0, 0, 0.9); }
#arrive .ar-skip { position: absolute; bottom: 9vh; font: 12px var(--pix); color: rgba(244, 230, 192, 0.55); letter-spacing: 0.1em; }
@keyframes arIn { 0% { opacity: 0; transform: translateY(-8px); } 14%, 82% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; } }
@media (max-width: 720px) { #arrive b { font-size: 30px; } #arrive small { font-size: 14px; padding: 0 16px; } }

/* A warband of your own */
.wbown { cursor: default; }
.wbown.open { grid-column: 1 / -1; }
.wbown .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.cwname { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.cwname input { flex: 1; min-width: 0; }
.cwrows { display: flex; flex-direction: column; gap: 6px; }
.cwrow { display: flex; gap: 6px; align-items: center; padding: 4px; background: rgba(0, 0, 0, 0.2); border-radius: 3px; }
.cwrow img.portrait { width: 40px; height: 40px; flex: none; }
.cwsel { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.cwsel select { flex: 1 1 120px; min-width: 0; font-size: 13px; padding: 3px; background: rgba(var(--bg), 0.9); color: var(--paper); border: 1px solid var(--line); }
.cwsel small { flex-basis: 100%; }
.cwcost.bad { color: #ff9a80; }

/* The ability card: what the readied ability does, above the fight bar */
#bb-tip { position: absolute; left: 8px; right: 8px; max-width: 520px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; background: rgba(var(--bg0), 0.94); border: 1px solid var(--gold); border-radius: 4px; font-size: 13px; line-height: 1.35; z-index: 21; pointer-events: auto; }
#bb-tip img { width: 32px; height: 32px; flex: none; image-rendering: pixelated; }
#bb-tip div { flex: 1; min-width: 0; }
#bb-tip b { font-family: var(--pix); color: var(--gold2); font-size: 15px; }
#bb-tip .meta { color: var(--dim); font-size: 12px; margin-left: 6px; }
#bb-tip p { margin: 2px 0 0; color: var(--paper); }
#bb-tip .hint { color: var(--gold); font-size: 12px; }
#bb-tip .tbtn { display: flex; flex-direction: column; gap: 4px; }
#bb-tip .tbtn button { min-height: 36px; padding: 2px 10px; }

/* Travel screen: which parts show */
#hud.no-top #top, #hud.no-journal #journal, #hud.no-band #band, #hud.no-mini #mini, #hud.no-log #log, #hud.no-wx #t-wx { display: none !important; }
#hud.no-zoom #zoomseg, #hud.no-zoom #fabzoom { display: none !important; }
#hud.no-tools #b-chat { display: none !important; }
#hud.no-labels #acts button small { display: none; }
#hud.no-fab #fab { display: none !important; }
#hud.no-region #region { display: none !important; }
#battlebar button.ic.off { opacity: 0.5; }
#battlebar button.ic.off img { filter: grayscale(1) brightness(0.6); }
#battlebar button.ic.peek { border-color: var(--gold2); box-shadow: 0 0 0 1px var(--gold2) inset; }
#hud:has(#bb-tip:not([hidden])) #note { bottom: 46%; }
/* Phones: the lobby rules fit the width (long option names used to push it sideways) */
.rules, .rules > * { min-width: 0; }
.rules select { max-width: 100%; min-width: 0; }
@media (max-width: 600px) { .rules label.check:has(select) { flex-wrap: wrap; } .rules label.check select { flex: 1 1 100%; } }
/* The captain's paths (round 27). */
#b-band.ping { position: relative; border-color: var(--gold); }
#b-band.ping::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; background: var(--gold2, #f0d080); box-shadow: 0 0 6px var(--gold2, #f0d080); }
.cxp { position: relative; height: 18px; background: rgba(0, 0, 0, 0.35); border: 2px solid var(--line); margin: 6px 0 10px; }
.cxp i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #8a6a2a, #e0b860); }
.cxp span { position: relative; display: block; text-align: center; font: 600 12px var(--pix); line-height: 14px; text-shadow: 1px 1px 0 #000; }
.paths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 900px) { .paths { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .paths { grid-template-columns: 1fr; } }
.path { border: 2px solid var(--line); border-top: 4px solid var(--pc); padding: 6px; background: rgba(0, 0, 0, 0.18); }
.path h4 { margin: 0; color: var(--pc); font: 700 15px var(--pix); }
.path > .fine { margin: 2px 0 6px; }
.step { display: flex; gap: 6px; align-items: flex-start; padding: 6px; margin-top: 6px; border: 1px solid var(--line); position: relative; }
.step + .step::before { content: ""; position: absolute; left: 14px; top: -7px; height: 6px; border-left: 2px solid var(--line); }
.step img, .step .pas { width: 24px; height: 24px; image-rendering: pixelated; flex: none; display: grid; place-items: center; color: var(--pc); font-size: 16px; }
.step > div { min-width: 0; }
.step b { display: block; font: 600 13px var(--pix); }
.step em { display: block; font-style: normal; font-size: 12px; opacity: 0.75; }
.step small { display: block; font-size: 12px; line-height: 1.3; margin: 2px 0 4px; }
.step .tag { font-size: 12px; opacity: 0.8; }
.step.got { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, transparent); }
.step.got .tag { color: var(--pc); opacity: 1; }
.step.locked { opacity: 0.55; }
.step.open { border-color: var(--gold); }
.step.master { border-style: double; border-width: 3px; }
/* Round 28: standing in the realms, urgent calls, village works. */
.stand { font-weight: 700; padding: 0 4px; border-radius: 3px; background: rgba(0, 0, 0, 0.3); }
.stand.r0 { color: #ff6050; } .stand.r1 { color: #f0a050; } .stand.r2 { color: #c8c0b0; }
.stand.r3 { color: #d8d090; } .stand.r4 { color: #a0d890; } .stand.r5 { color: #80e0c0; } .stand.r6 { color: #ffe080; }
.item.urgent { box-shadow: inset 3px 0 0 #ff6a4a; }
.workic { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; font-size: 16px; color: #f0d8a0; background: rgba(60, 40, 20, 0.6); border-radius: 4px; }
.lvpips { color: #e0a838; font-size: 12px; letter-spacing: 1px; margin-left: 4px; }

/* Round 34: the journal's travels. */
.wonders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 8px 0; }
@media (max-width: 640px) { .wonders { grid-template-columns: 1fr 1fr; } }
.wonder { border: 1px solid #3a3226; padding: 6px 8px; background: rgba(20, 16, 10, 0.5); opacity: 0.6; }
.wonder.got { border-color: #c8a040; opacity: 1; background: rgba(60, 44, 18, 0.45); }
.wonder b { display: block; color: #ffe8a0; }
.wonder small { display: block; font-size: 12px; margin: 2px 0; }
.wonder em { display: block; font-size: 12px; color: #c8b080; }

/* Round 39: phone polish. */
#banner { max-width: calc(100vw - 24px); box-sizing: border-box; }
#banner small { white-space: normal; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  #banner { top: 16%; padding: 5px 10px; width: max-content; }
  #banner small { font-size: 12px; max-width: 520px; margin: 2px auto 0; }
}
@media (pointer: coarse) and (max-height: 500px) {
  /* Landscape phones: the march buttons in one row that scrolls sideways, zoom on the left. */
  #acts { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; pointer-events: auto; padding-bottom: 2px; }
  #acts::-webkit-scrollbar { display: none; }
  #acts button { flex: none; padding: 3px 9px; font-size: 13px; min-height: 36px; }
  #fabzoom { left: 12px; right: auto; }
  #band { max-height: calc(100% - 70px); }
  #note { bottom: 64px; max-width: 70vw; font-size: 13px; }
}
@media (max-width: 720px) and (min-height: 501px) {
  /* Portrait: the banner sits low, above the fight bar, clear of the roster. */
  #banner { top: auto; bottom: calc(max(8px, env(safe-area-inset-bottom)) + 66px); }
}
@media (pointer: coarse) and (min-height: 501px) {
  /* Portrait phones: the roster stops above the zoom buttons and scrolls. */
  #band { max-height: calc(50% - 72px); }
}

/* Round 41: market fortunes in the trade tab. */
.fortune { padding: 6px 9px; border-left: 3px solid #ffd040; background: rgba(255, 208, 64, 0.1); margin: 6px 0; }
.fortune.fair { border-color: #e0a0e8; background: rgba(224, 160, 232, 0.1); }
.fortune.poor { border-color: #9a9a9a; background: rgba(154, 154, 154, 0.12); }

/* Round 42: per-sellsword copilot, the initiative strip. */
button.pilot.auto { background: #6a5020; border-color: #e8c060; color: #fff4d0; }
button.pilot.manual { background: #2a3a4a; border-color: #80b0e0; color: #e0f0ff; }
#initbar { position: absolute; top: 46px; left: 50%; transform: translateX(-50%); display: flex; gap: 3px; z-index: 12; pointer-events: none; max-width: 70vw; overflow: hidden; }
#initbar .ib { position: relative; width: 30px; height: 34px; border: 2px solid #3a3020; background: #16120e; display: flex; align-items: flex-end; justify-content: center; font-size: 9px; color: #f0e0b8; }
#initbar .ib.foe { border-color: #7a2a2a; }
#initbar .ib.me { border-color: #e8c060; }
#initbar .ib.cur { transform: scale(1.18); border-color: #fff4c0; box-shadow: 0 0 8px #e8c060; z-index: 2; }
#initbar .ib img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
#initbar .ib b { position: relative; background: rgba(0,0,0,0.7); padding: 0 2px; }
@media (pointer: coarse) and (max-height: 500px) { #initbar { top: 38px; } #initbar .ib { width: 24px; height: 28px; } }

/* Round 43: the captain's hero. */
.heroform { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; align-items: end; margin: 8px 0; }
.heroform label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.heroform label.check { flex-direction: row; align-items: center; }
.heroform input[data-hf=name], .heroform select { padding: 4px 6px; }
.paths .path ol { margin: 4px 0 6px 18px; padding: 0; font-size: 12px; }
.paths .path li { opacity: 0.55; margin: 2px 0; }
.paths .path li.got { opacity: 1; color: #f0d890; }
.paths .path li.next { opacity: 0.9; }
.unitcap { color: #ffd860; }

/* Round 44: the hero sheet in the lobby, with what the calling makes of them. */
.lobbyhero .row button.on { outline: 2px solid var(--gold, #e0b040); }
.heroform .heroprev { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.hp-card { display: flex; gap: 10px; align-items: center; }
.hp-card > div { display: flex; flex-direction: column; gap: 2px; }
.hp-card .portrait { width: 52px; height: 58px; }
.hp-call { font-size: 13px; line-height: 1.6; }
.hp-call span { white-space: nowrap; }
.hp-call span.v { color: #e8c060; }
.hp-call img, .path em.hv img { width: 16px; height: 16px; vertical-align: -3px; image-rendering: pixelated; margin-left: 2px; }
.path em.hv { display: block; font-style: normal; font-size: 12px; color: #e8c060; }

/* Round 45: a hero class's pool of abilities. */
.path.arch { grid-column: 1 / -1; }
.hpicks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hpick { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 13px; }
.hpick img { width: 18px; height: 18px; image-rendering: pixelated; }
.hpick.got { outline: 2px solid var(--pc, #e0b040); opacity: 1; }
.hpick.sig span { color: #e8c060; }
/* Round 46: hero classes in tiers. */
.hp-first { display: block; margin: 6px 0 2px; }
.hp-tier { margin-top: 4px; line-height: 1.7; }
.hp-tier > small { display: inline-block; min-width: 92px; color: #b8a888; }
.hopt { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; margin-right: 8px; font-size: 13px; }
.hopt img, .hpick i { width: 16px; height: 16px; image-rendering: pixelated; font-style: normal; }
.hopt.feat, .hpick.feat span { color: #a8d0a0; }
.hopt.valor, .hpick.valor span { color: #e8c060; }
.hopt.sig, .hpick.sig span { color: #f0a060; }
.hpick em { font-size: 12px; opacity: 0.7; font-style: normal; }
.htier { margin-top: 6px; }
.htier.shut { opacity: 0.55; }
.htier > small { color: #b8a888; }
/* Round 47: dressing wounds on the march. */
.tendrow { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 4px 0 8px; }
.tendrow .fine { flex: 1 1 220px; }
.oath { margin: 2px 0 6px; padding: 4px 8px; border-left: 3px solid #c9a24a; background: rgba(201,162,74,0.08); font-size: 0.92em; }
#dmgtip .flank { color: #f0c070; }
/* Round 49: rival companies in the journal. */
.cohead { margin-top: 16px; }
.rival.company h3 { display: flex; align-items: center; gap: 8px; }
.cobanner { display: inline-block; width: 12px; height: 16px; background: var(--cc); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%); }
.tag.co-feud { color: #ff7a6a; border-color: #a03a3a; }
.tag.co-bad { color: #f0a060; }
.tag.co-friend { color: #8ad08a; }
.tag.co-wary { color: #c8c0a8; }
/* Round 52: a fallen captain's legacy, chosen when the next takes up the sword. */
.heroform .legacy { grid-column: 1 / -1; margin: 6px 0; padding: 6px 8px; border-left: 3px solid #c9a24a; background: rgba(201,162,74,0.08); }
.heroform .legacy p { margin: 0 0 6px; }
.heroform .legacy .lg { display: flex; flex-direction: row; gap: 8px; align-items: flex-start; margin: 4px 0; cursor: pointer; }
.heroform .legacy .lg input { width: auto; flex: 0 0 auto; margin-top: 3px; }
.heroform .legacy .lg span { flex: 1; }
.heroform .legacy .lg small { display: block; opacity: 0.8; }


/* ---------- round 61: the game master ---------- */
.seat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seat button { text-align: left; padding: 8px 10px; }
.seat button small { font: 13px/1.3 var(--serif); opacity: 0.8; margin-top: 3px; }
body.gm #b-near, body.gm #b-follow, body.gm #b-wait, body.gm #b-camp, body.gm #b-band, body.gm #b-party, body.gm #b-journal, body.gm #battlebar, body.gm #fab, body.gm #initbar { display: none !important; }
body.gm #log { width: min(380px, calc(100% - 470px)); }
#gmbox { position: absolute; top: 46px; right: 8px; bottom: calc(max(8px, env(safe-area-inset-bottom)) + 192px); width: min(430px, calc(100% - 16px)); display: flex; flex-direction: column; background: rgba(var(--bg), 0.94); border: 2px solid var(--line); box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6); pointer-events: auto; z-index: 20; font-size: 14px; }
#gmbox.shut { display: none; }
#gm-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); }
#gm-head select { font-size: 13px; padding: 3px 6px; max-width: 170px; }
#gm-head .check { margin: 0; font-size: 12px; }
.gm-pow { font: 700 17px var(--pix); color: var(--gold2); }
.gm-pow small { font-size: 12px; color: var(--dim); }
#gm-tabs { display: flex; gap: 4px; padding: 6px 8px 0; }
#gm-tabs button { padding: 4px 10px; font-size: 13px; border-bottom-width: 0; }
#gm-tabs button i { font-style: normal; color: var(--gold2); margin-left: 3px; }
#gm-body { flex: 1; overflow-y: auto; padding: 6px 8px 10px; border-top: 1px solid var(--line); }
#gm-body h4 { font: 600 12px var(--pix); text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); margin: 12px 0 4px; }
#gm-body input, #gm-body select, #gm-body textarea { font-size: 13px; padding: 4px 6px; }
#gm-body textarea { width: 100%; box-sizing: border-box; font: 14px/1.3 var(--serif); color: var(--paper); background: var(--ink2); border: 2px solid var(--line); border-radius: 3px; resize: vertical; }
.gm-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0; }
.gm-row input { flex: 1; min-width: 90px; }
.gm-opt { display: grid; grid-template-columns: 1fr auto 52px auto 52px; gap: 3px; margin: 3px 0; }
.gm-opt input[type=number] { width: 100%; box-sizing: border-box; }
.gm-band { border-left: 3px solid var(--c, var(--line)); background: rgba(var(--bg2), 0.8); padding: 5px 7px; margin: 0 0 6px; }
.gm-band.on { outline: 1px solid var(--gold); }
.gm-bh { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.gm-bh .fine { margin: 0; }
.gm-stats { margin: 2px 0; }
.gm-stats .bad { color: var(--red); } .gm-stats .good { color: var(--green); }
.gm-adv { margin: 2px 0; opacity: 0.85; }
.gm-row select { max-width: 96px; }
.gm-meter { position: relative; display: block; height: 7px; background: var(--ink); border: 1px solid var(--line); margin: 4px 0; }
.gm-meter i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--green), var(--gold), var(--red)); }
.gm-meter u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--paper); text-decoration: none; }
.gm-meter.sm { width: 56px; display: inline-block; margin: 0; }
.gm-ai { border-top: 1px solid var(--line); padding-top: 4px; }
.gm-feed { list-style: none; margin: 0; padding: 0; }
.gm-f { display: grid; grid-template-columns: 52px 18px 1fr; gap: 4px; padding: 3px 0; border-bottom: 1px solid rgba(var(--bg3), 0.9); font-size: 13px; line-height: 1.3; }
.gm-f .gm-t { color: var(--faint); font-size: 12px; }
.gm-f.road .gm-i { color: var(--gold); } .gm-f.world .gm-i, .gm-f.rules .gm-i { color: var(--blue); } .gm-f.gm .gm-i { color: var(--gold2); } .gm-f.band .gm-i { color: var(--green); }
.gm-f.kev .gm-i, .gm-f.jev .gm-i, .gm-f.weigher .gm-i, .gm-f.gemini .gm-i, .gm-f.anthropic .gm-i { color: #c090f0; }
.gm-f i { color: var(--paper); }
.gm-card { background: rgba(var(--bg2), 0.8); border: 1px solid var(--line); padding: 5px 7px; margin: 0 0 6px; }
.gm-card.ai { border-color: #a070e0; }
.gm-card p { margin: 0 0 4px; font: 14px/1.3 var(--serif); }
.gm-p { color: #c090f0; font: 700 13px var(--pix); }
.gm-foes { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.gm-foes li { border: 1px solid var(--line); padding: 2px 6px; cursor: pointer; font-size: 13px; background: var(--ink2); }
.gm-foes li.on { border-color: var(--gold2); background: var(--on); }
.gm-foes li.down { opacity: 0.5; }
.gm-foes li .fine { margin: 0 0 0 6px; }
#gm-arm { margin: 0; padding: 5px 8px; background: var(--pri); color: var(--pri-ink); font-size: 13px; }
@media (max-width: 760px) {
  #gmbox { top: auto; bottom: calc(max(8px, env(safe-area-inset-bottom)) + 52px); height: 52vh; }
  body.gm #log { display: none; }
  .seat { grid-template-columns: 1fr; }
}
body.gm #band { display: none; }
.gm-row .check { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 13px; }
/* Round 61: the "New look" dialog (lookdlg.js), over the panel. */
#lookdlg { position: fixed; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(var(--bg0), 0.55); }
#lookdlg[hidden] { display: none; }
#lookdlg .lcard { width: min(560px, 100%); max-height: 88vh; overflow-y: auto; background: rgba(var(--bg2), 0.98); border: 2px solid var(--line); outline: 2px solid var(--edge); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); padding: 0 14px 14px; }
#lookdlg header { display: flex; align-items: center; gap: 8px; padding: 10px 0 4px; }
#lookdlg h2 { font: 700 20px var(--head); color: var(--gold2); margin: 0; flex: 1; }
#lookdlg label { display: block; margin: 8px 0; }
#lookdlg textarea { width: 100%; box-sizing: border-box; margin-top: 4px; font: 14px var(--pix); background: var(--ink2); color: inherit; border: 2px solid var(--line); padding: 6px; resize: vertical; }
#lookdlg .lrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
#lookdlg .lrow.end { justify-content: flex-end; }
#lookdlg .lopt { display: inline-flex; gap: 4px; align-items: center; margin: 0; }
#lookdlg .lpacks { display: grid; gap: 6px; }
#lookdlg .lpack { display: grid; grid-template-columns: auto 1fr auto; gap: 0 8px; align-items: center; margin: 0; padding: 6px 8px; background: var(--ink2); border: 2px solid var(--line); cursor: pointer; }
#lookdlg .lpack.on { border-color: var(--gold); }
#lookdlg .lpack small { grid-column: 2; color: var(--dim); }
#lookdlg .lpack em { grid-row: 1 / span 2; grid-column: 3; font-style: normal; color: var(--gold2); }
#lookdlg .lpack input { grid-row: 1 / span 2; }
#lookdlg .lbusy { color: var(--gold2); }
#lookdlg .lerr { color: #f08070; }

/* Round 63: mischief on the band. */
.chip.hex { background: rgba(120, 60, 140, 0.55); }
.chip.hex.boon { background: rgba(60, 120, 60, 0.55); }
.gm-hex button { margin-left: 6px; }

/* ---------- Round 64: a quieter, modern interface ----------
 * One panel style for everything (dark translucent glass, a thin light edge, round corners), a plain
 * system sans for controls and numbers, the old pixel and book faces only for titles (--head) and story
 * prose. Every setting lives in the menu (☰ or Esc, #menu); the HUD keeps only what is needed at a glance.
 * "Plain" is the default interface style; the older styles still recolour it.
 */
:root {
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --pixel: "Pixelify Sans", ui-monospace, monospace;
  --pix: var(--ui);
  --head: var(--pixel);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke2: rgba(255, 255, 255, 0.15);
  --glass: rgba(var(--bg), 0.74);
  --r: 10px;
  --r-sm: 7px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
body[data-ui="plain"] {
  --ink: #121110; --ink2: #1a1917; --ink3: #25231f; --line: #3a3631; --paper: #e9e4d8; --dim: #a7a094; --faint: #747067;
  --gold: #c9a25a; --gold2: #e8d3a2; --red: #d0644e; --green: #7fb26a; --blue: #8aaed0;
  --bg: 17, 16, 14; --bg0: 5, 5, 4; --bg2: 22, 21, 19; --bg3: 36, 34, 30; --selrgb: 60, 52, 38;
  --edge: transparent; --deep: #0c0b0a; --on: #3b3324; --sel: #2a2620; --pri: #c9a25a; --pri-ink: #1b1409;
  --h1sh: rgba(0, 0, 0, 0.6); --h1glow: rgba(201, 162, 90, 0.18);
  --head: "Cinzel", var(--serif);
}

/* Controls */
button { font: 500 14px/1.2 var(--ui); border: 1px solid var(--stroke2); border-radius: var(--r-sm); background-color: var(--ink3); box-shadow: none; padding: 7px 12px; transition: background-color 0.12s, border-color 0.12s, color 0.12s; }
button:hover:not(:disabled) { border-color: color-mix(in srgb, var(--gold) 60%, transparent); }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button.primary { background: var(--pri); color: var(--pri-ink); border-color: transparent; font-weight: 600; }
button.primary:hover:not(:disabled) { border-color: transparent; filter: brightness(1.08); }
button.small { padding: 5px 10px; font-size: 13px; }
button.on { background: var(--on); border-color: color-mix(in srgb, var(--gold) 70%, transparent); color: var(--gold2); }
button small { font: 400 12px var(--ui); letter-spacing: 0.04em; opacity: 0.55; }
button.danger { background: #5a2420; border-color: #a04030; }
button.icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; font-size: 16px; line-height: 1; }
button.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
input, select { font: 15px var(--ui); border: 1px solid var(--stroke2); border-radius: var(--r-sm); background: rgba(0, 0, 0, 0.28); padding: 7px 10px; }
input:focus, select:focus { border-color: color-mix(in srgb, var(--gold) 70%, transparent); }
.kicker { font: 600 12px var(--ui); letter-spacing: 0.14em; }
.fine { font-family: var(--ui); }
.code { font-family: var(--pixel); }

/* Surfaces: one panel style */
.card, .pcard, .dlg, #lookdlg .lcard { border: 1px solid var(--stroke); outline: none; border-radius: 14px; box-shadow: var(--shadow); }
.card { padding: 26px 28px; }
.card h1 { letter-spacing: 0.05em; }
body[data-ui="plain"] .card h1 { font-weight: 600; font-size: 50px; }
.card label { font: 500 13px var(--ui); }
.item, .mode, .wb, .power, ol.chapters li, .roster li, .goal, .gm-card, .gm-band { border-width: 1px; border-radius: 8px; }
.item { border-color: var(--stroke); background: rgba(255, 255, 255, 0.03); }
.stats div { border-radius: 6px; }
.tag, .foes span, .threat { border-radius: 4px; }
.colors button { border-radius: 50%; }

/* HUD: the menu button, one status strip, slim cards, a dock for the actions */
#b-menu { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 8px; background: var(--glass); border-color: var(--stroke); backdrop-filter: blur(8px); }
#b-style-title { top: max(12px, env(safe-area-inset-top)); right: 12px; background: var(--glass); border-color: var(--stroke); }
#top { left: 52px; max-width: calc(100% - 60px); gap: 0; background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r); padding: 2px 4px; backdrop-filter: blur(8px); }
.chip { background: transparent; border: 0; padding: 5px 8px; font: 500 13px var(--ui); font-variant-numeric: tabular-nums; }
.chip + .chip { border-left: 1px solid var(--stroke); }
.chip b { font-weight: 600; }
.chip small { font: 400 12px var(--ui); }
.chip .meter { height: 5px; border: 0; border-radius: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.1); }
.chip.hex { border-radius: 6px; }
#t-food-chip.low, #t-fat-chip.spent { color: #f08a70; }
#journal { top: calc(max(8px, env(safe-area-inset-top)) + 44px); background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r); padding: 7px 30px 8px 12px; backdrop-filter: blur(8px); }
#journal b { font: 600 12px var(--ui); letter-spacing: 0.1em; }
#journal span { font-size: 14px; }
#j-danger { font: 600 12px var(--ui); letter-spacing: 0.08em; }
#band { gap: 4px; }
#band li { background: var(--glass); border: 1px solid var(--stroke); border-left-width: 3px; border-radius: var(--r-sm); padding: 4px 8px 5px; font: 500 13px var(--ui); backdrop-filter: blur(6px); }
#band li.sel { border-color: color-mix(in srgb, var(--gold2) 70%, transparent); }
#band li .lv { font-size: 12px; }
#band li .hb { height: 3px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, 0.08); }
#band li .pp { border-radius: 4px; border: 0; }
#log li { font: 13px/1.35 var(--ui); background: rgba(var(--bg), 0.6); border-left-width: 2px; border-radius: 0 6px 6px 0; padding: 3px 9px; }
#log li.chat b { font: 600 13px var(--ui); }
#note { font: 500 14px var(--ui); border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent); border-radius: var(--r); padding: 8px 16px; box-shadow: var(--shadow); }
#banner { font-family: var(--head); border: 1px solid var(--stroke); border-radius: var(--r); background: var(--glass); text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8); }
#banner small { font-family: var(--serif); }
#region { font-family: var(--head); }
#region em { font: 600 12px var(--ui); letter-spacing: 0.2em; }
#acts { left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: calc(100% - 16px); justify-content: center; align-items: center; gap: 2px; padding: 5px; background: var(--glass); border: 1px solid var(--stroke); border-radius: 12px; pointer-events: auto; backdrop-filter: blur(10px); box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35); }
#acts :where(button:not(.primary)) { background: transparent; border-color: transparent; }
#acts :where(button:not(.primary)):hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); border-color: transparent; }
#acts button { padding: 7px 11px; }
#acts button small { display: inline; margin-left: 6px; font-size: 12px; opacity: 0.4; }
#zoomseg { display: inline-flex; align-items: center; gap: 0; margin-left: 4px; padding-left: 6px; border-left: 1px solid var(--stroke); }
#zoomseg button { min-width: 30px; padding: 6px 7px; color: var(--dim); }
#acts button.icon { padding: 0; }
#b-chat { width: 34px; height: 34px; color: var(--dim); }
#fabzoom button { background: var(--glass); border: 1px solid var(--stroke2); backdrop-filter: blur(8px); font: 500 22px var(--ui); }
#fab { border-width: 2px; background: var(--glass); backdrop-filter: blur(8px); box-shadow: var(--shadow); }
#fab span { font: 600 12px var(--ui); }
#battlebar { background: rgba(var(--bg), 0.86); border: 1px solid var(--stroke); border-radius: 12px; padding: 8px 10px; backdrop-filter: blur(10px); box-shadow: var(--shadow); }
#bb-who { font: 13px var(--ui); }
#bb-who b { font: 600 15px var(--ui); }
#bb-acts button { font-size: 13px; }
#bb-valor { border-top-color: var(--stroke); }
#chatbox input { background: rgba(var(--bg), 0.9); }
@media (pointer: coarse) { #acts button small { display: none; } }
@media (max-width: 720px) {
  #acts { left: 6px; right: 6px; transform: none; width: auto; max-width: none; }
  #acts button { padding: 6px 9px; }
  #top { left: 50px; max-width: calc(100% - 58px); }
}
@media (pointer: coarse) and (max-height: 500px) {
  #acts { justify-content: flex-start; left: 8px; right: 8px; transform: none; width: auto; max-width: none; }
}

/* Dialog and panels */
.dlg { background: rgba(var(--bg2), 0.95); border-top: 2px solid color-mix(in srgb, var(--gold) 70%, transparent); }
#d-who { font: 600 13px var(--ui); letter-spacing: 0.08em; text-transform: uppercase; }
#d-choices button { font: 500 15px var(--ui); text-align: left; padding: 9px 12px; }
#d-hint { font: 12px var(--ui); }
#panel { background: rgba(var(--bg0), 0.5); }
.pcard { background: rgba(var(--bg2), 0.96); overflow: hidden; }
.pcard header { padding: 14px 16px 8px 20px; }
.pcard h2 { font-weight: 600; letter-spacing: 0.03em; }
#p-close { width: 34px; height: 34px; padding: 0; background: transparent; border-color: transparent; color: var(--dim); }
#p-close:hover:not(:disabled) { color: var(--paper); background: rgba(255, 255, 255, 0.07); }
#p-tabs { gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--stroke); }
#p-tabs button, #gm-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 12px 9px; color: var(--dim); font: 500 14px var(--ui); }
#p-tabs button:hover:not(:disabled), #gm-tabs button:hover:not(:disabled) { color: var(--paper); border-color: transparent; }
#p-tabs button.on, #gm-tabs button.on { background: none; color: var(--gold2); border-bottom-color: var(--gold); }
#p-body { padding: 14px 20px 20px; }
#p-body h3, #gm-body h4 { font: 600 12px var(--ui); letter-spacing: 0.14em; }
#gmbox { border: 1px solid var(--stroke); border-radius: 12px; backdrop-filter: blur(10px); }

/* The menu (☰ / Esc) */
#menu { position: fixed; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(var(--bg0), 0.5); }
#menu .mcard { width: min(620px, 100%); max-height: min(86vh, 820px); display: flex; flex-direction: column; background: rgba(var(--bg2), 0.98); backdrop-filter: blur(16px); border: 1px solid var(--stroke); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
#menu header { display: flex; align-items: center; gap: 8px; padding: 14px 14px 4px 22px; }
#menu h2 { flex: 1; margin: 0; font: 600 20px var(--head); color: var(--gold2); letter-spacing: 0.04em; }
#m-close { background: transparent; border-color: transparent; color: var(--dim); }
#m-close:hover:not(:disabled) { color: var(--paper); background: rgba(255, 255, 255, 0.07); border-color: transparent; }
#m-tabs { display: flex; gap: 2px; padding: 4px 18px 0; border-bottom: 1px solid var(--stroke); overflow-x: auto; scrollbar-width: none; flex: none; }
#m-tabs::-webkit-scrollbar { display: none; }
#m-tabs button { flex: none; background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 12px 10px; color: var(--dim); font: 500 14px var(--ui); }
#m-tabs button:hover:not(:disabled) { color: var(--paper); }
#m-tabs button.on { color: var(--gold2); border-bottom-color: var(--gold); }
#m-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 22px 22px; font-family: var(--ui); }
#m-body h3 { font: 600 12px var(--ui); text-transform: uppercase; letter-spacing: 0.14em; color: var(--gold); margin: 20px 0 6px; }
#m-body .fine { font-size: 12.5px; line-height: 1.45; color: var(--faint); margin: 12px 0 0; }
.mrow { display: grid; grid-template-columns: 128px 1fr; gap: 4px 14px; align-items: center; margin: 9px 0; }
.mrow .ml { color: var(--dim); font-size: 14px; }
.mrow .mnote { grid-column: 2; color: var(--faint); font-size: 12px; line-height: 1.35; }
.mrow.off { opacity: 0.45; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { padding: 6px 11px; font-size: 13px; background: rgba(255, 255, 255, 0.04); }
.seg button:disabled { opacity: 1; cursor: default; min-width: 52px; }
.seg .sw { display: inline-flex; gap: 2px; margin-right: 6px; vertical-align: -1px; }
.seg .sw i { width: 6px; height: 11px; border-radius: 2px; display: inline-block; }
.mparts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.mparts.one { grid-template-columns: minmax(0, 420px); }
.mreset { margin: 10px 0 4px; text-align: right; }
.mswitch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--stroke); cursor: pointer; font-size: 14px; color: var(--paper); }
.mswitch small { display: block; color: var(--faint); font-size: 12px; }
.mswitch input { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 34px; height: 20px; margin: 0; padding: 0; border-radius: 10px; background: var(--ink3); border: 1px solid var(--stroke2); cursor: pointer; transition: background-color 0.15s; }
.mswitch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--dim); transition: transform 0.15s; }
.mswitch input:checked { background: var(--gold); border-color: var(--gold); }
.mswitch input:checked::after { transform: translateX(14px); background: #1b1409; }
.mcode { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: baseline; margin: 16px 0 0; padding: 10px 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--stroke); border-radius: 10px; }
.mcode span { color: var(--dim); font-size: 13px; }
.mcode b { font: 600 22px var(--pixel); letter-spacing: 0.22em; color: var(--gold2); }
.mcode small { grid-column: 1 / -1; color: var(--faint); font-size: 12px; }
#m-mix .snd-mixer { gap: 10px 16px !important; font-size: 14px !important; color: var(--dim); }
#m-mix input[type="range"] { accent-color: var(--gold); padding: 0; border: 0; background: none; }
.mkeys { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0; font-size: 14px; align-items: baseline; }
.mkeys dt { text-align: right; }
.mkeys dd { margin: 0; color: var(--dim); }
.mkeys kbd { font: 600 12px var(--ui); padding: 2px 7px; border: 1px solid var(--stroke2); border-bottom-width: 2px; border-radius: 5px; background: rgba(255, 255, 255, 0.04); color: var(--paper); white-space: nowrap; }
@media (max-width: 720px) {
  #menu { padding: 0; align-items: flex-end; }
  #menu .mcard { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 16px 16px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  #menu header { padding: 12px 10px 2px 16px; }
  #m-tabs { padding: 2px 10px 0; }
  #m-tabs button { padding: 9px 10px 10px; }
  #m-body { padding: 2px 16px 20px; }
  .mrow { grid-template-columns: 1fr; gap: 6px; }
  .mrow .mnote { grid-column: 1; }
  .mparts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { button, .mswitch input, .mswitch input::after { transition: none; } }
.kicker small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.seat button { display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; }

/* ---------- Round 65: the lobby in sections ----------
 * You (colour, seat), Warband (cards with their four members), Captain, Rules (the rarely changed
 * ones folded under Advanced), Captains and talk; Set out stays at the bottom edge of the card.
 */
.card.lobbycard { width: min(860px, 100%); padding-bottom: 0; }
.lobbycard .lobby-head { padding-bottom: 14px; border-bottom: 1px solid var(--stroke); }
.lobbycard .lobby-head .fine { max-width: 340px; margin: 0; }
.lobbycard .kicker { margin: 0 0 6px; }
.lsec { padding: 16px 0; border-bottom: 1px solid var(--stroke); }
.lsec[hidden] { display: none; }
.lsec-h { margin: 0 0 10px; font: 600 15px var(--ui); color: var(--gold2); letter-spacing: 0.02em; }
.lsec-h small { display: block; margin-top: 2px; font: 400 13px/1.4 var(--ui); color: var(--faint); letter-spacing: 0; }
.you-row { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.you-row .grow { flex: 1 1 340px; }
.you-row .colors { padding-top: 2px; }
.you-row .colors button { width: 30px; height: 30px; border-width: 2px; }
.you-row .seat button { min-height: 0; }
.lobbycard .seat button small, .lobbycard .check small { font: 12.5px/1.35 var(--ui); }
/* The warband cards: name, what they are about, the four with their trade and people, the purse. */
.lobbycard .warbands { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; margin: 0; }
.lobbycard .wb { gap: 8px; padding: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--stroke); border-radius: 10px; }
.lobbycard .wb:hover { border-color: var(--stroke2); background: rgba(255, 255, 255, 0.05); }
.lobbycard .wb.mine { border-color: color-mix(in srgb, var(--gold) 75%, transparent); background: rgba(var(--selrgb), 0.55); box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 45%, transparent) inset; }
.wb .wbhead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lobbycard .wb b { font: 600 15px var(--ui); color: var(--paper); }
.lobbycard .wb.mine b { color: var(--gold2); }
.wb .wbpick { font: 600 12px var(--ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); white-space: nowrap; }
.lobbycard .wb small { font: 13px/1.35 var(--ui); color: var(--dim); }
.wbmen { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wbman { display: flex; align-items: center; gap: 7px; min-width: 0; }
.wbman img.portrait { width: 34px; height: 38px; flex: none; border-radius: 5px; background: rgba(0, 0, 0, 0.3); image-rendering: pixelated; object-fit: cover; }
.wbman span { display: flex; flex-direction: column; min-width: 0; font: 500 13px/1.2 var(--ui); color: var(--paper); }
.wbman span em { font-style: normal; font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lobbycard .wbstock { font: 12px var(--ui); color: var(--dim); padding-top: 6px; border-top: 1px solid var(--stroke); margin-top: auto; }
.lobbycard .wbwho { font: 12px var(--ui); }
.lobbycard .wbown { cursor: default; }
.lobbycard .wbown .row { margin: 0; }
.lobbycard .cwrow { border-radius: 8px; background: rgba(0, 0, 0, 0.18); padding: 6px; }
.lobbycard .cwsel select { font: 13px var(--ui); padding: 5px 6px; border-radius: 6px; }
.lobbycard .cwsel small { font: 12px var(--ui); color: var(--faint); }
/* Rules: the few that matter up front, the rest folded away. */
.lobbycard .rules { margin: 0; gap: 10px; }
.lobbycard .rules .check { font: 14px var(--ui) !important; color: var(--dim); }
.lobbycard .rules .check select { min-width: 220px; }
.lobbycard .mode { border-color: var(--stroke); background: rgba(255, 255, 255, 0.03); border-radius: 10px; padding: 10px 12px; }
.lobbycard .mode:has(input:checked) { border-color: color-mix(in srgb, var(--gold) 75%, transparent); background: rgba(var(--selrgb), 0.55); }
.lobbycard .mode b { font: 600 14px var(--ui); }
.lobbycard .mode small { font: 13px/1.35 var(--ui); }
.adv { border: 1px solid var(--stroke); border-radius: 10px; background: rgba(255, 255, 255, 0.02); }
.adv summary { cursor: pointer; padding: 9px 12px; font: 500 14px var(--ui); color: var(--dim); list-style: none; display: flex; align-items: center; gap: 8px; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary::before { content: "›"; display: inline-block; width: 10px; transition: transform 0.15s; color: var(--gold); font-size: 16px; line-height: 1; }
.adv[open] summary::before { transform: rotate(90deg); }
.adv summary:hover { color: var(--paper); }
.advbody { display: grid; gap: 8px; padding: 2px 12px 12px; }
.advbody .hint { font: 12px/1.35 var(--ui); color: var(--faint); margin: -4px 0 2px; }
.lobbycard .rules.locked { opacity: 1; pointer-events: auto; }
.lobbycard .rules.locked :is(select, input, .mode) { pointer-events: none; }
.lobbycard .rules.locked :is(select, .mode, .check) { opacity: 0.6; }
/* Captains and talk, then the bar with Set out. */
.lobbycard .roster li { background: rgba(255, 255, 255, 0.03); border-radius: 8px; font: 14px var(--ui); padding: 6px 10px; }
.lobbycard .roster li i { border-radius: 50%; border: 0; }
.lobbycard .chat ul { border-radius: 8px; background: rgba(0, 0, 0, 0.22); font: 13px/1.4 var(--ui); }
.lobby-go { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin: 0 -28px; padding: 12px 28px 14px; background: rgba(var(--bg2), 0.97); border-top: 1px solid var(--stroke); border-radius: 0 0 14px 14px; backdrop-filter: blur(8px); }
.lobby-go .fine { margin: 0; flex: 1; }
.lobby-go button { padding: 10px 26px; font-size: 15px; }
@media (max-width: 600px) {
  .card.lobbycard { padding: 18px 16px 0; }
  .lobby-go { margin: 0 -16px; padding: 10px 16px 12px; }
  .lobbycard .rules .check select { min-width: 0; }
  .lobbycard .warbands { grid-template-columns: 1fr; }
}
/* The sellsword sheet: abilities or the plain blow when fighting on their own. */
.abilseg { margin: 4px 0 0; }
.abilseg button.on { background: var(--on); color: var(--gold2); border-color: color-mix(in srgb, var(--gold) 70%, transparent); }

/* A solo game master has no band: the band's stores in the top bar mean nothing. */
body.gm-solo #t-day ~ .chip:not(#t-wx) { display: none; }
/* Round 64: the trade overview in the market tab. */
.tradeview { border: 1px solid rgba(244, 230, 192, 0.25); border-radius: 4px; padding: 4px 8px; margin: 6px 0; background: rgba(244, 230, 192, 0.05); }
.tradeview h3 { margin: 2px 0 4px; }
.tradeview p { margin: 3px 0; font-size: 13px; }
.tradeview .good { color: #9fd38a; }

/* Round 66: a contract won or lost, a banner with the pay. */
#cdone { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); min-width: 260px; max-width: min(460px, 90%); background: rgba(var(--bg), 0.94); border: 2px solid var(--gold); box-shadow: 0 0 0 1px #000, 0 6px 24px rgba(0, 0, 0, 0.6); padding: 8px 18px 10px; text-align: center; pointer-events: none; z-index: 6; }
#cdone.fail { border-color: #a04030; }
#cdone em { display: block; font: 600 12px var(--pix); font-style: normal; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold2); }
#cdone.fail em { color: #f0a090; }
#cdone b { display: block; font: 700 20px var(--pix); color: #f4e6c0; margin: 2px 0; }
#cdone b small { font: italic 13px var(--serif); color: var(--paper); font-weight: 400; }
#cdone p { margin: 2px 0; font: italic 13px var(--serif); color: var(--paper); }
#cdone p.why { font-style: normal; color: #f0a090; }
#cdone .gains { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 6px; }
#cdone .gains span { font: 600 14px var(--pix); color: var(--gold2); border: 1px solid #6a5020; padding: 1px 8px; background: var(--ink3); display: inline-flex; align-items: center; gap: 4px; }
#cdone .gains span.bad { color: #f0a090; border-color: #6a2a20; }
#cdone.show { animation: cdoneIn 5.6s ease both; }
@keyframes cdoneIn { 0% { opacity: 0; transform: translate(-50%, -10px) scale(0.96); } 8%, 82% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; } }
.item.cdone { opacity: 0.85; }
.item.cdone .gains { font: 12px var(--pix); color: var(--gold2); white-space: nowrap; }
.item.cdone.fail .gains { color: var(--dim); }

/* Round 66: the Captain's Path, one screen for the hero's skills and the company's ways. */
.cp-hero { margin-bottom: 6px; }
.cp-lead { border: 1px dashed var(--line); padding: 4px 8px; margin: 4px 0 8px; }
.cp-lead summary { cursor: pointer; font: 600 13px var(--pix); color: var(--gold2); }
.cpath { display: flex; flex-direction: column; gap: 8px; }
.cp-tier { border: 2px solid var(--line); background: rgba(0, 0, 0, 0.18); padding: 6px 8px; }
.cp-tier.shut { opacity: 0.55; }
.cp-tier header { display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 3px; margin-bottom: 4px; }
.cp-tier header b { font: 700 15px var(--pix); color: var(--gold2); }
.cp-tier header small { font-size: 12px; color: var(--dim); }
.cp-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 4px; }
.cp-lab { flex: none; width: 64px; font: 600 12px var(--pix); color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; padding-top: 6px; }
.cp-opts { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.cp-opt { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 4px; text-align: left; border: 1px solid var(--line); border-left: 3px solid var(--pc, var(--gold)); background: var(--ink3); max-width: 100%; }
.cp-opt img, .cp-opt i { width: 20px; height: 20px; image-rendering: pixelated; flex: none; font-style: normal; display: grid; place-items: center; color: var(--pc, var(--gold2)); }
.cp-opt span { display: flex; flex-direction: column; min-width: 0; }
.cp-opt b { font: 600 12px var(--pix); white-space: nowrap; }
.cp-opt em { font-style: normal; font-size: 12px; opacity: 0.75; white-space: nowrap; }
.cp-opt.hero { --pc: #e0b040; }
.cp-opt.feat b { color: #a8d0a0; }
.cp-opt.valor b { color: #e8c060; }
.cp-opt.sig b { color: #f0a060; }
.cp-opt.passive b { color: #c8d0e0; }
.cp-opt.crown b, .hopt.crown { color: #f0c860; }
.cp-opt.got { background: color-mix(in srgb, var(--pc, #e0b040) 22%, var(--ink3)); outline: 1px solid var(--pc, #e0b040); opacity: 1; }
.cp-opt.open { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; cursor: pointer; }
.cp-opt.locked { opacity: 0.5; }
.cp-opt.master { border-style: double; border-width: 3px 3px 3px 3px; }
.cp-opt.old { --pc: #9a8a70; }
@media (max-width: 520px) { .cp-row { flex-direction: column; gap: 2px; } .cp-lab { width: auto; padding-top: 0; } }
/* Round 66: the build menu shows the kit building that will stand in the village. */
.item.haspic { align-items: center; }
.workpic { flex: none; width: 76px; height: 58px; display: flex; align-items: flex-end; justify-content: center; background: radial-gradient(ellipse at 50% 85%, rgba(90, 120, 60, 0.55), rgba(40, 50, 30, 0.2) 70%); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.workpic img { max-width: 72px; max-height: 56px; image-rendering: auto; }
/* Round 66: on a phone the compact bar gives the weather's place to coin and rations, so they fit one line. */
@media (max-width: 520px) { #hud.hud-compact .chip.wx { display: none; } }

/* Round 67: big bands. The Sellswords tab sorts, filters and folds rows to one line; the reserve stays back. */
.bandbar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 4px 0 6px; font: 13px var(--pix); }
.bandbar label { display: inline-flex; gap: 4px; align-items: center; color: var(--dim); }
.bandbar select { max-width: 190px; }
.bandbar .bb-bulk { display: inline-flex; gap: 4px; margin-left: auto; }
.bandbar button.on { border-color: var(--gold); color: var(--gold2); }
.bandcount { margin: 2px 0 6px !important; }
.list.compact { gap: 3px; }
.list.compact .item { padding: 2px 6px; gap: 2px 8px; }
.list.compact .item .portrait { width: 26px; height: 29px; }
.list.compact .item .nm { font-size: 14px; display: inline; }
.list.compact .item .sub { display: inline; font-size: 12px; margin-left: 6px; }
.list.compact .item .tags { display: none; }
.list.compact .item .acts .tag { font-size: 12px; padding: 0 4px; }
.list.compact .item .acts button.small { padding: 1px 6px; font-size: 12px; }
.item .acts button.resv.on { border-color: #6a5020; color: var(--gold2); }
#band li.resv { opacity: 0.55; border-style: dashed; }
#band.many { gap: 2px; }
#band.many li { padding: 1px 5px 2px; font-size: 12px; }
#band.many li .pp { width: 18px; height: 20px; }
.cp-title small { font-size: 12px; color: var(--dim); text-transform: none; letter-spacing: 0; margin-left: 6px; }
.cp-hero .portrait.click { cursor: pointer; }
/* Round 70: the banner of a Valor call. */
#valorcall { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; text-align: center; z-index: 30; padding: 10px 34px 12px; max-width: min(620px, calc(100vw - 32px)); box-sizing: border-box;
  background: linear-gradient(90deg, transparent, rgba(40, 18, 70, 0.88) 18%, rgba(40, 18, 70, 0.88) 82%, transparent); border-top: 2px solid #c8a0ff; border-bottom: 2px solid #c8a0ff; }
#valorcall em { display: block; font: 13px var(--serif); font-style: italic; color: #d8c8f0; }
#valorcall b { display: block; font: 700 34px var(--pix); color: #f4e4ff; letter-spacing: 2px; text-shadow: 0 0 12px #a060ff, 2px 2px 0 #000; }
#valorcall small { display: block; font: 13px var(--serif); color: var(--paper); margin-top: 2px; }
#valorcall.go { animation: valorcall 2.6s ease-out forwards; }
@keyframes valorcall {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); filter: brightness(2.2); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(0.96); filter: brightness(1.4); }
  16% { transform: translate(-50%, -50%) scale(1); filter: none; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(1); }
}
@media (max-width: 760px) { #valorcall b { font-size: 24px; } #valorcall small { font-size: 12px; } }
@media (prefers-reduced-motion: reduce) { #valorcall.go { animation: none; } }
#valorcall.boss { background: linear-gradient(90deg, transparent, rgba(80, 14, 10, 0.9) 18%, rgba(80, 14, 10, 0.9) 82%, transparent); border-color: #ff7050; }
#valorcall.boss b { color: #ffe0d0; text-shadow: 0 0 12px #ff4020, 2px 2px 0 #000; }
#valorcall.boss em { color: #f0c0b0; }
/* Round 72: the boss bar across the top of a boss fight. */
#bossbar { position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 48px); left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 16px)); z-index: 12; pointer-events: none; display: flex; flex-direction: column; gap: 6px; }
#bossbar .bb { background: linear-gradient(180deg, rgba(40, 10, 8, 0.9), rgba(18, 8, 8, 0.9)); border: 1px solid #a8483a; border-radius: 8px; padding: 6px 10px 8px; box-shadow: 0 0 14px color-mix(in srgb, var(--aura) 45%, transparent), 0 4px 14px rgba(0, 0, 0, 0.5); }
#bossbar .bbtop { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
#bossbar .bbname { font: 700 18px var(--pix); color: #ffe6d6; text-shadow: 0 0 8px var(--aura), 1px 1px 0 #000; letter-spacing: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#bossbar .bbph { font: 12px var(--ui, var(--serif)); color: #f0c8b8; white-space: nowrap; text-transform: uppercase; letter-spacing: 1px; }
#bossbar .rage .bbph { color: #ff7050; font-weight: 700; animation: bbrage 0.9s ease-in-out infinite alternate; }
@keyframes bbrage { from { text-shadow: 0 0 2px #ff3010; } to { text-shadow: 0 0 10px #ff3010; } }
#bossbar .bbbar { position: relative; height: 16px; background: #1a0c0a; border: 1px solid #000; border-radius: 4px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8); }
#bossbar .bbbar i { position: absolute; left: 0; top: 0; bottom: 0; }
#bossbar .bbghost { background: #f0d8a0; transition: width 0.9s ease-in 0.35s; opacity: 0.75; }
#bossbar .bbfill { background: linear-gradient(180deg, #ff6a50, #b8221a 60%, #8a1410); transition: width 0.15s; }
#bossbar .rage .bbfill { background: linear-gradient(180deg, #ff8a40, #e0300e 60%, #a01a08); }
#bossbar .bbarmw { position: relative; height: 3px; margin-top: 3px; background: rgba(0, 0, 0, 0.5); border-radius: 2px; overflow: hidden; }
#bossbar .bbarm { position: absolute; left: 0; top: 0; bottom: 0; background: #b8c8d8; transition: width 0.15s; }
body.bossfight #journal { display: none; }
#bossbar .bbbar s { position: absolute; top: -1px; bottom: -1px; width: 2px; margin-left: -1px; background: #fff0c0; box-shadow: 0 0 4px #ffd080; text-decoration: none; }
#bossbar .bbbar s::after { content: ""; position: absolute; top: 0; left: -3px; border: 4px solid transparent; border-top-color: #fff0c0; }
#bossbar .bbbar s.past { background: rgba(0, 0, 0, 0.55); box-shadow: none; }
#bossbar .bbbar s.past::after { border-top-color: rgba(0, 0, 0, 0.55); }
#bossbar .bbhp { position: absolute; right: 6px; top: 0; bottom: 0; font: 700 11px/16px var(--ui, var(--serif)); color: #fff; text-shadow: 1px 1px 0 #000; font-style: normal; }
@media (max-width: 720px) { body.bossfight #band { top: calc(max(8px, env(safe-area-inset-top)) + 106px); } }
@media (max-width: 760px) { #bossbar { top: calc(max(8px, env(safe-area-inset-top)) + 42px); } #bossbar .bb { padding: 4px 8px 6px; } #bossbar .bbname { font-size: 14px; } #bossbar .bbph { font-size: 10px; } #bossbar .bbbar { height: 12px; } #bossbar .bbhp { font-size: 10px; line-height: 12px; } }

/* Round 74: colour-blind team colours (style.js TEAMS "cb"): your side's bars blue instead of green. */
body[data-team="cb"] #band li .hb i { background: #4a90e0; }

/* Round 74: the supplies bar names its values on wide screens; a tap or click shows the full note. */
.chip .lbl { display: none; font: inherit; font-style: normal; font-weight: 400; opacity: 0.72; margin-right: 1px; }
@media (min-width: 1200px) { .chip .lbl { display: inline; } }
#top .chip { cursor: help; }
#top #t-day { cursor: pointer; }
#top .chip:focus-visible { outline: 2px solid var(--gold, #e0b050); outline-offset: -2px; }
#chiptip { position: fixed; z-index: 60; max-width: min(320px, calc(100vw - 16px)); padding: 6px 10px; font: 400 13px/1.35 var(--ui, var(--serif)); color: #f0e8d8; background: rgba(16, 14, 12, 0.94); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); pointer-events: none; }

/* Round 74: fight HUD layering. The journal steps aside for the whole fight; the phase banner is a small
   pill under the top HUD (main.js sets --fighttop below the boss bar and the turn strip); the bars' tip is
   a small note in a corner that can be closed. */
#hud.fight #journal { display: none !important; }
#hud.fight #banner { top: var(--fighttop, 56px); bottom: auto; font-size: 17px; padding: 3px 12px; white-space: normal; width: max-content; max-width: min(560px, calc(100vw - 24px)); }
#hud.fight #banner small { display: inline; font-size: 12px; margin: 0 0 0 8px; }
#bartip { position: absolute; left: 8px; top: var(--fighttop, 56px); z-index: 13; max-width: min(250px, 56vw); background: rgba(var(--bg), 0.9); border: 1px solid var(--line); border-radius: 6px; padding: 5px 26px 6px 8px; font: 12px/1.35 var(--ui, var(--pix)); color: var(--paper); cursor: pointer; }
#bartip b { color: var(--gold2); margin-right: 4px; }
#bartip .long, #bartip.open .short { display: none; }
#bartip.open .long { display: inline; }
#bartip button { position: absolute; top: 2px; right: 2px; min-width: 0; min-height: 0; padding: 0 5px; font-size: 11px; }
/* Deploying: the bar says how many stand placed and holds one big Fight! button. */
#battlebar.deploy { grid-template-columns: 1fr auto; grid-template-areas: "who side"; align-items: center; }
#battlebar.deploy :is(#bb-acts, #bb-valor, #bb-more, #bb-fold, #bb-cpace, #bb-cam) { display: none !important; }
#battlebar.deploy #bb-who { display: block !important; min-width: 0; }
#battlebar.deploy #bb-who b { display: block; margin: 0; }
#battlebar.deploy #bb-go { font-size: 20px; padding: 8px 30px; min-width: 150px; min-height: 48px; }
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  #battlebar.deploy { padding: 6px 8px; }
  #battlebar.deploy #bb-who b { font-size: 15px; }
  #battlebar.deploy #bb-go { font-size: 18px; padding: 6px 18px; min-width: 104px; }
}
/* Phones in a fight (or under an open panel): the band list folds to a thin strip of portraits. */
@media (max-width: 720px) {
  #hud.fight #band, body:has(#panel:not([hidden])) #band { width: 38px; top: calc(max(8px, env(safe-area-inset-top)) + 52px); gap: 3px; }
  body.bossfight #hud.fight #band { top: calc(max(8px, env(safe-area-inset-top)) + 106px); }
  :is(#hud.fight, body:has(#panel:not([hidden])) #hud) #band li { grid-template-columns: auto; padding: 2px 2px 3px; border-left-width: 3px; }
  :is(#hud.fight, body:has(#panel:not([hidden])) #hud) #band li :is(.nm, .lv) { display: none; }
  :is(#hud.fight, body:has(#panel:not([hidden])) #hud) #band li .pp { grid-row: auto; margin: 0; }
  :is(#hud.fight, body:has(#panel:not([hidden])) #hud) #band li .hb { grid-column: 1; }
}
/* The camp card stands left of the band list instead of over it; the road log keeps clear of a story line. */
@media (min-width: 721px) { #panel.campview { padding-right: 188px; } }
body:has(#dialog:not([hidden])) #log { width: min(420px, calc(50vw - 380px)); }
@media (max-width: 1100px) { body:has(#dialog:not([hidden])) #log { display: none; } }
@media (max-width: 720px) { #bartip { top: calc(var(--fighttop, 56px) + 36px); } }

/* ---------- Round 74: the quick-start lobby ----------
   Warband, difficulty and one big Set out; the rest folds under Customize (remembered). */
.lobby-go .qdiff { font: 14px var(--ui) !important; color: var(--dim); display: flex; align-items: center; gap: 8px; margin: 0; }
.lobby-go .qdiff select { min-width: 0; }
.lcustom { border-bottom: 1px solid var(--stroke); }
.lcustom > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; padding: 14px 0; font: 600 15px var(--ui); color: var(--gold2); }
.lcustom > summary::-webkit-details-marker { display: none; }
.lcustom > summary::before { content: "›"; display: inline-block; width: 10px; color: var(--gold); transition: transform 0.15s; }
.lcustom[open] > summary::before { transform: rotate(90deg); }
.lcustom > summary small { font: 400 13px var(--ui); color: var(--faint); }
.lcustom > .lsec:last-child { border-bottom: 0; }
.lobby-go #start { padding: 12px 40px; font-size: 17px; }
@media (max-width: 600px) {
  .lobbycard .lobby-head .fine { display: none; }
  .lobbycard .lobby-head { padding-bottom: 8px; }
  .lobbycard .code { font-size: 34px; margin: 0; }
  .lobbycard .wb small { display: none; }
  .lobbycard .wb.mine small, .lobbycard .wbown small { display: block; }
  .lobby-go { flex-wrap: wrap; }
  .lobby-go .qdiff { flex: 1 1 100%; }
  .lobby-go .qdiff select { flex: 1; }
  .lcustom > summary small { display: none; }
  /* A short pinned footer: just the buttons, Set out the widest. */
  .lobby-go { gap: 8px; padding: 8px 16px 10px; }
  .lobby-go .fine { display: none; }
  .lobby-go #start { flex: 1; padding: 12px 10px; }
  .lobby-go #start-solo { padding: 10px 10px; font-size: 13px; }
}

/* Round 74: one-time tips, small toasts above the action bar (dismiss with ✕; they go on their own). */
#tips { position: absolute; left: 50%; bottom: 178px; transform: translateX(-50%); display: grid; gap: 6px; width: min(420px, calc(100% - 32px)); z-index: 7; pointer-events: none; }
#tips .tip { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; background: rgba(var(--bg), 0.95); border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent); border-left: 3px solid var(--gold); border-radius: var(--r, 8px); padding: 8px 8px 8px 12px; box-shadow: var(--shadow); font: 13.5px/1.4 var(--ui); color: var(--paper); animation: tipin 0.25s ease-out; }
#tips .tip p { margin: 0; flex: 1; }
#tips .tip button { flex: none; min-width: 28px; }
@keyframes tipin { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 600px) { #tips { bottom: 150px; } #tips .tip { font-size: 12.5px; } }
/* Round 74: at an old camp the Camp button is the way in. */
#b-camp.here { border-color: var(--gold); box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 60%, transparent), 0 0 12px color-mix(in srgb, var(--gold) 35%, transparent); }
.chapters.acts li span { display: block; font-size: 13px; color: var(--dim); }
/* Round 74 (integration): in a fight the one-time tips stand bottom-right above the fight bar, off the field's middle. */
#hud.fight #tips { left: auto; right: 12px; transform: none; bottom: 120px; width: min(340px, calc(100% - 24px)); }
@media (max-width: 720px) { #hud.fight #tips { right: 50px; bottom: 150px; } }

/* ---------- Round 77: one type system ----------
 * Three faces, each with one job:
 *   --font-display  titles: screen and dialog headings, banners, the names of lands (an interface style may swap it)
 *   --font-text     the narrator: story lines, descriptions, lore (Alegreya)
 *   --font-ui       everything you press or read off: buttons, labels, lists, numbers (Inter, tabular figures)
 *   --font-pixel    the company code only (and what the canvas draws itself)
 * The older names (--head, --serif, --ui, --pix, --pixel) stay as aliases. Nothing below 12px.
 */
:root {
  --font-display: "Cinzel", "Alegreya", Georgia, serif;
  --font-text: "Alegreya", Georgia, "Times New Roman", serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-pixel: "Pixelify Sans", ui-monospace, monospace;
  --head: var(--font-display);
  --serif: var(--font-text);
  --ui: var(--font-ui);
  --pix: var(--font-ui);
  --pixel: var(--font-pixel);
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px;
}
body[data-ui="plain"] { --head: var(--font-display); }
html, body { font-family: var(--font-ui); font-size: 15px; line-height: 1.45; font-feature-settings: "tnum" 1, "cv11" 1; -webkit-font-smoothing: antialiased; }
/* Titles. */
.card h1, .pcard h2, #menu h2, #lookdlg h2, #banner, #region, #arrive b, #valorcall b, #bossbar .bbname, #cdone b { font-family: var(--head); }
/* The narrator's voice. */
.card .lede, #d-text, #journal #j-goal, #p-body > p:not(.fine):not(.warn), #p-body .bio, #p-body .goal, #p-body .oath, #p-body .taunt, #p-body .why, ul.report li, ol.chapters li, .gm-card p, #arrive small, #region small, #banner small, #valorcall :is(em, small), #cdone p, #cdone b small { font-family: var(--font-text); }
#p-body > p:not(.fine):not(.warn), ul.report li { font-size: 16px; line-height: 1.5; }
/* Everything read off or pressed. */
#p-body, #m-body, #gm-body, .card, .dlg, #lookdlg .lcard, #battlebar, #top, #band, #log, #acts { font-family: var(--font-ui); }
#p-body { font-size: var(--fs-md); line-height: 1.45; }
#p-body :is(.item, table, .stats, .list, .fine, .tags, label, li, td, th) { font-family: var(--font-ui); }
#p-body ol.chapters li, #p-body ul.report li { font-family: var(--font-text); }
#p-body ol.chapters li b { font-family: var(--font-ui); }
.item .nm { font: 600 15px/1.3 var(--font-ui); }
.item .sub { font: 400 13px/1.4 var(--font-ui); color: var(--dim); }
.tag, .price, .legend, .threat, .foes span { font-family: var(--font-ui); }
.fine { font: 400 13px/1.45 var(--font-ui); }
.wb b, #dmgtip :is(b, .kill, .maybe), #bb-tip b { font-family: var(--font-ui); }
.code, .mcode b { font-family: var(--font-pixel); }
.mercy h4, #p-body h4 { font: 600 var(--fs-sm) var(--font-ui); letter-spacing: 0.04em; }
.seat button small, .mode small, .check small { font-family: var(--font-ui); }
#d-who { font-family: var(--font-ui); }
#d-text { font-size: 18px; line-height: 1.5; }
/* Nothing below 12px. */
#bb-acts button .cd, #battlebar button.ic kbd, #bb-valor button.ic em, #bb-more em, #bartip button, #bossbar .bbhp, .wbman span em { font-size: 12px; }
@media (max-width: 760px) { #bossbar .bbph { font-size: 12px; } }
/* Phones: the supplies bar stays on one line in the wider face. */
@media (max-width: 600px) { #top .chip { padding: 5px 6px; gap: 4px; letter-spacing: -0.01em; } }

/* ---------- Round 77: dialogs, one build ----------
 * A header (title in the display face, a round close button), a body with the same gutters, and a
 * clear order of buttons: one filled primary, outlined seconds, quiet thirds.
 */
:root { --dlg-x: 22px; --dlg-r: 16px; }
.pcard, #menu .mcard, #lookdlg .lcard { border-radius: var(--dlg-r); background: rgba(var(--bg2), 0.975); }
.pcard header, #menu header { padding: 16px 14px 8px var(--dlg-x); gap: 10px; align-items: center; }
#lookdlg header { padding: 14px 0 8px; }
.pcard h2, #menu h2, #lookdlg h2 { font-size: 22px; font-weight: 600; line-height: 1.15; letter-spacing: 0.04em; }
#p-title small { font: italic 400 13px var(--font-text); letter-spacing: 0; margin-top: 2px; color: var(--dim); }
#p-close, #m-close, #lookdlg header button { flex: none; width: 36px; height: 36px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.04); border: 1px solid transparent; color: var(--dim); font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
:is(#p-close, #m-close, #lookdlg header button):hover:not(:disabled) { color: var(--paper); background: rgba(255, 255, 255, 0.1); border-color: var(--stroke2); }
#p-tabs, #m-tabs { padding: 0 calc(var(--dlg-x) - 10px); }
#p-body, #m-body { padding: 14px var(--dlg-x) 22px; }
#p-body h3, #m-body h3, #gm-body h4 { font: 600 var(--fs-xs) var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin: 20px 0 8px; }
#p-body > h3:first-child { margin-top: 4px; }
#p-body .row { margin: 12px 0; gap: 8px; align-items: center; }
#p-body > .row:last-child { margin-bottom: 0; }
.item { border: 1px solid var(--stroke); border-radius: 10px; background: rgba(255, 255, 255, 0.03); padding: 8px 10px; }
.item .portrait { border-radius: 6px; }
.tag { border-radius: 5px; padding: 1px 7px; font-size: 12px; }
.mercy { border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); border-radius: 12px; background: rgba(var(--selrgb), 0.3); padding: 12px; margin: 14px 0 4px; }
.mercy h4 { margin: 0 0 4px; color: var(--gold2); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; }
.mercy .fine { margin: 0 0 8px; color: var(--dim); }
/* Buttons: the filled one leads. */
button { font-family: var(--font-ui); }
button.primary { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 2px 8px rgba(0, 0, 0, 0.3); }
#p-body .row > button.primary:only-child, .rw-go button.primary { min-width: 140px; padding: 10px 22px; font-size: 15px; }
.dlg { padding: 16px 20px 12px; border-radius: var(--dlg-r) var(--dlg-r) 12px 12px; }
#d-choices { display: grid; gap: 6px; }
@media (max-width: 600px) {
  :root { --dlg-x: 16px; }
  .pcard header, #menu header { padding: 12px 10px 6px var(--dlg-x); }
  .pcard h2, #menu h2 { font-size: 20px; }
  #p-body, #m-body { padding: 12px var(--dlg-x) 18px; }
}

/* ---------- Round 77: the lobby's pinned bar ----------
 * The card scrolls in itself (not the screen behind it), so the bar sits on the card's own bottom edge:
 * opaque, a fade above it, and room under the last row so nothing hides behind or peeks out below.
 */
#lobby.screen { overflow: hidden; align-items: stretch; }
.card.lobbycard { max-height: 100%; overflow-y: auto; overscroll-behavior: contain; margin: auto; scroll-padding-bottom: 96px; }
.lobbycard > .lcustom { margin-bottom: 18px; border-bottom: 0; }
.lobby-go { z-index: 3; background: rgb(var(--bg2)); backdrop-filter: none; border-top: 1px solid var(--stroke2); border-radius: 0; box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.35); }
.lobby-go::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 28px; margin-bottom: 1px; background: linear-gradient(to top, rgb(var(--bg2)), rgba(var(--bg2), 0)); pointer-events: none; }
.lobby-go .qdiff { font-family: var(--font-ui) !important; }
.lobby-go .fine { flex: 1 1 0; min-width: 0; font-size: 12px; text-wrap: balance; }
.lobby-go button { flex: none; white-space: nowrap; }
.card .lede { font-size: 17px; line-height: 1.5; }
.lobbycard .wb small, .wbown small { letter-spacing: 0; }
@media (max-width: 600px) {
  #lobby.screen { padding: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .lobby-go { padding-bottom: 12px; }
}

/* ---------- Round 77: the reward screen after a fight (main.js rewardHtml) ---------- */
.ico.hide { background: linear-gradient(160deg, #c9965a, #7a4f28); clip-path: polygon(18% 0, 38% 12%, 62% 12%, 82% 0, 100% 22%, 86% 46%, 100% 78%, 78% 100%, 50% 88%, 22% 100%, 0 78%, 14% 46%, 0 22%); }
.ico.relic { background: linear-gradient(135deg, #bfe6ff, #6a8fe0 55%, #3a4aa8); clip-path: polygon(50% 0, 100% 38%, 50% 100%, 0 38%); }
.ico.foes { background: #cfc8ba; clip-path: polygon(46% 0, 60% 0, 60% 58%, 82% 58%, 82% 70%, 60% 70%, 60% 100%, 46% 100%, 46% 70%, 24% 70%, 24% 58%, 46% 58%); transform: rotate(180deg); }
#panel.reward .pcard { width: min(680px, 100%); position: relative; border-color: color-mix(in srgb, var(--gold) 38%, transparent); animation: rw-card 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.15) both; }
#panel.reward:has(.rw.rout) .pcard { border-color: color-mix(in srgb, var(--red) 45%, transparent); }
#panel.reward .pcard header { position: absolute; top: 0; right: 0; z-index: 2; padding: 10px; }
#panel.reward #p-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#panel.reward #p-body { padding-top: 0; }
.rw { --rw: var(--gold); --rw2: var(--gold2); }
.rw.rout { --rw: var(--red); --rw2: #f0b0a0; }
.rw-head { margin: 0 calc(-1 * var(--dlg-x)) 16px; padding: 26px var(--dlg-x) 18px; text-align: center; background: radial-gradient(ellipse 70% 120% at 50% 0, color-mix(in srgb, var(--rw) 26%, transparent), transparent 72%); border-bottom: 1px solid color-mix(in srgb, var(--rw) 28%, transparent); }
.rw-crest { display: block; width: 150px; height: 10px; margin: 0 auto 10px; background: linear-gradient(90deg, transparent, var(--rw) 30%, var(--rw) 70%, transparent) center / 100% 1px no-repeat; position: relative; }
.rw-crest::after { content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -5px 0 0 -5px; background: var(--rw2); transform: rotate(45deg); box-shadow: 0 0 12px var(--rw); }
.rw-title { font: 600 38px/1.05 var(--head); letter-spacing: 0.1em; text-transform: uppercase; color: var(--rw2); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5), 0 0 26px color-mix(in srgb, var(--rw) 45%, transparent); animation: rw-title 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.rw-head .rw-sub { margin: 6px 0 0; font: italic 16px/1.4 var(--font-text); color: var(--dim); }
.rw-loot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 18px; }
.rw-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px 7px 10px; border-radius: 999px; background: rgba(var(--selrgb), 0.6); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); font: 500 var(--fs-sm)/1.2 var(--font-ui); color: var(--dim); animation: rw-pop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; animation-delay: calc(0.25s + var(--i, 0) * 0.07s); }
.rw-chip .ico { width: 16px; height: 16px; flex: none; }
.rw-chip b { font: 700 16px/1 var(--font-ui); color: var(--gold2); font-variant-numeric: tabular-nums; }
.rw-chip em { font-style: normal; }
.rw-chip.plain { background: rgba(255, 255, 255, 0.04); border-color: var(--stroke2); }
.rw-chip.plain b { color: var(--paper); }
.rw-chip.item b { font-size: 14px; font-weight: 600; }
.rw-chip.loss { background: color-mix(in srgb, var(--red) 14%, transparent); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.rw-chip.loss b { color: #f0a898; }
.rw-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.rw-unit { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 10px; border: 1px solid var(--stroke); border-radius: 12px; background: rgba(255, 255, 255, 0.035); animation: rw-rise 0.4s ease-out both; animation-delay: calc(0.3s + var(--i, 0) * 0.06s); }
.rw-pic { position: relative; flex: none; line-height: 0; }
.rw-pic .portrait { width: 46px; height: 52px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); }
.rw-who { display: grid; gap: 3px; min-width: 0; flex: 1; }
.rw-who > b { font: 600 14px/1.2 var(--font-ui); color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-lv { font: 500 12px/1.2 var(--font-ui); color: var(--dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rw-lv strong { color: var(--gold2); font-weight: 700; }
.rw-lv em { font-style: normal; color: var(--green); margin-left: 4px; }
.rw-xp { display: block; height: 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.45); box-shadow: inset 0 0 0 1px var(--stroke); overflow: hidden; }
.rw-xp i { display: block; height: 100%; width: var(--to); border-radius: 3px; background: linear-gradient(90deg, #5f9bd6, #9fd0ff); animation: rw-xp 1s cubic-bezier(0.3, 0.7, 0.2, 1) 0.65s both; }
.rw-st { font: 600 12px/1.25 var(--font-ui); letter-spacing: 0.02em; }
.rw-st small { display: block; font: 400 12px/1.25 var(--font-ui); opacity: 0.85; }
.rw-st.lvl { color: var(--gold2); text-transform: uppercase; letter-spacing: 0.1em; }
/* Level up: the bar runs out, starts again, and the card takes the gold. */
.rw-unit.up { border-color: color-mix(in srgb, var(--gold) 70%, transparent); background: rgba(var(--selrgb), 0.55); box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent) inset, 0 0 18px color-mix(in srgb, var(--gold) 18%, transparent); }
.rw-unit.up .rw-xp i { background: linear-gradient(90deg, var(--gold), var(--gold2)); animation: rw-xpup 1.5s cubic-bezier(0.3, 0.7, 0.2, 1) 0.65s both; }
.rw-up { position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 700 12px/1 var(--font-ui); font-style: normal; color: var(--pri-ink, #1b1409); background: var(--gold2); box-shadow: 0 0 0 2px rgb(var(--bg2)), 0 0 10px var(--gold); animation: rw-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.5) 1.5s both; }
/* Hurt, out of action, fallen, in reserve. */
.rw-unit.hurt { border-color: color-mix(in srgb, #e0a050 55%, transparent); }
.rw-unit.hurt .rw-st { color: #f0b868; }
.rw-unit.bad { border-color: color-mix(in srgb, var(--red) 65%, transparent); background: color-mix(in srgb, var(--red) 10%, transparent); }
.rw-unit.bad .rw-st { color: #f0a090; }
.rw-unit.bad .rw-pic .portrait { box-shadow: 0 0 0 2px var(--red); }
.rw-unit.dead { border-style: dashed; border-color: var(--stroke2); background: rgba(0, 0, 0, 0.3); }
.rw-unit.dead .rw-pic .portrait { filter: grayscale(1) brightness(0.55); }
.rw-unit.dead .rw-who > b { color: var(--dim); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.35); }
.rw-unit.dead .rw-st { color: var(--dim); text-transform: uppercase; letter-spacing: 0.12em; }
.rw-x { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 400 26px/1 var(--font-text); font-style: normal; color: #e8e0d0; text-shadow: 0 1px 4px #000; }
.rw-unit.dim { opacity: 0.62; }
.rw-unit.dim .rw-st { color: var(--faint); font-weight: 500; }
.rw-band.many { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 6px; }
.rw-band.many .rw-unit { padding: 6px 8px; gap: 8px; }
.rw-band.many .rw-pic .portrait { width: 34px; height: 38px; }
.rw .rw-text { margin: 16px 0 0; padding: 10px 14px; border-left: 2px solid color-mix(in srgb, var(--rw) 60%, transparent); background: rgba(255, 255, 255, 0.03); border-radius: 0 8px 8px 0; font: 15px/1.5 var(--font-text); color: var(--paper); }
#p-body .row.rw-go { justify-content: center; margin-top: 18px; }
.rw-go button.primary { min-width: 180px; padding: 12px 28px; font-size: 16px; }
@keyframes rw-card { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
@keyframes rw-title { from { opacity: 0; letter-spacing: 0.32em; transform: scale(1.12); } }
@keyframes rw-pop { from { opacity: 0; transform: scale(0.6); } }
@keyframes rw-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes rw-xp { from { width: var(--from); } }
@keyframes rw-xpup { 0% { width: var(--from); } 48% { width: 100%; } 49% { width: 100%; opacity: 0; } 50% { width: 0; opacity: 0; } 51% { width: 0; opacity: 1; } 100% { width: var(--to); } }
@media (max-width: 600px) {
  .rw-head { padding: 22px var(--dlg-x) 14px; margin-bottom: 12px; }
  .rw-title { font-size: 30px; }
  .rw-loot { gap: 6px; margin-bottom: 12px; }
  .rw-chip { padding: 6px 10px 6px 8px; }
  .rw-band { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .rw-unit { padding: 7px 8px; gap: 8px; }
  .rw-pic .portrait { width: 38px; height: 43px; }
  .rw-go button.primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #panel.reward .pcard, .rw-title, .rw-chip, .rw-unit, .rw-up, .rw-xp i, .rw-unit.up .rw-xp i { animation: none; }
}

/* Round 77: the captain's one skill tree: branches (the Captain's, round 82; the six ways) down, tiers across. */
.ctree { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.ct-head, .ct-br { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px 8px; }
.ct-head { padding: 0 8px 0 10px; }
.ct-head > div { font: 700 13px var(--pix); color: var(--gold2); text-align: center; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.ct-head small { display: block; font: 400 11px var(--pix); color: var(--dim); }
.ct-head > div.shut { opacity: 0.55; }
.ct-br { border: 2px solid var(--line); border-left: 4px solid var(--pc, var(--gold)); background: rgba(0, 0, 0, 0.18); padding: 5px 8px 6px; align-items: start; }
.ct-br.own { background: color-mix(in srgb, var(--pc, #e0b040) 9%, rgba(0, 0, 0, 0.18)); }
.ct-br > header { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; text-align: left; }
.ct-br > header b { font: 700 13px var(--pix); color: var(--pc, var(--gold2)); }
.ct-br > header small { font-size: 11px; line-height: 1.25; color: var(--dim); }
.ct-cell { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ct-cell.shut { opacity: 0.6; }
.ct-cell .cp-opt { width: 100%; min-width: 0; }
.ct-cell .cp-opt b, .ct-cell .cp-opt em { white-space: normal; overflow-wrap: anywhere; line-height: 1.15; }
.ct-br.way .ct-cell + .ct-cell:not(.none)::before { content: "›"; position: absolute; left: -8px; top: 7px; width: 8px; text-align: center; font: 700 13px var(--pix); color: var(--pc, var(--dim)); opacity: 0.8; }
.ct-legacy { margin: 6px 0; padding: 6px 8px; border-left: 3px solid #c9a24a; background: rgba(201, 162, 74, 0.08); }
.ct-legacy p { margin: 0 0 6px; }
.ct-legacy .lg { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; cursor: pointer; }
.ct-legacy .lg input { width: auto; flex: 0 0 auto; margin-top: 3px; }
.ct-legacy .lg small { display: block; opacity: 0.8; }
.cp-hero .sub.warn { color: #e0a060; }
@media (max-width: 760px) {
  .ct-head { display: none; }
  .ct-br { display: flex; flex-wrap: wrap; gap: 4px; }
  .ct-br > header { flex: 1 0 100%; }
  .ct-cell.none { display: none; }
  .ct-br.own .ct-cell { flex: 1 0 100%; flex-direction: row; flex-wrap: wrap; padding-left: 26px; }
  .ct-br.own .ct-cell .cp-opt { width: auto; }
  .ct-br.way .ct-cell { flex: 1 1 calc(50% - 4px); padding-left: 22px; }
  .ct-cell::before, .ct-br.way .ct-cell + .ct-cell:not(.none)::before { content: attr(data-tier); position: absolute; left: 0; top: 7px; width: 20px; text-align: center; font: 700 12px var(--pix); color: var(--dim); opacity: 1; }
}
.lobbyhero .cap-who { margin: 0 0 8px; font: 400 14px/1.45 var(--ui); }
.lobbyhero .cap-edit { border: 1px solid var(--line); padding: 6px 10px; margin: 0 0 6px; }
.lobbyhero .cap-edit > summary { cursor: pointer; font: 600 14px var(--ui); color: var(--gold2); }
.lobbyhero .cap-edit > summary small { font-weight: 400; color: var(--dim); margin-left: 6px; }
.ct-cell .cp-opt.feat { margin-left: 0; }

/* ---------- Round 79: fast graphics (body[data-perf="fast"]): nothing the browser has to blend over the moving picture ---------- */
body[data-perf="fast"] #view { filter: none !important; }
body[data-perf="fast"] #grade { display: none; }
body[data-perf="fast"] *, body[data-perf="fast"] *::before, body[data-perf="fast"] *::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }

/* ---------- Round 80: the coach (coach.js, coachui.js): a small card, a ring round what it points at ---------- */
#coach { position: fixed; z-index: 7; left: 8px; top: 120px; width: 330px; max-width: calc(100% - 16px); box-sizing: border-box; padding: 9px 12px 10px; background: rgba(var(--bg), 0.96); border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); border-left: 3px solid var(--gold); border-radius: var(--r); box-shadow: var(--shadow); font: 400 14px/1.42 var(--ui); color: var(--paper); }
#coach[hidden], #coach-ring[hidden], #coach-mark[hidden] { display: none; }
#coach header { display: flex; align-items: center; gap: 8px; min-height: 22px; }
#coach .ck { flex: 1; font: 600 11px var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
#coach .ct { display: block; font: 600 15px/1.3 var(--ui); color: var(--gold2); margin: 2px 0 3px; }
#coach p { margin: 0 0 9px; }
#coach .crow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#coach .crow .quiet { margin-left: auto; background: none; border-color: transparent; color: var(--dim); }
#coach .crow .quiet:hover { color: var(--paper); }
#coach .cx { flex: none; min-width: 30px; padding: 3px 8px; background: none; border-color: transparent; color: var(--dim); }
#coach .cfine { display: block; margin-top: 7px; color: var(--faint); font-size: 12px; }
#coach.offer { border-left-width: 1px; padding: 12px 14px; }
#coach.offer .ct { font: 600 17px/1.25 var(--head); margin-bottom: 5px; }
#coach.fold { padding: 4px 6px 4px 12px; width: auto !important; max-width: min(330px, calc(100% - 16px)); }
#coach.fold .ck { flex: none; }
#coach.fold .ct { flex: 1; margin: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#coach-ring, #coach-mark { position: fixed; z-index: 7; pointer-events: none; box-sizing: border-box; border: 2px solid var(--gold2); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55), 0 0 12px color-mix(in srgb, var(--gold) 70%, transparent); animation: coachPulse 1.5s ease-in-out infinite; }
#coach-ring { border-radius: 11px; }
#coach-mark { left: -30px; top: -22px; width: 60px; height: 44px; border-radius: 50%; }
@keyframes coachPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
/* A window in the middle of a small screen makes room for the card below it. */
#panel.coached { align-items: flex-start; padding-bottom: calc(var(--coach-h, 0px) + 18px); }
#panel.coached .pcard { max-height: 100%; }
.coachlist { margin: 4px 0 0; padding: 0; list-style: none; columns: 2; column-gap: 18px; font-size: 14px; }
.coachlist li { padding: 3px 0; color: var(--dim); break-inside: avoid; }
.coachlist li i { display: inline-block; width: 18px; font-style: normal; color: var(--gold2); }
.coachlist li.done { color: var(--paper); }
.coachlist li.now { color: var(--gold2); font-weight: 600; }
.coachlist li.skipped { color: var(--faint); }
.coachlist li small { color: var(--faint); }
@media (max-width: 720px) {
  #coach { font-size: 13.5px; padding: 7px 10px 8px; }
  #coach p { margin-bottom: 7px; }
  .coachlist { columns: 1; }
}
@media (prefers-reduced-motion: reduce) { #coach-ring, #coach-mark { animation: none; } }
/* Fast graphics: the ring stands still (nothing blended over the moving picture). */
body[data-perf="fast"] #coach-ring, body[data-perf="fast"] #coach-mark { animation: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55); }

/* ---------- Round 80: the start menu's helper (startcoach.js): the coach's card and ring over the title and the lobby ---------- */
#startcoach { position: fixed; z-index: 9; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: 380px; max-width: calc(100% - 16px); box-sizing: border-box; padding: 10px 13px 11px; background: rgb(var(--bg)); border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); border-left: 3px solid var(--gold); border-radius: var(--r); box-shadow: var(--shadow); font: 400 14px/1.42 var(--ui); color: var(--paper); }
#startcoach.top { bottom: auto; top: max(12px, env(safe-area-inset-top)); }
#startcoach[hidden], #start-ring[hidden] { display: none; }
#startcoach .ck { font: 600 11px var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
#startcoach .ct { display: block; font: 600 15px/1.3 var(--ui); color: var(--gold2); margin: 2px 0 3px; }
#startcoach.offer .ct { font: 600 17px/1.25 var(--head); margin-bottom: 5px; }
#startcoach p { margin: 0 0 9px; }
#startcoach .crow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#startcoach .crow .quiet { margin-left: auto; background: none; border-color: transparent; color: var(--dim); }
#start-ring { position: fixed; z-index: 8; pointer-events: none; box-sizing: border-box; border: 2px solid var(--gold2); border-radius: 11px; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55), 0 0 12px color-mix(in srgb, var(--gold) 70%, transparent); animation: coachPulse 1.5s ease-in-out infinite; }
/* A wide screen has room beside the card of the title and the lobby. */
@media (min-width: 1320px) { #startcoach, #startcoach.top { left: auto; right: 14px; top: auto; bottom: 14px; transform: none; width: 272px; } }
.starthelp { margin: 8px 0 0; }
.starthelp button, .starthelp-l { background: none; color: var(--dim); }
@media (prefers-reduced-motion: reduce) { #start-ring { animation: none; } }
body[data-perf="fast"] #start-ring { animation: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55); }

/* ---------- Round 80: the band's list can be off (Menu, Display, Band list; off on phones by default) ---------- */
body[data-band="off"] #band { display: none; }

/* ---------- Round 81: fatigue always in the top bar (a short meter on a phone); no zoom in the bottom bar ----------
   Zoom stays on the wheel and + / − keys, two fingers, and the round + and − buttons on a touch screen. */
#zoomseg { display: none !important; }
@media (max-width: 600px) { #t-fat-chip .meter { width: 26px; } #t-day .cn { display: none; } }

/* ---------- Round 81: a narrow phone's fight bar in two rows: the abilities get the whole width, the
   buttons (⋯, Copilot, Rules, End turn) sit under them. In one row the buttons left the abilities a
   sliver (one icon, half cut off, on a 360px screen). ---------- */
@media (max-width: 600px) {
  #battlebar:not(.deploy) { grid-template-columns: 1fr; grid-template-areas: "acts" "side"; }
  #battlebar.more:not(.deploy) { grid-template-areas: "who" "valor" "acts" "side"; }
  #battlebar:not(.deploy) #bb-side { justify-content: flex-end; }
  #battlebar:not(.deploy) #bb-go { flex: 1; }
}
