:root {
  color-scheme: dark;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--paper);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button {
  color: inherit;
  cursor: pointer;
  border: 1px solid #65706a55;
  background: #1d2929;
  padding: 12px 18px;
  border-radius: 5px;
  transition:
    border-color 0.2s,
    background 0.2s,
    translate 0.2s;
  min-height: 44px;
}
button:hover {
  border-color: var(--gold);
  background: #2a3733;
}
button:focus-visible {
  outline: 2px solid #ead5a6;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
button.primary {
  background: var(--gold);
  color: #17201d;
  border-color: var(--gold);
  font-weight: bold;
}
input,
select {
  padding: 12px;
  background: #172423;
  color: var(--paper);
  border: 1px solid #5b6861;
  border-radius: 4px;
  max-width: 100%;
}
h1,
h2,
p {
  margin-top: 0;
}
h1 {
  font-weight: normal;
  font-size: clamp(36px, 5vw, 66px);
  line-height: 1.05;
  letter-spacing: -2px;
}
h2 {
  font-size: 24px;
  font-weight: normal;
}
small,
.eyebrow,
header,
footer,
.muted,
.zone-help,
.card-stats,
.mana,
.filters,
.copies,
.class-choice small {
  font-family: Arial, sans-serif;
}
.muted {
  color: var(--muted);
  line-height: 1.6;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--gold);
}
.home {
  max-width: 1440px;
  margin: auto;
  min-height: 100svh;
  padding: 30px 6vw 20px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 74% 43%, #354c3c55, transparent 47%);
}
header {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
}
.brand {
  font-family: Georgia;
  font-size: 40px;
  text-decoration: none;
  color: var(--paper);
  letter-spacing: -8px;
  padding-right: 14px;
}
.brand span {
  font-size: 18px;
  color: var(--gold);
}
.edition {
  margin-left: auto;
}
.hero-copy {
  position: relative;
  z-index: 2;
  padding: 110px 0 130px;
  max-width: 50%;
}
.hero-copy h1 {
  font-size: clamp(74px, 9vw, 136px);
  letter-spacing: -6px;
  margin: 16px 0 22px;
}
.hero-copy h1 span {
  color: var(--gold);
}
.hero-copy p {
  font-size: 18px;
  line-height: 1.65;
  color: #aab4ab;
}
.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}
.hero-actions button {
  padding: 18px 25px;
}
.hero-actions span {
  padding-left: 24px;
}
.showcase {
  position: absolute;
  right: 5%;
  top: 150px;
  width: 42%;
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}
.showcase .card {
  position: absolute;
  width: 190px;
  height: 285px;
  box-shadow: 0 30px 70px #0009;
  animation: float 7s ease-in-out infinite;
}
.showcase .card:nth-of-type(1) {
  transform: rotate(-15deg) translate(-115px, 12px);
  z-index: 1;
}
.showcase .card:nth-of-type(2) {
  transform: translateY(-25px);
  z-index: 3;
}
.showcase .card:nth-of-type(3) {
  transform: rotate(16deg) translate(125px, 15px);
  z-index: 2;
}
.showcase-orbit {
  position: absolute;
  width: 370px;
  height: 370px;
  border: 1px solid #bda47633;
  border-radius: 50%;
  box-shadow:
    0 0 0 35px #a9906630,
    0 0 0 36px #bda47615;
  opacity: 0.4;
}
.showcase-caption {
  position: absolute;
  bottom: -55px;
  font: 9px Arial;
  letter-spacing: 3px;
  color: var(--muted);
}
.home-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  border-top: 1px solid #626b5d55;
  padding-top: 24px;
}
.home-nav button {
  display: flex;
  align-items: center;
  gap: 20px;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 15px 5px;
}
.home-nav b {
  font-size: 12px;
  color: var(--gold);
  font-weight: normal;
}
.home-nav span {
  font-size: 23px;
  flex: 1;
}
.home-nav small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 9px;
}
footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 36px;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
}
footer span {
  margin-right: auto;
}
footer button {
  font-size: 11px;
  background: transparent;
  border: 0;
}
.art {
  display: block;
  position: absolute;
  inset: 0;
  background-image: url("../assets/heroes.png");
  background-size: 300% 300%;
  background-position: var(--ax) var(--ay);
}
.art.creature {
  background-image: url("../assets/creatures.png");
  background-size: 400% 400%;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  padding: 6px 6px 8px;
  width: 165px;
  height: 245px;
  background: linear-gradient(140deg, #6e7661, #293e36 45%, #162722);
  border: 2px solid #a28e62;
  border-radius: 14px 14px 8px 8px;
  box-shadow:
    inset 0 0 0 3px #142621,
    0 6px 15px #0007;
  overflow: visible;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  color: #e8ddbf;
  transition:
    box-shadow 0.2s,
    filter 0.2s;
}
.card:hover {
  background: linear-gradient(140deg, #78806b, #32493c);
  box-shadow: 0 0 16px #c7a87355;
}
.card-image {
  height: 120px;
  position: relative;
  overflow: hidden;
  border-radius: 9px 9px 30% 30%;
  flex-shrink: 0;
  border: 1px solid #c9aa7077;
}
.card-name {
  font-size: 13px;
  line-height: 1.1;
  padding: 9px 0 5px;
  font-weight: bold;
  text-shadow: 0 2px #000;
}
.card p {
  font-size: 11px;
  line-height: 1.3;
  padding: 0 7px;
  margin: 4px 0;
  color: #d4cfb9;
  flex: 1;
}
.cost {
  position: absolute;
  left: -8px;
  top: -9px;
  width: 31px;
  height: 35px;
  display: grid;
  place-items: center;
  background: linear-gradient(#7bafc0, #214963);
  border: 2px solid #abc4ca;
  border-radius: 45%;
  font: bold 23px Georgia;
  text-shadow: 0 2px #000;
  z-index: 1;
  color: #fff;
}
.card-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  margin-top: auto;
  font-size: 8px;
  min-height: 24px;
}
.atk,
.hp {
  font: bold 20px Georgia;
  border-radius: 50%;
  min-width: 26px;
  text-shadow: 0 2px #000;
}
.atk {
  color: #ecd68b;
}
.hp {
  color: #f2b9a7;
}
.keywords {
  font-size: 12px;
  color: #d3d8c3;
}
.glyph {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  vertical-align: middle;
}
.rarity-common {
  --rarity: #c5c9bb;
}
.rarity-rare {
  --rarity: #76c2ef;
}
.rarity-epic {
  --rarity: #d298ef;
}
.rarity-legendary {
  --rarity: #ffce75;
}
.card {
  border-color: var(--rarity);
}
.rarity-mark {
  position: absolute;
  right: -7px;
  top: -8px;
  z-index: 2;
  width: 25px;
  height: 27px;
  display: grid;
  place-items: center;
  color: var(--rarity);
  background: #14211f;
  border: 1px solid var(--rarity);
  border-radius: 6px;
  box-shadow: 0 2px 7px #0009;
}
.rarity-mark .glyph {
  width: 20px;
  height: 20px;
}
.rarity-legendary .rarity-mark {
  box-shadow: 0 0 12px #f5b45266;
}
.card.type-spell {
  border-radius: 30px 30px 9px 9px;
  background: linear-gradient(150deg, #3b4055, #142b38 60%, #152127);
}
.type-spell .card-image {
  border-radius: 50% 50% 28% 28%;
  border-color: #a6d7e0aa;
}
.card-kind {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #bce8ed;
  font-size: 9px;
  letter-spacing: 1px;
}
.card-kind .glyph {
  width: 24px;
  height: 24px;
}
.compact .card-kind > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.compact .card-kind .glyph {
  width: 22px;
  height: 22px;
}
.compact .rarity-mark {
  width: 20px;
  height: 22px;
  right: -5px;
  top: -6px;
}
.compact .rarity-mark .glyph {
  width: 16px;
  height: 16px;
}
.page {
  max-width: 1180px;
  margin: auto;
  padding: 30px 36px 70px;
}
.page header {
  margin-bottom: 45px;
}
.page > p,
.page li {
  line-height: 1.7;
  max-width: 800px;
}
.setup-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.class-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 20px 0;
}
.class-choice {
  height: 145px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: left;
  padding: 10px;
  border-color: #59665c;
}
.class-choice .art:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 25%, #101719ee);
}
.class-choice strong,
.class-choice small {
  position: relative;
  z-index: 1;
}
.class-choice strong {
  font-size: 12px;
}
.class-choice small {
  font-size: 9px;
  margin-top: 5px;
  color: var(--class);
}
.class-choice.chosen {
  border: 2px solid var(--class);
  box-shadow: 0 0 20px color-mix(in srgb, var(--class), transparent 80%);
}
.setup-players p {
  font-size: 13px;
  color: var(--muted);
}
.wide {
  display: block;
  width: 100%;
  margin-top: 35px;
}
.filters {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  margin: 25px 0;
}
.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 28px 16px;
}
.catalog .card {
  width: 100%;
  height: 255px;
}
.catalog .card-image {
  height: 130px;
}
.copies {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
}
.copies button {
  padding: 8px 15px;
}
.deck-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.deck-list article {
  position: relative;
  overflow: hidden;
  min-height: 265px;
  border: 1px solid #646b5a77;
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  padding: 20px;
}
.deck-list .art:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent, #101719 90%);
}
.deck-list article > div {
  position: relative;
  z-index: 1;
}
.deck-list small {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--class, var(--gold));
}
.deck-list h2 {
  margin: 8px 0;
}
.deck-list p {
  font-size: 12px;
  color: #b8c4b6;
}
.deck-list button {
  font-size: 12px;
}
.file-label {
  display: block;
  padding: 20px;
  border: 1px dashed #5a6b61;
  margin-top: 25px;
}
.curve {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin: 20px 0;
  height: 90px;
}
.curve div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 40px;
  font: 10px Arial;
  text-align: center;
}
.curve i {
  background: var(--gold);
  max-height: 70px;
}
.tabletop {
  height: 100svh;
  max-width: 1100px;
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr 32px 1fr;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #334a3d, #152421 60%, #0c1617);
  position: relative;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.player-zone {
  min-height: 0;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 12px 22px 5px;
  border: 1px solid #b49b6033;
  box-shadow: inset 0 0 80px #0006;
}
.player-zone.p1 {
  transform: rotate(180deg);
}
.player-zone.active {
  box-shadow:
    inset 0 -2px 0 var(--class),
    inset 0 0 70px #0005;
}
.board-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex: 1;
  min-height: 95px;
  padding: 10px 0;
}
.empty-board {
  font-size: 12px;
  font-style: italic;
  color: #a0b0a255;
  letter-spacing: 1px;
}
.compact {
  width: 82px;
  height: 112px;
  padding: 3px;
  border-radius: 8px;
  flex-shrink: 1;
  min-width: 0;
}
.compact .card-image {
  height: 62%;
  border-radius: 6px 6px 30% 30%;
}
.compact .card-name {
  font-size: 9px;
  padding: 4px 0 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compact .cost {
  width: 23px;
  height: 25px;
  font-size: 16px;
  left: -6px;
  top: -6px;
}
.compact .atk,
.compact .hp {
  font-size: 16px;
  min-width: 15px;
}
.compact .card-stats {
  min-height: 20px;
}
.compact .keywords {
  font-size: 9px;
  white-space: nowrap;
}
.hand {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: 105px;
  padding: 5px 8px 0;
}
:is(.hand, .fx-hand) .compact {
  width: 78px;
  height: 105px;
}
:is(.hand, .fx-hand) .compact:hover {
  translate: 0 -8px;
  z-index: 3;
}
:is(.hand, .fx-hand) .card-name {
  font-size: 8px;
}
:is(.hand, .fx-hand) .card-stats {
  font-size: 7px;
}
.player-bar {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 90px;
  padding: 5px 10px;
  margin: 0 0 7px;
  background: #0b171b66;
  border-top: 1px solid #b29a5933;
  border-bottom: 1px solid #b29a5933;
  border-radius: 10px;
}
.hero-portrait {
  position: relative;
  width: 66px;
  height: 72px;
  border-radius: 45% 45% 30% 30%;
  border: 2px solid var(--class);
  flex-shrink: 0;
  padding: 0;
  overflow: visible;
}
.hero-portrait .art {
  border-radius: 45% 45% 30% 30%;
}
.hero-portrait b {
  position: absolute;
  bottom: -5px;
  left: 0;
  right: 0;
  background: #3a2525;
  border: 1px solid #8d6860;
  border-radius: 10px;
  font: 16px Georgia;
}
.hero-portrait i {
  position: absolute;
  right: -15px;
  top: -5px;
  color: #b4c2d0;
  font: 13px Arial;
  background: #283e4a;
  border-radius: 8px;
  padding: 4px;
}
.hero-meta {
  flex: 1;
  min-width: 0;
}
.hero-meta strong {
  display: block;
  font-size: 15px;
}
.hero-meta small {
  display: block;
  font-size: 9px;
  color: #99aaa0;
  margin: 5px 0;
}
.mana {
  display: flex;
  gap: 3px;
  align-items: center;
}
.mana i {
  width: 10px;
  height: 13px;
  background: #263e49;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.mana i.full {
  background: #7bc1d2;
  filter: drop-shadow(0 0 5px #6ca6c0);
}
.mana i.locked {
  background: #a96365;
}
.mana b {
  font-size: 11px;
  color: #a9d2dc;
  margin-left: 5px;
}
.power {
  font-size: 11px;
  text-align: center;
  padding: 5px 10px;
  max-width: 130px;
  min-height: 65px;
  border-radius: 40%;
  border-color: #ac955144;
  background: radial-gradient(#60513755, #172b27);
}
.power span {
  display: block;
  color: var(--gold);
  font-size: 22px;
}
.power small {
  display: block;
  font-size: 8px;
  margin-top: 3px;
  color: #a1b9b6;
}
.power.used {
  opacity: 0.4;
}
.turn-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.turn-controls button {
  font-size: 10px;
  padding: 8px 12px;
  min-height: 35px;
  border-color: var(--class);
  background: #243a30;
}
.zone-help {
  text-align: center;
  font-size: 7px;
  letter-spacing: 1px;
  color: #687e73;
  padding: 5px;
}
.table-seam {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  font-size: 10px;
  letter-spacing: 3px;
  background: #0c1718;
  position: relative;
  z-index: 2;
  border-block: 1px solid #a68d4b55;
}
.table-seam span {
  color: var(--gold);
}
.table-seam button {
  min-height: 24px;
  padding: 0 14px;
  border: 0;
  font-size: 13px;
}
.table-seam small {
  font-size: 8px;
  letter-spacing: 1px;
}
.selected {
  outline: 2px solid #ebd599;
  box-shadow: 0 0 25px #e1c77b88 !important;
}
.ready {
  box-shadow: 0 0 12px #9cbe8355;
  border-color: #b3c989;
}
.shielded:after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid #f3d99688;
  border-radius: 40%;
  pointer-events: none;
  box-shadow: 0 0 18px #e7d48155;
  animation: breathe 3s infinite;
}
.frozen {
  filter: drop-shadow(0 0 6px #a5e8ff);
  border-color: #a5e8ff !important;
}
.stealthed {
  opacity: 0.65;
}
.detail-panel {
  position: absolute;
  z-index: 20;
  inset: 8px 12px;
  display: grid;
  grid-template-columns: 220px minmax(0, 320px);
  justify-content: center;
  align-items: center;
  gap: 28px;
  padding: 36px 28px 24px;
  background: #07110fa6;
  backdrop-filter: blur(8px) saturate(0.65);
  -webkit-backdrop-filter: blur(8px) saturate(0.65);
  border: 0;
  box-shadow: none;
  border-radius: 0;
  overflow: hidden;
}
.detail-panel .preview-card {
  width: 220px;
  height: 330px;
  pointer-events: none;
  box-shadow:
    0 18px 45px #000c,
    0 0 32px color-mix(in srgb, var(--rarity), transparent 80%);
  animation: card-zoom 180ms ease-out both;
}
.detail-panel .preview-card .card-image {
  height: 155px;
}
.detail-panel .preview-card .card-name {
  font-size: 18px;
  line-height: 1.15;
  padding-top: 12px;
}
.detail-panel .preview-card > p {
  font-size: 14px;
  line-height: 1.45;
  margin: 10px 0;
}
.detail-panel .preview-card .atk,
.detail-panel .preview-card .hp {
  font-size: 26px;
}
.detail-notes {
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  padding: 6px 8px 8px 2px;
  overscroll-behavior: contain;
}
.detail-panel h2 {
  font-size: 24px;
  line-height: 1.2;
  margin: 12px 0 18px;
}
.detail-panel p {
  font-size: 14px;
  line-height: 1.5;
}
.detail-panel small {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--gold);
}
.detail-meta {
  color: var(--rarity);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}
.detail-meta .glyph {
  width: 20px;
  height: 20px;
}
.current-stats {
  color: #b7d2c3;
}
.detail-notes > .primary {
  margin-top: 16px;
}
.power-enlarged {
  width: 190px;
  height: 220px;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--class);
  background: radial-gradient(
    ellipse,
    color-mix(in srgb, var(--class), transparent 85%),
    transparent 70%
  );
  border: 1px solid color-mix(in srgb, var(--class), transparent 55%);
  border-radius: 50%;
  box-shadow:
    0 0 45px #0007,
    inset 0 0 25px #0005;
  animation: card-zoom 180ms ease-out both;
}
.power-enlarged .glyph {
  width: 96px;
  height: 96px;
  stroke-width: 1.2;
}
.power-enlarged > span {
  font: 12px Georgia;
  letter-spacing: 3px;
}
.power-description {
  color: #ece0bd;
  font-size: 18px !important;
}
.power-status {
  color: #a8c7c1;
  margin-top: 18px;
}
.preview-static .preview-card,
.preview-static > .power-enlarged {
  animation: none;
}
@keyframes card-zoom {
  from {
    opacity: 0.2;
    scale: 0.72;
    translate: 0 12px;
  }
  to {
    opacity: 1;
    scale: 1;
    translate: 0 0;
  }
}
.close {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
  font-size: 22px;
  padding: 5px 13px;
}
.explanations {
  margin: 0;
  max-height: none;
  overflow: visible;
}
.keyword-note {
  border-left: 2px solid #bca56a88;
  padding-left: 12px;
  margin: 0 0 16px;
}
.keyword-note h3 {
  color: #e6ce94;
  font-size: 14px;
  margin: 0 0 5px;
}
.keyword-note p {
  color: #c2cec4;
  font-size: 13px;
  margin: 0;
}
.collection-detail {
  position: fixed;
  inset: 0;
  background: #081112b8;
  z-index: 30;
  display: grid;
  place-items: center;
}
.collection-detail .detail-panel {
  position: relative;
  inset: auto;
  width: min(850px, 96vw);
  height: min(540px, 92dvh);
  min-height: 0;
}
.selection-bar {
  position: absolute;
  z-index: 15;
  bottom: 5px;
  left: 15px;
  right: 15px;
  background: #c9aa70;
  color: #162420;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 6px;
  box-shadow: 0 8px 25px #0008;
}
.selection-bar button {
  font-size: 11px;
  min-height: 30px;
  padding: 5px 12px;
}
.choice-overlay {
  position: absolute;
  z-index: 25;
  inset: 8px;
  background: #10201cf5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--gold);
  border-radius: 12px;
}
.choice-overlay > div {
  display: flex;
  gap: 22px;
}
.choice-overlay .card {
  width: 130px;
  height: 190px;
}
.choice-overlay .card-image {
  height: 80px;
}
.choice-overlay .card p {
  font-size: 9px;
}
.choice-overlay > div > div > button:last-child:not(.card) {
  display: block;
  margin: 8px auto;
}
.global-overlay {
  position: fixed;
  inset: 0;
  background: #0b1718ed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding: 30px;
  backdrop-filter: blur(15px);
}
.global-overlay h1 {
  max-width: 800px;
}
.global-overlay button {
  min-width: 240px;
}
.history {
  max-height: 25vh;
  overflow: auto;
  font-size: 12px;
  width: 400px;
  max-width: 90vw;
  color: #abb9ac;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: #dcc59c;
  color: #14211d;
  border-radius: 6px;
  padding: 16px 25px;
  box-shadow: 0 5px 35px #0008;
  text-align: center;
  max-width: 90vw;
  font: 14px Arial;
}
#fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  overflow: hidden;
}
.particle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
  animation: burst 0.8s forwards;
}
.float-number {
  position: absolute;
  font: bold 35px Georgia;
  color: #ffe8bc;
  text-shadow: 0 2px 5px #000;
  animation: rise 0.9s forwards;
}
.aim-line {
  position: absolute;
  height: 3px;
  transform-origin: left;
  background: linear-gradient(90deg, #c9aa7066, #f5df9b);
  box-shadow: 0 0 10px #c9aa70;
  border-radius: 5px;
}
.aim-line:after {
  content: "";
  position: absolute;
  right: -5px;
  top: -5px;
  border-left: 12px solid #f5df9b;
  border-block: 6px solid transparent;
}
@keyframes burst {
  to {
    translate: var(--dx) var(--dy);
    opacity: 0;
    scale: 0.1;
  }
}
@keyframes rise {
  to {
    translate: 0 -70px;
    opacity: 0;
  }
}
@keyframes float {
  50% {
    translate: 0 -10px;
  }
}
@keyframes breathe {
  50% {
    opacity: 0.5;
  }
}
@media (min-width: 1100px) {
  .tabletop {
    max-width: 850px;
  }
}
@media (max-width: 900px) {
  .hero-copy {
    max-width: 100%;
    padding: 65px 0 40px;
  }
  .hero-copy h1 {
    font-size: 100px;
  }
  .showcase {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    height: 370px;
    margin-bottom: 85px;
  }
  .home-nav {
    gap: 10px;
  }
  .home-nav span {
    font-size: 19px;
  }
  .home-nav button {
    gap: 10px;
  }
  .home-nav small {
    font-size: 9px;
  }
  .home {
    padding: 25px 35px;
  }
  .deck-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .home {
    padding: 20px;
  }
  .home header {
    gap: 12px;
    font-size: 8px;
  }
  .edition {
    display: none;
  }
  .hero-copy {
    padding-top: 50px;
  }
  .hero-copy h1 {
    font-size: 80px;
  }
  .hero-copy p {
    font-size: 15px;
  }
  .hero-actions {
    flex-wrap: wrap;
  }
  .showcase {
    scale: 0.85;
    margin-top: -10px;
    margin-bottom: 35px;
  }
  .home-nav {
    grid-template-columns: 1fr;
  }
  .home-nav small {
    font-size: 11px;
  }
  .home-nav span {
    font-size: 23px;
  }
  footer {
    flex-wrap: wrap;
  }
  footer span {
    width: 100%;
  }
  .page {
    padding: 20px;
  }
  .setup-players {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .deck-list {
    grid-template-columns: 1fr;
  }
  .catalog {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 12px;
  }
  .player-zone {
    padding: 6px 9px 3px;
  }
  .player-bar {
    gap: 5px;
    padding: 4px;
    min-height: 65px;
  }
  .hero-portrait {
    width: 44px;
    height: 52px;
  }
  .hero-meta strong {
    font-size: 10px;
  }
  .hero-meta small {
    font-size: 7px;
  }
  .power {
    font-size: 8px;
    padding: 3px;
    min-height: 50px;
    width: 75px;
  }
  .power span {
    font-size: 16px;
  }
  .turn-controls button {
    font-size: 8px;
    padding: 4px;
    min-height: 30px;
  }
  .hand {
    gap: 4px;
    padding: 5px 3px;
    min-height: 85px;
  }
  :is(.hand, .fx-hand) .compact {
    height: 80px;
  }
  .compact {
    height: 85px;
    width: 63px;
  }
  .compact .card-name {
    font-size: 7px;
  }
  .compact .atk,
  .compact .hp {
    font-size: 13px;
  }
  .compact .keywords {
    font-size: 7px;
  }
  .compact .cost {
    width: 19px;
    height: 21px;
    font-size: 12px;
  }
  .board-row {
    gap: 5px;
  }
  .detail-panel {
    inset: 4px;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 16px;
    padding: 36px 12px 14px;
  }
  .detail-panel .preview-card {
    width: 140px;
    height: 230px;
  }
  .detail-panel .preview-card .card-image {
    height: 96px;
  }
  .detail-panel .preview-card .card-name {
    font-size: 13px;
  }
  .detail-panel .preview-card > p {
    font-size: 11px;
    line-height: 1.3;
    margin: 5px 0;
  }
  .detail-panel h2 {
    font-size: 19px;
  }
  .detail-panel p {
    font-size: 12px;
  }
  .power-enlarged {
    width: 130px;
    height: 180px;
  }
  .power-enlarged .glyph {
    width: 70px;
    height: 70px;
  }
  .choice-overlay .card {
    width: 95px;
    height: 150px;
  }
  .choice-overlay .card-image {
    height: 60px;
  }
  .choice-overlay .card-name {
    font-size: 9px;
  }
  .choice-overlay > div {
    gap: 8px;
  }
  .choice-overlay .card p {
    font-size: 8px;
  }
  .mana i {
    width: 6px;
    height: 9px;
  }
  .zone-help {
    font-size: 5px;
  }
  .table-seam {
    gap: 10px;
  }
  .tabletop {
    grid-template-rows: 1fr 26px 1fr;
  }
  .card-stats {
    gap: 1px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}

.turn-banner {
  position: absolute;
  top: 15%;
  left: 15%;
  right: 15%;
  text-align: center;
  padding: 18px;
  background: linear-gradient(90deg, transparent, #c9aa70dd, transparent);
  color: #14221d;
  font-size: 22px;
  letter-spacing: 1px;
  pointer-events: none;
  z-index: 16;
  animation: turn-in 1.4s both;
}
@keyframes turn-in {
  0%,
  100% {
    opacity: 0;
    translate: 0 8px;
  }
  20%,
  80% {
    opacity: 1;
    translate: 0 0;
  }
}
@media (min-width: 601px) {
  .board-row .compact {
    width: 96px;
    height: 138px;
  }
  :is(.hand, .fx-hand) .compact {
    width: 94px;
    height: 125px;
  }
  .compact .card-name,
  :is(.hand, .fx-hand) .card-name {
    font-size: 10px;
  }
  .compact .atk,
  .compact .hp {
    font-size: 19px;
  }
  .compact .cost {
    width: 26px;
    height: 28px;
    font-size: 18px;
  }
  .player-bar {
    min-height: 98px;
  }
  .hero-meta strong {
    font-size: 17px;
  }
  .hero-meta small {
    font-size: 10px;
  }
  .turn-controls button {
    min-height: 44px;
    font-size: 11px;
  }
  .power {
    min-width: 105px;
    min-height: 70px;
  }
  .hand {
    min-height: 136px;
  }
  .zone-help {
    font-size: 8px;
  }
  .table-seam {
    min-height: 40px;
  }
  .tabletop {
    grid-template-rows: 1fr 40px 1fr;
  }
}
.valid-target {
  outline: 2px solid #e2ca8b;
  box-shadow: 0 0 22px #dfc88066 !important;
  cursor: crosshair;
}

/* Gesture surfaces own card movement; detail text and menus remain scrollable. */
.hand,
.board-row,
.hero-portrait {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.tabletop button {
  touch-action: manipulation;
}
.tabletop .hand .card,
.tabletop .board-row .card,
.tabletop .hero-portrait {
  touch-action: none;
}
.tabletop {
  height: 100dvh;
  overscroll-behavior: none;
}
.detail-panel,
.explanations,
.history {
  overscroll-behavior: contain;
}
@media (hover: none) {
  :is(.hand, .fx-hand) .compact:hover {
    translate: none;
  }
}

/* Actors are inert snapshots in viewport coordinates; their child faces its owner. */
[hidden] {
  display: none !important;
}
.fx-playback {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.fx-actor {
  position: absolute;
  pointer-events: none;
}
.fx-actor > .fx-card {
  width: 100%;
  height: 100%;
  margin: 0;
  min-height: 0;
  opacity: 1;
  transform: rotate(var(--facing));
  animation: none;
  transition: none;
  pointer-events: none;
}
/* A presentation copy never runs the live card's own CSS animations: a
   transform animation (the sleeping units' breathing) replaced the facing
   rotation above and turned every sleeping unit upside down mid-playback. */
#fx .fx-actor > .fx-card,
#fx .fx-actor > .fx-card.unit-token.sleeping {
  animation: none !important;
}
.fx-masked {
  opacity: 0 !important;
}
.fx-label {
  position: absolute;
  transform: translate(-50%, -50%) rotate(var(--facing));
  font: bold 22px Georgia;
  color: #ffe8bc;
  text-shadow: 0 2px 5px #000;
  background: #152421dc;
  border: 1px solid #c9aa7088;
  border-radius: 8px;
  padding: 10px 16px;
  max-width: 70vw;
  text-align: center;
}
.fx-spark {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.fx-playback > div:first-child {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.table-seam [data-action="skip-effects"] {
  font-size: 10px;
  letter-spacing: 0;
}

/* Abilities remain inspectable even when they cannot currently be activated. */
.power {
  border-radius: 18px;
  min-height: 86px;
  color: var(--class);
  touch-action: none !important;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.power > .glyph {
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto 3px;
}
.power > .power-name {
  font-size: 11px;
  color: #e1d9bd;
}
.power small {
  font-size: 7px;
  letter-spacing: 0.3px;
}
.power[aria-disabled="true"] {
  opacity: 0.6;
}
.power.used {
  opacity: 0.6;
}
@media (max-width: 600px) {
  .power {
    min-height: 66px;
  }
  .power > .glyph {
    width: 24px;
    height: 24px;
  }
  .power > .power-name {
    font-size: 8px;
  }
  .power small {
    font-size: 6px;
  }
}

.card-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 20px 0;
}
.card-legend > span {
  color: var(--rarity);
}

/* Local presentation cues; all geometry is in viewport coordinates. */
.fx-resource-label {
  font-size: 13px;
  padding: 5px 9px;
  white-space: nowrap;
}
.fx-ring,
.fx-spell,
.fx-deck-card {
  position: absolute;
  pointer-events: none;
}
.fx-ring {
  width: 72px;
  height: 72px;
  margin: -36px;
  border: 2px solid var(--cue);
  border-radius: 50%;
  box-shadow:
    0 0 22px var(--cue),
    inset 0 0 12px var(--cue);
}
.fx-ring.frost {
  border-radius: 20%;
  transform: rotate(45deg);
}
.fx-spell {
  width: 18px;
  height: 18px;
  margin: -9px;
  border-radius: 50%;
  background: var(--cue);
  box-shadow: 0 0 12px 5px var(--cue);
}
.fx-spell.frost {
  border-radius: 2px;
  transform: rotate(45deg);
}
.fx-spell.healing {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}
.fx-spell.healing::before,
.fx-spell.healing::after {
  content: "";
  position: absolute;
  background: var(--cue);
  box-shadow: 0 0 12px var(--cue);
}
.fx-spell.healing::before {
  width: 6px;
  height: 20px;
  left: 7px;
}
.fx-spell.healing::after {
  width: 20px;
  height: 6px;
  top: 7px;
}
.fx-deck-card {
  width: 34px;
  height: 48px;
  margin: -24px -17px;
  display: grid;
  place-items: center;
  border: 1px solid #c9aa70;
  border-radius: 5px;
  background: repeating-linear-gradient(45deg, #253e37 0 5px, #1b2a29 5px 10px);
  color: #e8d7aa;
  transform: rotate(var(--facing));
  box-shadow: 0 4px 12px #0008;
}

/* CP12: the card is the focal point; trait explanations are always open below it. */
.detail-panel {
  inset: 0;
}
.centered-preview {
  display: block;
  padding: 10px 40px 14px;
}
.centered-preview .detail-notes {
  width: min(100%, 660px);
  height: 100%;
  margin: auto;
  padding: 0 12px 8px;
  text-align: center;
}
.preview-stage {
  display: flex;
  justify-content: center;
  padding: 14px 8px 8px;
}
.centered-preview .preview-card {
  width: 228px;
  height: 292px;
  padding: 7px;
}
.centered-preview .preview-card .card-image {
  height: 132px;
}
.centered-preview .preview-card .card-name {
  font-size: 18px;
  padding: 8px 2px 2px;
}
.centered-preview .preview-card > p {
  font-size: 14px;
  line-height: 1.35;
  margin: 5px 0;
}
.centered-preview .detail-meta {
  justify-content: center;
  font-size: 10px;
  margin: 0 0 7px;
}
.centered-preview .detail-meta .glyph {
  width: 15px;
  height: 15px;
}
.centered-preview .explanations {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  text-align: left;
}
.centered-preview .explanations:has(> :only-child) {
  grid-template-columns: minmax(0, 460px);
  justify-content: center;
}
.centered-preview .keyword-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--trait, #d8cba1), transparent 60%);
  border-radius: 12px;
  background: linear-gradient(135deg, #233833f5, #101e1cf5);
}
.centered-preview .keyword-note h3 {
  font: bold 14px Georgia;
  color: var(--trait, #f0dfaf);
  margin: 0 0 3px;
}
.centered-preview .keyword-note p {
  color: #e5e7da;
  font: 12px/1.4 Georgia;
  margin: 0;
}
.trait-note-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 38px;
  flex: 0 0 34px;
  color: var(--trait, #edcf8d);
}
.trait-note-icon .glyph {
  width: 30px;
  height: 30px;
  stroke-width: 1.8;
}
.centered-preview .detail-notes > .primary {
  margin: 9px 0 0;
  min-height: 36px;
  padding: 8px 24px;
}
.inactive-trait {
  opacity: 0.6;
}
.trait-Poisonous {
  --trait: #bbef77;
}
.trait-Deathrattle,
.trait-Stealth,
.trait-Silence {
  --trait: #d4b2f2;
}
.trait-Lifesteal {
  --trait: #f6a8b6;
}
.trait-Freeze,
.trait-SpellDamage,
.trait-Windfury {
  --trait: #a0e3ff;
}
.trait-Reborn,
.trait-DivineShield,
.trait-Battlecry {
  --trait: #ffe09c;
}
.card-image {
  position: relative;
}
.trait-ribbon {
  position: absolute;
  bottom: 7px;
  left: 4px;
  right: 4px;
  display: flex;
  justify-content: center;
  gap: 4px;
  z-index: 2;
}
.trait-icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  color: var(--trait, #fff0b9);
  background: #11221bf5;
  border: 1px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 2px 5px #000c;
}
.trait-icon .glyph {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}
.compact .trait-ribbon {
  bottom: 5px;
  gap: 2px;
}
.compact .trait-icon {
  width: 18px;
  height: 18px;
}
.compact .trait-icon .glyph {
  width: 14px;
  height: 14px;
}
.atk,
.hp {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  font: bold 24px/1 Georgia;
  border: 2px solid #f6d689;
  box-shadow:
    0 3px 0 #070d0d,
    inset 0 1px 3px #fffa;
  text-shadow:
    0 2px 2px #000,
    1px 0 #000,
    -1px 0 #000;
}
.atk {
  background: linear-gradient(135deg, #a77830, #47381e);
  border-radius: 9px 3px 9px 3px;
  color: #fff3c9;
}
.hp {
  background: linear-gradient(135deg, #ba5d53, #5d2429);
  border-color: #f1b0a0;
  border-radius: 50% 50% 40% 40%;
  color: #fff2df;
}
.compact .atk,
.compact .hp {
  width: 25px;
  height: 25px;
  min-width: 25px;
  font-size: 20px;
}
.centered-preview .preview-card .atk,
.centered-preview .preview-card .hp {
  width: 36px;
  height: 36px;
  font-size: 28px;
}
.atk.boosted {
  color: #ceff9a;
  border-color: #b8e980;
  box-shadow: 0 0 10px #a3dc6655;
}
.hp.wounded {
  color: #ffe09c;
  border-color: #ff796e;
}
.cost {
  box-shadow:
    0 3px 0 #081725,
    inset 0 1px 6px #effbff;
  font-weight: 900;
}
.hero-portrait b {
  font-weight: bold;
  font-size: 20px;
  border-width: 2px;
  box-shadow: 0 3px 8px #0009;
  color: #ffe0ca;
}
.deck-pile {
  width: 48px;
  min-width: 48px;
  position: relative;
  isolation: isolate;
  margin: 0 5px;
}
.deck-pile::before,
.deck-pile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1px solid #9c875c;
  border-radius: 7px;
  background: #18251f;
  transform: translate(calc(var(--deck-height) * -0.65), var(--deck-height))
    rotate(-6deg);
}
.deck-pile::after {
  transform: translate(var(--deck-height), calc(var(--deck-height) * -0.6))
    rotate(6deg);
}
.deck-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 66px;
  border: 1px solid #cdb074;
  border-radius: 7px;
  background: repeating-linear-gradient(45deg, #344437 0 4px, #253b31 4px 8px);
  box-shadow: 0 4px 8px #0007;
  color: #f5dfb2;
}
.deck-count .glyph {
  width: 18px;
  height: 18px;
}
.deck-count b {
  font: bold 22px/1.1 Georgia;
  text-shadow: 0 2px #000;
}
.deck-count small {
  font: 7px/1.4 Arial;
  letter-spacing: 1px;
}
.deck-pile.empty .deck-count {
  border-style: dashed;
  background: #1a2522;
  color: #d3a29a;
}
.tabletop {
  background: #10211c;
}
.player-zone {
  background: radial-gradient(
    ellipse at 50% 27%,
    #344b3680,
    #142a2388 65%,
    #0b1915
  );
  box-shadow:
    inset 0 0 70px #0008,
    inset 0 0 0 3px #9f845126,
    inset 0 0 0 8px #020a0755;
}
.player-zone.active {
  box-shadow:
    inset 0 -3px var(--class),
    inset 0 0 70px #0008,
    inset 0 0 0 3px #cfb27444,
    inset 0 0 0 8px #020a0755;
}
.board-row {
  position: relative;
  border-radius: 38%;
  background: radial-gradient(ellipse, #bacb8d0a, transparent 67%);
}
.board-row::before {
  content: "";
  position: absolute;
  inset: 16% 5%;
  border: 1px solid #c4ac6524;
  outline: 1px solid #c4ac650c;
  outline-offset: 7px;
  border-radius: 50%;
  pointer-events: none;
}
.board-row::after {
  content: "✧";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font: 80px Georgia;
  color: #d8c38d0c;
  pointer-events: none;
}
.board-row .card {
  z-index: 1;
}
.player-bar {
  background: linear-gradient(100deg, #0c1c18e8, #26392bdd, #0b1c19ed);
  border-color: #c5a26866;
  box-shadow:
    0 5px 15px #0004,
    inset 0 1px #ffe4ae11;
}
.table-seam {
  background: linear-gradient(#342e23, #17201a 35%, #0b1815 65%, #3c3324);
  border-color: #c6a86688;
}
.collection-detail .centered-preview {
  width: min(760px, 94vw);
  height: min(850px, 94dvh);
  max-height: 94dvh;
}
.collection-detail .centered-preview .preview-card {
  width: 270px;
  height: 375px;
}
.collection-detail .centered-preview .card-image {
  height: 190px;
}
.collection-detail .centered-preview .detail-notes {
  height: auto;
  max-height: 100%;
}
@media (max-width: 600px) {
  .centered-preview {
    padding: 8px 24px;
  }
  .centered-preview .preview-card {
    width: 190px;
    height: 255px;
  }
  .centered-preview .preview-card .card-image {
    height: 110px;
  }
  .centered-preview .explanations {
    grid-template-columns: 1fr;
  }
  .centered-preview .keyword-note p {
    font-size: 11px;
  }
  .deck-pile {
    width: 34px;
    min-width: 34px;
    margin: 0 2px;
  }
  .deck-count {
    min-height: 56px;
  }
  .deck-count b {
    font-size: 18px;
  }
  .compact .atk,
  .compact .hp {
    min-width: 20px;
    width: 20px;
    height: 22px;
    font-size: 17px;
  }
}

/* Original impact families; no screen shake or persistent idle particles. */
.fx-impact {
  position: absolute;
  width: 90px;
  height: 90px;
  margin: -45px;
  color: var(--cue);
  pointer-events: none;
  transform: rotate(var(--facing));
  filter: drop-shadow(0 0 9px var(--cue));
}
.fx-impact > i {
  display: block;
  position: absolute;
  inset: 7%;
  border: 3px solid currentColor;
  border-radius: 50%;
}
.impact-heavy > i,
.impact-summon > i {
  border: 0;
  background: var(--cue);
  clip-path: polygon(
    50% 0,
    60% 28%,
    85% 9%,
    76% 38%,
    100% 50%,
    73% 59%,
    92% 87%,
    62% 75%,
    50% 100%,
    40% 73%,
    12% 91%,
    26% 61%,
    0 50%,
    29% 39%,
    9% 13%,
    40% 27%
  );
}
.impact-claw > i,
.impact-slash > i {
  inset: 6% 45%;
  border: none;
  border-radius: 100% 0;
  background: currentColor;
  transform: rotate(35deg);
}
.impact-claw > i:nth-child(2),
.impact-slash > i:nth-child(2) {
  translate: -20px 0;
}
.impact-claw > i:nth-child(3) {
  translate: 20px 0;
}
.impact-slash > i:nth-child(2) {
  transform: rotate(-35deg);
  translate: 0 0;
}
.impact-slash > i:nth-child(3) {
  display: none;
}
.impact-venom > i {
  background: #aee76488;
  border-radius: 60% 40% 60% 40%;
}
.impact-drain > i {
  border-width: 5px 0;
  transform: rotate(40deg);
}
.impact-arcane > i {
  border-radius: 15%;
  transform: rotate(45deg);
}
.impact-whirl > i {
  border-color: currentColor transparent;
}
.impact-whirl > i:nth-child(2) {
  inset: 20%;
  transform: rotate(60deg);
}
.impact-whirl > i:nth-child(3) {
  inset: 35%;
  transform: rotate(120deg);
}
.particle-venom {
  width: 8px;
  height: 10px;
  border-radius: 60% 40%;
}
.particle-arcane,
.particle-summon {
  border-radius: 0;
  transform: rotate(45deg);
}
.fx-label.fx-damage-number {
  background: #7d3029;
  color: #fff0bd;
  font: bold 40px Georgia;
  border: 3px solid #f9cf84;
  border-radius: 12px 4px;
  padding: 5px 14px;
  box-shadow:
    0 5px 0 #20120c,
    0 0 25px #eb8f4866;
  text-shadow: 2px 3px #36130c;
}
.fx-label.fx-heal-number {
  color: #c5ffd3;
  font-size: 32px;
  border-color: #acdcb0;
}

.detail-panel .preview-card.stealthed {
  opacity: 1;
}
.hp.boosted:not(.wounded) {
  color: #ceff9a;
  border-color: #b8e980;
}

/* Center the complete inspection group when the iPad half has spare height. */
.centered-preview .detail-notes {
  display: flex;
  flex-direction: column;
}
.centered-preview .detail-notes > * {
  flex-shrink: 0;
}
.centered-preview .preview-stage {
  margin-top: auto;
}
.centered-preview .detail-notes > :last-child {
  margin-bottom: auto;
}
.centered-preview .detail-notes > .primary {
  align-self: center;
}

/* CP13 — Graphic Occult Folk. Target: portrait 12.9-inch iPad Pro. */
.art.folk-art {
  width: 100%;
  height: 100%;
  background: none;
  overflow: hidden;
}
.card {
  background: #101c2b;
  border: 2px solid var(--rarity, #e4cf9f);
  border-radius: 13px;
  padding: 8px;
  box-shadow:
    inset 0 0 0 2px #192d45,
    0 7px 16px #040a12aa;
}
.card::before {
  content: "";
  position: absolute;
  inset: -3px;
  background: url("../assets/card-frame-folk.svg") center / 100% 100% no-repeat;
  z-index: 3;
  pointer-events: none;
}
.card:hover {
  background: #192d45;
  box-shadow: 0 0 14px #c5a46a44;
}
.card .card-image {
  border: 1px solid #c5a46a;
  border-radius: 28px 28px 4px 4px;
}
.card .card-name {
  position: relative;
  background: #f3e9ce;
  color: #101c2b;
  text-shadow: none;
  border: 1px solid #c5a46a;
  border-radius: 7px 7px 3px 3px;
  padding: 5px 3px;
  margin-top: 4px;
  line-height: 1.1;
  z-index: 2;
}
.card > p {
  color: #192d45;
  background: #f3e9ce;
  border: 1px solid #c5a46a;
  border-radius: 3px 3px 8px 8px;
  padding: 6px 5px;
  margin: 3px 0;
}
.card-stats {
  position: relative;
  z-index: 4;
  padding-top: 3px;
}
.atk,
.hp {
  border-color: #c5a46a;
  background: #101c2b;
  color: #f3e9ce;
  box-shadow:
    inset 0 0 0 1px #f3e9ce55,
    0 2px 3px #03080d;
  text-shadow: 0 1px #000;
}
.hp {
  border-radius: 45% 45% 50% 50%;
}
.cost {
  background: radial-gradient(circle at 35% 25%, #627c9b, #192d45 70%);
  border: 2px solid #e4c691;
  box-shadow:
    0 0 0 2px #101c2b,
    inset 0 1px 4px #aab2b488;
  z-index: 5;
}
.rarity-mark {
  z-index: 5;
  background: #101c2b;
  border-radius: 50%;
}
.card.type-spell {
  background: #192d45;
  border-radius: 26px 26px 12px 12px;
}
.card.faction-warrior .card-image {
  border-color: #bc7b4a;
}
.card.faction-paladin .card-image {
  border-color: #efdb9e;
}
.trait-icon {
  color: var(--trait, #e7d19d);
  background: #101c2bf2;
  box-shadow: 0 2px 4px #0008;
}
.card .trait-icon {
  border-width: 1.5px;
}
.tabletop {
  grid-template-rows: repeat(2, minmax(0, 1fr));
  background: #101c2b;
}
.player-zone {
  padding: 8px 20px 6px;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 65%, #c5a46a16, transparent 72%),
    linear-gradient(155deg, #25323b, #192631 68%, #17222c);
  border-color: #c5a46a2b;
  box-shadow: inset 0 0 64px #070f1838;
}
.player-zone.active {
  box-shadow:
    inset 0 -3px var(--class),
    inset 0 0 64px #070f1838;
}
.player-zone > .arena-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: 0.42;
  pointer-events: none;
}
.player-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(#101c2b66, #101c2b18 60%, #101c2be0);
}
.player-zone.faction-warrior {
  --class: #c18158 !important;
}
.player-zone.faction-paladin {
  --class: #e0c78a !important;
}
.board-row {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin-inline: auto;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  align-content: center;
  gap: 8px;
  border-radius: 0;
  background: none;
}
.board-row::before,
.board-row::after {
  display: none;
}
.board-row.dense-board {
  max-width: 680px;
}
.board-row > .compact {
  flex: 0 0 var(--unit-width);
  width: var(--unit-width);
  height: var(--unit-height);
  padding: 7px;
}
.board-row > .compact .card-image,
.fx-unit > .compact .card-image {
  height: 66%;
}
.board-row > .compact .card-name,
.fx-unit > .compact .card-name {
  font-size: 14px;
  white-space: normal;
  min-height: 28px;
  padding: 5px 3px;
}
.board-row > .compact .atk,
.board-row > .compact .hp,
.fx-unit > .compact .atk,
.fx-unit > .compact .hp {
  min-width: 35px;
  width: 35px;
  height: 32px;
  font-size: 27px;
}
.board-row > .compact .cost,
.fx-unit > .compact .cost {
  width: 34px;
  height: 36px;
  font-size: 25px;
  left: -6px;
  top: -7px;
}
.board-row > .compact .rarity-mark,
.fx-unit > .compact .rarity-mark {
  width: 25px;
  height: 25px;
}
.board-row > .compact .trait-icon,
.fx-unit > .compact .trait-icon {
  width: 24px;
  height: 24px;
}
.board-row > .compact .trait-icon .glyph,
.fx-unit > .compact .trait-icon .glyph {
  width: 18px;
  height: 18px;
}
.player-bar {
  flex: 0 0 66px;
  min-height: 66px;
  max-height: 66px;
  margin: 4px 0 3px;
  padding: 4px 8px;
  gap: 12px;
  background: #101c2be8;
  border-color: #c5a46a66;
  border-radius: 10px;
}
.hero-portrait {
  width: 48px;
  height: 50px;
}
.hero-portrait b {
  font-size: 17px;
  bottom: -4px;
}
.hero-portrait i {
  font-size: 11px;
  padding: 2px 4px;
  right: -9px;
}
.hero-meta strong {
  font-size: 14px;
  line-height: 1.1;
}
.hero-meta small {
  margin: 3px 0;
  font-size: 9px;
}
.power {
  display: grid;
  grid-template-columns: 25px 1fr;
  align-items: center;
  gap: 4px;
  min-width: 112px;
  max-width: 130px;
  min-height: 46px;
  height: 46px;
  padding: 4px 7px;
  border-radius: 12px;
  background: #192d45;
}
.power > .glyph {
  width: 24px;
  height: 24px;
}
.power .power-name {
  font-size: 11px;
}
.power > small {
  grid-column: 1 / -1;
  font-size: 7px;
  margin: 0;
}
.deck-pile {
  width: 35px;
  min-width: 35px;
}
.deck-count {
  min-height: 48px;
}
.deck-count > .glyph {
  width: 14px;
  height: 14px;
}
.deck-count b {
  font-size: 18px;
}
.deck-count small {
  font-size: 6px;
}
.turn-controls {
  flex-direction: row;
  align-items: center;
  gap: 5px;
}
.turn-controls button {
  min-height: 40px;
  font-size: 10px;
  padding: 6px 9px;
  background: #192d45;
}
.hand {
  flex: 0 0 146px;
  height: 146px;
  min-height: 146px;
  gap: 5px;
  padding: 7px 4px 0;
  align-items: flex-start;
}
:is(.hand, .fx-hand) .compact {
  width: 102px;
  height: 134px;
  padding: 5px;
}
:is(.hand, .fx-hand) .compact .card-image {
  height: 59%;
}
:is(.hand, .fx-hand) .compact .card-name {
  font-size: 10px;
  padding: 4px 1px;
}
:is(.hand, .fx-hand) .compact .atk,
:is(.hand, .fx-hand) .compact .hp {
  font-size: 19px;
  width: 23px;
  height: 23px;
  min-width: 23px;
}
.zone-help {
  display: none;
}
.table-seam {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 0;
  background: transparent;
  border: 0;
  letter-spacing: 0;
  pointer-events: none;
}
.table-seam button {
  pointer-events: auto;
  min-width: 40px;
  min-height: 40px;
  padding: 7px;
  border: 1px solid #c5a46a;
  border-radius: 50%;
  color: #f3e9ce;
  background: #101c2be8;
  box-shadow: 0 3px 12px #0007;
}
.table-seam [data-action="skip-effects"] {
  border-radius: 10px;
  font-size: 9px;
}
.detail-panel {
  background: #101c2bb8;
}
.centered-preview .keyword-note {
  background: #192d45f5;
}
.centered-preview .preview-card > p {
  color: #192d45;
}
.centered-preview .preview-card .card-name {
  padding: 7px 3px;
}
.hold-preview,
.hold-preview * {
  pointer-events: none;
}
.hold-hint {
  color: #f3e9ce;
  font-size: 11px !important;
  margin: 8px 0 0;
  letter-spacing: 1px;
}
.centered-preview .detail-notes > .hold-hint {
  margin-bottom: auto;
}

.player-zone .centered-preview .preview-card {
  width: 280px;
  height: 356px;
}
.player-zone .centered-preview .preview-card .card-image {
  height: 172px;
}
.player-zone .centered-preview .preview-card > p {
  font-size: 16px;
}
.player-zone .centered-preview .preview-card .card-name {
  font-size: 20px;
}

/* CP14 — single combat lane, portrait units, six readable hand cards. */
.player-zone > .arena-art {
  opacity: 0.14;
  filter: saturate(0.6);
  -webkit-mask-image: radial-gradient(
    ellipse at center,
    transparent 22%,
    #000 95%
  );
  mask-image: radial-gradient(ellipse at center, transparent 22%, #000 95%);
}
.player-zone::before {
  background:
    radial-gradient(ellipse at 16% 74%, #d6b67913, transparent 55%),
    radial-gradient(ellipse at 86% 76%, #d6b6790d, transparent 50%),
    linear-gradient(#101c2b26, transparent 45%, #101c2b66);
}
.board-row {
  flex: 0 0 280px;
  height: 280px;
  flex-wrap: nowrap;
  gap: var(--unit-gap, 18px);
  align-items: center;
  align-content: center;
  margin-bottom: auto;
  max-width: none;
}
.board-row.legacy-board {
  max-width: none;
}
.board-row > .compact {
  flex-shrink: 0;
}
.card.unit-token {
  padding: 0;
  border: 0;
  border-radius: 48% 48% 40% 40%;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.card.unit-token::before {
  inset: 3px 3px 28px;
  border-radius: 48% 48% 42% 42%;
  background: linear-gradient(
    125deg,
    #ffe9b3,
    #8e6b3b 36%,
    #f3e9ce 60%,
    #a17b43
  );
  box-shadow:
    0 8px 16px #0008,
    inset 0 0 0 2px #101c2b;
  z-index: 0;
}
.card.unit-token .card-image {
  position: absolute;
  inset: 9px 9px 34px;
  width: auto;
  height: auto;
  border: 2px solid #c5a46a;
  border-radius: 48% 48% 42% 42%;
  overflow: hidden;
  z-index: 1;
}
.card.unit-token .card-name {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 0;
  margin: 0;
  min-height: 24px;
  padding: 4px 0;
  background: none;
  border: 0;
  color: #f3e9ce;
  text-shadow: 0 2px 3px #000;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card.unit-token .cost {
  display: none;
}
.card.unit-token .card-stats {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 23px;
  height: 43px;
  padding: 0;
}
.card.unit-token .atk,
.card.unit-token .hp {
  width: 43px;
  height: 43px;
  min-width: 43px;
  font-size: 32px;
  border: 2px solid #eed7a3;
}
.card.unit-token .atk {
  border-radius: 12px 5px 12px 5px;
}
.card.unit-token .hp {
  border-radius: 50%;
}
.card.unit-token .rarity-mark {
  top: 9px;
  right: 7px;
  width: 21px;
  height: 21px;
}
.card.unit-token .trait-ribbon {
  bottom: 15px;
  gap: 4px;
}
.card.unit-token .trait-icon {
  width: 26px;
  height: 26px;
}
.card.unit-token .trait-icon .glyph {
  width: 19px;
  height: 19px;
}
.card.unit-token.guarded::before {
  border-radius: 24% 24% 45% 45%;
  outline: 3px solid #d8c695;
  outline-offset: 2px;
}
.card.unit-token.shielded::after {
  inset: -6px -4px 20px;
  border-radius: 50%;
  border: 3px solid #ffe5a4;
  background: radial-gradient(ellipse at 30% 20%, #fff4b933, transparent 60%);
  box-shadow:
    0 0 12px #f6d37b77,
    inset 0 0 12px #f6d37b66;
  pointer-events: none;
}
.card.unit-token.frozen .card-image {
  border: 4px solid #a8edff;
  box-shadow: inset 0 0 18px #7bdbff;
  filter: saturate(0.55) hue-rotate(15deg);
}
.card.unit-token.exhausted:not(.selected) .card-image {
  filter: saturate(0.65) brightness(0.84);
}
.card.unit-token.ready::before {
  box-shadow:
    0 0 0 2px var(--ui-ready),
    0 0 13px #90c9ba66,
    0 8px 16px #0008;
}
.card.unit-token.selected {
  transform: translateY(-8px);
}
.card.unit-token.selected::before {
  outline: 3px solid var(--ui-selected);
  outline-offset: 4px;
  box-shadow: 0 0 22px #eacb7a88;
}
.targeting [data-entity]:not(.valid-target):not(.selected) {
  opacity: 0.48;
}
.targeting .valid-target {
  opacity: 1;
}
.card.unit-token.valid-target::before {
  outline: 3px solid var(--ui-target);
  outline-offset: 4px;
  box-shadow: 0 0 18px #eabf6866;
}
.card.unit-token.valid-target {
  cursor: crosshair;
}
.hand {
  flex: 0 0 196px;
  height: 196px;
  min-height: 196px;
  gap: var(--hand-gap);
  padding: 8px 6px 0;
}
:is(.hand, .fx-hand) .compact {
  flex: 0 1 var(--hand-card-width, var(--hand-width));
  width: var(--hand-card-width, var(--hand-width));
  height: var(--hand-height);
  padding: 6px;
  transition:
    translate 0.16s,
    box-shadow 0.16s;
}
:is(.hand, .fx-hand) .compact .card-name {
  font-size: var(--card-label-size);
  padding: 5px 2px;
}
:is(.hand, .fx-hand) .compact .atk,
:is(.hand, .fx-hand) .compact .hp {
  width: 29px;
  height: 29px;
  font-size: var(--hand-stat-size);
}
:is(.hand, .fx-hand) .compact .card-image {
  height: 62%;
}
.hand.legacy-hand .compact {
  flex-basis: var(--legacy-hand-width);
}
:is(.hand, .fx-hand) .compact:hover {
  translate: 0 -5px;
}
.zone-help {
  display: block;
  height: 13px;
  flex: 0 0 13px;
  margin: 0;
  font-size: 8px;
  color: #aab2b4;
  letter-spacing: 1px;
}
.selection-bar {
  bottom: 280px;
  border-radius: 20px;
  padding: 7px 12px;
  background: #101c2bf2;
  border: 1px solid #c5a46a;
  font-size: 13px;
}
.drag-card {
  position: absolute;
  width: var(--hand-width);
  height: var(--hand-height);
  pointer-events: none;
  z-index: 50;
  transform: translate(-50%, -55%) rotate(var(--facing));
  filter: drop-shadow(0 16px 12px #0009);
}
.drag-card > .card {
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.drag-source {
  opacity: 0.3;
}
.board-row.drop-ready {
  background: radial-gradient(ellipse, #e4c48122, transparent 70%);
  outline: 1px dashed #d1ba7b66;
  border-radius: 40px;
}
@media (prefers-reduced-motion: reduce) {
  :is(.hand, .fx-hand) .compact {
    transition: none;
  }
}
.unit-state {
  position: absolute;
  left: 6px;
  top: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  z-index: 5;
  border-radius: 50%;
  background: #192d45;
  border: 1px solid #aab2b4;
  color: #d7e8ee;
  font: bold 13px Georgia;
}
.unit-state .glyph {
  width: 20px;
  height: 20px;
}
.selection-bar {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  min-width: 280px;
  max-width: 80%;
  gap: 20px;
  color: #f3e9ce;
}
.selection-bar button {
  color: #f3e9ce;
  background: #192d45;
  border: 1px solid #c5a46a;
  min-height: 36px;
}

/* CP15 — deliberate opening hands; each player confirms in turn. */
.opening-panel {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: min(620px, 85%);
  text-align: center;
  padding: 28px 34px;
  border: 1px solid #c5a46a66;
  border-radius: 24px;
  background: #101c2bed;
  box-shadow: 0 18px 40px #0004;
}
.opening-panel h2 {
  color: #f3e9ce;
  font-size: 30px;
  margin: 14px 0;
}
.opening-panel p {
  color: #c8ced2;
  font-size: 15px;
  line-height: 1.5;
  margin: 0 auto 20px;
  max-width: 440px;
}
.opening-panel small {
  display: block;
  margin-top: 15px;
  font-size: 11px;
  color: #aab2b4;
}
.opening-panel button {
  min-height: 48px;
  padding-inline: 25px;
}
.opening-table .empty-board,
.opening-table .turn-controls {
  visibility: hidden;
}
.hand .opening-replace {
  translate: 0 -12px;
  outline: 3px solid #e6a972;
  outline-offset: 2px;
}
.hand .opening-replace::after {
  content: "VYMĚNIT";
  position: absolute;
  inset: 40% 0 auto;
  padding: 10px 0;
  background: #101c2be8;
  border-block: 1px solid #d5ae72;
  color: #ffe1b4;
  font: bold 13px Georgia;
  letter-spacing: 1px;
  z-index: 7;
}
/* CP16 — explicit release target and short, cancellable card return. */
.returning-card {
  position: absolute;
  width: var(--hand-width);
  height: var(--hand-height);
  pointer-events: none;
  z-index: 50;
  transform: translate(-50%, -55%) rotate(var(--facing));
  filter: drop-shadow(0 12px 10px #0008);
}
.returning-card > .card {
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.return-source {
  opacity: 0.25;
}
.drag-card.drop-accepted {
  filter: drop-shadow(0 0 12px #e7c88288) drop-shadow(0 16px 12px #0009);
}
.board-row.drop-hover {
  background: radial-gradient(ellipse, #e4c48133, transparent 75%);
  outline: 2px solid #f1d6a1;
  border-radius: 40px;
}
.card.unit-token.target-hover::before {
  outline: 4px solid var(--ui-selected);
  outline-offset: 5px;
  box-shadow: 0 0 24px #eacb7aaa;
}
.hero-portrait.target-hover {
  outline: 3px solid var(--ui-selected);
  box-shadow: 0 0 20px #eacb7aaa;
}

/* Event-time changes: old portrait dissolves while its replacement appears. */
.fx-actor > .fx-outgoing {
  position: absolute;
  inset: 0;
}
.fx-change-label {
  z-index: 1;
  background: #101c2bf5;
  font-size: 26px;
  color: #fff0bc;
  border-color: #e5c68a;
  box-shadow: 0 3px 18px #0009;
}
.fx-ring.change-buff,
.fx-ring.change-keyword {
  border-style: double;
  border-width: 6px;
  box-shadow: 0 0 22px #ffe09a88;
}
.fx-ring.change-transform {
  border-style: dashed;
  box-shadow: 0 0 32px #c7a2fa99;
}
.fx-ring.change-control {
  border-width: 5px;
  box-shadow: 0 0 28px #c7a2fa88;
}
.fx-ring.change-freeze {
  border-radius: 20%;
  border-style: dashed;
}
.fx-ring.change-silence {
  border-style: dotted;
}

/* CP18 combat fragments stay on the inert presentation layer. */
.fx-shield-shard {
  position: absolute;
  width: 24px;
  height: 36px;
  margin: -18px -12px;
  background: linear-gradient(135deg, #fffbe5, #e8c46a88);
  border: 1px solid #fff0b7;
  clip-path: polygon(50% 0, 100% 75%, 25% 100%, 0 35%);
  transform: rotate(var(--shard-angle));
  filter: drop-shadow(0 0 5px #ffe39b);
}
.fx-ring.shield-crack {
  width: 120px;
  height: 150px;
  margin: -75px -60px;
  border: 4px dashed #fff0b7;
}
.fx-death-mote {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #d9c39b;
  border-radius: 50%;
  box-shadow: 0 0 8px #d9c39b55;
}

/* CP19 — a quiet, physical table: details stay outside the combat lane. */
.arena-dressing,
.arena-dressing * {
  pointer-events: none;
  user-select: none;
}
.arena-dressing {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}
.arena-rim {
  position: absolute;
  inset: 8px;
  border: 1px solid #c5a46a38;
  border-radius: 14px;
  box-shadow:
    0 0 0 5px #07131c55,
    inset 0 0 0 2px #d4b4780b,
    inset 0 0 28px #070e1626;
}
.arena-rim::before,
.arena-rim::after {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: linear-gradient(
    transparent,
    #c5a46a35 20%,
    #c5a46a0a 50%,
    #c5a46a35 80%,
    transparent
  );
}
.arena-rim::before {
  left: 4px;
}
.arena-rim::after {
  right: 4px;
}
.arena-light {
  position: absolute;
  top: 46%;
  width: 50px;
  height: 78px;
}
.arena-light-left {
  left: 22px;
}
.arena-light-right {
  right: 22px;
}
.arena-light svg {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.85;
  filter: drop-shadow(0 5px 4px #0008);
}
.arena-glow {
  position: absolute;
  width: 160px;
  height: 160px;
  left: 50%;
  top: 18%;
  margin: -80px;
  border-radius: 50%;
  background: radial-gradient(
    ellipse,
    #e8b96822,
    #d79c4710 35%,
    transparent 70%
  );
  opacity: 0.85;
  animation: hearth-glow 7s ease-in-out infinite alternate;
}
.arena-light.lantern .arena-glow {
  top: 50%;
}
.arena-flame {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: hearth-flame 3.7s ease-in-out infinite alternate;
}
.arena-light-right .arena-flame {
  animation-delay: -1.8s;
}
.arena-light-right .arena-glow {
  animation-delay: -3.5s;
}
.arena-mote {
  position: absolute;
  left: 50%;
  top: 10%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #f0d39d;
  opacity: 0;
  animation: hearth-mote 10s ease-in-out infinite;
}
.lantern .arena-mote {
  top: 38%;
}
.arena-mote.mote-1 {
  left: 42%;
  animation-delay: -3.5s;
}
.arena-mote.mote-2 {
  left: 62%;
  animation-delay: -7s;
}
@keyframes hearth-glow {
  from {
    opacity: 0.65;
  }
  to {
    opacity: 1;
  }
}
@keyframes hearth-flame {
  from {
    opacity: 0.8;
    transform: scale(0.96, 1) rotate(-3deg);
  }
  to {
    opacity: 1;
    transform: scale(1.04, 0.94) rotate(3deg);
  }
}
@keyframes hearth-mote {
  0%,
  15% {
    opacity: 0;
    transform: translate(0, 0);
  }
  25% {
    opacity: 0.45;
  }
  65% {
    opacity: 0;
    transform: translate(10px, -36px);
  }
  100% {
    opacity: 0;
    transform: translate(10px, -36px);
  }
}
.tabletop[data-atmosphere="still"] .arena-dressing *,
.page-hidden .arena-dressing * {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .arena-dressing * {
    animation: none;
  }
}

/* CP20: inert full-hand reveal, with a quiet readable hold before embers. */
.fx-burning-card {
  z-index: 2;
  filter: drop-shadow(0 12px 20px #0009);
}
.fx-burn-label {
  z-index: 3;
  width: 228px;
  font-size: 17px;
}
.fx-burn-ember {
  position: absolute;
  z-index: 4;
  width: 5px;
  height: 8px;
  border-radius: 60% 30%;
  background: #ffe1a0;
  box-shadow: 0 0 9px #f78a37;
}

/* Shared dimensions also drive event-time hand layout in presentation. */
.hand {
  --hand-card-width: var(--hand-width);
  --hand-card-height: var(--hand-height);
}
.hand.legacy-hand {
  --hand-card-width: var(--legacy-hand-width);
}
.fx-hand > .fx-card {
  width: 100%;
  height: 100%;
  translate: none;
}
.fx-discarding-card {
  z-index: 3;
}

/* V1 — actionable hierarchy; hints never intercept a touch or consume a row. */
.zone-help {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}
.turn-state {
  font:
    600 10px system-ui,
    sans-serif;
  letter-spacing: 0.6px;
}
.active .turn-state {
  color: var(--ui-ready);
}
.hand [data-availability="ready"] {
  outline: 2px solid var(--ui-ready);
  outline-offset: 2px;
}
.hand [data-availability="mana"] .cost {
  filter: saturate(0.25);
  border-style: dashed;
}
.play-cue {
  position: absolute;
  z-index: 6;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 5px;
  border-radius: 5px;
  border: 1px solid var(--ui-ready);
  background: var(--ui-ink);
  color: var(--ui-ready);
  white-space: nowrap;
  font:
    700 9px system-ui,
    sans-serif;
  letter-spacing: 0.5px;
  pointer-events: none;
}
.card-availability {
  margin: 7px 0;
  color: var(--paper);
  font:
    13px/1.4 system-ui,
    sans-serif;
}
.card-availability.available {
  color: var(--ui-ready);
}
.drag-feedback {
  position: absolute;
  z-index: 55;
  pointer-events: none;
  transform: rotate(var(--facing));
  color: var(--paper);
  font:
    600 13px/1.3 system-ui,
    sans-serif;
}
.drag-feedback > i {
  position: absolute;
  width: 26px;
  height: 26px;
  left: -13px;
  top: -13px;
  border: 2px dashed var(--ui-target);
  border-radius: 50%;
  background: #101c2b55;
}
.drag-feedback > span {
  position: absolute;
  top: var(--hint-y, 27px);
  left: var(--hint-x, 0px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 230px;
  padding: 7px 11px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--gold);
  background: var(--ui-surface);
  box-shadow: 0 5px 12px #0006;
}
.drag-feedback.accepted > i {
  border-style: solid;
  border-color: var(--ui-ready);
  background: #a8d4c633;
}
.drag-feedback.accepted > span {
  border-color: var(--ui-ready);
  color: var(--ui-ready);
}

/* V2: keep attention on the two participants until the impact readout ends. */
.fx-playback:is([data-phase="attack"], [data-phase="impact"])
  .fx-unit:not(.combat-participant) {
  opacity: 0.45;
}

/* CP23 test setup/report live outside the playing surface. */
.test-setup,
.report-page {
  max-width: 940px;
  margin: auto;
}
.test-champions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 24px 0;
}
.test-champions section {
  position: relative;
  border: 1px solid var(--gold);
  padding: 24px;
  border-radius: 16px;
}
.test-champions .art {
  position: relative;
  display: block;
  width: 130px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
}
.test-champions h2 {
  font-size: 26px;
}
.test-setup label,
.report-page label {
  display: block;
  margin: 20px 0 8px;
}
.report-page textarea {
  width: 100%;
  font:
    18px/1.5 system-ui,
    sans-serif;
  color: var(--paper);
  background: var(--ui-surface);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
}
.report-page dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
}
.report-page dd {
  margin: 0;
}
.build-label {
  display: block;
  margin: 16px 0;
  color: var(--muted);
  font:
    12px system-ui,
    sans-serif;
}
.record-warning {
  color: #ffd69b;
}

/* V3 faction rituals: local inert shapes, quiet outside the actual event. */
.fx-faction {
  position: absolute;
  width: 140px;
  height: 160px;
  margin: -80px -70px;
  pointer-events: none;
  transform: rotate(var(--facing)) scale(var(--ritual-size, 1));
}
.fx-faction > i {
  position: absolute;
  inset: 10px;
  border: 3px solid;
}
.fx-faction-warrior > i {
  border-color: #df985a;
  border-radius: 20%;
  box-shadow: 0 0 10px #e9853033;
}
.fx-faction-warrior > i:nth-child(2) {
  inset: 0 22px;
  border-width: 2px;
  border-style: dashed;
  transform: rotate(16deg);
}
.fx-faction-warrior > i:nth-child(3),
.fx-faction-warrior > i:nth-child(4) {
  inset: 55px -12px;
  height: 3px;
  border-width: 0;
  background: #ffbe73;
  transform: rotate(-28deg);
}
.fx-faction-warrior > i:nth-child(4) {
  transform: rotate(28deg);
}
.fx-faction-paladin > i {
  border-color: #fff0bc;
  border-radius: 50% 50% 40% 40%;
  box-shadow: 0 0 18px #fff0bc44;
}
.fx-faction-paladin > i:nth-child(2) {
  inset: -6px;
  border-width: 1px;
  border-inline-color: transparent;
}
.fx-faction-paladin > i:nth-child(3),
.fx-faction-paladin > i:nth-child(4) {
  inset: 65px 57px;
  border: 0;
  background: #fff2cd;
  transform: rotate(45deg);
  box-shadow: 0 0 20px #ffe4a3;
}
.fx-faction-paladin > i:nth-child(4) {
  inset: 25px 65px 115px;
}
.fx-label.fx-armor-number {
  background: #23344bf2;
  color: #ffe3a5;
  border: 2px solid #d9b77a;
  font-size: 28px;
}

/* Board portraits face the active reader; ownership, slots and player bars stay fixed. */
.board-row > .unit-token {
  rotate: var(--board-rotation, 0deg);
}

/* CS1: selectable premade sets */
.deck-list .deck-set {
  display: grid;
  gap: 2px;
  margin: 8px 0 4px;
  padding-top: 8px;
  border-top: 1px solid #646b5a44;
}
.deck-list .deck-set b {
  font-size: 13px;
}
.deck-list .deck-set small {
  letter-spacing: 0.5px;
  color: #b8c4b6;
  font-size: 11px;
}
.deck-list .deck-set button {
  justify-self: start;
  margin-top: 4px;
}
.deck-plan {
  margin-top: 6px;
  font-size: 12px;
}
.test-champions label {
  display: block;
  margin-top: 10px;
  font-size: 12px;
}
.test-champions select {
  display: block;
  width: 100%;
  margin-top: 4px;
}
.deck-list article.has-sets > div {
  width: 100%;
  padding: 14px;
  border-radius: 6px;
  background: color-mix(in srgb, #101719, transparent 12%);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* Keyword highlighting inside card rules text */
.card p .kw {
  font-weight: 800;
  color: #8a3f14;
  letter-spacing: 0.01em;
}
.card p .kw {
  white-space: nowrap;
}
.card p .kw .glyph {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  margin: 0 0.12em 0 0;
  vertical-align: -0.22em;
  stroke-width: 2;
}

/* Structured rules text: traits on one line, then one line per ability */
.card p .rules-traits,
.card p .rules-line {
  display: block;
}
.card p .rules-traits {
  font-size: 1.04em;
  margin-bottom: 0.25em;
}
.card p .rules-traits:only-child {
  margin-bottom: 0;
}
.card p .rules-line + .rules-line {
  margin-top: 0.3em;
}
.card p .rules-sep {
  font-style: normal;
  color: #9a7a4c;
}
.card p .kw-trigger {
  color: #2f4f73;
}

/* Board portraits never overflow a narrow window: shrink to the row width, keep proportions. */
.board-row > .compact {
  --fit-width: min(
    var(--unit-width),
    calc(
      (100% - (var(--unit-count, 1) - 1) * var(--unit-gap, 18px)) /
        var(--unit-count, 1)
    )
  );
  flex: 0 0 var(--fit-width);
  width: var(--fit-width);
  height: auto;
  aspect-ratio: var(--unit-w) / var(--unit-h);
}

/* Grand entrance for legendary / epic units played from hand */
.fx-grand-dim {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, #0000 0, #050a12 70%);
  pointer-events: none;
}
.fx-grand-star {
  position: fixed;
  width: 0;
  height: 0;
  pointer-events: none;
}
.fx-grand-star i,
.fx-grand-star b {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
}
.fx-grand-star i {
  width: 300px;
  height: 300px;
  background: conic-gradient(
    from 0deg,
    #0000 0 11%,
    #ffe7a8cc 12.5%,
    #0000 14% 36%,
    #ffe7a8cc 37.5%,
    #0000 39% 61%,
    #ffe7a8cc 62.5%,
    #0000 64% 86%,
    #ffe7a8cc 87.5%,
    #0000 89%
  );
  mask: radial-gradient(circle, #000 0 18%, #0000 62%);
  -webkit-mask: radial-gradient(circle, #000 0 18%, #0000 62%);
}
.fx-grand-star i + i {
  rotate: 45deg;
  scale: 0.7;
}
.fx-grand-star b {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6d8 0, #f3c76acc 35%, #0000 70%);
}
.fx-grand-star.epic i {
  filter: hue-rotate(250deg) saturate(1.4);
}
.fx-grand-star.epic b {
  background: radial-gradient(circle, #fbefff 0, #c79cf0bb 35%, #0000 70%);
}
.fx-label.fx-grand-label {
  font-size: 22px;
  letter-spacing: 0.08em;
  color: #ffe7a8;
  text-shadow:
    0 0 12px #f3c76a,
    0 2px 3px #000;
  /* Offset in the reader's orientation: above the unit for either seat. */
  transform: translate(-50%, -50%) rotate(var(--facing)) translateY(-150px);
}

/* Card-to-unit morph ghost */
.fx-actor.fx-morph {
  z-index: 4;
  transform-origin: 50% 50%;
}

/* Ability trigger label (Konec tahu, Po kouzle, Poslední přání…) */
.fx-label.fx-trigger-label {
  font-size: 15px;
  padding: 5px 12px;
  color: #ffe7a8;
  background: #1d2c40e6;
  border-color: #c5a46a;
  transform: translate(-50%, -50%) rotate(var(--facing)) translateY(-86px);
}

/* Divine Shield: a warm golden "egg" around the portrait (Hearthstone-like). */
.card.unit-token.shielded::after {
  inset: -12px -9px 16px;
  border-radius: 50% 50% 47% 47% / 56% 56% 44% 44%;
  border: 2px solid #fff3c8d9;
  background:
    radial-gradient(
      ellipse 22% 14% at 33% 20%,
      #fffdf0e6 0,
      #fff6d066 45%,
      transparent 100%
    ),
    radial-gradient(
      ellipse 60% 58% at 50% 54%,
      #ffd76a10 55%,
      #ffcf5a4d 78%,
      #ffe9a8b3 92%,
      transparent 100%
    );
  box-shadow:
    0 0 16px #ffd36ab3,
    0 0 42px #ffc84a55,
    inset 0 0 26px #ffe08a99,
    inset 0 -10px 22px #f5b84244;
  z-index: 2;
  animation: divine-egg 3.4s ease-in-out infinite;
}
@keyframes divine-egg {
  0%,
  100% {
    opacity: 0.86;
  }
  50% {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .card.unit-token.shielded::after {
    animation: none;
  }
}

/* Drop position marker between board units (layout-neutral). */
.board-row > .slot-marker {
  flex: 0 0 6px;
  width: 6px;
  align-self: center;
  height: 72%;
  margin-inline: calc((6px + var(--unit-gap, 18px)) / -2);
  border-radius: 3px;
  background: linear-gradient(#ffe7a800, #ffe7a8 20%, #fff6d8 50%, #ffe7a8 80%, #ffe7a800);
  box-shadow: 0 0 14px #f3c76acc;
  pointer-events: none;
  z-index: 3;
  animation: slot-pulse 0.9s ease-in-out infinite alternate;
}
@keyframes slot-pulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .board-row > .slot-marker { animation: none; }
}

/* Larger hero medallion: an oval portrait that rises from the player bar
   toward the board, gold rim, class-coloured halo, enamel HP and armour pills. */
.tabletop .hero-portrait {
  width: 96px;
  height: 110px;
  margin-top: -46px;
  align-self: flex-end;
  border: 3px solid #e7cb8c;
  border-radius: 50% 50% 46% 46% / 55% 55% 45% 45%;
  background: #101c2b;
  box-shadow:
    0 0 0 2px #101c2b,
    0 0 0 4px color-mix(in srgb, var(--class), #c5a46a 45%),
    0 10px 20px #000b,
    0 0 26px color-mix(in srgb, var(--class), transparent 55%);
  z-index: 3;
  transition: box-shadow 0.3s ease;
}
.tabletop .hero-portrait .art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}
.tabletop .hero-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    ellipse 70% 40% at 50% 0%,
    #fff4d633,
    transparent 70%
  );
  box-shadow: inset 0 -18px 22px #0009;
  pointer-events: none;
}
.player-zone.active .hero-portrait {
  box-shadow:
    0 0 0 2px #101c2b,
    0 0 0 4px #f1d48e,
    0 10px 20px #000b,
    0 0 34px color-mix(in srgb, var(--class), transparent 25%);
}
.tabletop .hero-portrait b {
  left: 50%;
  right: auto;
  bottom: -12px;
  translate: -50% 0;
  min-width: 62px;
  padding: 3px 10px;
  font: bold 21px Georgia;
  color: #fff1dc;
  background: linear-gradient(#a8332c, #6e1c1a);
  border: 2px solid #f1d28e;
  border-radius: 16px;
  box-shadow:
    0 3px 8px #000a,
    inset 0 1px #ffb7a855;
  white-space: nowrap;
  z-index: 2;
}
.tabletop .hero-portrait i {
  top: 4px;
  right: auto;
  left: -14px;
  bottom: auto;
  padding: 3px 8px;
  font: bold 15px Georgia;
  color: #eef6ff;
  background: linear-gradient(#5d7690, #2c3f55);
  border: 2px solid #c9d8e6;
  border-radius: 12px 12px 14px 14px;
  box-shadow: 0 3px 8px #000a;
  z-index: 2;
}
.tabletop .hero-portrait.target-hover {
  outline: none;
  box-shadow:
    0 0 0 2px #101c2b,
    0 0 0 5px var(--ui-selected, #f6d48c),
    0 0 30px #eacb7acc;
}
/* Keep the side lanterns clear of the raised medallion. */
.tabletop .arena-light {
  top: 37%;
}

/* Setup polish: champion cards, hero power, deck choice, VS seal */
.setup-players {
  position: relative;
}
.setup-players > section {
  padding: 18px;
  border: 1px solid #c5a46a33;
  border-radius: 14px;
  background: linear-gradient(160deg, #142235cc, #0c1622e6);
  box-shadow: inset 0 1px #ffe8b311, 0 12px 30px #0006;
}
.class-choice {
  transition: transform 0.18s ease, box-shadow 0.25s ease, filter 0.25s ease;
}
.class-grid:has(.chosen) .class-choice:not(.chosen) {
  filter: saturate(0.6) brightness(0.72);
}
.class-choice:hover {
  filter: none;
  transform: translateY(-2px);
}
.class-choice.chosen {
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 0 0 2px var(--class),
    0 0 26px color-mix(in srgb, var(--class), transparent 45%),
    0 10px 22px #000a;
  z-index: 1;
}
.class-choice.chosen::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font: bold 13px Georgia;
  color: #101c2b;
  background: var(--class);
  box-shadow: 0 2px 6px #0009;
}
.setup-hero h2 {
  margin: 18px 0 2px;
  font-size: 30px;
  letter-spacing: 0.01em;
}
.setup-hero > p:not(.setup-power) {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  color: #c5a46a;
}
.setup-power {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 12px 0 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #0b1520b3;
  border: 1px solid #c5a46a33;
  font-size: 13px;
  line-height: 1.35;
  color: #dcd6c1;
}
.setup-power .glyph {
  width: 34px;
  height: 34px;
  padding: 6px;
  border-radius: 50%;
  border: 1px solid #c5a46a88;
  color: #f1d48e;
  background: #101c2b;
}
.setup-power b {
  color: #f3e9ce;
}
.setup-deck {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c5a46a;
}
.setup-deck select {
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #c5a46a88;
  background: #101c2b;
  color: #f3e9ce;
}
.setup-vs {
  position: absolute;
  left: 50%;
  top: 150px;
  translate: -50% 0;
  z-index: 2;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6dc9c, #b88a43 60%, #6d4f22);
  box-shadow: 0 0 0 3px #101c2b, 0 0 0 5px #c5a46a, 0 8px 22px #000c;
  font: bold 18px Georgia;
  color: #101c2b;
  letter-spacing: 0.04em;
}
.setup-start {
  font-size: 18px;
  letter-spacing: 0.06em;
  box-shadow: 0 8px 24px #c5a46a44;
}

/* ── Hero console (player bar) in the Graphic Occult Folk language ──
   Navy panel with a gold hairline, serif name plate, faceted mana crystals,
   a coin-like hero power and a wax-seal style end-turn button. */
.tabletop .player-bar {
  position: relative;
  flex: 0 0 84px;
  min-height: 84px;
  max-height: 84px;
  margin: 6px 0 4px;
  padding: 6px 12px 6px 10px;
  gap: 14px;
  background: linear-gradient(180deg, #16263af2, #0d1826f7);
  border: 1px solid #c5a46a55;
  border-radius: 16px;
  box-shadow:
    inset 0 1px #f3e9ce14,
    0 8px 20px #0009;
}
.tabletop .player-bar::before {
  content: "";
  position: absolute;
  left: 110px;
  right: 24px;
  top: -1px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    #c5a46acc 18%,
    #f3e9ce 50%,
    #c5a46acc 82%,
    transparent
  );
  pointer-events: none;
}
.tabletop .player-bar::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 9px;
  height: 9px;
  rotate: 45deg;
  translate: -50% 0;
  background: #c5a46a;
  box-shadow: 0 0 0 2px #101c2b;
  pointer-events: none;
}
/* Medallion: in flow, raised with a relative offset (no negative margins). */
.tabletop .hero-portrait {
  position: relative;
  top: -14px;
  width: 86px;
  height: 98px;
  margin: 0;
  align-self: center;
}
.tabletop .hero-meta strong {
  font: bold 17px Georgia, serif;
  color: #f3e9ce;
  letter-spacing: 0.01em;
}
.tabletop .hero-meta small {
  font: 10px Georgia, serif;
  font-variant: small-caps;
  letter-spacing: 0.12em;
  color: #c5a46a;
  margin: 2px 0 5px;
}
/* Mana: faceted diamond crystals. */
.tabletop .mana {
  gap: 4px;
}
.tabletop .mana i {
  width: 15px;
  height: 21px;
  clip-path: polygon(50% 0, 100% 42%, 50% 100%, 0 42%);
  background: linear-gradient(160deg, #2a3e55 0 45%, #18263a 46%);
  filter: none;
}
.tabletop .mana i.full {
  background:
    linear-gradient(160deg, #f2fbff 0 18%, transparent 19%),
    linear-gradient(200deg, #9fdcf2 0 46%, #3f86b0 47% 100%);
  filter: drop-shadow(0 0 6px #7cc8e6aa);
}
.tabletop .mana i.locked {
  background: linear-gradient(200deg, #e4a4ad 0 46%, #8e3f4f 47% 100%);
  filter: drop-shadow(0 0 4px #c4677a88);
}
.tabletop .mana b {
  margin-left: 8px;
  font: bold 14px Georgia, serif;
  color: #cdeefa;
  letter-spacing: 0.04em;
}
/* Hero power: coin + name plate. */
.tabletop .power {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 170px;
  height: 60px;
  min-height: 60px;
  padding: 4px 14px 4px 4px;
  border-radius: 32px;
  border: 1px solid #c5a46a77;
  background: linear-gradient(180deg, #1c2e45, #111d2d);
  box-shadow: inset 0 1px #f3e9ce12, 0 4px 10px #0007;
  text-align: left;
}
.tabletop .power > .glyph {
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  padding: 11px;
  border-radius: 50%;
  color: #ffe7a8;
  background: radial-gradient(circle at 35% 30%, #3a4f69, #142235 70%);
  border: 2px solid #c5a46a;
  box-shadow: 0 0 0 2px #101c2b, inset 0 0 10px #000a;
}
.tabletop .power .power-name {
  display: block;
  font: bold 14px Georgia, serif;
  line-height: 1.15;
  color: #f3e9ce;
}
.tabletop .power > small {
  display: block;
  margin-top: 2px;
  font: 11px Georgia, serif;
  font-variant: small-caps;
  letter-spacing: 0.12em;
  color: #c5a46a;
}
.player-zone.active .power:not([aria-disabled="true"]) > .glyph {
  box-shadow:
    0 0 0 2px #101c2b,
    0 0 16px #ffd36ab3,
    inset 0 0 10px #000a;
}
.tabletop .power.used,
.tabletop .power[aria-disabled="true"] {
  opacity: 0.55;
  filter: saturate(0.5);
}
/* Turn controls: wax-seal end turn and a small star coin. */
.tabletop .turn-controls {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.tabletop .turn-controls .end-turn {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 28px;
  font: bold 15px Georgia, serif;
  letter-spacing: 0.03em;
  color: #101c2b;
  background: linear-gradient(180deg, #f6dc9c, #c5a46a);
  border: 1px solid #f3e9ce;
  box-shadow:
    0 0 0 2px #101c2b,
    0 0 0 3px #c5a46a,
    0 6px 14px #000a;
}
.tabletop .turn-controls .end-turn:disabled {
  color: #8f9db0;
  font-style: italic;
  font-weight: normal;
  background: #142235;
  border-color: #c5a46a44;
  box-shadow: none;
}
.tabletop .turn-controls .coin-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 20px;
  font: bold 13px Georgia, serif;
  color: #ffe7a8;
  background: #142235;
  border: 1px solid #c5a46a99;
}
.tabletop .turn-controls .coin-btn i {
  font-style: normal;
  color: #f6d48c;
}
.tabletop .power {
  display: grid;
  grid-template-columns: 50px auto;
  grid-template-rows: auto auto;
  column-gap: 9px;
  align-content: center;
  align-items: center;
}
.tabletop .power > .glyph {
  grid-row: 1 / span 2;
}
.tabletop .power .power-name {
  align-self: end;
}
.tabletop .power > small {
  align-self: start;
  margin-top: 1px;
}
.tabletop .power > .glyph {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin: 0;
}
.tabletop .power > .power-name {
  grid-column: 2;
  grid-row: 1;
}
.tabletop .power > small {
  grid-column: 2;
  grid-row: 2;
}

/* Refined controls: softly rounded rectangles with antique-gold glow.
   End turn is quiet while moves remain and glows when nothing is left. */
.tabletop .power {
  border-radius: 10px;
  height: 58px;
  min-height: 58px;
  padding: 4px 14px 4px 5px;
  border: 1px solid #c5a46a99;
  background: linear-gradient(180deg, #1e3149, #122033);
  box-shadow:
    inset 0 1px #f3e9ce1a,
    inset 0 0 0 1px #101c2b,
    0 4px 12px #0008;
}
.tabletop .power > .glyph {
  border-radius: 8px;
  rotate: 0deg;
  width: 46px;
  height: 46px;
  flex-basis: 46px;
  padding: 10px;
}
.tabletop .power {
  grid-template-columns: 46px auto;
}
.player-zone.active .power:not([aria-disabled="true"]) {
  border-color: #f1d48e;
  box-shadow:
    inset 0 1px #fff3d022,
    0 0 0 1px #101c2b,
    0 0 18px #f3c76a66,
    0 4px 12px #0008;
}
.player-zone.active .power:not([aria-disabled="true"]) > .glyph {
  box-shadow:
    0 0 0 2px #101c2b,
    0 0 12px #ffd36acc,
    inset 0 0 10px #000a;
}
.tabletop .power.used,
.tabletop .power[aria-disabled="true"] {
  opacity: 0.72;
  filter: saturate(0.35) brightness(0.85);
}
.tabletop .turn-controls .end-turn {
  display: grid;
  place-content: center;
  min-width: 148px;
  min-height: 54px;
  padding: 0 20px;
  border-radius: 10px;
  line-height: 1.1;
}
.tabletop .turn-controls .end-turn small {
  display: block;
  margin-top: 3px;
  font: 10px Georgia, serif;
  font-variant: small-caps;
  letter-spacing: 0.12em;
  font-weight: normal;
}
/* Moves remain: outlined, readable, not inviting. */
.tabletop .turn-controls .end-turn.has-actions:not(:disabled) {
  color: #f3e9ce;
  background: linear-gradient(180deg, #1e3149, #122033);
  border: 1px solid #c5a46a;
  box-shadow:
    inset 0 1px #f3e9ce1a,
    0 0 0 1px #101c2b,
    0 4px 12px #0008;
}
.tabletop .turn-controls .end-turn.has-actions small {
  color: #c5a46a;
}
/* Nothing left to do: gold plate with a breathing glow. */
.tabletop .turn-controls .end-turn.no-actions:not(:disabled) {
  color: #101c2b;
  background: linear-gradient(180deg, #fbe7b0, #d6b06a 55%, #b58b45);
  border: 1px solid #fff3d0;
  box-shadow:
    0 0 0 1px #101c2b,
    0 0 0 2px #c5a46a,
    0 0 22px #f3c76aaa,
    0 6px 14px #000a;
  animation: end-turn-glow 1.8s ease-in-out infinite;
}
@keyframes end-turn-glow {
  50% {
    box-shadow:
      0 0 0 1px #101c2b,
      0 0 0 2px #f1d48e,
      0 0 34px #ffd36add,
      0 6px 14px #000a;
  }
}
.tabletop .turn-controls .end-turn:disabled {
  border-radius: 10px;
}
.tabletop .turn-controls .coin-btn {
  border-radius: 8px;
}
@media (prefers-reduced-motion: reduce) {
  .tabletop .turn-controls .end-turn.no-actions {
    animation: none;
  }
}

/* Smoother, stronger pulses; phase is continuous across re-renders. */
.tabletop .turn-controls .end-turn.no-actions:not(:disabled) {
  animation: end-turn-glow 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  animation-delay: var(--pulse-delay, 0ms);
}
.tabletop .turn-controls .end-turn.no-actions.glow-enter:not(:disabled) {
  animation:
    end-turn-enter 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both,
    end-turn-glow 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  animation-delay: 0ms, var(--pulse-delay, 0ms);
}
@keyframes end-turn-glow {
  0%,
  100% {
    filter: brightness(1);
    box-shadow:
      0 0 0 1px #101c2b,
      0 0 0 2px #c5a46a,
      0 0 18px #f3c76a99,
      0 6px 14px #000a;
  }
  50% {
    filter: brightness(1.12);
    box-shadow:
      0 0 0 1px #101c2b,
      0 0 0 3px #ffe7a8,
      0 0 30px #ffd36aee,
      0 0 64px #f3c76a88,
      0 6px 14px #000a;
  }
}
@keyframes end-turn-enter {
  from {
    filter: brightness(0.55) saturate(0.3);
    scale: 0.94;
  }
  60% {
    filter: brightness(1.35);
    scale: 1.04;
  }
  to {
    filter: brightness(1);
    scale: 1;
  }
}
.player-zone.active .power:not([aria-disabled="true"]) {
  animation: power-glow 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  animation-delay: var(--pulse-delay, 0ms);
}
@keyframes power-glow {
  0%,
  100% {
    box-shadow:
      inset 0 1px #fff3d022,
      0 0 0 1px #101c2b,
      0 0 14px #f3c76a55,
      0 4px 12px #0008;
  }
  50% {
    box-shadow:
      inset 0 1px #fff3d033,
      0 0 0 1px #101c2b,
      0 0 26px #ffd36acc,
      0 0 48px #f3c76a55,
      0 4px 12px #0008;
  }
}
.tabletop .power,
.tabletop .turn-controls button {
  transition:
    background 0.35s ease,
    border-color 0.35s ease,
    color 0.35s ease,
    filter 0.35s ease,
    opacity 0.35s ease;
}
@media (prefers-reduced-motion: reduce) {
  .tabletop .turn-controls .end-turn.no-actions,
  .tabletop .turn-controls .end-turn.no-actions.glow-enter,
  .player-zone.active .power:not([aria-disabled="true"]) {
    animation: none;
  }
}

/* Hero console refinements: name breathing room, mana in the meta column,
   centred hero power, weapon token on the medallion. */
.tabletop .hero-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding-top: 6px;
  align-self: stretch;
}
.tabletop .hero-meta strong {
  font-size: 18px;
}
.tabletop .hero-meta .mana {
  margin: 0;
}
.tabletop .hero-meta .weapon-name {
  margin: -3px 0 0;
  font: 10px Georgia, serif;
  font-variant: small-caps;
  letter-spacing: 0.1em;
  color: #c5a46a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabletop .power {
  max-width: 210px;
  padding: 5px 16px 5px 6px;
  row-gap: 2px;
  align-content: center;
}
.tabletop .power > .glyph {
  align-self: center;
}
.tabletop .power .power-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  align-self: end;
}
.tabletop .power > small {
  align-self: start;
}
.tabletop .hero-portrait .hero-weapon {
  position: absolute;
  left: -22px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px 3px 5px;
  border-radius: 9px;
  background: linear-gradient(#1e3149, #101c2b);
  border: 1.5px solid #e7cb8c;
  box-shadow:
    0 3px 8px #000b,
    0 0 10px #f3c76a44;
  z-index: 3;
}
.tabletop .hero-weapon .glyph {
  width: 16px;
  height: 16px;
  color: #ffe7a8;
}
.tabletop .hero-weapon .hw-atk {
  font: bold 16px Georgia, serif;
  color: #ffd98a;
}
.tabletop .hero-weapon .hw-dur {
  font: bold 13px Georgia, serif;
  color: #c9d8e6;
  padding-left: 4px;
  border-left: 1px solid #c5a46a66;
}

/* Particle layer and active-player accents (class colour driven). */
.particle-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 20;
}
.tabletop .hero-portrait {
  border-color: color-mix(in srgb, var(--class), #e7cb8c 50%);
}
.player-zone.active .player-bar {
  border-color: color-mix(in srgb, var(--class), #c5a46a 40%);
}
.player-zone.active .player-bar::after {
  width: 12px;
  height: 12px;
  top: -7px;
  background: radial-gradient(circle at 35% 30%, #fff6dc, var(--class) 60%);
  box-shadow:
    0 0 0 2px #101c2b,
    0 0 12px var(--class),
    0 0 26px color-mix(in srgb, var(--class), transparent 40%);
  animation: seam-diamond 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  animation-delay: var(--pulse-delay, 0ms);
}
@keyframes seam-diamond {
  50% {
    filter: brightness(1.35);
    box-shadow:
      0 0 0 2px #101c2b,
      0 0 18px var(--class),
      0 0 40px color-mix(in srgb, var(--class), transparent 25%);
  }
}
.player-zone.active .player-bar::before {
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--class), #c5a46a 40%) 18%,
    #f3e9ce 50%,
    color-mix(in srgb, var(--class), #c5a46a 40%) 82%,
    transparent
  );
}
/* Available mana crystals twinkle gently, staggered. */
.player-zone.active .mana i.full {
  animation: crystal-twinkle 3.2s ease-in-out infinite;
  animation-delay: calc(var(--pulse-delay, 0ms) + var(--i, 0) * 180ms);
}
@keyframes crystal-twinkle {
  50% {
    opacity: 0.72;
  }
}
@media (prefers-reduced-motion: reduce) {
  .player-zone.active .player-bar::after,
  .player-zone.active .mana i.full {
    animation: none;
  }
}

/* The acting player has priority: while they drag or aim, the other player's
   open preview steps aside so the whole table stays visible. */
.tabletop.drag-priority .player-zone:not(.active) .detail-panel {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
/* History toggle on the left of the seam, mirroring the menu. */
.table-seam.table-seam-left {
  right: auto;
  left: 8px;
}
.table-seam button.open {
  background: #c5a46a;
  color: #101c2b;
}
.log-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  rotate: var(--log-facing, 0deg);
  z-index: 40;
  width: min(640px, 92vw);
  padding: 16px 18px 12px;
  border-radius: 16px;
  border: 1px solid #c5a46a88;
  background: linear-gradient(180deg, #16263af7, #0d1826fa);
  box-shadow: 0 18px 50px #000c, inset 0 1px #f3e9ce14;
  text-align: center;
}
.log-panel h3 {
  margin: 0 0 10px;
  font: 13px Georgia, serif;
  font-variant: small-caps;
  letter-spacing: 0.16em;
  color: #c5a46a;
}
.log-list {
  display: flex;
  justify-content: center;
  gap: 14px;
}
.log-entry {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 170px;
}
.log-entry .card {
  width: 150px;
  height: 214px;
  font-size: 0.8em;
  pointer-events: none;
}
.log-entry small {
  font: 11px Georgia, serif;
  color: var(--class);
}
.log-ago {
  font: bold 12px Georgia, serif;
  color: #f3e9ce;
}
.log-entry.log-age-1 {
  opacity: 0.82;
}
.log-entry.log-age-2 {
  opacity: 0.64;
}
.log-entry.log-age-0 .log-ago {
  color: #ffe7a8;
}
.log-hint {
  display: block;
  margin-top: 8px;
  font-size: 10px;
  color: #8f9db0;
}

.tabletop .hero-portrait .hero-weapon {
  left: -26px;
  bottom: auto;
  top: 38px;
}
.log-entry .card > p {
  display: none;
}
.log-entry .card {
  width: 132px;
  height: 178px;
}
.log-entry small {
  opacity: 1;
}
.log-entry small {
  margin-top: 12px;
}

/* Hero power when usable: calm steady glow plus a slow, subtle light
   reflection sweeping across the button (replaces the strong pulse). */
.player-zone.active .power:not([aria-disabled="true"]) {
  animation: none;
  box-shadow:
    inset 0 1px #fff3d02a,
    0 0 0 1px #101c2b,
    0 0 14px #f3c76a4d,
    0 4px 12px #0008;
}
.tabletop .power {
  position: relative;
  overflow: hidden;
}
.player-zone.active .power:not([aria-disabled="true"])::after {
  content: "";
  position: absolute;
  inset: -40% auto -40% 0;
  width: 46%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    #fff6dc00 20%,
    #fff6dc3a 48%,
    #fffaf05c 52%,
    #fff6dc00 80%,
    transparent 100%
  );
  pointer-events: none;
  translate: -120% 0;
  animation: power-sheen 5.2s cubic-bezier(0.45, 0, 0.25, 1) infinite;
}
@keyframes power-sheen {
  0% {
    translate: -120% 0;
  }
  34%,
  100% {
    translate: 330% 0;
  }
}

/* Centre diamond: no particles, just lit in the class colour, breathing slowly. */
.player-zone.active .player-bar::after {
  background: radial-gradient(circle at 35% 30%, #fffaf0, var(--class) 70%);
  box-shadow:
    0 0 0 2px #101c2b,
    0 0 10px var(--class),
    0 0 24px color-mix(in srgb, var(--class), transparent 30%),
    0 0 46px color-mix(in srgb, var(--class), transparent 65%);
  animation: seam-diamond-soft 4.8s ease-in-out infinite;
}
@keyframes seam-diamond-soft {
  50% {
    opacity: 0.78;
  }
}

/* Active-player aura: a soft class-colour light rising from the bar onto
   the table, screen-blended under the units. */
.tabletop .bar-aura {
  position: absolute;
  z-index: -1;
  left: -12px;
  right: -12px;
  bottom: calc(100% - 6px);
  height: 230px;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(
      60% 100% at 50% 100%,
      color-mix(in srgb, var(--class), transparent 62%),
      transparent 72%
    ),
    linear-gradient(
      0deg,
      color-mix(in srgb, var(--class), transparent 80%),
      transparent 55%
    );
  transition: opacity 0.8s ease;
}
.player-zone.active .bar-aura {
  opacity: 1;
  animation: bar-aura 6s ease-in-out infinite;
}
@keyframes bar-aura {
  50% {
    opacity: 0.72;
  }
}
@media (prefers-reduced-motion: reduce) {
  .player-zone.active .power:not([aria-disabled="true"])::after,
  .player-zone.active .bar-aura,
  .player-zone.active .player-bar::after {
    animation: none;
  }
}

/* Spell effects: SVG lightning / beams drawn in viewport space. */
.fx-spell-svg {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
}
.fx-bolt,
.fx-beam {
  opacity: 0;
  filter: drop-shadow(0 0 4px var(--cue)) drop-shadow(0 0 12px var(--cue));
}
.fx-bolt polyline:first-child,
.fx-beam polyline:first-child {
  opacity: 0.55;
}
.fx-beam polyline:first-child {
  opacity: 0.4;
}
.particle-layer {
  z-index: 85;
}

/* Lasting spell marks on units: a breathing halo with tiny glowing motes
   rising around the silhouette (class colour when empowered, ice when frozen). */
.card.unit-token .unit-aura {
  --aura: var(--class, #f3c76a);
  position: absolute;
  z-index: -1;
  inset: -6px -6px 22px;
  border-radius: 48% 48% 42% 42%;
  pointer-events: none;
  box-shadow:
    0 0 14px color-mix(in srgb, var(--aura), transparent 35%),
    0 0 34px color-mix(in srgb, var(--aura), transparent 70%);
  animation: unit-aura 3.6s ease-in-out infinite;
}
.card.unit-token .unit-aura.frost {
  --aura: #a6eaff;
}
.card.unit-token .unit-aura i {
  position: absolute;
  bottom: 18%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 18%, var(--aura) 34%, transparent 70%);
  opacity: 0;
  animation: unit-aura-mote 3.2s ease-out infinite;
}
.card.unit-token .unit-aura i:nth-child(1) { left: 2%; animation-delay: 0s; }
.card.unit-token .unit-aura i:nth-child(2) { left: 98%; animation-delay: 0.8s; }
.card.unit-token .unit-aura i:nth-child(3) { left: 8%; bottom: 46%; animation-delay: 1.6s; }
.card.unit-token .unit-aura i:nth-child(4) { left: 92%; bottom: 52%; animation-delay: 2.4s; }
.card.unit-token .unit-aura.frost i {
  animation-name: unit-aura-frost;
  animation-duration: 4.2s;
}
@keyframes unit-aura {
  50% {
    opacity: 0.6;
  }
}
@keyframes unit-aura-mote {
  0% { opacity: 0; translate: 0 0; }
  20% { opacity: 1; }
  100% { opacity: 0; translate: 0 -46px; }
}
@keyframes unit-aura-frost {
  0% { opacity: 0; translate: 0 -10px; scale: 0.6; }
  30% { opacity: 1; scale: 1; }
  100% { opacity: 0; translate: 0 22px; scale: 0.7; }
}
@media (prefers-reduced-motion: reduce) {
  .card.unit-token .unit-aura,
  .card.unit-token .unit-aura i {
    animation: none;
  }
}

/* While a playback runs, ambient table animations pause (the animated
   clones live in #fx), so the frame budget goes to the effects. */
.fx-busy .tabletop *,
.fx-busy .tabletop *::before,
.fx-busy .tabletop *::after {
  animation-play-state: paused !important;
}

/* Hand of up to 8 cards: cards keep their size and overlap only as much as
   the width needs; from 7 cards the hand fans out (geometry: hand-fan.js,
   mirrored for presentation clones in fx.js). */
.hand {
  container-type: inline-size;
  gap: var(--hand-gap);
}
.hand > .card {
  position: relative;
  rotate: var(--fan, 0deg);
  margin-top: var(--arc, 0px);
}
.hand > .card + .card {
  margin-left: min(
    0px,
    calc(
      (100cqw - var(--n) * var(--hand-card-width) - (var(--n) - 1) * var(--hand-gap)) /
        (var(--n) - 1)
    )
  );
}
.hand.fanned > .card {
  flex-shrink: 0;
  transition:
    translate 0.18s ease,
    rotate 0.18s ease,
    box-shadow 0.16s;
}
.hand.fanned > .card:is(:hover, .selected) {
  z-index: 6;
  rotate: 0deg;
  translate: 0 -16px;
}
.hand.fanned > .card:is(:hover, .selected) + .card {
  translate: 16px 0;
}
.hand.fanned > .card:has(+ .card:is(:hover, .selected)) {
  translate: -16px 0;
}
.fx-hand > .fx-card {
  rotate: var(--fan, 0deg);
}

/* ───── Rarity: frame metal + gem; card type: domed spell frame ─────
   Frames: public/assets/frames (node scripts/make-frames.mjs), gems: gems.js. */
.rarity-common {
  --rarity-line: #9b927f;
}
.rarity-rare {
  --rarity-line: #c6ccd3;
}
.rarity-epic {
  --rarity-line: #c9a5e6;
}
.rarity-legendary {
  --rarity-line: #f1cf86;
}
.card:not(.unit-token)::before {
  background-image: url("../assets/frames/frame-minion-common.svg");
}
.card:not(.unit-token).rarity-rare::before {
  background-image: url("../assets/frames/frame-minion-rare.svg");
}
.card:not(.unit-token).rarity-epic::before {
  background-image: url("../assets/frames/frame-minion-epic.svg");
}
.card:not(.unit-token).rarity-legendary::before {
  background-image: url("../assets/frames/frame-minion-legendary.svg");
}
.card.type-spell::before {
  background-image: url("../assets/frames/frame-spell-common.svg");
}
.card.type-spell.rarity-rare::before {
  background-image: url("../assets/frames/frame-spell-rare.svg");
}
.card.type-spell.rarity-epic::before {
  background-image: url("../assets/frames/frame-spell-epic.svg");
}
.card.type-spell.rarity-legendary::before {
  background-image: url("../assets/frames/frame-spell-legendary.svg");
}
.card:not(.unit-token) {
  border-color: color-mix(in srgb, var(--rarity-line) 55%, #101c2b);
}
.card:not(.unit-token) .card-image,
.card:not(.unit-token) .card-name {
  border-color: var(--rarity-line);
}
.card.rarity-common:not(.unit-token) {
  background: #121a24;
}
.card.rarity-legendary:not(.unit-token, .type-spell) {
  box-shadow:
    inset 0 0 0 2px #3a2c12,
    0 0 14px #ffce7533,
    0 7px 16px #040a12aa;
}
/* Spells: domed grimoire page, violet night instead of the unit plate. */
.card.type-spell,
.card.type-spell:hover {
  background: url("../assets/frames/body-spell.svg") center / 100% 100% no-repeat;
  border-color: transparent;
  border-radius: 0;
  box-shadow: none;
}
.card.type-spell .card-image {
  border-radius: 50% 50% 18% 18% / 42% 42% 12% 12%;
}
.card.type-spell .card-kind {
  color: #d9ccff;
}
/* Gem sits in the top of the frame, over its centre ornament. */
.rarity-gem {
  position: absolute;
  top: -14px;
  left: 50%;
  translate: -50% 0;
  z-index: 6;
  width: 30px;
  height: 30px;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px #000a);
}
.rarity-gem svg {
  display: block;
  width: 100%;
  height: 100%;
}
.rarity-gem.gem-epic {
  width: 29px;
  height: 34px;
  top: -16px;
}
.rarity-gem.gem-legendary {
  width: 84px;
  height: 42px;
  top: -21px;
}
.compact .rarity-gem {
  width: 22px;
  height: 22px;
  top: -10px;
}
.compact .rarity-gem.gem-epic {
  width: 21px;
  height: 25px;
  top: -12px;
}
.compact .rarity-gem.gem-legendary {
  width: 64px;
  height: 32px;
  top: -16px;
}
.card.unit-token .rarity-gem {
  top: -5px;
  width: 24px;
  height: 24px;
}
.card.unit-token .rarity-gem.gem-epic {
  width: 22px;
  height: 26px;
  top: -7px;
}
.card.unit-token .rarity-gem.gem-legendary {
  width: 76px;
  height: 38px;
  top: -16px;
}
/* Board ovals: the ring is cast in the rarity's metal. */
.card.unit-token.rarity-common::before {
  background-image: linear-gradient(125deg, #c4bdae, #5b554a 36%, #a49d8c 60%, #4c463c);
}
.card.unit-token.rarity-rare::before {
  background-image: linear-gradient(125deg, #fbfcfd, #858d96 36%, #e6e9ec 60%, #6a727b);
}
.card.unit-token.rarity-epic::before {
  background-image: linear-gradient(125deg, #f3dcff, #7243a6 36%, #dcc0f2 60%, #573683);
}
.card.unit-token.rarity-legendary::before {
  background-image: linear-gradient(125deg, #fff2c8, #b8832f 34%, #ffe8a8 58%, #9a6b28);
}
.card.unit-token .card-image {
  border-color: var(--rarity-line);
}
.card-legend .rarity-gem {
  position: static;
  display: inline-block;
  translate: none;
  vertical-align: middle;
  margin-right: 6px;
}

/* Legendary showcase (fx.js legendShowcase). */
.fx-legend-dim {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, #1a120690, #050a10e6 70%);
}
.fx-legend-rays {
  position: fixed;
  z-index: 4;
  width: 120vmin;
  height: 120vmin;
  margin: -60vmin 0 0 -60vmin;
  pointer-events: none;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #ffd27a44 0deg 5deg, transparent 5deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 8%, #0008 34%, transparent 68%);
  mask-image: radial-gradient(circle, #000 8%, #0008 34%, transparent 68%);
}
.fx-legend-card {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 6;
  pointer-events: none;
  transform-origin: 50% 50%;
}
.fx-legend-card > .card {
  margin: 0;
  box-shadow:
    0 0 0 1px #ffe3a066,
    0 0 40px #ffcf7066,
    0 24px 40px #000c;
}
.card-legend .rarity-gem {
  width: 22px;
  height: 22px;
}
.card-legend .rarity-gem.gem-legendary {
  width: 46px;
  height: 23px;
}

/* Playable cue: an emerald halo on cards that can be played now; on your turn
   the cards you cannot play yet are dimmed. Rarity never uses green. */
.hand [data-availability="ready"] {
  outline: none;
  box-shadow:
    0 0 0 4px #3fd07acc,
    0 0 18px 6px #3fd07a55,
    0 7px 16px #040a12aa;
}
.hand.fanned > .card.pressed {
  z-index: 6;
  rotate: 0deg;
  translate: 0 -16px;
}
.hand.fanned > .card.pressed + .card {
  translate: 16px 0;
}
.hand.fanned > .card:has(+ .card.pressed) {
  translate: -16px 0;
}
.qa-only {
  opacity: 0 !important;
}
.hand .card.type-spell[data-availability="ready"] {
  box-shadow: none;
  filter: drop-shadow(0 0 2.5px #3fd07a) drop-shadow(0 0 9px #3fd07a99);
}

/* Held hand card (soft hold): it rises out of the hand, enlarged to read. */
.hand > .card.peek {
  z-index: 9;
  rotate: 0deg;
  translate: 0 -46%;
  scale: 1.55;
  transition:
    translate 0.2s cubic-bezier(0.2, 0.8, 0.3, 1.1),
    scale 0.2s cubic-bezier(0.2, 0.8, 0.3, 1.1),
    rotate 0.2s ease;
  box-shadow:
    0 18px 34px #000b,
    0 0 0 1px #ffffff22;
}
.hand > .card.peek + .card {
  translate: 22px 0;
}
.hand > .card:has(+ .card.peek) {
  translate: -22px 0;
}

/* Rarity gem lives in the top-right corner of the frame, off the artwork. */
.rarity-gem,
.rarity-gem.gem-epic,
.rarity-gem.gem-legendary {
  top: -10px;
  right: -9px;
  left: auto;
  translate: none;
  width: 28px;
  height: 28px;
}
.rarity-gem.gem-epic {
  width: 24px;
  height: 30px;
  top: -12px;
  right: -7px;
}
.rarity-gem.gem-legendary {
  width: 34px;
  height: 34px;
  top: -13px;
  right: -12px;
}
.compact .rarity-gem,
.compact .rarity-gem.gem-epic,
.compact .rarity-gem.gem-legendary {
  top: -8px;
  right: -7px;
  width: 22px;
  height: 22px;
}
.compact .rarity-gem.gem-epic {
  width: 19px;
  height: 24px;
  top: -10px;
  right: -5px;
}
.compact .rarity-gem.gem-legendary {
  width: 28px;
  height: 28px;
  top: -11px;
  right: -10px;
}
.card.unit-token .rarity-gem,
.card.unit-token .rarity-gem.gem-epic,
.card.unit-token .rarity-gem.gem-legendary {
  top: 4px;
  right: 2px;
  width: 24px;
  height: 24px;
}
.card.unit-token .rarity-gem.gem-epic {
  width: 21px;
  height: 26px;
  top: 2px;
}
.card.unit-token .rarity-gem.gem-legendary {
  width: 32px;
  height: 32px;
  top: -2px;
  right: -3px;
}
.card-legend .rarity-gem,
.card-legend .rarity-gem.gem-legendary {
  width: 24px;
  height: 24px;
}

/* ───── History (last three plays) ───── */
.table-seam .log-btn {
  display: grid;
  place-items: center;
  width: 46px;
  min-height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #c5a46a66;
  background: radial-gradient(circle at 50% 30%, #22344a, #0e1826 72%);
  box-shadow: 0 2px 8px #0009, inset 0 1px #ffffff14;
  color: inherit;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.table-seam .log-btn.open,
.table-seam .log-btn:hover {
  background: radial-gradient(circle at 50% 30%, #2a3e56, #101c2b 72%);
  border-color: #f0d59a;
  box-shadow:
    0 0 0 3px #f0d59a22,
    0 0 16px #f0c46a55,
    inset 0 1px #ffffff1f;
}
.log-icon {
  width: 26px;
  height: 19px;
}
.log-icon path {
  stroke: #0c1520;
  stroke-width: 0.8;
}
.log-icon .c0 {
  fill: #fff0c4;
  filter: drop-shadow(0 0 3px #ffd98a);
}
.log-icon .c1 {
  fill: #b89d6a;
}
.log-icon .c2 {
  fill: #5d5a54;
}
.log-panel {
  width: auto;
  max-width: 94vw;
  padding: 14px 20px 18px;
  border: 0;
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% 0%, #c5a46a1f, transparent 60%),
    linear-gradient(180deg, #121e2ef5, #0a121cf7);
  box-shadow:
    0 0 0 1px #c5a46a55,
    0 0 0 5px #0a121c,
    0 0 0 6px #c5a46a2a,
    0 24px 60px #000d;
  animation: log-in 0.28s cubic-bezier(0.2, 0.8, 0.3, 1.1);
}
@keyframes log-in {
  from {
    opacity: 0;
    scale: 0.94;
  }
}
.log-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}
.log-head h3 {
  margin: 0;
}
.log-orn {
  width: 54px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c5a46a99, transparent);
}
.log-list {
  gap: 18px;
  align-items: end;
}
.log-entry {
  position: relative;
  width: auto;
  gap: 0;
  padding: 26px 4px 4px;
  border: 0;
  background: none;
  cursor: pointer;
  transition: translate 0.2s ease;
}
.log-entry:hover,
.log-entry:active {
  translate: 0 -3px;
}
.log-entry .card,
.log-entry .card.compact {
  width: 128px;
  height: 166px;
  pointer-events: none;
}
.log-entry.log-age-0 {
  opacity: 1;
}
.log-entry.log-age-1 {
  opacity: 0.86;
  filter: saturate(0.75);
}
.log-entry.log-age-2 {
  opacity: 0.66;
  filter: saturate(0.45) brightness(0.85);
}
/* Who played it: the hero's medallion under the card. */
.log-who {
  position: relative;
  z-index: 8;
  display: block;
  width: 34px;
  height: 34px;
  margin-top: -14px;
  overflow: hidden;
  border-radius: 50%;
  box-shadow:
    0 0 0 2px #0a121c,
    0 0 0 3.5px var(--class),
    0 4px 8px #000a;
}
.log-who .art {
  width: 100%;
  height: 100%;
}
.log-empty {
  margin: 10px 0 4px;
  color: #8f9db0;
  font: italic 13px Georgia, serif;
}
/* Recency crystal above each card. */
.log-crystal {
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% 0;
  width: 16px;
  height: 24px;
}
.log-crystal path {
  stroke-linejoin: round;
}
.log-crystal > path:first-child {
  stroke: #0a121c;
  stroke-width: 1.4;
}
.log-crystal .facet {
  fill: none;
  stroke: #ffffff55;
  stroke-width: 0.8;
}
.log-crystal.age-0 > path:first-child {
  fill: #fff0c4;
}
.log-crystal.age-0 {
  filter: drop-shadow(0 0 4px #ffd98a) drop-shadow(0 0 10px #f3b54a99);
  animation: log-glow 2.6s ease-in-out infinite;
}
@keyframes log-glow {
  50% {
    filter: drop-shadow(0 0 2px #ffd98a) drop-shadow(0 0 6px #f3b54a66);
  }
}
.log-crystal.age-1 > path:first-child {
  fill: #a8916a;
}
.log-crystal.age-1 {
  filter: drop-shadow(0 0 3px #c5a46a55);
}
.log-crystal.age-2 > path:first-child {
  fill: #4a4844;
}
.log-crystal.age-2 .facet {
  stroke: #ffffff22;
}
.log-crystal .crack {
  fill: none;
  stroke: #1a1917;
  stroke-width: 1.2;
}
/* Focus: the card large, once per half, each facing its player. */
.log-focus {
  position: absolute;
  inset: 0;
  z-index: 46;
  display: grid;
  grid-template-rows: 1fr 1fr;
  background: #04080dd9;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: log-in 0.22s ease-out;
}
.log-focus-half {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 20px;
  min-height: 0;
}
.log-focus-half.h1 {
  rotate: 180deg;
}
.log-focus-card {
  position: relative;
  display: grid;
  justify-items: center;
  padding-top: 30px;
}
.log-focus-card > .card {
  zoom: 1.3;
  margin: 0 0 10px;
}
.log-focus-card .log-crystal {
  width: 20px;
  height: 30px;
}
.log-focus-who {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 13px Georgia, serif;
  color: color-mix(in srgb, var(--class), #fff 35%);
}
.log-focus-who .art {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #0a121c, 0 0 0 3px var(--class);
}
.log-focus-notes {
  display: grid;
  gap: 8px;
  width: min(300px, 40vw);
}
.log-focus-notes .keyword-note {
  margin: 0;
}
@media (prefers-reduced-motion: reduce) {
  .log-crystal.age-0 {
    animation: none;
  }
}

.log-focus-notes .keyword-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid #c5a46a33;
  border-left: 2px solid #c5a46a99;
  border-radius: 10px;
  background: #101c2bcc;
  text-align: left;
}
.log-focus-notes .trait-note-icon .glyph {
  width: 22px;
  height: 22px;
}
html.log-focus-open .particle-layer {
  opacity: 0;
  transition: opacity 0.2s ease;
}
.log-focus-card > .card {
  margin-bottom: 28px;
}
.log-focus-who > .art {
  position: relative;
  inset: auto;
  flex: 0 0 30px;
}

/* ───── Units: sleeping = drifting z's, never faded; ready = emerald ───── */
.card.unit-token.sleeping::before,
.card.unit-token.sleeping:not(.selected) .card-image,
.card.unit-token.exhausted.sleeping:not(.selected) .card-image {
  filter: none;
}
.card.unit-token.sleeping .card-image::after {
  display: none;
}
.card.unit-token.exhausted:not(.selected, .sleeping) .card-image {
  filter: saturate(0.85) brightness(0.92);
}
.card.unit-token.ready::before {
  box-shadow:
    0 0 0 2px #3fd07a,
    0 0 14px #3fd07a77,
    0 8px 16px #0008;
}
.unit-zzz {
  position: absolute;
  z-index: 6;
  left: 4px;
  top: 4px;
  width: 44px;
  height: 46px;
  pointer-events: none;
}
.unit-zzz i {
  position: absolute;
  left: 4px;
  bottom: 0;
  font: italic 700 15px Georgia, serif;
  color: #dfe8ff;
  text-shadow:
    0 0 6px #8fb0ff,
    0 1px 2px #000;
  opacity: 0;
  animation: zzz-float 3s ease-in-out infinite;
}
.unit-zzz i:nth-child(2) {
  font-size: 19px;
  animation-delay: 1s;
}
.unit-zzz i:nth-child(3) {
  font-size: 24px;
  animation-delay: 2s;
}
@keyframes zzz-float {
  0% {
    opacity: 0;
    translate: 0 0;
    scale: 0.6;
  }
  20% {
    opacity: 1;
  }
  70% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    translate: 16px -34px;
    scale: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .unit-zzz i {
    animation: none;
    opacity: 0.9;
  }
  .unit-zzz i:nth-child(2) {
    translate: 8px -14px;
  }
  .unit-zzz i:nth-child(3) {
    translate: 16px -30px;
  }
}

/* ───── Fate choice (Discover) and Choose One ───── */
.choice-overlay.fate {
  inset: 0;
  gap: 18px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse 60% 55% at 50% 52%, color-mix(in srgb, var(--class, #c5a46a), transparent 82%), transparent 70%),
    #060b11ee;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: log-in 0.3s ease-out;
}
.fate-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.fate-head h2 {
  margin: 0;
  font: 400 26px Georgia, serif;
  letter-spacing: 0.04em;
  color: #f3e9ce;
  text-shadow: 0 2px 12px #000;
}
.fate-orn {
  width: 70px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--class, #c5a46a), #f3d68f 50%), transparent);
}
.fate-cards {
  display: flex;
  gap: 26px;
  align-items: flex-start;
}
.fate-pick {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  animation: fate-in 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.15) both;
  animation-delay: calc(var(--i) * 90ms + 80ms);
}
@keyframes fate-in {
  from {
    opacity: 0;
    translate: 0 30px;
    scale: 0.9;
  }
}
.fate-pick > .card {
  zoom: 1.3;
  pointer-events: none;
  transition:
    translate 0.22s ease,
    box-shadow 0.22s ease;
}
.fate-pick:hover > .card,
.fate-pick:focus-visible > .card,
.fate-pick:active > .card {
  translate: 0 -6px;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--class, #c5a46a), #fff 40%),
    0 0 26px color-mix(in srgb, var(--class, #c5a46a), transparent 30%),
    0 16px 30px #000c;
}
.fate-take,
.fate-way,
.choice-overlay.fate .fate-back {
  display: grid;
  place-items: center;
  min-width: 150px;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid color-mix(in srgb, var(--class, #c5a46a), #f3d68f 55%);
  border-radius: 10px;
  color: #fff1d2;
  font: 600 16px Georgia, serif;
  letter-spacing: 0.03em;
  background: linear-gradient(180deg, color-mix(in srgb, var(--class, #c5a46a), #241a10 55%), color-mix(in srgb, var(--class, #c5a46a), #0b0d12 78%));
  box-shadow:
    inset 0 1px #ffffff26,
    0 6px 16px #0009;
}
.fate-ways {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 90%;
}
.fate-way {
  min-height: 64px;
  max-width: 300px;
  padding: 10px 20px;
  font-size: 15px;
  line-height: 1.3;
  cursor: pointer;
  animation: fate-in 0.45s cubic-bezier(0.2, 0.8, 0.3, 1.15) both;
  animation-delay: calc(var(--i) * 90ms + 80ms);
}
.choice-overlay.fate .fate-back {
  min-height: 36px;
  min-width: 110px;
  font-size: 13px;
  background: #0d151fcc;
  border-color: #ffffff2a;
  cursor: pointer;
}
.fx-power-bolt {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 7;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, #fff 0 22%, color-mix(in srgb, var(--cue), #fff 35%) 40%, transparent 72%);
  box-shadow:
    0 0 14px 6px color-mix(in srgb, var(--cue), transparent 35%),
    0 0 32px 12px color-mix(in srgb, var(--cue), transparent 70%);
}

.choice-overlay.fate .fate-pick > .card {
  width: 165px;
  height: 245px;
  zoom: 1.32;
}
.choice-overlay.fate .card-image {
  height: 104px;
  flex: 0 0 104px;
}
.choice-overlay.fate .card p {
  font-size: 10.5px;
  line-height: 1.3;
}
.unit-zzz {
  left: 0;
  top: -4px;
  width: 56px;
  height: 60px;
}
.unit-zzz i {
  font-size: 19px;
  color: #eef3ff;
  text-shadow:
    0 0 8px #9db8ff,
    0 0 2px #fff,
    0 2px 3px #000;
}
.unit-zzz i:nth-child(2) {
  font-size: 24px;
}
.unit-zzz i:nth-child(3) {
  font-size: 30px;
}
.fx-power-bolt {
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
}

/* Battlecry being aimed: the unit waits in its slot as a glowing ghost. */
.board-row > .pending-unit {
  flex: 0 0 var(--unit-width);
  width: var(--unit-width);
  height: var(--unit-height);
  pointer-events: none;
  rotate: var(--board-rotation, 0deg);
  animation: pending-unit 1.6s ease-in-out infinite;
}
.board-row > .pending-unit > .card {
  width: 100%;
  height: 100%;
  opacity: 0.82;
}
@keyframes pending-unit {
  50% {
    filter: drop-shadow(0 0 14px #f3d48c) brightness(1.08);
  }
}
.hand .card.selected {
  opacity: 0.45;
}


/* ───── Corner preview of the player not at turn ─────
   Bottom-right corner of their half (top/height set in render): over their
   bar's right side and their hand, never over their hero or the units. No
   panel – the card and its notes float with a soft shadow. */
.player-zone > .detail-panel.corner-preview {
  inset: auto 8px auto auto;
  z-index: 20;
  width: auto;
  max-width: 76%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: preview-in 0.22s ease-out;
}
@keyframes preview-in {
  from {
    opacity: 0;
    translate: 18px 0;
  }
}
.player-zone > .detail-panel.corner-preview::before {
  content: "";
  position: absolute;
  inset: -30px -8px -10px -40px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 78% 60%, #03060bd9 0%, #03060ba0 45%, transparent 72%);
}
.player-zone > .detail-panel.corner-preview .detail-notes {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: 1fr auto auto auto;
  column-gap: 14px;
  row-gap: 7px;
  align-items: end;
  width: auto;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: visible;
  text-align: left;
}
.player-zone > .detail-panel.corner-preview .detail-notes > * {
  margin: 0;
}
.player-zone > .detail-panel.corner-preview .preview-stage {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: end;
  padding: 0;
  margin: 0;
}
.player-zone > .detail-panel.corner-preview .preview-card,
.player-zone > .detail-panel.corner-preview .preview-card.compact {
  width: 165px;
  height: 245px;
  padding: 6px 6px 8px;
  zoom: var(--pz, 1.1);
  box-shadow:
    0 0 0 1px #0008,
    0 18px 34px #000d,
    0 0 40px #000a;
}
.player-zone > .detail-panel.corner-preview .preview-card .card-image {
  height: 108px;
}
.player-zone > .detail-panel.corner-preview .preview-card .card-name {
  font-size: 13px;
  padding: 5px 3px;
}
.player-zone > .detail-panel.corner-preview .preview-card > p {
  font-size: 10.5px;
  line-height: 1.3;
}
/* Notes: a readable column beside the card, aligned to its bottom. */
.player-zone > .detail-panel.corner-preview .detail-meta,
.player-zone > .detail-panel.corner-preview .explanations,
.player-zone > .detail-panel.corner-preview .card-availability {
  width: min(250px, 34vw);
}
.player-zone > .detail-panel.corner-preview .detail-meta {
  grid-column: 1;
  grid-row: 2;
}
.player-zone > .detail-panel.corner-preview .explanations {
  grid-column: 1;
  grid-row: 3;
}
.player-zone > .detail-panel.corner-preview .card-availability {
  grid-column: 1;
  grid-row: 4;
}
.player-zone > .detail-panel.corner-preview .explanations {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}
.player-zone > .detail-panel.corner-preview .keyword-note {
  padding: 9px 12px;
  border-radius: 12px;
  background: #0b1420f2;
  box-shadow: 0 8px 18px #000a;
}
.player-zone > .detail-panel.corner-preview .keyword-note h3 {
  font-size: 15px;
}
.player-zone > .detail-panel.corner-preview .keyword-note p {
  font-size: 13px;
  line-height: 1.4;
}
.player-zone > .detail-panel.corner-preview .detail-meta {
  justify-content: flex-start;
  font-size: 11px;
  color: #c9c0aa;
}
.player-zone > .detail-panel.corner-preview .card-availability {
  font-size: 13px;
  color: #e9c98c;
}
/* The other player's corner preview limits nobody: it stays while the
   player at turn drags or aims. */
.tabletop.drag-priority .player-zone:not(.active) .detail-panel.corner-preview {
  opacity: 1;
  pointer-events: auto;
}
.player-zone > .detail-panel.power-preview.corner-preview {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  gap: 12px;
}
.player-zone > .detail-panel.power-preview.corner-preview .detail-notes {
  display: block;
  width: min(260px, 36vw);
  height: auto;
}
