/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --bg:       #0b0d10;
  --surface:  #131820;
  --card:     #151c26;
  --border:   #1e2a38;
  --border2:  #263344;
  --muted:    #6a7d8f;
  --dim:      #99a3ad;
  --white:    #e6e9ef;
  --acc:      #7cc3ff;
  --acc2:     #4fa8f0;
  --green:    #4ecb8a;
  --amber:    #f5c842;
  --red:      #ff6b6b;

  /* zone colours */
  --forest-c:    #3d7a5e;
  --grassland-c: #c49a1a;
  --wetland-c:   #2b80b8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font: 14px/1.5 'Segoe UI', system-ui, sans-serif;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 48px;
  background: #0d1219;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .02em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Seat pill in topbar */
.topbar-seat {
  flex-shrink: 0;
}
.seat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1a2636;
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 3px 10px 3px 6px;
  font-size: 12px;
  color: var(--acc);
  font-weight: 600;
}
.seat-pill .seat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--acc);
  box-shadow: 0 0 6px var(--acc);
}
.seat-pill.spectator { color: var(--muted); border-color: var(--border); }
.seat-pill.spectator .seat-dot { background: var(--muted); box-shadow: none; }

/* Log ticker in topbar */
.topbar-log {
  flex: 1;
  min-width: 0;
  padding: 0 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  appearance: none;
}
.topbar-log:hover .log-latest { color: var(--white); }
.log-latest {
  display: block;
  width: 100%;
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.log-latest.log-flash {
  color: var(--white);
  transition: color 2s ease;
}

.log-history-panel {
  position: fixed;
  top: 56px;
  left: 16px;
  right: 16px;
  max-height: min(55vh, 520px);
  z-index: 220;
  background: #0f151d;
  border: 1px solid var(--border2);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,.45);
  overflow: hidden;
}
.log-history-panel[hidden] { display: none; }
.log-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  background: #111925;
  border-bottom: 1px solid var(--border);
}
.log-history-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.log-history-close:hover { color: var(--white); }
.log-history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: min(55vh, 470px);
  overflow-y: auto;
}
.log-history-entry {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.log-history-entry:last-child { border-bottom: 0; }
.log-history-entry.empty { color: var(--muted); font-style: italic; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.seat-select {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--white);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}
.seat-select:focus { outline: none; border-color: var(--acc); }

/* readonly banner below topbar */
.readonly-banner {
  background: #1a1400;
  border-bottom: 1px solid #4a3800;
  color: var(--amber);
  font-size: 12px;
  text-align: center;
  padding: 4px 16px;
}

/* ── Turn indicator banner ── */
.turn-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s;
}
.turn-banner.my-turn {
  background: #0c2010;
  border-color: #1d5c2e;
  color: var(--green);
}
.turn-banner.their-turn {
  background: #0f111a;
  border-color: var(--border);
  color: var(--muted);
}
.turn-banner .turn-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.turn-banner.my-turn .turn-dot {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 1.6s ease-in-out infinite;
}
.turn-banner.their-turn .turn-dot {
  background: var(--muted);
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 4px var(--green); opacity: 1; }
  50%       { box-shadow: 0 0 10px var(--green); opacity: .6; }
}

/* active player row — stronger highlight */
.player-row.is-active .player-row-header {
  background: #0f1f14 !important;
}
.player-row.is-me.is-active .player-row-header {
  background: #1a1e0b !important;
}

/* ============================================================
   BADGES & UTILS
   ============================================================ */
.badge {
  display: inline-block;
  border: 1px solid var(--border2);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--dim);
  font-size: 11px;
}
.badge.active-badge { border-color: var(--green); color: var(--green); }
.badge.you-badge    { border-color: var(--acc);   color: var(--acc); }
.badge.cubes        { border-color: var(--border2); }

.small { font-size: 12px; color: var(--dim); }
.muted { color: var(--muted); }

main { padding: 12px 16px; }

/* ============================================================
   LAYOUT
   ============================================================ */
