:root {
  --bg: #efe8d6;
  --paper: #fbf6ea;
  --paper-2: #f4ecd9;
  --ink: #2c2a24;
  --muted: #7a735f;
  --line: #dccfb3;
  --forest: #23473a;
  --forest-2: #2f5e4b;
  --accent: #2f6b4f;
  --accent-dark: #22513b;
  --gold: #c99a2e;
  --woodland: #4f7a3c;
  --meadow: #b88a1f;
  --wetland: #2f6f95;
  --hl: #d9602f;
  --egg: #d3a62c;
  --radius: 12px;
  --seed: #a87b24;
  --berry: #a3304d;
  --insect: #4f7f25;
  --fish: #2a6c9c;
  --rodent: #6f6152;
  --any: #7a5aa6;
  --t-play: #b9583a;
  --t-activate: #3d6b4c;
  --t-end: #5b4a7a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --shadow: 0 1px 2px #0000001a, 0 4px 14px #0000000f;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font: 14px/1.35 ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
  background: var(--bg) url("img/landscape.svg") center bottom / cover no-repeat fixed;
}
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 8px; padding: 6px 12px; display: inline-flex; align-items: center; gap: 6px; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: inset 0 -2px 0 #0002; }
button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.ghost { background: transparent; }
input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 600; }
a { color: var(--accent-dark); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- icons ---------- */
.ic { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -0.2em; flex-shrink: 0; }
.fi { display: inline-flex; color: var(--any); }
.fi-seed { color: var(--seed); } .fi-berry { color: var(--berry); } .fi-insect { color: var(--insect); }
.fi-fish { color: var(--fish); } .fi-rodent { color: var(--rodent); } .fi-any { color: var(--any); }
.hi-woodland { color: var(--woodland); } .hi-meadow { color: var(--meadow); } .hi-wetland { color: var(--wetland); }
.egg-ic { color: var(--egg); }
.card-ic { color: #4a6b8a; }
.foodline { display: inline-flex; gap: 7px; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
.foodline .f { display: inline-flex; align-items: center; gap: 1px; }
.foodline .f.zero { opacity: .3; }

/* ---------- panels ---------- */
.panel, .box {
  background: color-mix(in srgb, var(--paper) 92%, transparent); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(3px);
}
.panel { padding: 10px 12px; }
.box { padding: 18px; margin-bottom: 14px; }
.panel h3, .box h3 { font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--forest); }
.box h3 { margin-bottom: 10px; }
.label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); font-weight: 700; }

