/* MagicAIl Table — styles: the game table, blockers, land piles, the player's side.
   The styles are split into files in their old order (build 71, before: one style.css); index.html loads them in
   this order, so later rules still win over earlier ones. */

/* ---------- Game table ---------- */






.life {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.life-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.life-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.life-value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.05;
  min-width: 2ch;
  text-align: center;
}

.life-claude .life-value { color: var(--gold); }

.life-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.life-btn:hover { border-color: var(--gold); }

.player-counters {
  font-size: 11px;
  color: var(--red);
}

.player-counters:empty { display: none; }



.pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  --card-w: 72px;
}

.pile.clickable { cursor: pointer; }
.pile.clickable:hover .pile-stack { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: var(--card-r); }
.pile.empty .card-back { opacity: 0.2; }

.pile-stack { width: var(--card-w); }

.pile-empty {
  display: block;
  width: var(--card-w);
  aspect-ratio: 63 / 88;
  border: 1px dashed var(--border);
  border-radius: var(--card-r);
}

.pile-label {
  font-size: 12px;
  color: var(--muted);
}

.pile-label b { color: var(--text); }





.battlefield {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
}

.bf-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  min-height: calc(var(--card-w) * 1.4 + 10px);
  padding: 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.15);
  position: relative;
}

/* Watermark in each box: "Mana", "Creatures", "Others" (always English), big and faint behind the cards. */
[data-mark] { position: relative; isolation: isolate; }

[data-mark]::before {
  content: attr(data-mark);
  position: absolute;
  inset: 0;
  z-index: -1;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 5vw, 110px);
  letter-spacing: 0.12em;
  white-space: nowrap;
  color: rgba(232, 226, 210, 0.04);
  pointer-events: none;
  user-select: none;
}

#bf-lands::before,
#p-lands::before { font-size: clamp(24px, 3.2vw, 64px); }
.other-row[data-mark]::before { font-size: clamp(20px, 2.6vw, 54px); letter-spacing: 0.08em; }

#bf-permanents, #bf-other { --card-w: 168px; gap: 18px; min-height: calc(168px * 1.4 + 12px); }
#bf-lands { --card-w: 82px; min-height: calc(82px * 1.4 + 10px); }

.slot {
  --base: var(--card-w);
  position: relative;
  padding: 0;
  padding-top: calc(var(--under) * 18px);
  border: none;
  background: none;
  cursor: zoom-in;
  width: calc(var(--base) + var(--blockers, 0) * var(--card-w) * 0.8 + var(--blockers, 0) * var(--card-w) * 0.06);
  transition: width 0.25s;
  color: inherit;
}

.slot .card { transition: transform 0.25s; z-index: 1; }

.slot.tapped {
  --base: calc(var(--card-w) * 88 / 63);
}

.slot.tapped > .card {
  transform: translateX(calc((var(--card-w) * 88 / 63 - var(--card-w)) / 2)) rotate(90deg);
  transform-origin: 50% 50%;
}

.slot.attacking > .card {
  box-shadow: 0 0 0 2px var(--red), 0 0 18px rgba(224, 121, 95, 0.7);
}

/* A spell on the stack targets this card / player. */
.slot.targeted > .card,
.stack.targeted .stack-card:last-child,
.life.targeted {
  animation: target-glow 1.1s ease-in-out infinite;
}

.life.targeted { border-radius: 10px; }

