/* Puerto Rico 1897 – pixel UI */
:root {
  --ink: #1b1420;
  --ink2: #3a2c3a;
  --paper: #efe3c8;
  --paper2: #d6c4a0;
  --paper3: #f8f0dc;
  --gold: #f5c84c;
  --gold2: #c48a1c;
  --wood: #b8763a;
  --wood2: #74431f;
  --sea: #2f8fbf;
  --sea2: #1d5a7c;
  --green: #5da83a;
  --green2: #2f6b32;
  --red: #d2453a;
  --violet: #9a64c4;
  --shadow: 4px 4px 0 rgba(10, 20, 40, .45);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: #2f8fbf url(assets/tile_sea.png) repeat;
  background-size: 64px 64px;
  image-rendering: pixelated;
  min-height: 100vh;
  animation: sea 12s linear infinite;
}
@keyframes sea { from { background-position: 0 0; } to { background-position: 64px 64px; } }
img.px { image-rendering: pixelated; image-rendering: crisp-edges; display: inline-block; vertical-align: middle; }
button, input { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- Panels */
.panel {
  background: var(--paper) url(assets/tile_paper.png) repeat;
  background-size: 64px 64px;
  border: 4px solid var(--ink);
  box-shadow: inset 0 0 0 3px var(--paper3), inset 0 0 0 5px var(--paper2), var(--shadow);
  padding: 12px 14px;
  position: relative;
}
.panel > h2, .panel > h3 {
  margin: -12px -14px 10px;
  padding: 6px 12px 5px;
  background: var(--wood) url(assets/tile_wood.png) repeat;
  background-size: 48px 48px;
  color: var(--paper3);
  border-bottom: 4px solid var(--ink);
  text-shadow: 2px 2px 0 var(--ink);
  font-size: 17px;
  letter-spacing: .5px;
  display: flex; align-items: center; gap: 8px;
}
.panel > h2 .right, .panel > h3 .right { margin-left: auto; font-size: 14px; }

/* ---------------------------------------------------------------- Buttons */
.btn {
  border: 3px solid var(--ink);
  background: var(--gold);
  color: var(--ink);
  padding: 7px 14px 6px;
  cursor: pointer;
  box-shadow: inset -3px -3px 0 var(--gold2), inset 3px 3px 0 #fff6c8, 3px 3px 0 rgba(0,0,0,.35);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  line-height: 1.1;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translate(2px, 2px); box-shadow: inset -3px -3px 0 var(--gold2), inset 3px 3px 0 #fff6c8; }
.btn:disabled { filter: grayscale(.8) brightness(.9); cursor: not-allowed; opacity: .7; }
.btn.green { background: #7cc24f; box-shadow: inset -3px -3px 0 var(--green2), inset 3px 3px 0 #c8f0a0, 3px 3px 0 rgba(0,0,0,.35); }
.btn.blue { background: #6fb5e6; box-shadow: inset -3px -3px 0 var(--sea2), inset 3px 3px 0 #c8ecff, 3px 3px 0 rgba(0,0,0,.35); }
.btn.red { background: #e06a5c; box-shadow: inset -3px -3px 0 #842424, inset 3px 3px 0 #ffc0b0, 3px 3px 0 rgba(0,0,0,.35); }
.btn.plain { background: var(--paper3); box-shadow: inset -3px -3px 0 var(--paper2), inset 3px 3px 0 #fff, 3px 3px 0 rgba(0,0,0,.35); }
.btn.small { padding: 4px 8px 3px; font-size: 13px; border-width: 2px; }
.btn.big { font-size: 18px; padding: 11px 20px 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: #6b5a4a; }
.tag { font-size: 12px; padding: 1px 5px; border: 2px solid var(--ink); background: var(--paper3); }

input.txt {
  border: 3px solid var(--ink); background: #fffaf0; padding: 8px 10px; outline: none;
  box-shadow: inset 3px 3px 0 var(--paper2);
}
input.txt:focus { background: #fff; box-shadow: inset 3px 3px 0 var(--gold); }

/* ---------------------------------------------------------------- Startseite */
.home { max-width: 760px; margin: 0 auto; padding: 32px 16px; display: grid; gap: 20px; }
.title-card { text-align: center; padding: 22px 16px 18px; }
.title-card h1 {
  margin: 4px 0 0; font-size: clamp(34px, 7vw, 58px); line-height: 1; letter-spacing: 2px;
  color: var(--gold); text-shadow: 3px 3px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 5px 5px 0 rgba(0,0,0,.35);
}
.title-card .year { font-size: clamp(22px, 4vw, 34px); color: var(--red); text-shadow: 2px 2px 0 var(--ink); letter-spacing: 6px; }
.title-card .sub { margin-top: 8px; }
.title-art { display: flex; justify-content: center; align-items: flex-end; gap: 18px; margin-bottom: 8px; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.home-grid .panel { display: grid; gap: 10px; align-content: start; }
@media (max-width: 640px) { .home-grid { grid-template-columns: 1fr; } }
.code-input { text-transform: uppercase; letter-spacing: 4px; width: 120px; text-align: center; }
.hint { font-size: 13px; color: #6b5a4a; }
.err { background: #ffd8d0; border: 3px solid var(--red); padding: 6px 10px; }

/* ---------------------------------------------------------------- Lobby */
.lobby { max-width: 900px; margin: 0 auto; padding: 28px 16px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
@media (max-width: 760px) { .lobby { grid-template-columns: 1fr; } }
.lobby-code { font-size: 44px; letter-spacing: 8px; text-align: center; color: var(--ink); background: var(--paper3); border: 3px dashed var(--ink2); padding: 6px; margin-bottom: 10px; user-select: all; }
.seat { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 3px solid var(--ink); background: var(--paper3); margin-bottom: 8px; box-shadow: inset 6px 0 0 var(--pc, #ccc); padding-left: 16px; }
.seat.empty { border-style: dashed; opacity: .6; box-shadow: none; }
.seat .name { font-weight: 700; font-size: 17px; }
.dot { width: 10px; height: 10px; border: 2px solid var(--ink); display: inline-block; }
.dot.on { background: #7cc24f; } .dot.off { background: #999; }
.swatch { width: 22px; height: 22px; border: 3px solid var(--ink); display: inline-block; box-shadow: inset -3px -3px 0 rgba(0,0,0,.25); }

/* Chat */
.chat-log { height: 210px; overflow-y: auto; background: var(--paper3); border: 3px solid var(--ink); padding: 6px 8px; font-size: 14px; }
.chat-log div { margin: 2px 0; }
.chat-log .sys { color: #6b5a4a; font-style: italic; }

/* ---------------------------------------------------------------- Spiel */
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 8px 16px; background: var(--wood) url(assets/tile_wood.png); background-size: 48px 48px;
  border-bottom: 4px solid var(--ink); color: var(--paper3); text-shadow: 2px 2px 0 var(--ink);
  position: sticky; top: 0; z-index: 20;
}
.topbar .logo { font-size: 22px; font-weight: 700; color: var(--gold); letter-spacing: 1px; }
.topbar .logo span { color: #ffb0a0; }
.topbar .stat { display: inline-flex; align-items: center; gap: 5px; font-size: 15px; }
.topbar .spacer { flex: 1; }

.game { display: grid; grid-template-columns: minmax(340px, 400px) minmax(480px, 1fr) minmax(280px, 340px); gap: 14px; padding: 14px; align-items: start; }
.col { display: grid; gap: 14px; align-content: start; min-width: 0; }
@media (max-width: 1300px) { .game { grid-template-columns: minmax(330px, 390px) 1fr; } .col.c3 { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }
@media (max-width: 860px) {
  .game { grid-template-columns: 1fr; padding: 10px; }
  .topbar { position: static; }
  .prompt { position: sticky; bottom: 6px; z-index: 30; max-height: 45vh; overflow: auto; }
  .col.c2 { display: contents; }
  .col.c2 > .prompt { order: 10; grid-row: auto; }
}

/* Rollen */
.roles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.role {
  border: 3px solid var(--ink); background: var(--paper3); padding: 6px 4px 5px; text-align: center; position: relative;
  box-shadow: 3px 3px 0 rgba(0,0,0,.3); min-height: 104px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.role .rname { font-size: 12px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.role .money { display: flex; gap: 1px; flex-wrap: wrap; justify-content: center; min-height: 22px; }
.role.taken { opacity: .55; background: #d8ccb4; }
.role.taken .by { position: absolute; left: -3px; right: -3px; bottom: -3px; color: #fff; font-size: 12px; padding: 1px 2px; border: 3px solid var(--ink); text-shadow: 1px 1px 0 var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clickable { cursor: pointer; outline: 3px solid var(--gold); outline-offset: 2px; animation: glow 1.1s steps(2) infinite; }
.clickable:hover { transform: translate(-1px, -2px); }
@keyframes glow { 50% { outline-color: #fff6c8; } }
.role.active-role { background: #fff6c8; }

/* Plantagen */
.plants { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.tile { position: relative; display: inline-block; line-height: 0; border: 3px solid var(--ink); box-shadow: 3px 3px 0 rgba(0,0,0,.3); background: var(--ink); }
.tile .badge, .badge {
  position: absolute; right: -8px; top: -8px; background: var(--ink); color: var(--paper3); font-size: 12px; line-height: 1;
  padding: 3px 4px 2px; border: 2px solid var(--paper3); min-width: 18px; text-align: center;
}
.stack-label { font-size: 12px; text-align: center; margin-top: 3px; }
.sep { width: 3px; align-self: stretch; background: var(--paper2); margin: 0 4px; }

/* Schiffe */
.ships { display: grid; gap: 10px; }
.shiprow { display: flex; align-items: center; gap: 8px; }
.cargo { display: flex; gap: 3px; flex-wrap: wrap; padding: 4px; background: #8fc8e8; border: 3px solid var(--ink); }
.slot { width: 22px; height: 22px; display: grid; place-items: center; background: var(--sea2); border: 2px solid var(--ink); }
.slot.full { background: var(--paper3); }
.trade { display: flex; align-items: center; gap: 10px; }
.trade .cargo { background: var(--paper2); }
.supply-goods { display: flex; gap: 10px; flex-wrap: wrap; }
.gcount { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; }

/* Gebäudemarkt */
.market { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.bcard img.px { max-width: 100%; height: auto; }
.mcol { display: grid; gap: 6px; align-content: start; }
.mcol .colhead { font-size: 12px; text-align: center; color: #6b5a4a; }
.bcard {
  border: 3px solid var(--ink); background: var(--paper3); padding: 4px; position: relative; box-shadow: 2px 2px 0 rgba(0,0,0,.25);
  display: grid; grid-template-columns: auto 1fr; gap: 2px 6px; align-items: center; font-size: 12px; min-height: 52px;
}
.bcard.violet { background: #efe0f7; }
.bcard .bname { padding-right: 22px; grid-column: 1 / -1; font-weight: 700; font-size: 12px; line-height: 1.1; }
.bcard .meta { display: grid; gap: 1px; }
.bcard.soldout { opacity: .35; }
.bcard.cant { opacity: .55; }
.bcard .left { position: absolute; top: 2px; right: 4px; font-size: 11px; color: #6b5a4a; }
.circles { display: inline-flex; gap: 2px; }
.circ { width: 9px; height: 9px; border: 2px solid var(--ink); background: #fff; border-radius: 50%; }
.costtag { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; }
.costtag s { color: #8a7a6a; font-weight: 400; }

/* Tableau */
.board { display: grid; gap: 12px; }
.board-grid { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .board-grid { grid-template-columns: 1fr; } }
.island { display: grid; grid-template-columns: repeat(4, 54px); gap: 5px; padding: 8px; background: var(--green) ; border: 3px solid var(--ink); box-shadow: inset 0 0 0 3px var(--green2); }
.itile { position: relative; width: 54px; height: 54px; border: 3px solid var(--ink); line-height: 0; background: var(--ink); }
.itile img.bg { width: 48px; height: 48px; }
.itile .w, .bslot .w { position: absolute; }
.itile .w { left: 15px; top: 10px; filter: drop-shadow(2px 2px 0 rgba(0,0,0,.6)); }
.itile .ring { position: absolute; left: 17px; top: 17px; width: 14px; height: 14px; border: 3px solid rgba(255,250,240,.9); border-radius: 50%; background: rgba(27,20,32,.35); }
.itile.empty { border-style: dashed; border-color: var(--green2); background: transparent; }
.city { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 92px; grid-auto-flow: row dense; gap: 6px; padding: 8px; background: var(--paper2); border: 3px solid var(--ink); box-shadow: inset 0 0 0 3px #bfa97f; }
.bslot { border: 3px solid var(--ink); background: var(--paper3); padding: 3px; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; text-align: center; overflow: hidden; }
.bslot.large { grid-row: span 2; justify-content: center; }
.bslot.empty { border-style: dashed; border-color: #a38d6a; background: transparent; }
.bslot .bn { font-size: 11px; line-height: 1.05; font-weight: 700; }
.wslots { display: flex; gap: 2px; }
.wslot { width: 18px; height: 22px; border: 2px solid var(--ink); background: #d8ccb4; display: grid; place-items: center; line-height: 0; }
.wslot.on { background: #fff6c8; }
.wslot.edit { cursor: pointer; outline: 2px solid var(--gold2); }
.itile.edit { cursor: pointer; outline: 3px solid var(--gold); outline-offset: 1px; }
.wealth { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 17px; font-weight: 700; }
.wealth .it { display: inline-flex; align-items: center; gap: 5px; }
.sanjuan { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--paper3); border: 3px solid var(--ink); }
.sectlabel { font-size: 13px; font-weight: 700; margin-bottom: 4px; display: flex; justify-content: space-between; }

/* Aktionspanel */
.prompt { border-color: var(--ink); }
.prompt.mine { animation: pulse 1.4s steps(2) infinite; }
@keyframes pulse { 50% { box-shadow: inset 0 0 0 3px #fff6c8, inset 0 0 0 5px var(--gold), var(--shadow); } }
.prompt .ptitle { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.prompt .pdesc { margin-bottom: 10px; }
.opts { display: flex; gap: 8px; flex-wrap: wrap; }
.storegrid { display: grid; grid-template-columns: auto auto auto auto; gap: 6px 12px; align-items: center; margin-bottom: 10px; }
.thinking::after { content: '…'; animation: dots 1s steps(3) infinite; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { 0% { width: .3em; } 100% { width: 1.2em; } }

/* Mitspieler */
.pcard { border: 3px solid var(--ink); background: var(--paper3); padding: 8px 8px 8px 14px; box-shadow: inset 6px 0 0 var(--pc), 3px 3px 0 rgba(0,0,0,.25); display: grid; gap: 5px; cursor: pointer; }
.pcard.turn { background: #fff6c8; outline: 3px solid var(--gold); outline-offset: 2px; }
.pcard .ph { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.pcard .ph .nm { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .mini { display: flex; gap: 2px; flex-wrap: wrap; }
.pcard .mini .mt { position: relative; line-height: 0; }
.pcard .mini .mt.on::after { content: ''; position: absolute; right: 0; bottom: 0; width: 5px; height: 5px; background: #fff; border: 1px solid var(--ink); }
.pcard .nums { display: flex; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.govbadge { margin-left: auto; }

/* Log */
.log { max-height: 340px; overflow-y: auto; font-size: 13.5px; line-height: 1.3; background: var(--paper3); border: 3px solid var(--ink); padding: 6px 8px; }
.log div { padding: 2px 0 2px 7px; border-left: 4px solid transparent; margin-bottom: 2px; }
.log .round { font-weight: 700; color: var(--wood2); border: 0; padding-left: 0; margin-top: 4px; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabs .btn { flex: 1; justify-content: center; }
.tabs .btn.on { background: var(--paper3); box-shadow: inset 3px 3px 0 var(--paper2); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 20, 40, .65); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { max-width: min(900px, 96vw); max-height: 92vh; overflow: auto; }
table.score { border-collapse: collapse; width: 100%; font-size: 15px; }
table.score th, table.score td { border: 2px solid var(--ink); padding: 5px 8px; text-align: center; background: var(--paper3); }
table.score th { background: var(--paper2); }
table.score tr.win td { background: #fff1b8; font-weight: 700; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--paper3); padding: 10px 16px; border: 3px solid var(--gold); box-shadow: var(--shadow); max-width: 90vw; }
.toast.error { border-color: var(--red); }

/* ---------------------------------------------------------------- v2: menu, timer, observation mode */
.btn.on { background: var(--paper3); box-shadow: inset 3px 3px 0 var(--paper2), 3px 3px 0 rgba(0,0,0,.35); outline: 3px solid var(--gold); outline-offset: -6px; }
.btn.wide { width: 100%; justify-content: center; }
.tag.warn { background: #ffd8a0; }
.tips { margin: 4px 0 0; padding-left: 18px; line-height: 1.5; }
.lastround { color: #ffd0c0; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.ptile { display: inline-flex; flex-direction: column; align-items: center; }

.netbanner { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: var(--red); color: var(--paper3); border-bottom: 4px solid var(--ink); padding: 10px 16px; text-align: center; font-weight: 700; text-shadow: 2px 2px 0 var(--ink); }

/* turn timer */
.timer { position: relative; height: 20px; margin-top: 10px; border: 3px solid var(--ink); background: var(--paper2); overflow: hidden; }
.timerbar { height: 100%; width: 100%; transition: width .2s linear; box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); }
.timertext { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--paper3); text-shadow: 1px 1px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink); }
.timer.urgent { animation: shake .3s steps(2) infinite; }
.timer.urgent .timerbar { background: var(--red) !important; }
@keyframes shake { 50% { transform: translateX(2px); } }

/* ESC menu */
.menu { width: min(460px, 94vw); display: grid; gap: 8px; }
.slider { display: grid; grid-template-columns: 70px 1fr 48px; align-items: center; gap: 10px; font-weight: 600; }
.slider b { text-align: right; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 14px; background: var(--paper2); border: 3px solid var(--ink); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 24px; background: var(--gold); border: 3px solid var(--ink); cursor: pointer; box-shadow: inset -2px -2px 0 var(--gold2); }
input[type=range]::-moz-range-thumb { width: 12px; height: 20px; background: var(--gold); border: 3px solid var(--ink); border-radius: 0; cursor: pointer; }
.mute { font-weight: 400; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.confirm { display: grid; gap: 8px; padding: 10px; border: 3px dashed var(--red); background: #ffe8e0; }

/* observation mode: everything large, with texts */
.game.observe { grid-template-columns: 1fr; max-width: 1500px; margin: 0 auto; }
.game.observe > .prompt { position: sticky; top: 64px; z-index: 15; }
.obs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.obs-boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(620px, 1fr)); gap: 14px; }
@media (max-width: 860px) { .obs-row, .obs-boards { grid-template-columns: 1fr; } .game.observe > .prompt { position: sticky; top: auto; bottom: 6px; } }
.roles.big { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.role.big { min-height: 230px; padding: 10px 8px 26px; gap: 6px; }
.role.big .rname { font-size: 17px; }
.role .rdesc { font-size: 13.5px; line-height: 1.3; }
.role.big.taken .by { font-size: 14px; }
.market.big { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.bcard.big { grid-template-columns: auto 1fr; font-size: 14px; padding: 8px; gap: 6px 10px; }
.bcard.big .bname { font-size: 16px; }
.bcard .bdesc { grid-column: 1 / -1; font-size: 13.5px; line-height: 1.3; border-top: 2px dashed var(--paper2); padding-top: 4px; }
.bcard.big .circ { width: 12px; height: 12px; }
.bslot .bdesc { font-size: 10.5px; line-height: 1.1; color: #5a4a3a; }
.game.observe .city { grid-auto-rows: 138px; }
.log .k-timeout { background: #ffe8d0; }
.log .k-trigger { background: #ffd8d0; font-weight: 700; }

/* ---------------------------------------------------------------- v3: spectators & votes */
.seat.spec { box-shadow: inset 6px 0 0 #8f939c; opacity: .95; }
.spectab .row .btn { gap: 6px; }
.votebar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 65; width: min(640px, 94vw); padding: 10px 12px; border-color: var(--ink); animation: pulse 1.4s steps(2) infinite; }
.manage { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.mrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 6px; background: var(--paper3); border: 2px solid var(--ink); }

/* Readable type, explicit labels and confirmed-action feedback. */
.panel > h2, .panel > h3 { text-shadow: 0 1px 2px #1b1420; letter-spacing: 0; flex-wrap: wrap; }
.hint, .log, .role .rdesc, .bcard .bdesc { font-size: 14px; line-height: 1.5; }
.bslot .bn { font-size: 13px; line-height: 1.25; }
.bslot .bdesc { font-size: 12px; line-height: 1.35; }
.role .rname { overflow-wrap: anywhere; }
.topbar { flex-wrap: wrap; }
.topbar .stat { font-size: 14px; }
.wealth .it, .pcard .it { white-space: nowrap; }
.city { grid-auto-rows: minmax(108px, auto); }
.game.observe .city { grid-auto-rows: minmax(160px, auto); }
.action-feedback { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(680px, calc(100vw - 32px)); padding: 12px 18px; color: #fff8e8; background: #1b2836; border: 2px solid #f5c84c; border-radius: 8px; box-shadow: 0 6px 24px #0005; font-size: 16px; font-weight: 600; z-index: 45; pointer-events: none; }
.action-feedback.milestone { background: #fff1c8; color: #291d10; border-width: 3px; font-size: 18px; }
.fx-good { position: fixed; width: 32px; height: 32px; image-rendering: pixelated; z-index: 44; pointer-events: none; filter: drop-shadow(0 3px 3px #0008); }
.fx-delta { position: fixed; z-index: 44; pointer-events: none; background: #fff4c8; color: #252014; border: 2px solid #8c6521; border-radius: 6px; padding: 5px 10px; font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.version { display: inline-block; margin: 10px 0; padding: 4px 12px; border: 1px solid #8c744a; border-radius: 20px; background: var(--paper3); font-size: 14px; font-weight: 600; }
.role .rname { font-size: 13px; }
.bcard .bname { font-size: 13px; line-height: 1.3; }
.fx-ship { position: fixed; z-index: 44; pointer-events: none; image-rendering: pixelated; }
@media (max-width: 860px) { .action-feedback { top: 12px; bottom: auto; font-size: 14px; } }

/* Small action receipts remain visible even when the affected board is offscreen. */
.fx-feed { position: fixed; top: 88px; right: 12px; z-index: 43; display: grid; gap: 6px; width: min(310px, calc(100vw - 24px)); pointer-events: none; }
.fx-event { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 2px solid #aa8032; border-radius: 8px; background: #fff8e9; color: #271e17; box-shadow: 0 3px 12px #0003; font-size: 13px; line-height: 1.4; }
.fx-event img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; flex: none; }
@media (max-width: 860px) { .fx-feed { top: 78px; width: min(260px, calc(100vw - 24px)); } .fx-event { padding: 6px 9px; font-size: 12px; } }

/* ---------------------------------------------------------------- v5: context popup, compact names, soft wrapping */
.ptitle-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ptitle-row .ptitle { flex: 1 1 auto; margin-bottom: 0; }
.ctxbtn { gap: 6px; }
.ctxpop { margin: 10px 0; padding: 10px 12px; background: var(--paper3); border: 3px solid var(--ink); box-shadow: 4px 4px 0 rgba(0,0,0,.25); animation: ctxin .18s steps(3); }
@keyframes ctxin { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
.ctxhead { display: flex; align-items: center; gap: 8px; margin: -2px 0 8px; font-size: 16px; }
.ctxpop .cargo { margin-right: 10px; }
.slot.big { width: 38px; height: 36px; }
.ctxcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.ctxcard { display: grid; justify-items: center; gap: 2px; padding: 8px 6px; border: 3px solid var(--ink); background: #fff; text-align: center; }
.ctxcard.off { opacity: .5; background: var(--paper2); }
.ctxpop .shiprow.target .cargo { outline: 3px solid var(--gold); outline-offset: 1px; }
.ctxpop .row { gap: 6px 12px; }

/* never split a resource chip; wrap whole chips instead */
.gcount, .it, .costtag, .tag { white-space: nowrap; }
.pcard .nums, .supply-goods, .wealth, .mini { flex-wrap: wrap; row-gap: 4px; }
.pcard { min-width: 0; }
/* compact building names: one line, shortened, full name in tooltip */
.bcard:not(.big) .bname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; }
/* city slots are narrow: short name, soft-wrapped onto max. two lines */
.bslot .bn { white-space: normal; overflow-wrap: break-word; hyphens: auto; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; line-height: 1.2; }
.game.observe .bslot .bn { -webkit-line-clamp: unset; font-size: 13px; }

/* fast tooltips (tooltip.js) – appear after ~0.1 s instead of the browser's ~1 s */
.fast-tip { position: fixed; left: 0; top: 0; z-index: 90; max-width: 320px; padding: 6px 10px; background: var(--ink); color: var(--paper3); border: 2px solid var(--gold); box-shadow: 3px 3px 0 rgba(0,0,0,.35); font-size: 13px; line-height: 1.4; pointer-events: none; opacity: 0; transition: opacity .08s linear; white-space: pre-line; }
.fast-tip.on { opacity: 1; }

/* role selection: compact market & harbor overview */
.glance { display: grid; gap: 8px; }
.glance-row { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.glance-row > b { min-width: 104px; }
.glance-eval { display: inline-flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; margin-left: auto; }
.mini-ships { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.mini-ship { display: inline-flex; align-items: center; gap: 4px; }
.glance .slot { width: 20px; height: 20px; }
.verdict.bad { color: #842424; font-weight: 600; }
