/* Chainspire — Cosmic Gothic desktop duel scaffold. PLACEHOLDER art. Money-path frozen. */
:root {
  --bg: #07080c;
  --panel: #10131a;
  --bone: #e8dfc8;
  --muted: #8a8578;
  --line: rgba(201, 162, 39, 0.28);
  --gold: #c9a227;
  --danger: #ff5a1f;
  --font: "Segoe UI", system-ui, sans-serif;
  --card-w: 132px;
  --card-h: 184px;
  --card-w-sm: 100px;
  --card-h-sm: 140px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(91, 44, 111, 0.25), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(26, 168, 196, 0.08), transparent 40%),
    var(--bg);
  color: var(--bone);
  font-family: var(--font);
  overflow: hidden;
}
code { color: var(--gold); }

/* Lobby */
#lobby { height: 100%; display: grid; place-items: center; padding: 24px; }
.lobby-card {
  width: min(480px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #16101f, #0c0e14);
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
}
.lobby-card h1 {
  margin: 0 0 8px;
  letter-spacing: .18em;
  font-weight: 800;
  background: linear-gradient(90deg, #f3e2a0, #c9a227, #e4d4ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { margin: 0 0 10px; line-height: 1.45; }
.lede.muted, .fine { color: var(--muted); font-size: .9rem; }
.field { display: grid; gap: 6px; margin: 12px 0; font-size: .85rem; color: var(--muted); }
.field select {
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #0a0c12; color: var(--bone);
}

.btn {
  appearance: none; border: 1px solid var(--line);
  background: #1a1524; color: var(--bone);
  padding: 10px 16px; border-radius: 8px; cursor: pointer; font-weight: 700;
}
.btn:hover { border-color: var(--gold); }
.btn.primary {
  background: linear-gradient(180deg, #c9a227, #8a6a12);
  color: #120e05; border-color: #e2c56a; width: 100%; margin-top: 8px;
}
.btn.ghost { background: transparent; }
.btn.tiny { padding: 4px 8px; font-size: .75rem; margin-left: 8px; }

/* App shell */
#app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr 240px;
  grid-template-areas:
    "top top"
    "board log";
}
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 16px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 8, 16, .9);
  backdrop-filter: blur(8px);
}
.brand { font-weight: 900; letter-spacing: .14em; font-size: .95rem; }
.brand .sub { display: block; font-size: .65rem; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.phase-pill {
  flex: 1; text-align: center;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #14101c;
  font-weight: 700; font-size: .9rem;
}
.top-actions { display: flex; gap: 8px; }

.board {
  grid-area: board;
  display: grid;
  grid-template-rows: auto auto auto minmax(120px,auto) auto auto auto minmax(150px, 22vh);
  gap: 4px;
  padding: 8px 12px 4px;
  overflow: auto;
  min-height: 0;
}
.log {
  grid-area: log;
  border-left: 1px solid var(--line);
  padding: 10px;
  font-size: .75rem;
  color: var(--muted);
  overflow: auto;
  background: rgba(0,0,0,.35);
  line-height: 1.4;
}
.log div { margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.04); padding-bottom: 4px; }

.vault {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 4px 8px;
}
.vault-hp {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 12px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, #0a0c12);
}
.vault-hp strong { font-size: 1.6rem; color: var(--accent); }
.vlabel { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.meta { font-size: .75rem; color: var(--muted); }
.kit-strip { display: flex; gap: 4px; margin-left: auto; }
.kit { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); }
.kit.obsidian { background: #3A342C; }
.kit.violet { background: #6C3CE0; }
.kit.azure { background: #1AA8C4; }
.kit.ember { background: #FF5A1F; }
.kit.gold { background: #C9A227; }

.coin-pool { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pool-pip {
  display: inline-flex; align-items: center; gap: 4px;
  min-width: 36px; padding: 2px 6px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.08); opacity: .4; font-weight: 800; font-size: .8rem;
}
.pool-pip.lit { opacity: 1; border-color: var(--pip); box-shadow: 0 0 10px color-mix(in srgb, var(--pip) 40%, transparent); }
.pool-pip i {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--pip); display: inline-block;
}
.pool-note { font-size: .65rem; color: var(--muted); margin-left: 4px; }

.row { display: grid; grid-template-columns: 88px 1fr; gap: 6px; align-items: start; }
.row-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 8px; }
.row-cards { display: flex; flex-wrap: wrap; gap: 6px; min-height: 48px; }
.empty-hint { color: var(--muted); font-size: .8rem; padding: 12px; opacity: .6; }

.combat-lane {
  border: 1px dashed color-mix(in srgb, var(--gold) 35%, transparent);
  border-radius: 12px;
  padding: 6px 8px;
  background: rgba(201, 162, 39, 0.04);
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 6px;
}
.lane { display: flex; flex-wrap: wrap; gap: 8px; min-height: 100px; align-items: center; }
.lane-empty { color: var(--muted); font-size: .85rem; opacity: .5; padding: 20px; }
.lane-slot { position: relative; cursor: pointer; }
.block-tag {
  position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  font-size: .6rem; background: #1AA8C4; color: #041018; padding: 1px 6px; border-radius: 4px; font-weight: 800;
}
.hint { grid-column: 1 / -1; font-size: .75rem; color: var(--gold); min-height: 1.2em; }

/* Cards */
.card {
  position: relative;
  width: var(--card-w); height: var(--card-h);
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, #333);
  background: linear-gradient(180deg, color-mix(in srgb, var(--field) 80%, #1a1a22), #0c0e14);
  display: grid;
  grid-template-rows: auto 1fr auto auto auto auto;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0,0,0,.45);
  transition: transform .25s ease, box-shadow .25s ease;
  transform-style: preserve-3d;
  font-size: .65rem;
  user-select: none;
}
.card.small { width: var(--card-w-sm); height: var(--card-h-sm); font-size: .55rem; }
.card.exhausted { transform: rotate(8deg); filter: saturate(.7) brightness(.85); }
.card.attacking { outline: 2px solid var(--danger); transform: translateY(-8px); }
.card.blocking { outline: 2px solid #1AA8C4; }
.card.selected { outline: 2px solid #f3e2a0; box-shadow: 0 0 16px rgba(243,226,160,.35); }
.card.playable { cursor: pointer; box-shadow: 0 0 0 1px var(--accent), 0 8px 20px rgba(0,0,0,.5); }
.card.playable:hover { transform: translateY(-10px) scale(1.04); }
.card.legendary .aura {
  pointer-events: none;
  position: absolute; inset: -6px; border-radius: 14px; z-index: 0;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--hi) 35%, transparent), transparent 65%);
  animation: aura-pulse 2.4s ease-in-out infinite;
  filter: blur(4px);
}
@keyframes aura-pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}
.card-top { display: flex; justify-content: space-between; padding: 4px 6px; position: relative; z-index: 1; }
.pips { display: flex; gap: 2px; }
.pip {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--pip); color: #0a0a0a; font-weight: 900; font-size: .6rem;
  border: 1px solid rgba(255,255,255,.25);
}
.rarity { color: var(--muted); text-transform: uppercase; font-size: .55rem; }

.art-ph {
  position: relative; z-index: 1;
  margin: 0 6px; border-radius: 6px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  aspect-ratio: 1; background: var(--c0);
}
.art-ph svg { width: 100%; height: 100%; display: block; }
.art-label {
  position: absolute; top: 3px; left: 3px;
  font-size: .5rem; font-weight: 900; letter-spacing: .06em;
  background: rgba(0,0,0,.65); color: #ffb4a0; padding: 1px 4px; border-radius: 3px;
}
.art-id {
  position: absolute; bottom: 2px; left: 0; right: 0;
  text-align: center; font-size: .45rem; color: rgba(255,255,255,.7);
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  padding: 6px 2px 2px; word-break: break-all;
}
.card-name {
  position: relative; z-index: 1;
  padding: 3px 6px 0; font-weight: 800; font-size: .72rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card.small .card-name { font-size: .62rem; }
.type-line { padding: 0 6px; color: var(--muted); font-size: .55rem; position: relative; z-index: 1; }
.rules {
  padding: 2px 6px 4px; color: #cfc6b0; line-height: 1.25;
  overflow: hidden; position: relative; z-index: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.card.small .rules { -webkit-line-clamp: 2; }
.pt {
  position: absolute; right: 4px; bottom: 4px; z-index: 2;
  background: #0a0c12; border: 1px solid var(--accent);
  padding: 1px 6px; border-radius: 6px; font-weight: 900; font-size: .75rem;
}
.dmg { color: var(--danger); }

/* Hand fan (bull-run inspired bar) */
.handbar {
  border-top: 1px solid var(--line);
  padding: 4px 8px 8px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.45));
}
.hand {
  display: flex; justify-content: center; align-items: flex-end;
  height: 200px; gap: 0; perspective: 800px;
}
.hand-card {
  width: var(--card-w);
  margin-left: -36px;
  transition: transform .2s ease, margin .2s;
  cursor: pointer;
  animation: deal .35s ease backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.hand-card:first-child { margin-left: 0; }
.hand-card:hover {
  transform: translateY(-28px) scale(1.06);
  z-index: 5; margin-right: 8px;
}
@keyframes deal {
  from { transform: translateY(80px) rotate(6deg); opacity: 0; }
}

/* Play flip cue */
.field-card .card {
  animation: cast-flip .45s ease;
}
@keyframes cast-flip {
  0% { transform: rotateY(90deg) scale(.8); opacity: .2; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}

.modal {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.65); z-index: 40;
}
.modal-card {
  padding: 28px; border-radius: 14px; border: 1px solid var(--line);
  background: #14101c; text-align: center; min-width: 280px;
}
.ai-busy {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: #1a1524; border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 999px; z-index: 30; font-size: .8rem;
}

@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-areas: "top" "board" "log"; }
  .log { max-height: 100px; }
  :root { --card-w: 110px; --card-h: 154px; --card-w-sm: 84px; --card-h-sm: 118px; }
}


/* Kit BA optional face overrides */
.art-ph.art-kit { position: relative; overflow: hidden; }
.art-ph.art-kit .kit-face {
  width: 100%; height: 100%; object-fit: cover; display: block;
  min-height: 72px;
}
.art-ph.art-kit .art-label { background: rgba(201,162,39,.75); color: #0B0C10; }

.nav-meta { margin-top: 1rem; }
.nav-meta a { color: #C9A227; }

/* Founder stake + Gas + Rug targeting (effects pass) */
.stake-pip {
  position: absolute;
  right: 6px; bottom: 6px;
  min-width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f3e2a0, #8a6a12);
  color: #120e05;
  font-weight: 800; font-size: .75rem;
  display: grid; place-items: center;
  box-shadow: 0 0 8px rgba(201,162,39,.55);
}
.card.face { position: relative; }
.stake-label {
  font-size: .7rem; color: var(--gold); text-align: center; margin-top: 2px;
}
.founder-abs {
  display: flex; flex-direction: column; gap: 4px; margin-top: 4px;
}
.founder-abs .btn { width: 100%; font-size: .65rem; padding: 4px 6px; }
.field-card.founder.selected .card,
.field-card.selected .card { outline: 2px solid var(--gold); }
.gas-bar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  background: rgba(108, 60, 224, 0.2);
  border-bottom: 1px solid var(--line);
  font-size: .85rem;
}
.rug-targets {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 6px;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Stack / mulligan / multi-block */
.stack-bar {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 6px 14px;
  background: rgba(26, 14, 40, 0.85);
  border-bottom: 1px solid var(--line);
  font-size: .8rem;
}
.stack-item {
  padding: 2px 8px; border-radius: 6px;
  background: #2a1a3a; border: 1px solid #6C3CE0;
}
.stack-item.cancelled { opacity: .5; text-decoration: line-through; }
.mulligan-panel {
  padding: 24px; max-width: 1100px; margin: 0 auto;
}
.mull-hand { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0; }
.hand-card.mull-sel .card { outline: 2px solid #C9A227; }
.mull-actions { display: flex; gap: 12px; justify-content: center; margin: 12px 0; }
.assign-order { font-size: .7rem; margin-top: 4px; }
.assign-row { display: flex; gap: 4px; align-items: center; margin: 2px 0; }
