#hud > * { pointer-events: auto; }
/* avatars */
.avatar { position: absolute; transform: translate(-50%, -50%); width: 120px; display: flex; flex-direction: column; align-items: center; z-index: 700; cursor: pointer; }
.avatar-ring { width: 92px; height: 92px; border-radius: 50%; padding: 4px; background: conic-gradient(from 200deg, #2b6f93, #7fc4ea, #2b6f93); box-shadow: 0 6px 20px rgba(0,0,0,0.6); transition: box-shadow 200ms ease; }
.avatar-opp .avatar-ring { background: conic-gradient(from 200deg, #5a3f8a, #b39ae8, #5a3f8a); }
.avatar-portrait { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #3a6f99, #102a40 70%); }
.avatar-opp .avatar-portrait { background: radial-gradient(circle at 35% 30%, #6b4f9a, #1f1438 70%); }
.avatar-initial { font-family: var(--font-display); font-size: 40px; color: rgba(255,255,255,0.75); }
.avatar-life { position: absolute; top: 58px; min-width: 52px; padding: 2px 10px; border-radius: 14px; background: #0b1622; border: 2px solid #cfe6f7; font-weight: 900; font-size: 22px; text-align: center; }
.avatar-name { margin-top: 18px; font-size: 13px; color: var(--ink-dim); letter-spacing: 0.04em; }
.avatar-meta { font-size: 12px; color: var(--ink-dim); display: flex; gap: 6px; align-items: center; min-height: 18px; }
.avatar-pool { display: inline-flex; gap: 2px; }
.avatar-pool svg { width: 16px; height: 16px; }
.avatar-opp .avatar-life { top: 58px; }
.avatar.is-active .avatar-ring { box-shadow: 0 0 0 3px rgba(241,196,107,0.6), 0 6px 24px rgba(0,0,0,0.6); }
.avatar.hl-target .avatar-ring { box-shadow: 0 0 0 4px rgba(255,140,60,0.95), 0 0 30px 10px rgba(255,120,50,0.5); animation: pulse-ring 1.1s ease-in-out infinite; }
.avatar.hl-selected .avatar-ring { box-shadow: 0 0 0 5px #fff4d6, 0 0 30px 10px rgba(255,220,140,0.6); }
.avatar.life-down .avatar-life { animation: life-down 600ms var(--ease-out); }
.avatar.life-up .avatar-life { animation: life-up 600ms var(--ease-out); }
@keyframes life-down { 0% { color: #fff; } 25% { color: #ff6b6b; transform: scale(1.18); } 100% { color: inherit; transform: scale(1); } }
@keyframes life-up { 0% { color: #fff; } 25% { color: #7dffa8; transform: scale(1.18); } 100% { color: inherit; transform: scale(1); } }

/* shared piles */
.pile { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; z-index: 1; cursor: pointer; }
.pile-frame { position: relative; border-radius: 6px; border: 1.5px dashed rgba(160,210,240,0.28); background: rgba(10,25,40,0.4); }
.pile-backs { position: absolute; inset: 0; }
.pile-back { position: absolute; inset: 0; }
.pile-back > * { width: 100%; height: 100%; }
.pile-label { position: absolute; top: calc(100% + 6px); font-size: 11px; color: var(--ink-dim); white-space: nowrap; letter-spacing: 0.03em; }
.pile-count { position: absolute; top: -12px; right: -16px; min-width: 28px; padding: 2px 7px; border-radius: 12px; background: #0b1622; border: 1.5px solid rgba(200,230,250,0.6); font-weight: 800; font-size: 14px; text-align: center; z-index: 900; }
.pile-library.is-low .pile-count { border-color: var(--red); color: #ffb3b3; }
.pile-exile.is-empty { opacity: 0.45; }
.pile-library { cursor: default; }

/* phase ladder */
.phases { position: absolute; left: 1196px; top: 676px; width: 390px; display: flex; flex-direction: column; gap: 3px; z-index: 800; padding: 6px 8px; border-radius: 10px; background: rgba(6,14,24,0.55); }
.phase-row { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.phase-step { font-size: 10px; font-weight: 700; text-align: center; padding: 3px 0; border-radius: 4px; color: var(--ink-dim); background: rgba(255,255,255,0.04); transition: background-color 200ms ease, color 200ms ease; }
.phase-step.is-current { color: #08131d; background: var(--gold); }
.phase-step.is-current.is-opp { background: #b39ae8; }
.phase-stop { height: 8px; border-radius: 4px; border: 0; background: rgba(255,255,255,0.08); padding: 0; transition: background-color 150ms ease; }
.phase-stop.is-on { background: rgba(126,240,255,0.75); }
.phase-stops-opp .phase-stop.is-on { background: rgba(179,154,232,0.85); }

/* action buttons */
.btn-main { position: absolute; left: 1380px; top: 798px; width: 196px; height: 72px; border-radius: 36px; border: 0; z-index: 800;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: linear-gradient(180deg, #ffd27a, #e79a2d); color: #2a1600; box-shadow: 0 6px 22px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 140ms var(--ease-out), filter 160ms ease, background-color 160ms ease; }
.btn-main .btn-label { font-size: 22px; font-weight: 900; letter-spacing: 0.02em; }
.btn-main .btn-sub { font-size: 11px; font-weight: 700; opacity: 0.75; }
.btn-main[data-tone="pass"] { background: linear-gradient(180deg, #7fc4ea, #3a86b8); color: #04182a; }
.btn-main[data-tone="resolve"] { background: linear-gradient(180deg, #a9f0ff, #4cb6d6); color: #03202a; }
.btn-main:active:not(:disabled) { transform: scale(0.97); }
.btn-main:disabled { filter: grayscale(0.6) brightness(0.6); }
.btn-secondary { position: absolute; left: 1410px; top: 752px; width: 136px; height: 36px; border-radius: 18px; z-index: 800;
  border: 1.5px solid rgba(200,230,250,0.45); background: rgba(10,24,38,0.85); font-weight: 700; font-size: 14px; transition: transform 140ms var(--ease-out), background-color 150ms ease; }
.btn-secondary:active { transform: scale(0.97); }
.btn-fc { position: absolute; left: 1330px; top: 816px; width: 40px; height: 36px; border-radius: 8px; z-index: 800; font-size: 12px; font-weight: 800;
  border: 1.5px solid rgba(200,230,250,0.35); background: rgba(10,24,38,0.8); color: var(--ink-dim); transition: background-color 150ms ease, color 150ms ease; }
.btn-fc.is-on { background: var(--orange); color: #210b00; border-color: transparent; }
@media (hover: hover) and (pointer: fine) {
  .btn-main:hover:not(:disabled) { filter: brightness(1.08); }
  .btn-secondary:hover { background: rgba(30,55,80,0.9); }
}

/* banner + turn banner + toasts + reveal */
.banner { position: absolute; left: 760px; top: 450px; transform: translate(-50%, -50%); z-index: 820; padding: 8px 20px; border-radius: 20px; pointer-events: none;
  background: rgba(6,14,24,0.86); border: 1px solid var(--panel-edge); font-size: 16px; font-weight: 600; white-space: nowrap; opacity: 0; transition: opacity 160ms ease; display: flex; gap: 8px; align-items: center; }
.banner.is-on { opacity: 1; }
.banner[data-tone="warn"] { border-color: rgba(255,140,60,0.7); }
.banner svg { width: 20px; height: 20px; vertical-align: middle; }
.banner-paid { color: var(--ink-dim); font-size: 13px; }
.turn-banner { position: absolute; left: 760px; top: 450px; transform: translate(-50%, -50%); z-index: 5800; pointer-events: none; opacity: 0;
  font-family: var(--font-display); font-size: 54px; font-weight: 700; color: #fff4d6; text-shadow: 0 0 30px rgba(241,196,107,0.7), 0 3px 0 #3a2400; }
.turn-banner.is-opp { color: #efe6ff; text-shadow: 0 0 30px rgba(179,154,232,0.8), 0 3px 0 #1e1036; }
.toasts { position: absolute; left: 760px; top: 395px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 5800; pointer-events: none; }
.toast { padding: 7px 16px; border-radius: 16px; background: rgba(6,14,24,0.92); border: 1px solid var(--panel-edge); font-size: 14px; }
.toast.big { font-size: 28px; font-weight: 800; padding: 12px 28px; }
.reveal-strip { position: absolute; left: 760px; top: 450px; transform: translate(-50%, -50%); display: none; gap: 14px; align-items: center; z-index: 5800; padding: 16px; border-radius: 14px; background: rgba(6,14,24,0.9); pointer-events: none; }
.reveal-strip.is-open { display: flex; }
.reveal-title { font-weight: 800; writing-mode: vertical-rl; transform: rotate(180deg); color: var(--ink-dim); }
.reveal-card { width: 150px; height: 210px; }

/* log drawer */
.log-btn { position: absolute; left: 14px; top: 14px; z-index: 900; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--panel-edge); background: rgba(6,14,24,0.8); font-weight: 700; font-size: 13px; }
.log-drawer { position: absolute; left: 0; top: 0; bottom: 0; width: 340px; z-index: 5900; background: var(--panel); border-right: 1px solid var(--panel-edge);
  transform: translateX(-100%); transition: transform 260ms var(--ease-drawer, cubic-bezier(0.32,0.72,0,1)); display: flex; flex-direction: column; }
.log-drawer.is-open { transform: none; }
.log-head { padding: 16px 16px 10px 70px; font-weight: 800; }
.log-lines { flex: 1; overflow: auto; padding: 0 16px 16px; font-size: 13px; line-height: 1.45; color: #cfe0ec; user-select: text; }
.log-line { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }

/* debug panel (outside the stage, not scaled) */
.dbg-panel { position: fixed; right: 8px; top: 8px; width: 270px; max-height: calc(100vh - 16px); overflow: auto; z-index: 10000; background: rgba(8,12,20,0.94); border: 1px solid #355; border-radius: 10px; padding: 8px; font-size: 12px; }
.dbg-panel.is-collapsed > :not(.dbg-head) { display: none; }
.dbg-head { display: flex; justify-content: space-between; align-items: center; }
.dbg-x { background: none; border: 0; font-size: 16px; }
.dbg-status { color: var(--ink-dim); margin: 4px 0; font-size: 11px; }
.dbg-title { margin: 8px 0 4px; font-weight: 800; color: var(--gold); }
.dbg-items, .dbg-row { display: flex; flex-wrap: wrap; gap: 4px; }
.dbg-panel button:not(.dbg-x) { padding: 3px 7px; border-radius: 6px; border: 1px solid #456; background: #142132; font-size: 11px; }
.dbg-panel button.is-done { border-color: #3a7; }
.dbg-panel button.is-running { opacity: 0.5; }

/* Sound control (F): mute toggle + master volume, next to the log button */
.snd { position: absolute; left: 76px; top: 14px; z-index: 900; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 0; border-radius: 8px; background: rgba(6,14,24,0.8); border: 1px solid var(--panel-edge); }
.snd-btn { padding: 6px 10px; border: 0; background: transparent; font-weight: 700; font-size: 13px; color: var(--ink); cursor: pointer; }
.snd-btn.is-muted { color: var(--ink-dim); text-decoration: line-through; }
.snd-vol { width: 84px; accent-color: #59b7ff; }
@media (prefers-reduced-motion: reduce) { .avatar.hl-target .avatar-ring { animation: none; } }
@media (prefers-reduced-motion: reduce) {
  .avatar.life-down .avatar-life { animation: life-tint-down 600ms ease; }
  .avatar.life-up .avatar-life { animation: life-tint-up 600ms ease; }
}
@keyframes life-tint-down { 25% { color: #ff6b6b; } }
@keyframes life-tint-up { 25% { color: #7dffa8; } }
/* PROTOCOL v1.6: full floating pool + mana undo */
.avatar-pool { align-items: center; }
.pool-col { display: inline-flex; align-items: center; gap: 1px; }
.pool-n { font-size: 12px; font-weight: 800; margin-left: 1px; color: #e8f4ff; text-shadow: 0 1px 2px #000; }
.btn-undo { position: absolute; left: 1250px; top: 816px; width: 72px; height: 36px; border-radius: 8px; z-index: 800; font-size: 13px; font-weight: 800;
  background: rgba(6,14,24,0.85); border: 1.5px solid rgba(200,230,250,0.6); color: #e8f4ff; cursor: pointer; }
.btn-undo:hover { background: rgba(30,60,90,0.9); }
.btn-undo[hidden] { display: none; }
/* v1.6: the floating pool sat under the name, behind your hand fan; now a pill above your ring / beside the opponent's */
.avatar .avatar-pool { position: absolute; z-index: 5; padding: 3px 8px; border-radius: 14px; white-space: nowrap; gap: 4px; }
.avatar .avatar-pool:not(:empty) { background: rgba(6,14,24,0.88); border: 1.5px solid rgba(200,230,250,0.55); box-shadow: 0 4px 14px rgba(0,0,0,0.5); }
.avatar .avatar-pool svg { width: 20px; height: 20px; }
.avatar-you .avatar-pool { left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); }
.avatar-opp .avatar-pool { left: calc(100% + 4px); top: 34px; }
/* PROTOCOL v2.1 gear menu (lives in #overlay) */
.game-gear { position: absolute; left: 1544px; top: 12px; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(6,14,24,0.8); border: 1px solid var(--panel-edge); color: #cfe6f7; cursor: pointer; }
.game-gear:hover { background: rgba(30,60,90,0.9); color: #fff; }
.game-menu { position: absolute; left: 1412px; top: 60px; width: 174px; padding: 6px; border-radius: 12px; display: flex; flex-direction: column; gap: 4px;
  background: var(--panel); border: 1px solid var(--panel-edge); box-shadow: 0 14px 40px rgba(0,0,0,0.6); }
.game-menu-item { text-align: left; padding: 10px 14px; border-radius: 8px; border: 0; background: transparent; color: #e8f4ff; font-weight: 700; font-size: 15px; cursor: pointer; }
.game-menu-item:hover:not(:disabled) { background: rgba(80,140,200,0.22); }
.game-menu-item:disabled { opacity: 0.4; cursor: default; }
.game-gear, .game-menu { z-index: 20; } /* stays reachable over prompt scrims (game over, dialogs) */
.game-confirm-scrim { z-index: 21; }
.scrim-closed { z-index: 30; }
/* BACKLOG 1r: the graveyard / exile pile holds target candidates (click to open the browser) */
.pile.pile-target .pile-frame { box-shadow: 0 0 0 3px rgba(255,140,60,0.95), 0 0 26px 8px rgba(255,120,50,0.5); border-radius: 8px; }
.pile.pile-target { animation: pulse-ring 1.1s ease-in-out infinite; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .pile.pile-target { animation: none; } }