@keyframes target-glow {
  0%, 100% { box-shadow: 0 0 0 2px #5fb3ff, 0 0 10px rgba(95, 179, 255, 0.5); }
  50% { box-shadow: 0 0 0 3px #5fb3ff, 0 0 26px rgba(95, 179, 255, 0.95); }
}

.under-card {
  position: absolute;
  left: calc(var(--i) * 8px);
  top: calc((var(--under) - var(--i)) * 18px);
  --card-w: inherit;
  width: var(--card-w);
  z-index: 0;
  filter: brightness(0.85);
}

.slot.tapped .under-card { left: calc(var(--i) * 8px + (var(--card-w) * 88 / 63 - var(--card-w)) / 2); }

.under-card img,
.under-card .text-card {
  display: block;
  width: 100%;
  border-radius: var(--card-r);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.slot:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: var(--card-r); }

/* ---------- Combat: blockers lie next to the attacker ---------- */






/* Damage marked this turn: right side, above the printed power/toughness. */
.damage-badge {
  position: absolute;
  right: -6px;
  bottom: 18%;
  padding: 1px 6px;
  border-radius: 999px;
  background: #b3261e;
  color: #fff;
  border: 2px solid #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 3;
}

.card.big .damage-badge { font-size: 16px; }

/* ---------- Lands: piles per land type ---------- */

.land-pile { padding-bottom: 20px; }

.pile-layer {
  position: absolute;
  top: calc(var(--k) * -3px);
  left: calc(var(--k) * 3px);
  width: var(--card-w);
  aspect-ratio: 63 / 88;
  border-radius: var(--card-r);
  overflow: hidden;
  filter: brightness(0.6);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.pile-layer img,
.pile-layer .text-card { display: block; width: 100%; height: 100%; object-fit: cover; }

.slot.tapped .pile-layer {
  left: calc((var(--card-w) * 88 / 63 - var(--card-w)) / 2 + var(--k) * 3px);
  transform: rotate(90deg);
}

.pile-count {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  line-height: 18px;
  color: var(--text);
}

.pile-count.is-tapped { color: var(--muted); font-size: 12px; font-family: var(--font-body); }

.lands-wrap { position: relative; }

#bf-lands { padding-right: 190px; }

/* Claude's open mana, next to the lands. */
.mana-pool {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 172px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(201, 162, 74, 0.12);
  border: 1px solid var(--gold);
  text-align: center;
  animation: fade-in 0.25s ease-out;
}

.mana-pool-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.mana-pool-symbols { font-size: 20px; line-height: 1.2; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.mana-pool-words { font-size: 13px; font-weight: 600; color: var(--gold); }

/* ---------- The player's side ---------- */

.player-side {
  position: relative;
  margin-top: 12px;
  padding: 18px 14px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.side-title {
  position: absolute;
  top: -10px;
  left: 16px;
  padding: 0 8px;
  background: var(--bg);
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--muted);
}


.count-btns { display: inline-flex; gap: 3px; margin-left: 2px; }

.count-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.count-btn:hover { border-color: var(--gold); }

/* The player's attackers, with Claude's blockers next to them. */



/* The player's lands: per type an untapped and a tapped pile. */
.land-stacks {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: flex-end;
  --card-w: 58px;
}

.land-type { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.land-type-piles { display: flex; gap: 8px; align-items: flex-end; }
.land-type-name { font-size: 12px; color: var(--muted); white-space: nowrap; }


.mini-count {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.mini-count b { color: var(--text); font-size: 15px; }

.mini-icon {
  width: 22px;
  height: 30px;
  border-radius: 3px;
  border: 2px solid #0b0f0d;
  background:
    radial-gradient(circle at 50% 50%, rgba(201, 162, 74, 0.9) 0 14%, transparent 16%),
    linear-gradient(160deg, #23412f, #0b1612);
  box-shadow: 2px 2px 0 #10201a, 4px 4px 0 #0b1612;
}

.mini-icon-hand {
  box-shadow: -5px 1px 0 -1px #10201a, 5px 1px 0 -1px #10201a;
}

.player-stacks {
  display: flex;
  gap: 18px;
  --card-w: 104px;
}

.stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  cursor: zoom-in;
}

.stack:disabled { cursor: default; }

.stack-cards {
  position: relative;
  display: block;
  width: calc(var(--card-w) + 12px);
  aspect-ratio: 63 / 88;
  margin-right: -12px;
}

.stack-cards .pile-empty { width: var(--card-w); height: auto; }

.stack-card {
  position: absolute;
  top: calc(var(--k) * 6px);
  left: calc(var(--k) * 6px);
  width: var(--card-w);
  aspect-ratio: 63 / 88;
  border-radius: var(--card-r);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.stack-card:last-child { top: 0; left: 0; }
.stack-card:not(:last-child) { filter: brightness(0.7); }

.stack-card img,
.stack-card .text-card {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--card-r);
}

.stack-card.is-tapped:last-child { outline: 2px dashed var(--muted); outline-offset: 2px; }

.stack:not(:disabled):hover .stack-card:last-child { outline: 2px solid var(--gold); outline-offset: 2px; }

.stack-notes {
  min-height: 1em;
  font-size: 11px;
  color: var(--muted);
}

/* Build 104: the player's open mana, at the right end of their lands. */
.player-row { position: relative; }
.mana-pool.player-pool { top: auto; bottom: 8px; transform: none; z-index: 2; }
.mana-pool[hidden] { display: none; }

/* Build 106: at a table for two the number always stands under its label (Library / 67), both centered under the
   pile — the same for library, graveyard and exile (before: left-aligned, sometimes in one line, "Exile 3"). */
.table-layout:not(.multi) .pile-label { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.25; }
