/* Table geometry tuned for real 1920×1080 play: the actionable hand comes
   first, cards consume the space instead of empty zone padding, and the
   complete board stays visible where the viewport permits. Game-owned only. */
:root {
  --spade-table-card:clamp(126px,8.45vw,162px);
  --spade-hand-card:clamp(150px,11.1vw,214px);
  --spade-pile-card:clamp(112px,7vw,134px);
}
#shell {max-width:1780px;padding:clamp(11px,1.25vw,20px)}
.app-root {gap:8px}
.hand-panel {
  padding:10px 14px 13px;
  background:linear-gradient(120deg,#2b4b3a,#1a362b)!important;
}
.hand-panel .panel-title {margin-bottom:7px;font-size:13px}
.hand.xg-card-hand {
  --xg-hand-card-width:var(--spade-hand-card);
  --xg-hand-exposed:var(--spade-hand-card);
  min-height:0;
  justify-content:center;
  gap:clamp(10px,1vw,18px);
  align-content:start;
}
.hand .playing-card.xg-card {
  --xg-card-width:var(--spade-hand-card);
  block-size:auto;
  aspect-ratio:18 / 25;
}
.hand .ui-card-wrap {gap:0}
/* Move the useful one-word action onto the unused lower-left of each card.
   Eliminates an entire caption row without losing the suit's meaning. */
.hand .card-caption:not(:empty) {
  position:absolute;bottom:9px;left:10px;z-index:2;
  min-height:0;max-width:calc(100% - 20px);
  padding:3px 7px;border-radius:4px;
  font:800 12px/1.2 system-ui,sans-serif;letter-spacing:.075em;
  color:#fbedd1!important;background:#11251dc7;
  box-shadow:0 1px 5px #0004;pointer-events:none;
}
.hand .card-caption:empty {display:none}
.cards-row {min-height:0;gap:clamp(8px,1vw,16px)}
.playing-card.xg-card {
  --xg-card-width:var(--spade-table-card);
  block-size:auto;
  aspect-ratio:18 / 25;
}
.spade-diamond-target {width:var(--spade-table-card);height:auto;aspect-ratio:18 / 25}

.battlefield {gap:7px;padding:9px;border-radius:13px}
.kingdom-line,.threat-line {gap:8px}
.kingdom-line {grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr)}
.threat-line {grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr)}
.battlefield .zone {padding:8px 10px 8px}
.battlefield .panel-title {margin:0 0 7px;font-size:12px}
.triarch-row {gap:9px;justify-content:space-around}
.triarch-slot {
  min-width:var(--spade-table-card);
  flex:0 1 var(--spade-table-card);
  gap:4px;
}
/* Ranks and portraits identify the Triarchs; a second JACK/QUEEN/KING
   row only adds height. The progress meter remains the essential cue. */
