/* Zone height (field rows A-C and hand share this value) */
:root { --zone-h: 140px; }

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Shared surface panel */
.surface-zone {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), background var(--transition);
}

/* Shared card thumbnail (44×62) */
.card-thumb {
  width: 44px;
  height: 62px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
}

/* ---- Board ---- */
.solo-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  transition: border-color 0.3s ease;
}
.solo-board.opponent-turn {
  background: color-mix(in srgb, var(--accent2) 3%, transparent);
  border: 2px solid var(--accent2);
  border-radius: var(--radius-md);
}

/* ---- Field ---- */
.solo-field-upper {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.solo-field-lower { flex-shrink: 0; }

/* Row height fixed to --zone-h for A/B/C.
   flex-basis covers flex rows; height covers the wrapped lower row. */
.solo-field-row {
  position: relative;
  flex: 0 0 var(--zone-h);
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--zone-h);
  min-height: 0;
  padding: 4px 8px;
  overflow-x: auto;
}
.solo-field-row.drag-over { background: color-mix(in srgb, var(--border) 50%, transparent); }

.solo-field-row-label {
  position: absolute;
  top: 3px;
  left: 6px;
  color: var(--text-dim);
  font-size: 0.72rem;
  cursor: help;
  user-select: none;
}

/* Auto-overlap when 7+ cards in a row */
.solo-field-row.crowded .solo-card:not(:first-of-type) { margin-left: -20px; }

/* ---- Drop zone feedback ---- */
.drop-zone.drag-over { border-color: var(--accent); }
.drop-zone.drop-hint {
  border-color: var(--border2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 15%, transparent);
}

/* ---- Bottom (side zones + hand) ---- */
.solo-bottom {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  height: var(--zone-h);
}
.solo-bottom-controls {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  height: 100%;
}

/* ---- Side zones ---- */
.solo-side-zones { display: flex; flex-shrink: 0; gap: 8px; }

.solo-zone-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 72px;
  padding: 4px 8px;
  cursor: pointer;
}
#zone-discard { width: 100px; }
#zone-inkwell { width: 136px; }
.solo-zone-stack:hover { border-color: var(--border2); }

.solo-zone-label { color: var(--text-dim); font-size: 0.72rem; }
.solo-zone-count { color: var(--text);     font-size: 0.8rem; font-weight: bold; }

/* Card back (deck) */
.solo-card-back-img {
  display: block;
  object-fit: cover;
  cursor: grab;
}
.solo-card-back-img.empty    { opacity: 0.25; cursor: default; }
.solo-card-back-img.dragging { opacity: 0.35; }

/* Stacked pile (discard / inkwell). Width = 44 + 16 × (N-1). */
.solo-zone-pile {
  position: relative;
  flex-shrink: 0;
  width: var(--pile-w);
  height: 62px;
}
#zone-discard .solo-zone-pile { --pile-w: 76px; }  /* 3 cards */
#zone-inkwell .solo-zone-pile { --pile-w: 108px; } /* 5 cards */

.solo-zone-pile-card { position: absolute; overflow: hidden; }
.solo-zone-pile-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.solo-zone-pile-card.pile-back { background: var(--border); }
.solo-zone-pile-card.exerted {
  border-color: var(--accent);
  opacity: 0.9;
  transform: rotate(90deg);
  transform-origin: center center;
}

/* Empty zone placeholder */
.solo-zone-empty {
  padding: 0 8px;
  color: var(--text-dim);
  font-size: 0.72rem;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

/* ---- Hand ---- */
.solo-hand {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--zone-h);
  padding: 8px;
  overflow-x: auto;
}
/* Overlap hand when 8+ cards */
.solo-hand.hand-md,
.solo-hand.hand-lg { gap: 0; }
.solo-hand.hand-md .solo-card:not(:first-child) { margin-left: -14px; }
.solo-hand.hand-lg .solo-card:not(:first-child) { margin-left: -28px; }
.solo-hand .solo-card:hover { z-index: 10; }

/* ---- Card ---- */
@keyframes card-effect-pulse {
  0%   { box-shadow: 0 0 0 2px #c8a84b, 0 0 18px rgb(200 168 75 / 0.7); }
  55%  { box-shadow: 0 0 0 2px #c8a84b, 0 0 22px rgb(200 168 75 / 0.4); }
  100% { box-shadow: none; }
}

.solo-card {
  position: relative;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  /* Prevent touch-gesture interception (drag + long press) */
  touch-action: none;
  transform-origin: bottom center;
  transition: transform var(--transition), box-shadow var(--transition);
}
.solo-card.effect-triggered { animation: card-effect-pulse 0.85s ease-out forwards; }
.solo-card:hover            { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.solo-card.exerted          { transform: rotate(90deg); transform-origin: center center; }
.solo-card.exerted:hover    { transform: rotate(90deg) translateY(-4px); }
.solo-card.dragging         { opacity: 0.35; }

.solo-card img {
  display: block;
  border-radius: var(--radius-sm);
  pointer-events: none;
}
.solo-hand      .solo-card img { width: auto; height: 110px; }
.solo-field-row .solo-card img { width: auto; height: 88px; }

.solo-card-damage {
  position: absolute;
  bottom: 2px;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  color: #fff;
  font-size: 0.72rem;
  font-weight: bold;
  pointer-events: none;
}

/* Cannot quest until next turn */
.solo-card.summoning-sick img { filter: brightness(0.82) sepia(0.2); }

/* "zzz" badge on characters that entered play this turn */
.solo-card-new-badge {
  position: absolute;
  top: 3px;
  left: 3px;
  padding: 0 3px;
  background: rgb(30 30 60 / 0.75);
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 3px;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.5px;
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.solo-card-new-badge::after { content: 'zzz'; }