/* ---------- home / lobby ---------- */
.center { max-width: 600px; margin: 5vh auto; padding: 0 16px 40px; }
.hero { text-align: center; margin-bottom: 18px; }
.hero h1 { font-size: 50px; display: inline-flex; align-items: center; gap: 10px; color: var(--forest); text-shadow: 0 2px 0 #fff8; }
.hero h1 .ic { width: 46px; height: 46px; color: var(--accent); }
.hero p { color: #4f4b3e; margin: 6px 0 0; font-size: 15px; }
.hero-fan { display: flex; justify-content: center; margin: 22px 0 8px; height: 230px; }
.hero-fan .bcard { margin: 0 -26px; box-shadow: 0 8px 24px #0003; }
.hero-fan .bcard:nth-child(1) { transform: rotate(-9deg) translateY(14px); }
.hero-fan .bcard:nth-child(2) { transform: rotate(-3deg); z-index: 1; }
.hero-fan .bcard:nth-child(3) { transform: rotate(4deg) translateY(4px); z-index: 2; }
.hero-fan .bcard:nth-child(4) { transform: rotate(10deg) translateY(18px); z-index: 1; }
.row-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-inline input { flex: 1; min-width: 140px; }
.code { font: 700 42px/1 ui-monospace, Menlo, monospace; letter-spacing: 8px; color: var(--forest); }
.plist { list-style: none; padding: 0; margin: 10px 0; }
.plist li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.bad { color: #b23b1d; font-weight: 600; }
.ok { color: var(--accent); font-weight: 600; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 50px; color: #fff; flex-wrap: nowrap; position: relative; z-index: 5;
  background: linear-gradient(180deg, #2d5a48, #1f4134); box-shadow: 0 2px 10px #0003;
  border-bottom: 2px solid #c99a2e;
}
.topbar h1 { font-size: 20px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.topbar h1 .ic { color: #f0d27a; }
.topbar .spacer { flex: 1; }
.topbar button, .topbar a.pill { background: #ffffff1a; color: #fff; border-color: #ffffff40; text-decoration: none; }
.topbar button:hover { background: #ffffff30; border-color: #fff; }
.pill { padding: 3px 11px; border-radius: 999px; background: #ffffff1a; border: 1px solid #ffffff3a; white-space: nowrap; font-size: 13px; }
.pill.goal-now { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.pill.turn { background: #f0d27a; color: #3a2e0a; border-color: #f0d27a; font-weight: 700; }

/* ---------- game table: fits one screen ---------- */
.table { display: grid; grid-template-columns: 236px minmax(0, 1fr) 272px; gap: 10px; padding: 10px; height: calc(100vh - 50px); }
.col { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.col.left { overflow-y: auto; }
.col.mid { gap: 8px; }
@media (max-width: 1100px), (max-height: 640px) {
  .table { grid-template-columns: 1fr; height: auto; }
  .board { grid-template-rows: repeat(3, 200px) !important; }
  .dock { height: 170px !important; }
}

/* players */
.player { padding: 7px 8px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; position: relative; }
.player + .player { margin-top: 3px; }
.player:hover { background: #f1e8d3; }
.player.viewing { border-color: var(--accent); background: #eef1e4; }
.player.current { box-shadow: inset 3px 0 0 var(--hl); }
.pname { font-weight: 650; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.pname .turnmark { color: var(--hl); width: 11px; height: 11px; }
.score { display: inline-flex; align-items: center; gap: 3px; background: var(--forest); color: #fff; border-radius: 6px; padding: 0 7px; font-size: 13px; }
.pmeta { color: var(--muted); font-size: 11.5px; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pmeta .ic { width: 13px; height: 13px; }
.minimap { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin-top: 5px; }
.minimap i { height: 7px; border-radius: 2px; background: #00000012; }
.minimap i.woodland { background: var(--woodland); } .minimap i.meadow { background: var(--meadow); } .minimap i.wetland { background: var(--wetland); }

.goal { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; }
.goal:last-child { border-bottom: 0; }
.goal .r { font-weight: 800; min-width: 22px; color: var(--muted); font-family: var(--serif); }
.goal.now .r { color: var(--hl); }
.goal.now { background: #fff4dc; margin: 0 -6px; padding: 5px 6px; border-radius: 6px; }
.goal .pts { color: var(--muted); font-size: 11px; white-space: nowrap; }
.goal .res { font-size: 11px; color: var(--muted); }
.objective { padding: 8px 10px; border-radius: 9px; background: #efe7f7; border: 1px solid #cdbbe4; font-size: 13px; }
.objective b { display: block; font-family: var(--serif); }
.objective.pick { cursor: pointer; }
.objective.selected { box-shadow: 0 0 0 3px var(--accent); }

/* prompt + board header */
.prompt { padding: 8px 12px; border-radius: 10px; background: #fff7e2f0; border: 1px solid #ecd29a; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 500; min-height: 40px; box-shadow: var(--shadow); }
.prompt.mine { background: #ffeadff2; border-color: var(--hl); }
.prompt .grow { flex: 1; }
.prompt button { padding: 4px 10px; }
.board-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tab { border-radius: 999px; padding: 3px 12px; font-size: 13px; background: #fffbf0d9; }
.tab.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.tab .score { background: #0000001f; color: inherit; padding: 0 5px; margin-left: 2px; }
.board-head .foodline { margin-left: auto; background: #fffbf0d9; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }

/* board */
.board { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hrow {
  display: grid; grid-template-columns: 112px repeat(5, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) auto; gap: 4px 6px; padding: 6px;
  border-radius: var(--radius); border: 1px solid #00000014; background-size: cover; background-position: center bottom; min-height: 0; box-shadow: var(--shadow); position: relative;
}
.hrow::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, #fffdf6d9 0, #fffdf680 120px, #fffdf626 60%); pointer-events: none; }
.hrow > * { position: relative; }
.hrow.woodland { background-image: url("img/woodland.svg"); }
.hrow.meadow { background-image: url("img/meadow.svg"); }
.hrow.wetland { background-image: url("img/wetland.svg"); }
.hhead { grid-row: 1 / 3; display: flex; flex-direction: column; gap: 5px; justify-content: center; min-height: 0; }
.hhead .hname { font-family: var(--serif); font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.hhead .hname .ic { width: 22px; height: 22px; }
.hhead button { font-size: 12.5px; padding: 5px 6px; justify-content: center; }
.hhead .gain { font-size: 12px; color: #3f3b30; display: flex; align-items: center; gap: 3px; }
.hhead .order { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 3px; }
.hhead .order .ic { width: 11px; height: 11px; }
.cell { min-height: 0; min-width: 0; display: flex; justify-content: center; }
.slot { width: 100%; max-width: 170px; height: 100%; border: 2px dashed #0000002b; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #00000080; font-size: 11.5px; text-align: center; padding: 4px; background: #ffffff59; }
.slot.next { border-color: #00000066; background: #ffffffb3; color: #000000b0; }
.slot .ic { width: 13px; height: 13px; }
.chip { font-size: 10.5px; color: #3f3b30; display: flex; align-items: center; justify-content: center; gap: 3px; background: #fffbf0c7; border-radius: 6px; padding: 1px 4px; white-space: nowrap; overflow: hidden; }
.chip .ic { width: 11px; height: 11px; }
.chip.reached { opacity: .55; }
.chip.next { box-shadow: 0 0 0 1.5px var(--hl); background: #fff; }

/* hand dock */
.dock { height: clamp(130px, 21vh, 180px); flex-shrink: 0; display: flex; gap: 10px; align-items: stretch; padding: 8px 10px; }
.dock .dock-label { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 92px; font-size: 12px; }
.dock .dock-label b { font-family: var(--serif); font-size: 15px; color: var(--forest); }
.hand { flex: 1; display: flex; align-items: stretch; min-width: 0; padding: 0 4px; }
.hand .bcard { height: 100%; flex-shrink: 0; transition: transform .12s, margin .12s; }
.hand .bcard:hover { transform: translateY(-8px); z-index: 3; }
.hand .empty { align-self: center; }

/* right column */
.pool { display: flex; gap: 6px; flex-wrap: wrap; }
.token { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #fff, #efe6d2); border: 3px solid currentColor; box-shadow: inset 0 -2px 0 #0000001a, 0 1px 3px #0003; }
.token .ic { width: 21px; height: 21px; }
.token.pick { cursor: pointer; box-shadow: 0 0 0 3px var(--hl), 0 2px 6px #0003; }
.token.pick:hover { transform: translateY(-2px); }
.note { font-size: 11px; color: var(--muted); margin-top: 5px; }
.tray { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; height: clamp(250px, 40vh, 380px); grid-template-rows: 1fr 1fr; }
.tray .bcard { height: 100%; width: 100%; }
.deck { border-radius: 10px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 700; border: 3px solid #e9dfc6; font-family: var(--serif);
  background: #2f6b4f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36'%3E%3Cpath d='M26 6c-8 0-13 5-14 12l-2 4 1 .4 2-3.6C20 18 25 13 26 6z' fill='%23fff' fill-opacity='.09'/%3E%3C/svg%3E"); box-shadow: var(--shadow); }
.deck .ic { width: 30px; height: 30px; opacity: .9; color: #f0d27a; }
.deck.pick { cursor: pointer; box-shadow: 0 0 0 3px var(--hl); }
.logp { flex: 1; min-height: 80px; display: flex; flex-direction: column; }
.log { flex: 1; overflow: auto; font-size: 11.5px; display: flex; flex-direction: column-reverse; }
.log div { padding: 2px 0; border-bottom: 1px solid #efe6d2; }

/* ---------- bird cards ---------- */
.bcard {
  --bc: #fbf6ea;
  position: relative; display: flex; flex-direction: column; border-radius: .8em; overflow: hidden; background: var(--bc);
  border: 1px solid #00000026; box-shadow: 0 1px 2px #0000002a, 0 3px 10px #0000001a; font-size: 13px; color: var(--ink);
  background-image: linear-gradient(180deg, #fffdf6, #f3ead6);
}
.bcard.full { width: 15em; height: 21em; }
.bcard.mini { font-size: 8.4px; width: 100%; max-width: 170px; height: 100%; }
.hand .bcard.mini, .tray .bcard.mini { max-width: none; }
.hand .bcard.mini { width: auto; aspect-ratio: 0.72; }
.bc-head { display: flex; align-items: center; gap: .45em; padding: .45em .55em .35em; min-height: 3.1em; border-bottom: 1px solid #0000001a; background: linear-gradient(180deg, #fffefa, #f6efdf); }
.bc-pts { display: inline-flex; align-items: center; justify-content: center; gap: .1em; min-width: 2.3em; height: 2.3em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4a7a62, #23473a); color: #fff; font-weight: 800; font-size: 1em; box-shadow: inset 0 -2px 0 #0003, 0 0 0 2px #e9d9a8; flex-shrink: 0; position: relative; }
.bc-pts .ic { position: absolute; width: 1em; height: 1em; left: -.15em; top: -.2em; color: #f0d27a; }
.bc-pts b { font-family: var(--serif); font-size: 1.25em; }
.bc-name { font-family: var(--serif); font-weight: 700; font-size: 1.08em; line-height: 1.08; font-variant: small-caps; letter-spacing: .02em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bc-art { position: relative; flex: 1; min-height: 0; background: #e8e0cc; border-bottom: 1px solid #00000020; }
.bc-art .bird-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bc-habs { position: absolute; left: .4em; top: .4em; display: flex; flex-direction: column; gap: .25em; }
.hab-dot { width: 1.9em; height: 1.9em; border-radius: 50%; display: grid; place-items: center; color: #fff; box-shadow: 0 0 0 1.5px #fffbf0, 0 1px 3px #0004; }
.hab-dot .ic { width: 1.25em; height: 1.25em; }
.hab-dot.woodland { background: var(--woodland); } .hab-dot.meadow { background: var(--meadow); } .hab-dot.wetland { background: var(--wetland); }
.bc-cost { position: absolute; right: .4em; top: .4em; display: flex; align-items: center; gap: .1em; background: #fffbf0f0; border-radius: 1em; padding: .2em .4em; box-shadow: 0 1px 3px #0003; }
.bc-cost .ic { width: 1.45em; height: 1.45em; }
.bc-cost i { font-style: normal; color: var(--muted); font-size: .8em; }
.bc-cost.alt i { font-weight: 700; }
.bc-eggs { position: absolute; left: .4em; bottom: .35em; display: flex; gap: .05em; background: #fffbf0d9; border-radius: 1em; padding: .1em .35em; }
.bc-eggs .ic { width: 1.1em; height: 1.1em; }
.egg-cap { color: #fff; stroke: #b08a2a; }
.egg-cap use { color: #fffbf0; }
.egg-on { color: var(--egg); }
.egg-off { color: #0000002a; }
.bc-span { position: absolute; right: .4em; bottom: .35em; display: inline-flex; align-items: center; gap: .2em; font-family: var(--serif); font-weight: 700; font-size: .95em; color: #3a3426; background: #fffbf0d9; border-radius: 1em; padding: .1em .45em; }
.bc-span .ic { width: 1.1em; height: 1.1em; color: #6a5a3e; }
.bc-stats { position: absolute; right: .4em; top: 2.9em; display: flex; flex-direction: column; gap: .2em; align-items: flex-end; }
.bc-stats span { background: var(--forest); color: #fff; border-radius: 1em; padding: .1em .45em; font-weight: 800; display: inline-flex; align-items: center; gap: .2em; font-size: 1em; }
.bc-stats .ic { width: 1.1em; height: 1.1em; }
.bc-power { padding: .45em .6em .5em; font-size: .92em; line-height: 1.25; min-height: 4.4em; color: #fff; }
.bc-power b { display: flex; align-items: center; gap: .3em; text-transform: uppercase; letter-spacing: .07em; font-size: .78em; margin-bottom: .15em; opacity: .95; }
.bc-power b .ic { width: 1.15em; height: 1.15em; }
.bc-power.play { background: linear-gradient(180deg, #c3633f, var(--t-play)); }
.bc-power.activate { background: linear-gradient(180deg, #4a7c5a, var(--t-activate)); }
.bc-power.end { background: linear-gradient(180deg, #6a5890, var(--t-end)); }
.bc-power.none { background: #e8dfc9; color: var(--muted); font-style: italic; display: flex; align-items: center; }
.bcard.mini .bc-power { min-height: 0; padding: .35em .5em .4em; }
.bcard.mini .bc-power span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bcard.mini .bc-head { min-height: 2.9em; }
.bcard.tiny .bc-power, .bcard.tiny .bc-span, .bcard.tiny .bc-cost { display: none; }

.bcard.pick, .bcard.clickable { cursor: pointer; }
.bcard.pick { box-shadow: 0 0 0 3px var(--hl), 0 4px 12px #0003; }
.bcard.clickable:hover, .bcard.pick:hover { transform: translateY(-3px); }
.bcard.selected { box-shadow: 0 0 0 3px var(--accent), 0 4px 12px #0003; }
.bcard.unaffordable::after { content: ""; position: absolute; inset: 0; background: #f3ecdc80; pointer-events: none; }
.bcard.just-played { animation: pop .6s ease-out; }
@keyframes pop { 0% { transform: scale(.85); box-shadow: 0 0 0 6px #f0d27a; } 100% { transform: none; } }

/* hover preview */
#peek { position: fixed; z-index: 30; pointer-events: none; transition: opacity .08s; filter: drop-shadow(0 12px 28px #0005); }
#peek .bcard.full { font-size: 15px; }
#peek .peek-board { background: var(--paper); border-radius: 12px; padding: 10px; border: 1px solid var(--line); width: 560px; }
#peek .peek-board h4 { margin: 0 0 6px; font-family: var(--serif); font-size: 15px; display: flex; gap: 8px; align-items: center; }
#peek .peek-row { display: grid; grid-template-columns: 24px repeat(5, 1fr); gap: 4px; margin-bottom: 4px; height: 96px; align-items: stretch; }
#peek .peek-row > .ic { align-self: center; width: 20px; height: 20px; }
#peek .peek-row .bcard { font-size: 6.5px; max-width: none; }
#peek .peek-row .empty { border: 1.5px dashed #0002; border-radius: 6px; }
#peek .peek-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* setup */
.setup-wrap { padding: 16px; max-width: 1100px; margin: auto; display: flex; flex-direction: column; gap: 12px; }
.setup-hand { display: flex; gap: 12px; flex-wrap: wrap; }

/* gallery */
.gallery-tools { display: flex; gap: 10px; align-items: center; padding: 12px 16px; flex-wrap: wrap; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; padding: 0 16px 30px; justify-items: center; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: #1b2a2299; display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal { background: var(--paper); border-radius: 14px; padding: 18px; width: min(600px, 100%); max-height: 92vh; overflow: auto; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px #0006; }
.modal.wide { width: min(860px, 100%); }
.modal .top { display: flex; gap: 16px; }
.modal .top .bcard { flex-shrink: 0; }
.choice-row { display: flex; gap: 6px; flex-wrap: wrap; }
.choice-row button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.counter { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 2px 4px; background: #fff; }
.counter button { padding: 0 7px; border: 0; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid td .ic { width: 15px; height: 15px; }
table.grid tr.sub td { color: var(--muted); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend .ic { width: 20px; height: 20px; }
.guide p { margin: 6px 0; }
.tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: #efe7f7; color: var(--t-end); text-transform: uppercase; letter-spacing: .5px; }
.trig { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 700; }
.trig.play { background: var(--t-play); } .trig.activate { background: var(--t-activate); } .trig.end { background: var(--t-end); }

table.scores { border-collapse: collapse; width: 100%; }
table.scores th, table.scores td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; }
table.scores th:first-child, table.scores td:first-child { text-align: left; }
table.scores tr.win td { font-weight: 700; background: #fff4dc; }
table.scores .ic { color: var(--egg); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #b23b1d; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 40; box-shadow: 0 6px 20px #0003; }

/* ===================================================================
   Table polish (online board-game conventions: player colours, chunky
   panels, an action bar beside your hand, a game log + chat feed)
   =================================================================== */
body { font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; }
.panel { background: #fffdf8f2; border: 0; border-radius: 14px; box-shadow: 0 3px 0 #0000001c, 0 8px 22px #00000014; }
button { border-radius: 10px; box-shadow: 0 2px 0 #0000001f; font-weight: 600; }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 #0000001f; }
button.primary { box-shadow: 0 3px 0 #173a2c; }

/* avatars + player panels */
.avatar { --pc: #888; position: relative; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 70%, #fff), var(--pc)); display: inline-grid; place-items: center; color: #fff; flex-shrink: 0; box-shadow: 0 0 0 2px #fff, 0 2px 4px #0003; }
.avatar .ic { position: absolute; width: 60%; height: 60%; opacity: .22; }
.avatar b { position: relative; font-size: 14px; font-weight: 800; }
.avatar.sm { width: 18px; height: 18px; box-shadow: 0 0 0 1.5px #fff; }
.avatar.sm b { font-size: 10px; }
.player { --pc: #888; border: 2px solid transparent; border-left: 5px solid var(--pc); border-radius: 12px; padding: 7px 8px 8px; background: #fff; box-shadow: 0 2px 0 #00000012; }
.player + .player { margin-top: 7px; }
.player:hover { background: #fbf7ee; }
.player.viewing { border-color: var(--pc); border-left-width: 5px; background: #fff; }
.player.current { box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 45%, transparent), 0 2px 0 #00000012; animation: turnglow 1.6s ease-in-out infinite; }
@keyframes turnglow { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--pc) 25%, transparent), 0 2px 0 #00000012; } }
.pname { gap: 8px; justify-content: flex-start; }
.pname .pn { flex: 1; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.pname .pn small { font-weight: 500; color: var(--muted); font-size: 11px; }
.pname .score { font-size: 15px; padding: 2px 9px; border-radius: 8px; background: var(--pc, var(--forest)); }
.pmeta.chips span { background: #f3ede0; border-radius: 6px; padding: 1px 6px; display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: #4a4536; }
.tab { --pc: #888; display: inline-flex; align-items: center; gap: 6px; border: 2px solid transparent; }
.tab.on { background: #fff; color: var(--ink); border-color: var(--pc); box-shadow: 0 2px 0 var(--pc); }
.tab.on .score { background: var(--pc); color: #fff; }

/* action bar next to the hand */
.dock { gap: 12px; }
.actionbar { display: flex; gap: 8px; align-items: stretch; flex-shrink: 0; }
.act { width: 82px; flex-direction: column; justify-content: center; gap: 2px; color: #fff; border: 0; border-radius: 14px; padding: 8px 4px; font-size: 12px; box-shadow: 0 4px 0 #0003, inset 0 1px 0 #ffffff40; }
.act .ic { width: 28px; height: 28px; }
.act b { font-size: 14px; }
.act span { display: inline-flex; align-items: center; gap: 2px; background: #ffffff2e; border-radius: 8px; padding: 1px 7px; font-weight: 700; }
.act span .ic { width: 14px; height: 14px; }
.act.woodland { background: linear-gradient(180deg, #5f8f48, #3f6a2e); }
.act.meadow { background: linear-gradient(180deg, #d2a23a, #a77a17); }
.act.wetland { background: linear-gradient(180deg, #4a8fbb, #2a6488); }
.act:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-2px); }
.act:disabled { opacity: .4; filter: grayscale(.4); }
.act-info { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 64px; background: var(--forest); color: #fff; border-radius: 14px; box-shadow: 0 4px 0 #0003; }
.act-info b { font-size: 26px; line-height: 1; font-family: var(--serif); }
.act-info span { font-size: 10.5px; opacity: .85; }

/* feed: log + chat */
.feed-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.feed-tabs button { flex: 1; padding: 4px 6px; font-size: 12.5px; background: #f1ead9; border: 0; box-shadow: none; }
.feed-tabs button.on { background: var(--forest); color: #fff; }
.badge { background: var(--hl); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.log div { padding: 3px 2px; }
.log div.round { background: #fff4dc; font-weight: 700; border-radius: 6px; padding: 4px 6px; }
.log div.sub { padding-left: 12px; color: #5d5848; }
.chat { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; min-height: 0; }
.chat .msg { background: #f6f1e5; border-radius: 10px; padding: 4px 8px; align-self: flex-start; max-width: 92%; }
.chat .msg.me { background: #e5efe6; align-self: flex-end; }
.chat-in { display: flex; gap: 6px; margin-top: 6px; }
.chat-in input { flex: 1; min-width: 0; padding: 6px 8px; }
.chat-in button { padding: 4px 10px; }

/* nest icons */
.nest-ic { display: inline-flex; color: #7a5a3a; }
.nest-ic .ic { width: 1.25em; height: 1.25em; }
.nest-cup { color: #8a6236; } .nest-cavity { color: #6b4a2e; } .nest-platform { color: #7a6a4a; } .nest-ground { color: #9a7a50; } .nest-mound { color: #4f7a6a; } .nest-wild { color: #8a6236; }
.bc-eggs { align-items: center; gap: .1em; }
.bc-eggs .nest-ic { margin-right: .2em; padding-right: .25em; border-right: 1px solid #0000001f; }
.legend .nest-ic .ic { width: 22px; height: 22px; }
.guide .nest-ic .ic { width: 18px; height: 18px; vertical-align: -4px; }

/* home page: keep the card fan inside its own space, behind nothing */
.hero { position: relative; z-index: 0; }
.hero-fan { height: 260px; margin: 18px 0 14px; position: relative; z-index: 0; isolation: isolate; }
.hero-fan .bcard { font-size: 11px; }
.center > .box { position: relative; z-index: 1; }

/* real bird photos on cards */
.bc-art .bird-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; display: block; filter: saturate(1.05) contrast(1.02); }
.bc-art .photo-shade { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 18px #3a2e1a40; background: linear-gradient(180deg, #0000 60%, #0000002a); }
table.credits td { text-align: left; font-size: 12.5px; }

/* bots */
.bot-tag { display: inline-block; font-size: 9.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; padding: 1px 6px; border-radius: 6px; vertical-align: 1px; color: #fff; }
.bot-tag.easy { background: #5f9a5a; } .bot-tag.medium { background: #c8902e; } .bot-tag.hard { background: #b2452f; }
button.tiny { padding: 1px 8px; font-size: 11.5px; box-shadow: none; }
select { font: inherit; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; margin-left: 4px; }

/* Whenever powers */
.bc-power.watch { background: linear-gradient(180deg, #3f8098, #2b6176); }
.trig.watch { background: #2f6a80; }
/* nest pictures inside text */
.bc-power .nest-ic, .objective .nest-ic, .goal .nest-ic, .prompt .nest-ic, .log .nest-ic, table.grid .nest-ic, .pill .nest-ic, .gallery-tools .nest-ic { display: inline-flex; vertical-align: -0.28em; }
.bc-power .nest-ic { background: #fffbf0; border-radius: 50%; padding: .05em; margin: 0 .05em; }
.bc-power .nest-ic .ic { width: 1.3em; height: 1.3em; }
.objective .nest-ic .ic, .goal .nest-ic .ic, .prompt .nest-ic .ic, .log .nest-ic .ic, table.grid .nest-ic .ic, .pill .nest-ic .ic { width: 1.35em; height: 1.35em; }
.pill .nest-ic { color: #f0d27a; }
.gallery-tools .nest-ic .ic { width: 18px; height: 18px; }
.nest-legend .nest-ic .ic { width: 24px; height: 24px; }

.prompt.objective-offer { align-items: stretch; }
.prompt.objective-offer .objective { max-width: 280px; font-size: 12.5px; }
.prompt.objective-offer .objective:hover { box-shadow: 0 0 0 3px var(--hl); }
.objective + .objective { margin-top: 6px; }
.prompt .objective + .objective { margin-top: 0; }

/* mixed food tokens: split in two */
.token.mixed { border: 3px solid transparent; background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, var(--fa) 50%, var(--fb) 50%) border-box; position: relative; }
.token.mixed span { position: absolute; display: inline-flex; }
.token.mixed span:first-child { left: 4px; top: 4px; }
.token.mixed span:last-child { right: 4px; bottom: 4px; }
.token.mixed .ic { width: 16px; height: 16px; }
.token.mixed::after { content: ""; position: absolute; width: 2px; height: 120%; background: #0002; transform: rotate(45deg); }
.token.chosen { box-shadow: 0 0 0 3px var(--accent), 0 2px 6px #0003; }
/* bonus trades */
.chip .trade { display: inline-flex; align-items: center; gap: 1px; margin-left: 3px; padding-left: 3px; border-left: 1px solid #0002; color: #7a4a1a; font-weight: 700; }
.trade-note { color: #7a4a1a; font-weight: 600; }
.trade-note .ic, .chip .trade .ic { width: 12px; height: 12px; }

/* Always powers + egg discounts */
.bc-power.always { background: linear-gradient(180deg, #8a6d3b, #6e552b); }
.trig.always { background: #7a5f30; }
.pmeta.chips span.credit { background: #fff1cf; color: #7a5a12; }

/* room settings */
.settings-box h3 { justify-content: flex-start; }
.pill-mini { font-size: 11px; font-weight: 700; background: var(--hl); color: #fff; padding: 1px 8px; border-radius: 999px; font-family: inherit; }
.pill-mini.plain { background: #e6dcc3; color: var(--muted); }
.presets { margin-bottom: 6px; }
.presets button { padding: 3px 10px; font-size: 12.5px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.sgroup { display: flex; flex-direction: column; gap: 4px; }
.sgroup.chaos { grid-column: 1 / -1; background: #f7efe0; border-radius: 10px; padding: 8px 10px; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; padding: 3px 6px; border-radius: 8px; }
.srow.changed { background: #fff1d6; }
.srow input[type=number] { width: 64px; padding: 4px 6px; }
.srow input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.srow select { margin: 0; }
.active-settings { margin: 0; padding-left: 18px; font-size: 12.5px; }
/* fog of war card back */
.bcard.back { align-items: center; justify-content: center; gap: 6px; color: #f0d27a; background: #2f5e4b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36'%3E%3Cpath d='M26 6c-8 0-13 5-14 12l-2 4 1 .4 2-3.6C20 18 25 13 26 6z' fill='%23fff' fill-opacity='.09'/%3E%3C/svg%3E"); font-family: var(--serif); font-weight: 700; }
.bcard.back .ic { width: 2.4em; height: 2.4em; }
@media (max-width: 640px) { .settings-grid { grid-template-columns: 1fr; } }

/* trading */
.trades .offer { border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; margin-bottom: 6px; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.trades .offer.incoming { border-color: var(--hl); background: #fff4ec; }
.trades .offer.open { background: #f3f7ee; }
.trades .offer.mine { background: #f6f1e5; }
.trades .offer button { margin-right: 4px; }
.trades .bid { display: flex; gap: 6px; align-items: center; justify-content: space-between; width: 100%; }
.tf, .tc { display: inline-flex; align-items: center; gap: 1px; margin-right: 6px; font-weight: 700; }
.tc { background: #e9e2cf; border-radius: 6px; padding: 0 6px; font-weight: 600; cursor: default; }
.trades .arrow { color: var(--muted); margin: 0 4px; }
.modal .give { font-size: 13px; }

.prompt.objective-offer.swap .swap-out { display: flex; flex-direction: column; gap: 4px; }
.prompt.objective-offer.swap .swap-out button { font-size: 12px; padding: 3px 8px; }

/* footer + bug report / contact */
.site-footer { text-align: center; font-size: 13px; color: var(--muted); margin-top: 18px; background: #fffdf8cc; border-radius: 10px; padding: 8px; }
.site-footer a { color: var(--forest); }
.modal.feedback { width: min(560px, 100%); gap: 10px; }
.fb-row { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.fb-row input, .fb-row textarea { font: inherit; font-weight: 400; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; resize: vertical; }
.fb-check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* accounts */
.account-bar { background: #fffdf8e6; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; text-align: center; box-shadow: var(--shadow); }
.account-bar a { color: var(--forest); font-weight: 600; }
.invites .invite { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.invites .invite:last-child { border-bottom: 0; }
.invites .invite button { margin-left: 4px; }
.friend-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #efe6d2; font-size: 13.5px; }
.friend-row a { font-weight: 700; color: var(--forest); }
.friend-row .muted { flex: 1; font-size: 12px; }
.friend-row button { margin-left: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c9c0aa; display: inline-block; flex-shrink: 0; }
.dot.on { background: #3fae5a; box-shadow: 0 0 0 3px #3fae5a33; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: #f6f1e5; border-radius: 12px; padding: 10px; text-align: center; }
.stat .sv { font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--forest); }
.stat .sl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.stat .ss { font-size: 12px; color: #5d5848; }
.wide-center { max-width: 760px; }
.board-table tr.me td { background: #fff4dc; font-weight: 700; }
.board-table a { color: var(--forest); font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form a { font-size: 13px; }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.toast.good { background: var(--forest); }

/* announcement banner + admin page */
.announce { background: #fff4c9; border: 1px solid #e8c95a; color: #5a4300; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 14px; box-shadow: var(--shadow); }
.admin textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid #cfc6b4; margin-bottom: 6px; }
.adm-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.adm-table td { padding: 5px 6px; border-top: 1px solid #eee6d6; vertical-align: top; }
.adm-actions { white-space: nowrap; text-align: right; }
.adm-actions button { margin-left: 3px; }
.adm-banned td:first-child a { text-decoration: line-through; }
.adm-room { border-top: 1px solid #eee6d6; padding: 8px 0; font-size: 13px; }
.adm-players { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; }
.adm-chat { margin-top: 6px; background: #f7f2e7; border-radius: 8px; padding: 6px 8px; max-height: 180px; overflow: auto; }
.adm-temp { font-size: 16px; padding: 4px 8px; background: #f2ecdf; border-radius: 6px; user-select: all; }
.tiny-pill { font-size: 11px; padding: 1px 6px; }
button.danger { color: #a3271c; border-color: #e3b1aa; }

/* visitor chart (admin) */
.vchart { display: flex; align-items: flex-end; gap: 2px; height: 90px; margin-top: 10px; padding: 4px; background: #f7f2e7; border-radius: 8px; }
.vbar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.vbar i { display: block; width: 100%; min-height: 1px; background: var(--forest, #2f5d3a); border-radius: 2px 2px 0 0; }
.vaxis { display: flex; justify-content: space-between; font-size: 11px; margin-top: 2px; }

/* recovery code */
.recovery-code { display: flex; align-items: center; gap: 10px; background: #f2ecdf; border-radius: 10px; padding: 10px 12px; }
.recovery-code code { font-size: 20px; letter-spacing: 1px; font-weight: 700; user-select: all; flex: 1; }
.adm-report { border-top: 1px solid #eee6d6; padding: 8px 0; font-size: 13px; }
.adm-report button { margin-left: 3px; }
.feedback select, .feedback textarea { width: 100%; box-sizing: border-box; font: inherit; }

/* ranks */
.rank { display: inline-block; padding: 2px 9px; border-radius: 999px; font-weight: 700; font-size: 13px; color: #fff; background: #8a8173; white-space: nowrap; font-family: var(--sans, inherit); }
.rank small { font-weight: 400; opacity: .9; }
.rank-bronze { background: #a0623a; } .rank-silver { background: #8b95a0; } .rank-gold { background: #c99a1e; }
.rank-platinum { background: #3f9a96; } .rank-diamond { background: #4a74c9; } .rank-champion { background: linear-gradient(90deg, #8b3fc9, #c93f7d); }
.rank-unranked { background: #b9b1a2; }
.stat .sv .rank { font-size: 15px; }
.rating-change { background: #f6f1e5; border-radius: 10px; padding: 8px 12px; margin: 8px 0; }

/* spectating, disconnected players */
.watch-pill { background: #e7f0ff; color: #2b4f8a; }
.watch-dock { padding: 12px 14px; }
.away { font-size: 12px; color: #9a5b12; margin: 2px 0 4px; }
.away button { margin-left: 4px; }

/* tutorial tips */
.tutorial-tip { position: fixed; left: 16px; bottom: 16px; z-index: 60; max-width: 340px; background: #fffdf6; border: 2px solid var(--forest, #2f5d3a); border-radius: 14px; padding: 12px 14px; box-shadow: 0 8px 28px #0003; font-size: 13.5px; line-height: 1.45; }
.tutorial-tip .tt-head { font-size: 15px; margin-bottom: 4px; color: var(--forest, #2f5d3a); }
.tutorial-tip .tt-body { margin-bottom: 8px; }

/* ranked matchmaking */
.ranked-box { border: 2px solid #c99a1e55; }
.ranked-box.searching { border-color: #c99a1e; }
.rank-pill { background: #fff1c9; color: #6b4e00; }
.spinner { width: 14px; height: 14px; border: 2px solid #c99a1e55; border-top-color: #c99a1e; border-radius: 50%; display: inline-block; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* rules page */
.rules-page .box h2 { margin: 0 0 8px; font-family: var(--serif); color: var(--forest); }
.rules-title { margin: 0 0 8px; font-family: var(--serif); color: var(--forest); font-size: 28px; }
.rules-toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 14px; }
.rules-toc a { color: var(--forest); font-weight: 600; }
.rules-sec { scroll-margin-top: 70px; line-height: 1.55; }
.rules-sec li { margin: 3px 0; }
.rules-list td { text-align: left; }
.rules-score td { text-align: left; }

/* turn timer */
.tclock { font-variant-numeric: tabular-nums; }
.tclock.low { color: #b3261e; font-weight: 700; }

/* server-rendered pages (/rules, /privacy, /terms) */
.static-page .home-link { color: inherit; text-decoration: none; }
.static-page .topbar .pill { text-decoration: none; }
.rules-cols { columns: 2 260px; column-gap: 24px; }
.rules-cols li { break-inside: avoid; }

/* invite links */
.invite-row { margin: 6px 0; }
.invite-link { flex: 1; min-width: 0; font-size: 13px; }
.invite-hero { border: 2px solid var(--forest, #2f5d3a); }

/* your-turn alerts */
.alerts-panel { position: fixed; top: 60px; right: 16px; z-index: 70; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; box-shadow: 0 8px 24px #0003; max-width: 300px; font-size: 13.5px; }
.alerts-panel label { display: flex; gap: 6px; align-items: flex-start; }

/* daily challenge and season badges */
.daily-box { border: 2px solid #4a74c955; }
.daily-table tr.me td { font-weight: 700; }
.season-badge { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; background: #f6f1e5; border-radius: 10px; }
.season-badge small { color: var(--muted); }