.board {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

/* zones + hand stacked in right column only */
.zones-and-hand {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar .panel {
  background: var(--card);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

/* ============================================================
   PLAYERS PANEL — collapsible food inventory
   ============================================================ */
#players { padding: 8px 10px; }

.player-row {
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  overflow: hidden;
}
.player-row:last-child { margin-bottom: 0; }

.player-row-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
}
.player-row-header:hover { background: #192130; }

.player-row.is-active .player-row-header {
  border-left: 3px solid var(--green);
}
.player-row.is-me .player-row-header {
  border-left: 3px solid var(--acc);
}
.player-row.is-me.is-active .player-row-header {
  border-left: 3px solid var(--amber);
}

.player-name { font-weight: 600; font-size: 13px; flex: 1; }
.player-vp   { font-size: 12px; color: var(--amber); font-weight: 700; }
.player-cubes { font-size: 11px; color: var(--muted); }

.player-inventory {
  padding: 6px 8px 8px;
  background: #0f151e;
  border-top: 1px solid var(--border);
  display: none;
}
.player-row.expanded .player-inventory { display: block; }

.collapse-arrow {
  font-size: 10px;
  color: var(--muted);
  transition: transform .15s;
  flex-shrink: 0;
}
.player-row.expanded .collapse-arrow { transform: rotate(90deg); }

#action-helper {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
#action-helper:empty { display: none; }
#action-helper .egg-picker,
#action-helper .egg-pay-picker,
#action-helper .draw-picker {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.btn {
  background: #1a2535;
  border: 1px solid var(--border2);
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--white);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background .1s, border-color .1s, transform .08s;
  flex: 1;
}
.btn:hover  { background: #243348; border-color: var(--acc2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

/* ============================================================
   ZONES
   ============================================================ */
.zones { display: grid; gap: 8px; min-width: 0; }

.zone {
  background: var(--surface);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.zone h3 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
.zone-header {
  justify-content: space-between;
  gap: 10px;
}
.zone-action-btn {
  flex: 0 1 auto;
  min-width: 112px;
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: .03em;
}

/* ── White zone: inline strip (cube badge + egg costs on one row) ── */
.zone.white {
  padding: 4px 10px;
}

.white-zone-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.white-zone-label {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--muted);
}

#zone-white {
  display: flex;
  gap: 3px;
  flex: 1;
}
.white-cost-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0f141b;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 2px;
  gap: 1px;
  min-width: 0;
}
/* First cell (slot 1 = "no eggs") is narrower */
.white-cost-cell:first-child {
  flex: 0.6;
}
.white-cost-slot {
  font-size: 8px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1;
}
.white-cost-label {
  font-size: 8px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

/* ── Colour-zone slot grid ────────────────────────────────── */
.slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.card-tile {
  background: #12161e;
  border: 1px dashed var(--border);
  border-radius: 7px;
  overflow: hidden;
  position: relative;
  min-height: 60px;   /* enough for an empty bonus label */
}

/* zone tints on tiles */
.zone.forest    .card-tile { border-color: #2e463e; background: rgba(36,80,63,.12); }
.zone.grassland .card-tile { border-color: #4a442a; background: rgba(110,90,28,.12); }
.zone.wetland   .card-tile { border-color: #2b3f5a; background: rgba(22,63,92,.12); }

.card-tile .bonus {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 60px;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 4px 6px;
  line-height: 1.25;
  flex-direction: column;
}
.bonus-optional {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  color: var(--dim);
}

/* ── Compact board card (tray-style) ──────────────────────── */
.board-card {
  padding: 5px 7px 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: default;
}

.board-card-top {}

.board-card-name {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.board-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
  margin-top: 2px;
}
.board-card-meta .icon-res { width: 12px; height: 12px; }

.board-card-power {
  font-size: 9px;
  color: #8a99ab;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  border-left: 2px solid var(--border2);
  padding-left: 4px;
  margin-top: 1px;
}
/* power colour accents on board */
.board-card-power.brown  { border-color: #c0823a; }
.board-card-power.teal   { border-color: #3ab8b0; }
.board-card-power.white  { border-color: #aabbc8; }
.board-card-power.pink   { border-color: #d46fa3; }
.board-card-power.yellow { border-color: #c9a800; }

.board-card-footer {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 1px;
}
.board-egg-bar {
  font-size: 9px;
  letter-spacing: .5px;
  color: var(--amber);
}
.board-cached {
  font-size: 9px;
  color: var(--dim);
  display: flex;
  gap: 2px;
  align-items: center;
}
.board-cached .icon-res { width: 10px; height: 10px; }
.board-tucked {
  font-size: 9px;
  color: var(--muted);
}

/* ============================================================
   HAND — grid layout matching board cards
   ============================================================ */
.hand-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 12px;
  overflow: hidden;
}

.hand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
}
.hand-header h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.hand-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}

.hand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 10px;
}

/* Hand cards — same structure as board cards */
#hand .card-frame {
  background: #11161e;
  border: 1px solid var(--border2);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .12s, box-shadow .12s;
  cursor: default;
}
#hand .card-frame:hover {
  border-color: var(--acc2);
  box-shadow: 0 0 0 1px rgba(79,168,240,.2), 0 4px 12px rgba(0,0,0,.4);
}

.play-buttons {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  background: #0d1218;
}
.play-btn {
  flex: 1;
  padding: 5px 6px;
  font-size: 11px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.play-btn .btn-label { font-size: 10px; color: var(--muted); }

/* ============================================================
   RESOURCE PILLS
   ============================================================ */
.res { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.res span {
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 11px;
}
.res .nectar       { border-color: #b185ff; color: #c9a8ff; }
.res .invertebrate { border-color: #51d289; color: #7de8ab; }
.res .rodent       { border-color: #b5c2cc; }
.res .seed         { border-color: #ffd166; color: #ffe08a; }
.res .fish         { border-color: #7cc3ff; color: #9dd4ff; }
.res .fruit        { border-color: #ff7b7b; color: #ffaaaa; }

/* ============================================================
   BIRDFEEDER
   ============================================================ */
#birdfeeder-panel { padding: 4px 0; }
#birdfeeder-panel h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.birdfeeder-dice { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }

.feeder-die {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: #16202c;
  transition: transform .12s, box-shadow .12s, opacity .15s, border-color .15s;
  cursor: default; position: relative; flex-shrink: 0;
}
.feeder-die img { width: 24px; height: 24px; pointer-events: none; }

.feeder-die.pickable { cursor: pointer; border-color: var(--acc); box-shadow: 0 0 0 2px rgba(124,195,255,.15); }
.feeder-die.pickable:hover { transform: translateY(-3px) scale(1.08); box-shadow: 0 0 0 3px rgba(124,195,255,.3), 0 6px 14px rgba(0,0,0,.3); }
.feeder-die.spent { opacity: .25; border-color: var(--border); cursor: not-allowed; }

.feeder-die .die-count {
  position: absolute; bottom: -5px; right: -4px;
  background: #253040; border: 1px solid var(--border2); border-radius: 999px;
  font-size: 10px; padding: 0 4px; color: var(--acc); line-height: 1.4;
  display: none;
}
.feeder-die.pickable .die-count { display: block; }
.feeder-picks-left { font-size: 11px; color: var(--muted); }
.feeder-picks-left strong { color: #7ff0c8; }

/* ============================================================
   BIRD TRAY
   ============================================================ */
#tray-panel { padding: 0; }
#tray-panel h3 { margin: 0; padding: 10px 12px 6px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.tray-cards { display: flex; flex-direction: column; gap: 5px; padding: 0 8px 8px; }
.tray-card {
  border-radius: 8px; padding: 8px 9px;
  border: 1px solid var(--border);
  background: #0f151d;
  display: flex; align-items: flex-start; gap: 7px;
  transition: border-color .12s;
}
.tray-card:hover { border-color: var(--border2); }
.tray-card-body { flex: 1; min-width: 0; }
.tray-card-name {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 2px;
  min-width: 0;
}
.tray-card-name-text {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.tray-card-sci  { font-size: 10px; color: var(--muted); font-style: italic; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-card-meta { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 3px; }
.tray-card-type-row { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.tray-card-power { font-size: 10px; color: #8a99ab; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.power-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: #151f2b;
  color: var(--dim);
}
.power-type-chip.brown  { border-color: #7a5422; color: #e7c08d; }
.power-type-chip.teal,
.power-type-chip.blue   { border-color: #206f6a; color: #90e5df; }
.power-type-chip.white  { border-color: #617382; color: #e3ebf3; }
.power-type-chip.pink   { border-color: #7d365b; color: #f3bdd5; }
.power-type-chip.yellow { border-color: #7f6a09; color: #f3df88; }

.tray-zone-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.tray-zone-dot.forest    { background: var(--forest-c);    box-shadow: 0 0 5px var(--forest-c); }
.tray-zone-dot.grassland { background: var(--grassland-c); box-shadow: 0 0 5px var(--grassland-c); }
.tray-zone-dot.wetland   { background: var(--wetland-c);   box-shadow: 0 0 5px var(--wetland-c); }
.tray-zone-dot.multi     { background: linear-gradient(135deg, var(--forest-c), var(--wetland-c)); }

.tray-card-take {
  flex-shrink: 0; padding: 4px 9px; font-size: 11px;
  border-radius: 6px; background: #1a2d3f; border: 1px solid #2a3d54;
  color: var(--acc); cursor: pointer; transition: background .1s, transform .1s;
  align-self: center;
}
.tray-card-take:hover { background: #1f3850; transform: scale(1.04); }
.tray-card-take:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.tray-empty { padding: 8px; font-size: 11px; color: var(--muted); text-align: center; }
.badge-vp { font-size: 10px; background: #1e2e3d; border: 1px solid #2a3d54; border-radius: 4px; padding: 1px 5px; color: var(--acc); }

/* ============================================================
   BONUS CARDS
   ============================================================ */
/* ============================================================
   BONUS CARDS — collapsible subsection inside hand panel
   ============================================================ */
.bonus-subsection {
  border-top: 1px solid var(--border);
}

.bonus-subsection-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
}
.bonus-subsection-header:hover { background: #192130; }

.bonus-subsection-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  flex: 1;
}

/* collapse arrow reuses same pattern as player rows */
.bonus-subsection .collapse-arrow {
  font-size: 10px;
  color: var(--muted);
  transition: transform .15s;
  flex-shrink: 0;
}
.bonus-subsection.expanded .collapse-arrow { transform: rotate(90deg); }

/* body hidden by default, shown when expanded */
.bonus-subsection-body {
  display: none;
  padding: 8px 10px;
  background: #0f151e;
}
.bonus-subsection.expanded .bonus-subsection-body { display: flex; flex-wrap: wrap; gap: 8px; }

/* Individual bonus card — uses board-card layout */
.bonus-card-item {
  flex: 1 1 200px;
  max-width: 300px;
  background: #12171f;
  border: 1px solid var(--border2);
  border-radius: 8px;
  overflow: hidden;
}
.bonus-card-item .board-card-name {
  font-size: 12px;
}
.bonus-card-item .board-card-power {
  -webkit-line-clamp: unset;
  overflow: visible;
  display: block;
  cursor: default;
}
.bonus-card-item .board-card-power::after { content: ''; }

.bonus-card-cond {
  font-size: 10px;
  color: var(--dim);
  padding: 3px 7px 6px;
  line-height: 1.4;
}


.bonus-card-condition {
  color: #d9e7ff;
  font-weight: 600;
  padding-top: 6px;
}

.bonus-card-explainer {
  color: var(--dim);
}

/* ============================================================
   PANEL HEADERS (shared)
   ============================================================ */
.sidebar .panel h3, #goals h3 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

/* ============================================================
   GOALS
   ============================================================ */
#goals-list .goal-row {
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
#goals-list .goal-row:last-child { border-bottom: 0; }
#goals-list .goal-row:hover .goal-name { color: var(--white); }

.goal-row-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}
.goal-round-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}
.goal-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.goal-row.active .goal-name { color: var(--white); }
.goal-row.done   .goal-name { color: var(--muted); }

.goal-active-pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 5px var(--green);
  flex-shrink: 0;
  animation: pulse-dot 1.6s ease-in-out infinite;
}
.goal-done-tick {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}

.goal-progress-rows { display: flex; flex-direction: column; gap: 3px; }
.goal-progress-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.goal-progress-name {
  width: 62px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.goal-progress-bar-wrap {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.goal-progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--muted);
  transition: width .4s ease;
}
.goal-progress-bar.active { background: var(--acc); }
.goal-progress-count {
  width: 18px;
  font-size: 10px;
  font-weight: 700;
  color: var(--dim);
  text-align: right;
  flex-shrink: 0;
}


/* ============================================================
   ICON SIZES
   ============================================================ */
.icon-res       { width: 14px; height: 14px; vertical-align: middle; }
.zone-icon.small { width: 12px; height: 12px; vertical-align: middle; }
.zone-icon.large { width: 14px; height: 14px; vertical-align: middle; }

/* power-box for hand cards */
.power-box {
  font-size: 10px;
  line-height: 1.4;
  color: #8a99ab;
  padding: 4px 6px;
  border-left: 2px solid var(--border2);
  margin: 2px 0;
}
.power-box.power-brown  { border-color: #c0823a; }
.power-box.power-teal   { border-color: #3ab8b0; }
.power-box.power-white  { border-color: #aabbc8; }
.power-box.power-pink   { border-color: #d46fa3; }
.power-box.power-yellow { border-color: #c9a800; }
.power-box .muted       { color: var(--muted); font-size: 9px; display: block; margin-bottom: 1px; }

/* card-frame used in hand */
.card-frame {
  background: #11161e;
  border: 1px solid var(--border2);
  border-radius: 8px;
  overflow: hidden;
}
.card-header {
  display: flex;
  gap: 6px;
  padding: 7px 8px 4px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.card-habitat { display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; }
.card-zones   { display: flex; gap: 2px; }
.card-costs   { display: flex; gap: 3px; flex-wrap: wrap; font-size: 10px; }
.card-titleblock { flex: 1; min-width: 0; }
.card-name    { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-scientific { font-size: 10px; color: var(--muted); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-toprow  { display: flex; gap: 6px; padding: 4px 8px; font-size: 10px; color: var(--dim); }
.card-leftstats, .card-rightstats { flex: 1; }
.stat { line-height: 1.6; }
.card-body    { padding: 0; }

/* ============================================================
   POWER TEXT ICONS & POPOVER
   ============================================================ */
.power-icon {
  width: 12px;
  height: 12px;
  vertical-align: middle;
  display: inline-block;
}
.power-emoji {
  font-size: 11px;
  vertical-align: middle;
  line-height: 1;
}
.power-token {
  font-size: 9px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 3px;
  padding: 0 3px;
  color: var(--dim);
}

/* Board-card power – clamped, clickable to expand */
.board-card-power {
  cursor: pointer;
  position: relative;
  user-select: none;
}
.board-card-power:hover {
  opacity: .85;
}
.board-card-power::after {
  content: ' ↗';
  font-size: 8px;
  opacity: .5;
  vertical-align: super;
}

/* Full-text popover — attached to body, viewport-positioned */
.power-popover {
  position: absolute;
  z-index: 9999;
  background: #1a2535;
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--white);
  line-height: 1.5;
  width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,.6);
  white-space: normal;
  pointer-events: none;
}
.power-popover .power-icon {
  width: 14px;
  height: 14px;
}

/* Hand card play-buttons strip */
.hand-card .play-buttons {
  border-top: 1px solid var(--border);
  background: #0d1218;
}

@media (max-width: 900px) {
  .log-history-panel {
    left: 10px;
    right: 10px;
    top: 52px;
    max-height: 60vh;
  }
}

/* ============================================================
   STICKY POWER PROMPT RIBBON (mobile / scrolled-away prompt)
   ============================================================ */
#prompt-sticky-ribbon {
  display: none;
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8900;
  align-items: center;
  gap: 10px;
  background: #7c2d12;
  border: 1px solid #c2410c;
  border-radius: 24px;
  padding: 10px 16px 10px 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.55);
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  animation: ribbon-pop .25s ease;
}
@keyframes ribbon-pop {
  from { opacity:0; transform:translateX(-50%) translateY(12px); }
  to   { opacity:1; transform:translateX(-50%) translateY(0); }
}
.prompt-ribbon-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.prompt-ribbon-text {
  font-size: 12px;
  font-weight: 600;
  color: #fef3c7;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prompt-ribbon-btn {
  flex-shrink: 0;
  background: #c2410c;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.prompt-ribbon-btn:hover { background: #ea580c; }