.triarch .card-caption {display:none}
.triarch-slot .ui-meter {gap:4px}
.triarch-slot .meter-label {font-size:12px}
.triarch-slot .meter-track {height:7px}
.triarch.done .playing-card {opacity:1;filter:saturate(.68) brightness(.91);border-color:#c8dda8}
.triarch.done .playing-card::after {
  content:"✓";position:absolute;right:4px;bottom:4px;
  z-index:6;width:31px;height:31px;border-radius:50%;
  display:grid;place-items:center;
  font:900 24px/1 system-ui,sans-serif;
  background:#214b31;color:#d8ffac;border:2px solid #a9d88d;
  box-shadow:0 2px 7px #0009;
}
.triarch-slot:has(.triarch.done) .ui-meter.complete .meter-label {display:none}
.triarch-slot:has(.triarch.done) .ui-meter.complete .meter-track {background:#2c5640;border-color:#9ac28a}
.triarch-slot:has(.triarch.done) .ui-meter.complete .meter-fill {background:#c4e6a2}
.triarch.done .card-caption {color:#def1c5}
.revealed-row,.monster-row {align-content:start}
.monster .card-caption:empty,.revealed .card-caption:empty {display:none}
.monster .card-caption:not(:empty),.revealed .card-caption:not(:empty) {
  position:absolute;bottom:8px;left:8px;z-index:2;
  max-width:calc(100% - 16px);padding:3px 6px;
  border-radius:3px;background:#101d1ad4;color:#f9e7c9;
  font-size:12px;line-height:1.15;pointer-events:none;
}
.pile-visual {
  width:var(--spade-pile-card);height:auto;
  aspect-ratio:18 / 25;
}
.ui-pile {min-width:var(--spade-pile-card)}
.pile-count {top:auto;bottom:25px;right:1px}
.pile-name {font-size:12px;min-height:16px}
.supply-row {justify-content:space-evenly;gap:10px}

.action-bay:empty,.controls:empty {display:none}
.action-bay {gap:7px}
.action-bay .phase-panel {
  min-height:0;
  padding:9px 14px;
  display:flex;flex-direction:row;align-items:baseline;
  flex-wrap:wrap;gap:6px 13px;
}
.action-bay .phase-panel .phase-title {font-size:19px}
.action-bay .phase-panel .phase-detail {font-size:13px}
.controls .staging {min-height:0}
.staging .panel-title {min-height:0;margin-bottom:8px}
.staging .cards-row {min-height:0;gap:12px}
.controls .ui-panel {padding:11px 14px}
.staging .card-caption {font-size:12px}

/* During combo resolution the hand and committed cards are equally important.
   On a roomy desktop they share one band; the battlefield stays underneath
   rather than being pushed down by two full-width action panels. */
@media(min-width:1250px) {
  .app-root:has(.phase-badge.phase-combo,.phase-badge.phase-resolve) {
    display:grid;
    grid-template-columns:minmax(0,1.8fr) minmax(0,.85fr);
    grid-template-areas:
      "hand action"
      "board board";
    align-items:start;
    column-gap:12px;
    row-gap:8px;
  }
  .app-root:has(.phase-badge.phase-combo,.phase-badge.phase-resolve) > .hand-panel {grid-area:hand;align-self:stretch}
  .app-root:has(.phase-badge.phase-combo,.phase-badge.phase-resolve) > .action-bay {grid-area:action}
  .app-root:has(.phase-badge.phase-combo,.phase-badge.phase-resolve) > .battlefield {grid-area:board}
  .app-root:has(.phase-badge.phase-combo,.phase-badge.phase-resolve) .hand.xg-card-hand {justify-content:center;gap:10px}
  .app-root:has(.phase-badge.phase-combo,.phase-badge.phase-resolve) .staging .cards-row {gap:8px}
}

/* A short desktop still shows the entire hand before any below-fold zone. */
@media(max-width:1250px) {
  .kingdom-line {grid-template-columns:minmax(0,1.65fr) minmax(0,.72fr)}
  .threat-line {grid-template-columns:minmax(0,1.35fr) minmax(0,1fr)}
}
@media(max-width:900px) {
  .kingdom-line,.threat-line {grid-template-columns:1fr}
  .triarch-row {justify-content:flex-start;gap:13px}
}
@media(max-width:700px) {
  :root {
    --spade-table-card:100px;
    --spade-hand-card:112px;
    --spade-pile-card:96px;
  }
  .playing-card.xg-card {--xg-card-width:var(--spade-table-card);block-size:auto}
  .hand .playing-card.xg-card {--xg-card-width:var(--spade-hand-card);block-size:auto}
  .hand.xg-card-hand {--xg-hand-card-width:var(--spade-hand-card);--xg-hand-exposed:var(--spade-hand-card);min-height:0}
  .triarch-slot {min-width:var(--spade-table-card);flex-basis:var(--spade-table-card)}
  .spade-diamond-target {width:var(--spade-table-card);height:auto;aspect-ratio:18 / 25}
  .pile-visual {width:var(--spade-pile-card);height:auto}
  .ui-pile {min-width:var(--spade-pile-card)}
  .pile-count {top:auto;bottom:25px}
  .battlefield {padding:9px}
  .battlefield .zone {padding:9px}
  .controls .staging,.staging .cards-row,.cards-row {min-height:0}
  .hand-panel {padding:10px}
}
@media(max-width:420px) {
  :root {
    --spade-table-card:88px;
    --spade-hand-card:104px;
    --spade-pile-card:85px;
  }
  .hand.xg-card-hand {--xg-hand-card-width:var(--spade-hand-card);--xg-hand-exposed:var(--spade-hand-card)}
  .triarch-slot {min-width:var(--spade-table-card);flex-basis:var(--spade-table-card)}
  .triarch-row {gap:9px}
  .pile-count {top:auto;bottom:23px}
}

/* One tabletop, not a stack of bordered dashboard cards. Zones are separated
   by hairlines on the common felt; labels and pieces supply the hierarchy. */
#shell {padding-top:clamp(7px,1vw,14px)}
.app-root {gap:5px}
.hand-panel {
  padding:4px 7px 11px;
  border:0;border-radius:0;
  border-bottom:1px solid #9bae9166;
  background:transparent!important;
  box-shadow:none;
}
.hand-panel > .panel-title {display:none}
.hand-panel .ui-panel-children {gap:7px}
.hand-status {
  display:flex;align-items:center;flex-wrap:wrap;
  gap:5px 11px;min-width:0;padding:1px 3px 2px;
}
.hand-status .hand-label {
  margin-right:auto;color:#e3d7b1;
  font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.11em;
}
.hand-status .round-badge {background:none;color:#bdd4c4;padding:3px 7px}
.hand-status .phase-badge {font-size:13px;padding:5px 10px}
.hand.xg-card-hand {gap:clamp(10px,.9vw,16px)}
.battlefield {
  padding:5px 0 0;gap:0;border:0;border-radius:0;
  background:transparent;box-shadow:none;
}
.kingdom-line,.threat-line {gap:0}
.kingdom-line {
  grid-template-columns:minmax(0,1.27fr) minmax(0,.82fr) minmax(205px,.48fr);
  border-bottom:1px solid #acc39c69;
}
.threat-line {grid-template-columns:minmax(0,1.3fr) minmax(0,.9fr)}
.battlefield .zone {
  padding:9px 12px 12px;border:0;border-radius:0;
  background:transparent!important;
}
.kingdom-line > .zone:not(:first-child),
.threat-line > .zone:not(:first-child) {
  border-left:1px solid #a7bd9e4c;
}
/* Atmospheric lighting and luminous card frames replace the old line-art watermarks. */
.battlefield .diamonds-zone {
  position:relative;
  background:radial-gradient(ellipse at 28% 0%,#f0cf7b18 0%,#58b8c90d 48%,transparent 82%)!important;
}
.battlefield .revealed-zone {
  position:relative;
  background:radial-gradient(ellipse at 50% 0%,#7ad9eb1f 0%,#ebca7814 48%,transparent 85%)!important;
}
.battlefield .revealed-zone::before {
  content:"";position:absolute;top:0;left:12px;right:12px;height:2px;border-radius:2px;
  background:linear-gradient(90deg,#f5d88799 0%,#7ce4f766 48%,transparent 100%);
  box-shadow:0 0 12px #f5d88755;pointer-events:none;
}
.battlefield .monster-zone {
  position:relative;
  background:radial-gradient(ellipse at 36% 0%,#d9534326 0%,#73231d16 52%,transparent 86%)!important;
}
.battlefield .monster-zone::before {
  content:"";position:absolute;top:0;left:12px;right:12px;height:2px;border-radius:2px;
  background:linear-gradient(90deg,#ef7b67aa 0%,#d9534344 55%,transparent 100%);
  box-shadow:0 0 12px #e8634e66;pointer-events:none;
}
.revealed .playing-card {
  border-color:#f9e498!important;
  box-shadow:0 5px 14px #0009,0 0 0 1px #fff3be80,0 0 16px #f2cd6b52,0 0 26px #6fd8ec30!important;
  animation:diamond-prism-glow 4.2s ease-in-out infinite alternate;
}
@keyframes diamond-prism-glow {
  from {box-shadow:0 5px 14px #0009,0 0 0 1px #fff3be70,0 0 13px #f2cd6b44,0 0 22px #6fd8ec24}
  to {box-shadow:0 6px 16px #000a,0 0 0 1.5px #fff7d1aa,0 0 20px #f7d67875,0 0 32px #7ce4f745}
}
.spade-diamond-target {
  border:2px solid #ffe48f;
  background:linear-gradient(135deg,#ffe79928 0%,transparent 50%,#7ee3f722 100%);
  box-shadow:0 0 0 2px #f6ca5c66,0 0 20px #f6ca5caa,inset 0 0 16px #ffe69944;
  transition:box-shadow .18s ease,background .18s ease;
}
.spade-diamond-target:hover,.spade-diamond-target:focus-visible,.spade-diamond-target[data-target-selected="true"] {
  border:2px solid #fff6c7;
  outline:2px solid #f5ce69;outline-offset:2px;
  background:linear-gradient(135deg,#ffe79940 0%,#f5ce6922 50%,#7ee3f736 100%);
  box-shadow:0 0 0 3px #ffdf8088,0 0 26px #ffd86bcc,inset 0 0 20px #ffe89e66;
}
.monster .playing-card {
  border-color:#e4826f!important;
  box-shadow:0 6px 15px #000b,0 0 0 1px #f2968366,0 0 16px #d4473648,inset 0 0 14px #59140e38!important;
  animation:monster-ember-pulse 3.4s ease-in-out infinite alternate;
}
body:has(.phase-badge.phase-attack) .monster .playing-card {
  border-color:#ff9d88!important;
  animation-duration:1.5s;
}
@keyframes monster-ember-pulse {
  from {box-shadow:0 6px 15px #000b,0 0 0 1px #f2968355,0 0 13px #d447363d,inset 0 0 12px #59140e30}
  to {box-shadow:0 7px 18px #000c,0 0 0 1.5px #ffab9899,0 0 22px #e6523f75,inset 0 0 18px #78191148}
}
.staging .card-caption {
  display:inline-flex;align-items:center;justify-content:center;gap:4px;
  font-size:12px;padding:3px 8px;border-radius:999px;
  background:#102820cc;border:1px solid #d9be7b55;color:#f6e5bb;
}
.staging .card-caption .inline-suit {
  width:18px;height:18px;margin:0 1px;vertical-align:middle;
}
.action-bay .phase-panel .play-again-button {
  margin-left:auto;padding:8px 16px;font-size:14px;
  box-shadow:0 3px 12px #0007,0 0 14px #f1c86a44;
}
@media(prefers-reduced-motion:reduce) {
  .revealed .playing-card,.monster .playing-card {animation:none}
}
.battlefield .panel-title {margin-bottom:8px;color:#c6d8ca}
.players-zone .seats {
  display:flex;flex-direction:column;align-items:stretch;
  gap:1px;min-height:0;
}
.players-zone .seat {
  width:100%;box-sizing:border-box;
  background:transparent;border:0;border-left:3px solid transparent;
  border-radius:0;padding:8px 7px;
  font-size:14px;text-align:left;line-height:1.25;
  white-space:normal;color:#d7e2d6;
}
.players-zone .seat.active {
  border-left-color:#f2d38a;background:#d4b46c16;color:#ffebad;
}
.players-zone .seat.own {
  background:#b7dfbd12;color:#edffec;
}
.players-zone .seat.own.active {
  border-left-color:#f2d38a;background:#d4b46c23;color:#fff1c6;
}
.action-bay:not(:empty) {
  padding:7px 0;border-bottom:1px solid #acc39c69;
}
.action-bay .phase-panel,
.controls .ui-panel {
  padding:6px 11px;background:transparent!important;
  border:0;box-shadow:none;border-radius:0;
}
.action-bay .phase-panel {border-left:3px solid #bea36d}
.controls .staging {padding:6px 11px}
.controls .staging .panel-title {font-size:13px}

/* On narrower desktop tables the ruler row gets the wide column; uncovered
   diamonds and the players share the narrow column vertically. */
@media(max-width:1350px) and (min-width:901px) {
  .kingdom-line {
    grid-template-columns:minmax(0,1.55fr) minmax(0,.9fr);
    grid-template-rows:auto auto;
  }
  .kingdom-line > .diamonds-zone {grid-column:1;grid-row:1 / 3}
  .kingdom-line > .revealed-zone {grid-column:2;grid-row:1}
  .kingdom-line > .players-zone {grid-column:2;grid-row:2}
  .kingdom-line > .players-zone {border-top:1px solid #a7bd9e4c}
  .players-zone .seats {gap:0}
  .players-zone .seat {padding:5px 7px;font-size:13px}
}
@media(max-width:900px) {
  .kingdom-line,.threat-line {grid-template-columns:1fr}
  .kingdom-line > .zone,.threat-line > .zone {grid-column:auto;grid-row:auto}
  .kingdom-line > .zone:not(:first-child),
  .threat-line > .zone:not(:first-child) {
    border-left:0;border-top:1px solid #a7bd9e4c;
  }
  .players-zone .seats {flex-direction:row;flex-wrap:wrap;gap:5px 8px}
  .players-zone .seat {width:auto;padding:4px 8px}
}
@media(max-width:420px) {
  .hand-status {gap:4px 7px}
  .hand-status .hand-label {flex-basis:100%}
  .battlefield .zone {padding:8px 5px}
}

/* Taller full-HD screens leave enough room for a more substantial hand.
   Keep shorter desktop viewports on the smaller responsive card size. */
@media(min-width:1700px) and (min-height:980px) {
  :root {--spade-hand-card:242px}
}
