:root {
  color-scheme: dark;
  --page: #0c1318;
  --surface: #121e25;
  --surface-hi: #192831;
  --line: #2a3940;
  --text: #f3eddf;
  --muted: #a7b5b7;
  --gold: #f1c781;
  --accent: #f2c371;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(ellipse at 70% 0%, #172830, var(--page) 47%); color: var(--text); }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
button:focus-visible { outline: 2px solid #fff4bc; outline-offset: 3px; z-index: 4; }
svg { display: block; flex-shrink: 0; }
[data-icon] { display: inline-flex; }
[hidden] { display: none !important; }

.top { min-height: 79px; padding: 14px 28px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border-bottom: 1px solid #223139; background: #10191eea; }
.brand, .top-actions, .panel-title, .player-head, .turn { display: flex; align-items: center; }
.brand { gap: 13px; }
.mark { width: 47px; height: 47px; display: grid; place-items: center; color: var(--gold); background: #2c2a22; border: 1px solid #584b36; border-radius: 12px; }
.brand h1 { font-family: Georgia, serif; font-size: 1.48rem; font-weight: 700; letter-spacing: .13em; }
.brand p { color: var(--muted); font-size: .86rem; margin-top: 3px; }
.top-actions { gap: 9px; }
.local { color: #b7c8c0; display: inline-flex; align-items: center; gap: 8px; margin-right: 12px; font-size: .93rem; white-space: nowrap; }
.local i { width: 7px; height: 7px; border-radius: 50%; background: #72c395; box-shadow: 0 0 12px #72c39555; }

.table { max-width: 1800px; margin: auto; padding: 18px 24px 22px; display: grid; grid-template-columns: minmax(252px, 290px) minmax(0, 1fr); grid-template-rows: minmax(490px, 1fr) auto; gap: 14px; min-height: calc(100dvh - 79px); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; overflow: hidden; }
.roster, .hand, .action { padding: 14px; }
.roster { display: flex; flex-direction: column; }
.panel-title { gap: 9px; min-height: 25px; margin-bottom: 11px; }
.panel-title > span[data-icon] { color: var(--gold); }
.panel-title h2 { font-size: 1.06rem; letter-spacing: .01em; font-weight: 650; }
.counter { border: 1px solid var(--line); color: var(--muted); padding: 3px 8px; font-size: .81rem; border-radius: 6px; margin-left: auto; white-space: nowrap; }

#players { display: grid; gap: 8px; }
.player { border: 1px solid #2a3940; border-radius: 10px; background: #16232b; padding: 8px 10px; position: relative; }
.player.active { border-color: color-mix(in srgb, var(--player) 60%, #24323a); background: linear-gradient(110deg, #393127, #223038 94%); }
.player-head { gap: 9px; }
.avatar { width: 34px; height: 34px; border: 1px solid color-mix(in srgb, var(--player) 36%, transparent); border-radius: 8px; background: color-mix(in srgb, var(--player) 14%, transparent); color: var(--player); display: grid; place-items: center; }
.player h3 { font-size: .99rem; font-weight: 650; line-height: 1.1; }
.player-head span { display: block; margin-top: 2px; color: var(--muted); font-size: .78rem; }
.active .player-head span { color: var(--player); }
.score { margin-left: auto; color: var(--player); font-size: 1.22rem; font-weight: 650; }
.score small { font-size: .68rem; }
.player-cards, .pieces { display: flex; gap: 13px; align-items: center; color: var(--muted); font-size: .83rem; }
.player-cards { margin-top: 7px; }
.player-cards span, .pieces span, .cost span { display: inline-flex; gap: 5px; align-items: center; }
.pieces { border-top: 1px solid #ffffff0f; margin-top: 6px; padding-top: 5px; gap: 18px; }
.pieces b { color: #dce5e4; font-weight: 600; }
.goal { display: flex; align-items: start; gap: 10px; margin: auto 0 0; padding: 12px 3px 0; color: var(--gold); }
.goal strong { font-size: .86rem; }
.goal p { color: var(--muted); font-size: .82rem; margin-top: 3px; line-height: 1.35; }

.board { position: relative; min-height: 400px; background: #102831; isolation: isolate; }
#map, #targets { position: absolute; inset: 0; }
#map canvas { display: block; width: 100%; height: 100%; }
#targets { pointer-events: none; }
.board-head { position: absolute; inset: 0 0 auto; padding: 21px 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; pointer-events: none; background: linear-gradient(#071419b5, transparent); }
.eyebrow { color: var(--gold); font-size: .73rem; font-weight: 650; letter-spacing: .16em; }
.board-title h2 { margin-top: 4px; font: 500 clamp(1.1rem, 1.6vw, 1.56rem)/1.07 Georgia, serif; text-shadow: 0 2px 6px #000b; }
.round { padding: 7px 11px; border: 1px solid #6c807e66; border-radius: 6px; background: #0b1c21cf; white-space: nowrap; color: #e4edeb; }
.compass { position: absolute; top: 78px; right: 28px; color: #c4b98c; display: grid; place-items: center; opacity: .56; }
.compass b { font: .78rem Georgia, serif; }
.compass svg { width: 33px; height: 33px; }
.legend { position: absolute; left: 18px; bottom: 8px; display: flex; gap: 9px; flex-wrap: wrap; padding: 5px 8px; border: 1px solid #73898346; border-radius: 8px; background: #102126e8; color: #dce3db; pointer-events: none; }
.legend span { display: flex; align-items: center; gap: 5px; font-size: .81rem; white-space: nowrap; }
.legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--item); }
.map-controls { display: flex; position: absolute; right: 17px; bottom: 17px; border: 1px solid #73898366; background: #102126e8; border-radius: 8px; overflow: hidden; }
.map-controls button { border: 0; background: transparent; padding: 2px 11px 5px; font-size: 1.27rem; }
.map-controls button + button { border-left: 1px solid #73898346; }
.map-controls button:hover { background: #24404a; }
.target { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; border: 2px solid #fff2cc; color: #1b1710; background: #ffcc70; width: 28px; height: 28px; border-radius: 50%; font-weight: 800; font-size: 19px; line-height: 20px; box-shadow: 0 0 0 5px #34230b90, 0 2px 10px #000; padding: 0 0 2px; }
.target:hover { background: #fff3d4; scale: 1.1; }
#targets { z-index: 1; }
.map-controls { z-index: 2; }
.target-road { height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; box-shadow: none; transform: translate(-50%, -50%) rotate(var(--edge-angle, 0rad)); }
.target-road::after { content: ''; position: absolute; inset: 6px 0; border: 2px solid #fff2cc; border-radius: 6px; background: #ffcc70; box-shadow: 0 0 0 2px #34230b90, 0 2px 6px #000; }
.target-road:hover { background: transparent; }
.target-road:hover::after, .target-road:focus-visible::after { background: #fff3d4; }
#map-error { position: absolute; inset: 30% 15% auto; padding: 20px; background: var(--surface); border-radius: 8px; text-align: center; }

button.quiet, button.primary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 11px; min-height: 36px; border: 1px solid #34454e; border-radius: 7px; white-space: nowrap; font-size: .9rem; font-weight: 600; }
button.quiet { background: #19262e; color: #e4e9e9; }
button.quiet:hover:not(:disabled) { background: #263b45; }
button.primary { background: var(--accent); color: #231b13; border-color: #efcf97; box-shadow: inset 0 1px #fff3d58c; }
button.primary:hover:not(:disabled) { background: #ffe0a6; }
.hand .panel-title { margin-bottom: 9px; }
#visibility { margin-left: auto; padding: 4px 7px; min-height: 28px; font-size: .82rem; }
#resources { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.resource { position: relative; display: grid; min-height: 67px; justify-items: center; align-content: end; gap: 3px; padding: 4px 1px; border: 1px solid color-mix(in srgb, var(--item) 37%, #293439); border-radius: 6px; background: color-mix(in srgb, var(--item) 12%, #18252b); color: var(--item); }
.resource b { position: absolute; right: 4px; top: 1px; font-size: .83rem; }
.resource small { font-size: .67rem; white-space: nowrap; color: #f9f0e2; }
.resource.concealed { border: 1px solid #465654; color: #beac83; align-content: center; background: repeating-linear-gradient(45deg, #303735 0 2px, #26312f 2px 5px); box-shadow: inset 0 0 0 3px #1e2b2c; }
#projects { width: 100%; justify-content: flex-start; margin-top: 8px; }
#projects b { color: var(--gold); margin-left: auto; }
#builds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.build { display: grid; grid-template-columns: auto 1fr; text-align: left; align-items: center; column-gap: 9px; row-gap: 4px; min-height: 65px; padding: 8px 10px; background: #192831; border: 1px solid #34464f; border-radius: 8px; }
.build:disabled { opacity: .72; }
.build:hover:not(:disabled), .build.chosen { background: #30362f; border-color: var(--gold); }
.build strong { font-size: .94rem; line-height: 1.12; }
.build-icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 7px; background: #342f26; color: var(--gold); grid-row: span 2; }
.cost { display: flex; gap: 7px; flex-wrap: wrap; }
.cost span { color: var(--item); font-size: .84rem; gap: 2px; }
.turn { gap: 8px; margin-top: 10px; }
.dice { display: flex; gap: 4px; flex: none; }
.die { --s: 44px; width: var(--s); height: var(--s); display: block; perspective: 280px; }
.cube { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.3, 1.35, .5, 1); }
.face { position: absolute; inset: 0; border-radius: 22%; background: var(--pips), radial-gradient(circle at 32% 26%, #fffbf1, #eadbb6 78%); box-shadow: inset 0 0 0 1.5px #fff7e0, inset 0 -5px 9px #a8916a66; backface-visibility: hidden; }
.f1 { transform: translateZ(calc(var(--s) / 2)); --pips: radial-gradient(circle at 50% 50%, #b3352b 0 11%, #0000 12%); }
.f6 { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); --pips: radial-gradient(circle at 28% 25%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 72% 25%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 28% 50%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 72% 50%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 28% 75%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 72% 75%, #26302f 0 8%, #0000 9%); }
.f2 { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); --pips: radial-gradient(circle at 28% 28%, #26302f 0 9%, #0000 10%), radial-gradient(circle at 72% 72%, #26302f 0 9%, #0000 10%); }
.f5 { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); --pips: radial-gradient(circle at 27% 27%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 73% 27%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 50% 50%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 27% 73%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 73% 73%, #26302f 0 8%, #0000 9%); }
.f3 { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); --pips: radial-gradient(circle at 27% 27%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 50% 50%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 73% 73%, #26302f 0 8%, #0000 9%); }
.f4 { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); --pips: radial-gradient(circle at 28% 28%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 72% 28%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 28% 72%, #26302f 0 8%, #0000 9%), radial-gradient(circle at 72% 72%, #26302f 0 8%, #0000 9%); }
.die.blank .cube { opacity: .55; }
#status { color: var(--muted); flex: 1; padding-inline: 3px; font-size: .89rem; line-height: 1.22; }

dialog { color: var(--text); background: #17252d; border: 1px solid #53656c; border-radius: 14px; width: min(475px, calc(100% - 24px)); padding: 25px; }
dialog::backdrop { background: #081216d9; backdrop-filter: blur(5px); }
dialog h2 { color: var(--gold); font: 500 1.8rem Georgia, serif; }
dialog p, dialog ol { color: #c3ced0; margin: 13px 0; line-height: 1.55; }
dialog li { margin-bottom: 7px; }
dialog:has(.rules) { width: min(750px, calc(100% - 24px)); padding: 0; max-height: min(86dvh, 790px); overflow: auto; }
.rules-header { position: sticky; top: 0; z-index: 1; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 17px 22px 14px; border-bottom: 1px solid var(--line); background: #17252d; }
.rules-header p { margin: 4px 0 0; }
.rules-body { padding: 5px 22px 16px; }
.rules-body section { padding: 13px 0; border-bottom: 1px solid var(--line); }
.rules-body section:last-child { border-bottom: 0; }
.rules-body h3 { font-size: 1.05rem; margin-bottom: 7px; color: var(--gold); }
.rules-body p { margin: 5px 0 8px; }
.rules-body p:last-child { margin-bottom: 0; }
.rules-body ul { margin: 5px 0 10px; padding-left: 20px; color: #c3ced0; line-height: 1.5; }
.rules-table { overflow-x: auto; }
.rules-table table { width: 100%; border-collapse: collapse; text-align: left; }
.rules-table th, .rules-table td { border-bottom: 1px solid var(--line); padding: 8px 7px; }
.rules-table thead th { color: #d7c299; }
.rules-resource, .rules-building { display: inline-flex; gap: 5px; align-items: center; vertical-align: middle; white-space: nowrap; }
.rules-resource { color: var(--item); padding: 2px 3px; }
.rules-building img { width: 33px; height: 33px; }
.rules-body .rules-cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 7px; }
.rules-cards li { display: grid; gap: 3px; background: #20313a; padding: 8px 10px; border-radius: 6px; margin: 0; }
.rules-cards strong { color: var(--text); }
.dialog-actions, .project-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-row { border-top: 1px solid var(--line); padding-block: 8px; }
.project-row p { margin: 1px 0 0; font-size: .9rem; }

@media (max-width: 980px) {
  .table { grid-template-columns: 248px minmax(0, 1fr); padding-inline: 12px; }
  .build { column-gap: 5px; padding-inline: 6px; }
  .build-icon { width: 25px; }
  .build-icon svg { width: 17px; }
  .cost { gap: 3px; }
}
@media (max-width: 760px) {
  .top { min-height: 65px; padding: 8px 12px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
  .local { display: none; }
  .table { grid-template-columns: 1fr; grid-template-rows: auto; padding: 9px; gap: 9px; }
  .board { grid-row: 1; min-height: clamp(330px, 75vw, 570px); }
  .hand { grid-row: 2; }
  .action { grid-row: 3; }
  .roster { grid-row: 4; }
  #players { grid-template-columns: repeat(2, 1fr); }
  .board-head { padding: 14px 13px; }
  .compass { display: none; }
  .legend { left: 8px; bottom: 8px; gap: 7px; max-width: calc(100% - 88px); }
  .map-controls { right: 8px; bottom: 8px; }
}
@media (max-width: 430px) {
  .brand { gap: 6px; }
  .brand p { display: none; }
  .brand h1 { font-size: 1rem; }
  .mark { width: 33px; height: 33px; }
  .mark svg { width: 21px; }
  .top-actions svg { display: none; }
  .top-actions button { padding: 5px 7px; }
  #builds { grid-template-columns: repeat(2, 1fr); }
  .turn { flex-wrap: wrap; }
  #status { min-width: calc(100% - 85px); }
}

.lobby {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  width: min(1320px, 100%);
  min-height: calc(100dvh - 79px);
  margin: 0 auto;
  padding: clamp(16px, 3.2vw, 42px);
}
.lobby-panel { padding: clamp(20px, 3vw, 36px); align-self: stretch; }
.lobby-panel h2, .preview-caption h2 { font: 500 clamp(1.7rem, 3.3vw, 2.65rem)/1.04 Georgia, serif; margin-top: 7px; }
.lobby-lead { color: var(--muted); line-height: 1.5; margin: 12px 0 23px; }
.lobby-form { display: grid; gap: 8px; }
.lobby-form label { display: grid; gap: 7px; font-size: .93rem; font-weight: 600; }
.lobby-form input, .lobby-form select {
  width: 100%; min-width: 0; min-height: 43px; padding: 8px 11px;
  font: inherit; color: var(--text); background: #0e191f; border: 1px solid #43545a; border-radius: 7px;
}
.lobby-form input:focus, .lobby-form select:focus { outline: 1px solid var(--gold); border-color: var(--gold); }
.lobby-form input::placeholder { color: #8d9da2; }
.lobby-form .primary { min-height: 43px; }
.lobby-form select {
  appearance: none; padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 47%, #c7b996 48% 58%, transparent 59%),
    linear-gradient(-45deg, transparent 47%, #c7b996 48% 58%, transparent 59%);
  background-size: 7px 7px; background-repeat: no-repeat;
  background-position: calc(100% - 15px) center, calc(100% - 9px) center;
}
.auth-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.room-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.join-form { border-top: 1px solid var(--line); margin-top: 19px; padding-top: 17px; }
.join-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
#room-code { text-transform: uppercase; letter-spacing: .12em; }
#lobby-status { margin-top: 11px; color: var(--gold); font-size: .9rem; }
#lobby-status:empty { margin-top: 0; }
.lobby-preview { min-height: 425px; position: relative; background: #102831; }
#lobby-map { position: absolute; inset: 0; }
#lobby-map canvas { display: block; width: 100%; height: 100%; }
.preview-caption { position: absolute; inset: auto 0 0; padding: 26px; background: linear-gradient(transparent, #07151be8); pointer-events: none; }
.preview-caption h2 { font-size: clamp(1.3rem, 2.4vw, 2rem); }
.map-unavailable { background: radial-gradient(ellipse at center, #295753, #102831 64%); }
.room-code { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 18px 0; padding: 10px 12px; border: 1px solid #5b523e; border-radius: 9px; background: #2a2a23; }
.room-code span, .room-code strong { display: block; }
.room-code span { color: #c9c0a9; font-size: .78rem; }
.room-code strong { margin-top: 2px; color: var(--gold); font-size: 1.33rem; letter-spacing: .15em; user-select: all; }
.room-roster-title { display: flex; align-items: center; gap: 6px; }
.room-roster-title .counter + .counter { margin-left: 0; }
.room-roster { list-style: none; display: grid; gap: 6px; margin: 8px 0 12px; padding: 0; }
.room-roster li { display: flex; align-items: center; gap: 8px; min-height: 39px; padding: 4px 8px; border: 1px dashed #35454b; border-radius: 7px; color: var(--muted); font-size: .9rem; }
.room-roster li.taken { border-style: solid; background: #192831; color: var(--text); }
.room-roster strong { overflow-wrap: anywhere; min-width: 0; }
.room-avatar { display: grid; place-items: center; width: 27px; height: 27px; flex: none; color: var(--gold); }
.room-roster small { margin-left: auto; color: var(--muted); flex: none; }
.room-roster button { margin-left: auto; min-height: 28px; padding-block: 3px; }
.settings-details { border: 1px solid var(--line); border-radius: 7px; padding: 8px; }
.settings-details summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.settings-details form { padding-top: 9px; }
.rankings { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 15px; }
.rankings .panel-title { margin-bottom: 6px; }
.rankings .panel-title h2 { font: 650 1.05rem "Segoe UI", system-ui, sans-serif; margin: 0; }
#ranking-results { color: var(--muted); font-size: .9rem; }
#ranking-results ol { margin: 0; padding-inline-start: 1.55rem; }
#ranking-results li { padding: 6px 0 6px 3px; border-bottom: 1px solid #2a394080; }
#ranking-results li::marker { color: var(--gold); font-weight: 650; }
#ranking-results li strong { color: var(--text); overflow-wrap: anywhere; }
.ranking-wins { float: right; padding-left: 8px; color: var(--gold); font-variant-numeric: tabular-nums; }
.room-note { color: var(--muted); font-size: .88rem; line-height: 1.4; margin: 10px 0; }
.room-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.player-head h3 { overflow-wrap: anywhere; }
.player-head .avatar { flex: none; }
.player-identity { flex: 1; min-width: 0; }
.player-name-row { display: flex; align-items: center; gap: 5px; }
.player-name-row h3 { min-width: 0; }
.player-metrics { display: flex; flex: none; align-items: center; gap: 3px; margin-left: auto; }
.player-metrics .player-metric { display: inline-flex; align-items: center; gap: 2px; margin: 0; padding: 2px 3px; color: #b7c9c8; background: #102127; border: 1px solid #53666e72; border-radius: 4px; font-size: .79rem; font-weight: 650; }
.player-metrics .player-metric.awarded { color: #201805; background: #f9cb5b; border-color: #ffe797; }
.player-head .score { flex: none; }
@media (max-width: 430px) {
  #players { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .lobby { grid-template-columns: minmax(0, 1fr); min-height: auto; }
  .lobby-preview { min-height: clamp(280px, 67vw, 500px); }
}

.right-rail { display: grid; grid-template-rows: auto minmax(220px, 1fr); gap: 12px; min-width: 0; }
.dice-stage, .chat { padding: 12px; }
.dice-stage .panel-title, .chat .panel-title { margin-bottom: 8px; }
.dice-tray { display: flex; justify-content: center; align-items: center; gap: 26px; min-height: 96px; border: 1px solid #3e574f; border-radius: 9px; background: radial-gradient(ellipse at center, #284943, #172c2b 82%); box-shadow: inset 0 10px 30px #0008; overflow: hidden; }
.dice-tray .die { filter: drop-shadow(0 9px 6px #0009); }
.dice-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.dice-actions button { flex: 1; }
.dice-stage #status { min-width: 0; min-height: 1.15em; padding: 0; margin-top: 7px; }
.chat { display: grid; grid-template-rows: auto minmax(85px, 1fr) auto auto; min-height: 0; }
#feed { overflow: auto; overscroll-behavior: contain; min-height: 0; }
#feed p { padding: 5px 4px 6px; border-bottom: 1px solid #2a394060; line-height: 1.3; overflow-wrap: anywhere; font-size: .86rem; }
#feed .game { color: var(--muted); }
#feed .game strong { color: #a7cac0; }
#feed .chat { display: block; color: var(--text); }
#feed .chat strong { color: var(--gold); }
#chat-form { display: flex; gap: 5px; margin-top: 7px; }
#chat-form input { width: 100%; min-width: 0; color: var(--text); background: #0e191f; border: 1px solid #43545a; border-radius: 7px; padding: 6px; font: inherit; font-size: .86rem; }
#chat-error { color: var(--gold); font-size: .82rem; }
#trade-form { margin-top: 16px; }
.target-robber { color: #381d23; background: #f0b5ac; border-color: #ffe2c3; width: 31px; height: 31px; }
#robber-choices:not(:empty), #project-choices:not(:empty) { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.log-resource { display: inline-flex; align-items: center; vertical-align: middle; gap: 2px; color: var(--item); padding: 1px 3px; border-radius: 4px; background: #243234; white-space: nowrap; }
#trade-offer { margin-top: 10px; padding: 9px; border: 1px solid #806c46; border-radius: 7px; background: #282920; }
#trade-offer > strong { color: var(--gold); }
.offer-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
.offer-line > span:first-child { color: var(--muted); min-width: 76px; }
.offer-actions { display: flex; gap: 5px; margin-top: 6px; }
#player-trade-form { margin-top: 12px; }
#player-trade-form table { width: 100%; table-layout: fixed; border-collapse: collapse; }
#player-trade-form th, #player-trade-form td { text-align: left; padding: 4px; border-bottom: 1px solid var(--line); }
#player-trade-form input { padding: 4px 6px; min-height: 34px; }
#offer-error { margin: 0; color: var(--gold); }
#feed .private { border-left: 2px solid #d5ab72; background: #d5ab7210; }
@media (min-width: 1060px) {
  .table { grid-template-columns: minmax(225px, .7fr) minmax(0, 2.45fr) minmax(230px, .8fr); }
  .right-rail { grid-area: 1 / 3 / span 2 / 4; max-height: max(660px, calc(100dvh - 119px)); }
}
@media (min-width: 761px) and (max-width: 1059px) {
  .right-rail { grid-column: span 2; grid-template-columns: 248px 1fr; grid-template-rows: minmax(220px, 285px); }
}
@media (max-width: 760px) {
  .right-rail { grid-row: 4; grid-template-rows: auto 250px; }
  .roster { grid-row: 5; }
}

/* motion & polish */
#map canvas { cursor: grab; }
#map canvas:active { cursor: grabbing; }
.board, .lobby-preview { background: #9cc7d6; }
.target { animation: target-pulse 1.5s var(--sync, 0s) ease-in-out infinite; transition: scale .15s; }
.target-road { animation: none; }
.target-road::after { animation: target-pulse 1.5s var(--sync, 0s) ease-in-out infinite; }
@keyframes target-pulse { 50% { box-shadow: 0 0 0 4px #34230b80, 0 0 18px 5px #ffd27acc; } }
.panel { animation: panel-in .6s cubic-bezier(.2, .8, .2, 1) both; }
.table > :nth-child(2), .lobby > :nth-child(2) { animation-delay: .08s; }
.table > :nth-child(3) { animation-delay: .14s; }
.table > :nth-child(4) { animation-delay: .2s; }
.table > :nth-child(5) { animation-delay: .26s; }
@keyframes panel-in { from { opacity: 0; translate: 0 14px; } }
.player.active { box-shadow: 0 0 0 1px color-mix(in srgb, var(--player) 55%, transparent), 0 0 24px -4px var(--player); }
button.primary { background: linear-gradient(110deg, var(--accent) 40%, #ffe9be 50%, var(--accent) 60%) 0 0 / 250% 100%; transition: background-position .6s, transform .15s; }
button.primary:hover:not(:disabled) { background-position: 100% 0; transform: translateY(-1px); }
.build { transition: transform .15s, box-shadow .15s; }
.build:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 16px #0007; }
.board-head { background: linear-gradient(#071419a0, transparent); }
.mark { animation: mark-bob 4s ease-in-out infinite; }
@keyframes mark-bob { 50% { translate: 0 -3px; rotate: -4deg; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
