/* Splendor board — RTL, sprite-based tokens/gems, CSS-composed cards. */

#spl-root { max-width: 1100px; margin: 0 auto; }

/* ---- top bar ---- */
.spl-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, #2b1d4e, #1b2a4a);
  color: #fff; border-radius: 14px; padding: 12px 18px; margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.spl-round { font-weight: 800; font-size: 1.1rem; }
.spl-turn { font-weight: 700; }
.spl-turn.you { color: #ffd24a; }

/* ---- action bar: sits below the gems, just above the player boards ---- */
.spl-actionbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: #fff7e0; border: 2px solid #e0c060; border-radius: 12px;
  padding: 10px 14px; margin: 14px 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.spl-ab-text { font-weight: 700; color: #5a4a10; }
.spl-ab-tokens { display: flex; gap: 8px; }

/* ---- shared sprites ---- */
.spl-tok {
  display: inline-block; width: 38px; height: 38px; border-radius: 50%;
  background-image: url("../img/splendor/tokens.png"); background-size: 600% 100%;
  background-repeat: no-repeat; background-position-y: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,.35); position: relative; vertical-align: middle;
}
.spl-gem {
  display: inline-block; width: 22px; height: 22px; vertical-align: middle;
  background-image: url("../img/splendor/gems.png"); background-size: 500% 100%;
  background-repeat: no-repeat;
}
.spl-tok.selectable { cursor: pointer; transition: transform .1s; }
.spl-tok.selectable:hover { transform: scale(1.12); }
.spl-tok.picked { outline: 3px solid #ffd24a; outline-offset: 1px; }
.spl-tok-n {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem; color: #fff; text-shadow: 0 1px 2px #000;
}

/* ---- table layout ---- */
.spl-table {
  display: grid; grid-template-columns: auto auto; gap: 14px 18px;
  align-items: start; justify-content: center;
}
.spl-nobles { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.spl-cards { display: flex; flex-direction: column; gap: 12px; }
.spl-bank {
  display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(135deg, #1b2a4a, #2b1d4e); border-radius: 14px; padding: 12px;
}

/* ---- nobles (nobles.png art: 5 cols x 3 rows) ---- */
.spl-noble {
  width: 90px; height: 90px; border-radius: 8px; position: relative;
  background-image: url("../img/splendor/nobles.png"); background-size: 500% 300%;
  background-repeat: no-repeat; box-shadow: -2px 3px 8px rgba(0,0,0,.4); border: 2px solid #fff;
}
.spl-noble-shadow {
  position: absolute; inset: 0; pointer-events: none; border-radius: 6px;
  background-image: url("../img/splendor/noble_shadow.png"); background-size: 100% 100%;
}
.spl-noble-pts {
  position: absolute; top: 2px; right: 5px; font-weight: 900; font-size: 1.25rem;
  color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; z-index: 2;
}
.spl-noble-req {
  position: absolute; bottom: 4px; left: 0; right: 0; display: flex; gap: 2px;
  flex-wrap: wrap; justify-content: center; z-index: 2;
}
.spl-reqchip { position: relative; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.spl-reqchip .spl-mini { position: absolute; inset: 0; width: 22px; height: 22px; }
.spl-reqn {
  position: relative; z-index: 1; font-weight: 900; font-size: .78rem; color: #fff;
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
}

/* ---- cards ---- */
.spl-cardrow {
  display: flex; gap: 10px; align-items: center;
  background: rgba(0,0,0,.04); border-radius: 12px; padding: 8px;
}
/* card art sprite sheet (cards.jpg): 6 cols (img) x 6 rows (gem type) */
.spl-card, .spl-deck {
  width: 86px; height: 118px; border-radius: 8px; position: relative; flex: 0 0 auto;
  background-image: url("../img/splendor/cards.jpg"); background-size: 600% 600%;
  background-repeat: no-repeat; border: 2px solid #fff;
  box-shadow: -2px 3px 8px rgba(0,0,0,.45); overflow: hidden; transition: transform .1s;
}
.spl-deck {
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 900;
}
.spl-deck.selectable, .spl-card.affordable { cursor: pointer; }
.spl-deck.selectable:hover, .spl-card:hover { transform: translateY(-3px); }
.spl-deck-n {
  font-size: 1.5rem; text-shadow: 0 1px 4px #000, 0 0 6px #000;
  background: rgba(0,0,0,.35); border-radius: 50%; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
}
.spl-card-empty {
  background: rgba(255,255,255,.06); box-shadow: none; border: 2px dashed rgba(255,255,255,.4);
}
.spl-card.affordable { box-shadow: 0 0 0 3px #9acd32, -2px 3px 8px rgba(0,0,0,.45); }

.spl-card-header {
  position: absolute; top: 0; left: 0; right: 0; height: 30px;
  background-size: 100% 100%; background-repeat: no-repeat;
  display: flex; align-items: center; justify-content: space-between; padding: 0 5px;
  border-radius: 6px 6px 0 0;
}
.spl-card.type-white .spl-card-header { background-image: url("../img/splendor/ch_white.png"); }
.spl-card.type-blue  .spl-card-header { background-image: url("../img/splendor/ch_blue.png"); }
.spl-card.type-green .spl-card-header { background-image: url("../img/splendor/ch_green.png"); }
.spl-card.type-red   .spl-card-header { background-image: url("../img/splendor/ch_red.png"); }
.spl-card.type-black .spl-card-header { background-image: url("../img/splendor/ch_black.png"); }
.spl-card-pts {
  font-weight: 900; font-size: 1.2rem; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000;
}
.spl-card.type-white .spl-card-pts { color: #3a3526; text-shadow: 0 1px 2px #fff; }
.spl-card-bonus { width: 24px; height: 24px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }

.spl-card-costs {
  position: absolute; bottom: 5px; left: 5px; display: flex; flex-direction: column; gap: 2px;
}
.spl-costchip {
  position: relative; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}
.spl-costchip .spl-mini { position: absolute; inset: 0; width: 24px; height: 24px; }
.spl-costchip .spl-costn {
  position: relative; z-index: 1; font-weight: 900; font-size: .82rem; color: #fff;
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
}

/* gem sprites (gems.png header gem / oleum minigem) */
.spl-mini {
  display: inline-block; width: 22px; height: 22px; vertical-align: middle;
  background-image: url("../img/splendor/oleum-small.png"); background-size: 500% 100%;
  background-repeat: no-repeat;
}

.spl-card-acts {
  position: absolute; bottom: 4px; right: 4px; display: flex; flex-direction: column; gap: 4px;
  opacity: 0; transition: opacity .12s;
}
.spl-card:hover .spl-card-acts { opacity: 1; }
.spl-mini-btn {
  border: none; border-radius: 6px; padding: 3px 8px; font-size: .72rem; font-weight: 800;
  cursor: pointer; color: #fff;
}
.spl-mini-btn.buy { background: #2e8b57; }
.spl-mini-btn.res { background: #6b5bd0; }
.spl-mini-btn:hover { filter: brightness(1.1); }

/* card backs (others' reserved) — row 5 of cards.jpg */
.spl-card-back {
  width: 52px; height: 72px; border-radius: 6px; border: 2px solid #fff;
  background-image: url("../img/splendor/cards.jpg"); background-size: 600% 600%;
  background-repeat: no-repeat; box-shadow: -1px 2px 5px rgba(0,0,0,.4);
}
.spl-back-1 { background-position: 0 100%; }
.spl-back-2 { background-position: 20% 100%; }
.spl-back-3 { background-position: 40% 100%; }

/* ---- bank ---- */
.spl-bankpile { display: flex; align-items: center; gap: 8px; }
.spl-bankpile .spl-tok { width: 44px; height: 44px; }
.spl-bank-n { color: #fff; font-weight: 800; min-width: 18px; text-align: center; }

/* ---- player boards ---- */
.spl-boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 16px; }
.spl-pboard {
  border: 3px solid #2b1d4e; border-radius: 14px; padding: 12px;
  background: linear-gradient(135deg, #f6f2ea, #e7ddc9); box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.spl-pboard.active { border-color: #ffb300; box-shadow: 0 0 0 3px rgba(255,179,0,.3), 0 4px 14px rgba(0,0,0,.25); }
.spl-pb-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
  background: rgba(255,255,255,.7); border-radius: 9px; padding: 6px 10px;
}
.spl-pb-name { font-weight: 800; color: #2b1d4e; }
.spl-pb-pts { font-weight: 900; font-size: 1.15rem; color: #2b1d4e; }
.spl-nob-badge { font-weight: 800; font-size: .85rem; color: #8a6d1a; }

.spl-pb-section { margin-bottom: 8px; }
.spl-pb-label { display: block; font-size: .72rem; font-weight: 800; color: #6b5fa0; margin: 0 2px 3px; }
.spl-pb-row { display: flex; gap: 5px; }
.spl-pb-chip {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: 2px;
  border-radius: 8px; padding: 3px 0;
}
.spl-pb-chip.bonus { background: rgba(0,0,0,.06); }
.spl-pb-chip.bonus.type-white { background: #efe9dc; }
.spl-pb-chip.bonus.type-blue  { background: #cfe0f2; }
.spl-pb-chip.bonus.type-green { background: #cfeedb; }
.spl-pb-chip.bonus.type-red   { background: #f4d3ce; }
.spl-pb-chip.bonus.type-black { background: #d8d8e0; }
.spl-pb-chip.bonus .spl-gem { width: 20px; height: 20px; }
.spl-pb-chip.token .spl-tok { width: 30px; height: 30px; }
.spl-pb-chip.token .spl-pb-n {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000;
}
.spl-pb-n { font-weight: 800; font-size: .92rem; color: #222; }
.spl-pb-chip.zero { opacity: .32; }
.spl-pb-reserved { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.spl-pb-rlabel { font-weight: 700; color: #2b1d4e; }
.spl-minicard { width: 60px; height: 82px; }
.spl-minicard .spl-card-header { height: 22px; }
.spl-minicard .spl-card-pts { font-size: .9rem; }
.spl-minicard .spl-card-bonus { width: 16px; height: 16px; }
.spl-minicard .spl-costchip { width: 17px; height: 17px; }
.spl-minicard .spl-costchip .spl-mini { width: 17px; height: 17px; }
.spl-minicard .spl-costn { font-size: .6rem; }
.spl-minicard .spl-mini-btn { position: absolute; bottom: 2px; left: 2px; padding: 2px 6px; font-size: .62rem; }

/* ---- messages / finished ---- */
.spl-code { background: #2b1d4e; color: #fff; padding: 3px 10px; border-radius: 7px; font-size: 1.1rem; letter-spacing: 1px; }
.spl-msg {
  position: fixed; bottom: 18px; right: 18px; z-index: 50;
  background: #c0392b; color: #fff; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 320px; font-weight: 600;
}
.spl-msg.ok { background: #16a34a; }
.spl-final { display: flex; flex-direction: column; gap: 8px; max-width: 360px; margin: 14px auto; }
.spl-final-row { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: 10px; background: #f0ece2; font-weight: 700; }
.spl-final-row.win { background: #fff3cf; box-shadow: 0 0 0 2px #ffb300 inset; }

/* ---- responsive / mobile ---- */
@media (max-width: 820px) {
  .spl-table { grid-template-columns: 1fr; }
  .spl-bank { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .spl-cardrow { overflow-x: auto; }
}
@media (max-width: 640px) {
  .spl-boards { display: flex; flex-direction: column; }
  .spl-pboard.you { order: -1; }   /* your own board on top when stacked */
  .spl-card { width: 72px; height: 100px; }
  .spl-deck { width: 60px; height: 84px; }
  .spl-noble { width: 74px; height: 74px; }
  .spl-bankpile .spl-tok { width: 38px; height: 38px; }
}
