/* Lobby */
.lobby-panel {
  max-width: 600px;
  margin: 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
}

.lobby-panel h2 {
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
}
.lobby-panel h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-dim);
}

.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  font-weight: 500;
}
.form-group input,
.form-group select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  width: 100%;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.aspect-checks {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.aspect-checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.aspect-checks label:hover {
  border-color: var(--text-dim);
}
.aspect-checks label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.aspect-checks input {
  display: none;
}

.lobby-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.lobby-big-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Draft mode selector */
.draft-mode-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
label.draft-mode-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  flex: 1;
  min-width: 120px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 0;
}
label.draft-mode-option:hover {
  border-color: var(--text-dim);
}
label.draft-mode-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.draft-mode-option input {
  display: none;
}
.draft-mode-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.draft-mode-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.lobby-big-btn {
  flex: 1;
  padding: 1.5rem 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.lobby-big-btn svg {
  width: 1.8rem;
  height: 1.8rem;
}

.lobby-big-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

.deck-info {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.deck-preview {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  margin-bottom: 0.75rem;
  text-align: left;
}
.deck-preview .discard-item {
  border-left: 3px solid var(--deck-preview-color, var(--border));
}
.deck-preview-count {
  font-weight: 700;
  font-size: 0.75rem;
  background: var(--surface-hover);
  padding: 0.1rem 0.35rem;
  border-radius: 9999px;
}

/* Draft panel */
.draft-panel {
  max-width: 620px;
  text-align: center;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#aspect-phase {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

/* Draft timeline — 6 step indicators */
.draft-timeline {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.draft-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  min-width: 3.5rem;
  opacity: 0.35;
  transition: all var(--transition);
}
.draft-step.completed {
  opacity: 0.75;
  border-color: var(--text-dim);
}
.draft-step.completed.ban {
  border-color: #ff6b6b55;
}
.draft-step.active {
  opacity: 1;
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 10px var(--accent-glow);
}
.draft-step-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-dim);
}
.draft-step.ban .draft-step-label {
  color: #ff6b6b;
}
.draft-step-player {
  font-size: 0.72rem;
  font-weight: 600;
}
.draft-step-player.you {
  color: var(--accent);
}
.draft-step-player.opp {
  color: var(--text-dim);
}
.draft-step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.draft-step-icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* Draft prompt text */
.draft-prompt-text {
  font-size: 1rem;
  margin-bottom: 1.25rem;
  color: var(--text);
  font-weight: 500;
}
.draft-prompt-text.your-turn {
  color: var(--accent);
}
.draft-prompt-text.waiting {
  color: var(--text-dim);
}
.draft-prompt-text.done {
  color: #6bcb77;
}

/* Draft domain grid */
.draft-domains {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  justify-items: center;
  margin-bottom: 1rem;
}

.draft-domain-btn {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  transition: all var(--transition);
  padding: 0;
}
.draft-domain-btn svg {
  width: 1.6rem;
  height: 1.6rem;
}
.draft-domain-name {
  font-size: 0.55rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.draft-domain-btn.available {
  cursor: pointer;
}
.draft-domain-btn.available:hover {
  background: var(--surface-hover);
  transform: scale(1.1);
  box-shadow: 0 0 12px currentColor;
}

.draft-domain-btn.banned {
  opacity: 0.25;
  border-style: dashed;
  border-color: #ff6b6b;
  text-decoration: line-through;
  cursor: not-allowed;
}

.draft-domain-btn.my-pick {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: default;
}

.draft-domain-btn.opp-pick {
  opacity: 0.4;
  border-color: var(--text-dim);
  cursor: default;
}

.draft-domain-btn:disabled:not(.banned):not(.my-pick):not(.opp-pick):not(
    .coming-soon
  ) {
  opacity: 0.5;
  cursor: not-allowed;
}

.draft-domain-btn.coming-soon {
  opacity: 0.3;
  border-style: dashed;
  border-color: var(--text-dim);
  color: var(--text-dim) !important;
  cursor: default;
  position: relative;
}

.coming-soon-label {
  display: block;
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-top: 0.1rem;
}

/* Aspect selection after draft */
.draft-domain-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.draft-domain-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  border: 2px solid;
}
.draft-domain-badge svg {
  width: 1rem;
  height: 1rem;
}
.aspect-count {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 400;
}

#btn-swap-domains {
  margin-bottom: 1rem;
}
.deck-select-status {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  min-height: 1.2em;
}

.game-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.game-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}
.game-list-empty {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.join-group {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.join-group label {
  flex-shrink: 0;
}
.join-group input {
  flex: 1;
}
.join-group button {
  flex-shrink: 0;
}

.hint {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.join-url-box {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
}
.join-url-box input {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: monospace;
}
.join-url-box button {
  flex-shrink: 0;
}

/* Buttons */
button {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.55rem 1.3rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
}
button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-glow);
}
button:active:not(:disabled) {
  transform: scale(0.97);
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Primary button style */
button.btn-primary,
#btn-create,
#btn-ai {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
#btn-create:hover:not(:disabled),
#btn-ai:hover:not(:disabled),
button.btn-primary:hover:not(:disabled) {
  background: #5a7ae8;
  border-color: #5a7ae8;
  box-shadow: 0 2px 12px rgba(108, 140, 255, 0.25);
}

/* Game Board */
.board {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);
  position: relative;
}

.board-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 52px);
}

.board-scrollable {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 1;
}

.player-area {
  min-height: 120px;
  display: flex;
  flex-direction: column;
}

/* Opponent area is slightly dimmed to create hierarchy */
.opponent-area {
  opacity: 0.88;
}
.opponent-area:hover {
  opacity: 1;
}

.player-stats {
  display: flex;
  gap: 1.25rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  align-items: center;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.stat-value {
  font-weight: 700;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stat-integrity .stat-value {
  color: #ff6b6b;
}
.stat-power .stat-value {
  color: #ffd93d;
}
.stat-energy .stat-value {
  color: #6bcb77;
}

.player-name {
  font-weight: 600;
  margin-right: auto;
  font-size: 0.95rem;
}

.zone-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.5rem;
  font-weight: 600;
}

.field-row {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
}

.play-zone {
  flex: 1;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  align-items: flex-start;
  flex-wrap: wrap;
  align-content: flex-start;
  transition: background var(--transition);
}

/* Board divider — turn/round info */
.board-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  padding: 0.4rem 1rem;
  margin: 0.25rem 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  transition: all 0.3s ease;
}

/* Turn indicator on the divider */
.your-turn .board-divider {
  border-color: rgba(108, 140, 255, 0.3);
  background: rgba(108, 140, 255, 0.06);
}
.your-turn #turn-info {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}
#turn-info {
  transition: color var(--transition);
}
#round-info {
  font-weight: 500;
}

/* Connection indicator dot */
.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4444;
  margin-left: auto;
  flex-shrink: 0;
  transition:
    opacity 1s ease,
    background 0.3s ease;
}
.conn-dot.connected {
  background: #6bcb77;
}
.conn-dot.reconnecting {
  background: #f0c040;
  animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
.conn-dot.fade-out {
  opacity: 0;
}

/* Hand */
.hand-area {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

.hand-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 0.2rem 0.5rem;
  gap: 0.3rem;
}
.hand-header .zone-label {
  padding: 0;
}
.hand-header:hover .zone-label {
  color: var(--text);
}
.hand-toggle-icon {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-left: 0.3rem;
  transition: transform 0.2s ease;
}
.hand-area.collapsed .hand-toggle-icon {
  transform: rotate(-90deg);
}
.hand-area.collapsed .hand-zone {
  display: none;
}

.hand-zone {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  overflow-x: auto;
  flex-wrap: wrap;
  min-height: 0;
}

/* Cards in game zones */
.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  width: 140px;
  min-width: 140px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(108, 140, 255, 0.1);
}
.game-card.tapped {
  transform: rotate(6deg);
  opacity: 0.6;
}
.game-card.tapped:hover {
  opacity: 0.8;
}
.game-card.selected {
  border-color: #ffd93d;
  box-shadow: 0 0 12px rgba(255, 217, 61, 0.35);
}

.game-card-name {
  font-weight: 600;
  font-size: 0.82rem;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.game-card-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.game-card-cost {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--accent);
}

.game-card-strength {
  color: #ff8888;
  font-weight: 700;
  font-size: 0.85rem;
}

.game-card-type {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.game-card-text {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.4;
  max-height: 3rem;
  overflow: hidden;
  white-space: pre-line;
  mask-image: linear-gradient(to bottom, #000 50%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent);
}

/* Hand cards are bigger and feel "liftable" */
.hand-zone .game-card {
  width: 140px;
  min-width: 0;
  flex: 0 0 140px;
  transition: all var(--transition);
}
.hand-zone .game-card:hover {
  transform: translateY(-10px);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.4),
    0 0 15px rgba(108, 140, 255, 0.12);
  z-index: 10;
}
.hand-zone .game-card-text {
  max-height: 4rem;
}

/* Hidden card (opponent hand) */
.game-card-hidden {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 50px;
  min-width: 50px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 1.2rem;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(255, 255, 255, 0.02) 4px,
    rgba(255, 255, 255, 0.02) 8px
  );
}

/* Domain borders on game cards */
.game-card.domain-Лес {
  border-left: 3px solid var(--forest);
}
.game-card.domain-Искры {
  border-left: 3px solid var(--sparks);
}
.game-card.domain-Ледник {
  border-left: 3px solid var(--glacier);
}
.game-card.domain-Вулкан {
  border-left: 3px solid var(--volcano);
}
.game-card.domain-Океан {
  border-left: 3px solid var(--ocean);
}
.game-card.domain-Ветер {
  border-left: 3px solid var(--wind);
}
.game-card.domain-Пустошь {
  border-left: 3px solid var(--wasteland);
}
.game-card.domain-Звёзды {
  border-left: 3px solid var(--stars);
}

/* Token cards (face-down creatures) */
.game-card.token-card {
  background: var(--surface-hover);
  border-left: 3px solid #888;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(255, 255, 255, 0.03) 8px,
    rgba(255, 255, 255, 0.03) 16px
  );
}
.game-card.token-card .game-card-name {
  font-style: italic;
  color: var(--text-dim);
}
.game-card.token-card .token-inspect {
  font-size: 0.6rem;
  color: var(--accent);
  cursor: pointer;
}

/* Playable-from-zone cards (right of field) */
.playable-zones {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
}
.playable-zones.hidden {
  display: none;
}
.playable-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.playable-section-header {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 2px;
}
.playable-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 100px;
  position: relative;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.playable-card:hover {
  border-color: var(--accent);
}
.playable-card.can-play {
  border-color: #ffd93d;
  box-shadow: 0 0 6px rgba(255, 217, 61, 0.2);
}
.playable-card-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.playable-card-name {
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playable-timer {
  font-size: 0.65rem;
  color: var(--text-dim);
}
/* Domain borders on playable cards */
.playable-card.domain-Лес {
  border-left: 3px solid var(--forest);
}
.playable-card.domain-Искры {
  border-left: 3px solid var(--sparks);
}
.playable-card.domain-Ледник {
  border-left: 3px solid var(--glacier);
}
.playable-card.domain-Вулкан {
  border-left: 3px solid var(--volcano);
}
.playable-card.domain-Океан {
  border-left: 3px solid var(--ocean);
}
.playable-card.domain-Ветер {
  border-left: 3px solid var(--wind);
}
.playable-card.domain-Пустошь {
  border-left: 3px solid var(--wasteland);
}
.playable-card.domain-Звёзды {
  border-left: 3px solid var(--stars);
}

/* Action bar — horizontal, between field and hand */
.action-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.action-bar button {
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  text-align: center;
  white-space: nowrap;
}

.btn-log-toggle {
  margin-left: auto;
  font-size: 0.78rem;
  padding: 0.4rem 0.7rem;
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-log-toggle:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-dim);
}

/* Turn-aware action bar: highlight active buttons */
.your-turn .action-bar button:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.your-turn .action-bar button:not(:disabled):hover {
  background: rgba(108, 140, 255, 0.22);
  box-shadow: 0 0 8px rgba(108, 140, 255, 0.15);
}

/* Pass button emphasis during your turn */
.your-turn #btn-pass:not(:disabled) {
  background: rgba(108, 140, 255, 0.1);
}

/* Attack confirm mode */
.your-turn .action-bar #btn-attack.confirm-mode:not(:disabled) {
  background: rgba(255, 68, 68, 0.15);
  border-color: #ff4444;
  color: #ff8888;
}

/* Attack all shortcut */
#btn-attack-all {
  background: rgba(255, 68, 68, 0.15);
  border-color: #ff4444;
  color: #ff8888;
  font-size: 0.8rem;
}
#btn-attack-all:hover {
  background: rgba(255, 68, 68, 0.25);
}

/* Cancel button - always visible styling */
#btn-cancel {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
  font-size: 0.8rem;
}
#btn-cancel:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
}

/* Confirm block button styling */
#btn-confirm-block {
  background: rgba(68, 170, 255, 0.15);
  border-color: #44aaff;
  color: #88ccff;
}
#btn-confirm-block:hover:not(:disabled) {
  background: rgba(68, 170, 255, 0.25);
  box-shadow: 0 0 8px rgba(68, 170, 255, 0.2);
}

/* Combat states */
.game-card.attacking {
  border-color: #ff4444;
  box-shadow: 0 0 12px rgba(255, 68, 68, 0.3);
  animation: pulse-attack 1.5s ease-in-out infinite;
}

@keyframes pulse-attack {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.2);
  }
  50% {
    box-shadow: 0 0 16px rgba(255, 68, 68, 0.4);
  }
}

.game-card.blocking {
  border-color: #44aaff;
  box-shadow: 0 0 12px rgba(68, 170, 255, 0.3);
}

.blocker-badge {
  position: absolute;
  bottom: -0.2rem;
  left: 0;
  right: 0;
  background: rgba(68, 170, 255, 0.9);
  color: #fff;
  font-size: 0.6rem;
  padding: 0.15rem 0.3rem;
  border-radius: 0 0 6px 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Discard stack */
.discard-stack {
  min-width: 85px;
  max-width: 105px;
  padding: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  transition: all var(--transition);
  align-self: center;
  flex-shrink: 0;
}
.discard-stack:not(.empty) {
  cursor: pointer;
}
.discard-stack:not(.empty):hover {
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: scale(1.03);
}
.discard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}
.discard-top-name {
  font-size: 0.7rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: left;
}
.discard-count {
  background: var(--accent);
  color: white;
  border-radius: 50%;
  min-width: 1.3rem;
  height: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.discard-label {
  display: block;
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.discard-empty {
  font-size: 0.7rem;
}

/* Discard modal */
.discard-modal-content {
  max-height: 80vh;
  overflow-y: auto;
  max-width: 450px;
}
.discard-modal-content h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}
.discard-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.discard-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.discard-item:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}
.discard-item-cost {
  font-weight: 700;
  font-size: 0.82rem;
  min-width: 1.5ch;
  text-align: center;
  color: var(--accent);
}
.discard-item-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
}
.discard-item-type {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.discard-item-str {
  font-weight: 700;
  font-size: 0.82rem;
  color: #ef4444;
}

/* Zone stacks column (deck + discard + exile) */
.zone-stacks {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-self: center;
  flex-shrink: 0;
}

/* Playable card highlight (gold) in zone browser */
.discard-item.playable-highlight {
  border-color: #d4a017;
  background: rgba(212, 160, 23, 0.12);
  box-shadow: 0 0 6px rgba(212, 160, 23, 0.3);
}
.discard-item.playable-highlight:hover {
  border-color: #e6b422;
  background: rgba(212, 160, 23, 0.2);
}

/* Effect overlay */
.effect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.effect-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: modal-enter 0.2s ease-out;
}
.effect-prompt {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text);
  line-height: 1.4;
  padding-right: 3.5rem;
}
.effect-options,
.effect-targets {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.btn-effect-option,
.btn-effect-target {
  padding: 0.65rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 0.88rem;
  transition: all var(--transition);
}
.btn-effect-option:hover,
.btn-effect-target:hover {
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.05);
}
.btn-effect-option.selected,
.btn-effect-target.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 8px rgba(108, 140, 255, 0.1);
}
.effect-choice-count {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.btn-effect-confirm,
.btn-effect-skip {
  padding: 0.55rem 1.3rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.88rem;
  margin-right: 0.5rem;
  font-weight: 500;
  transition: all var(--transition);
}
.btn-effect-confirm {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-effect-confirm:hover:not(:disabled) {
  background: #5a7ae8;
  box-shadow: 0 2px 12px rgba(108, 140, 255, 0.25);
}
.btn-effect-confirm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-effect-skip {
  background: var(--bg);
  color: var(--text-dim);
}
.btn-effect-skip:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

/* Minimized overlay */
.effect-overlay.minimized {
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 80px;
}
.effect-overlay.minimized .effect-panel {
  pointer-events: auto;
  max-width: none;
  width: auto;
  padding: 0.45rem 1rem;
  cursor: pointer;
  animation: none;
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(108, 140, 255, 0.25);
}
.effect-overlay.minimized .effect-panel > *:not(.overlay-minimized-label) {
  display: none;
}
.overlay-minimized-label {
  display: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.effect-overlay.minimized .overlay-minimized-label {
  display: block;
}
.btn-minimize-overlay {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 1;
}
.btn-minimize-overlay:hover {
  color: var(--text);
  border-color: var(--text);
}

/* Field targeting mode */
.game-card.targetable {
  cursor: crosshair;
  box-shadow: 0 0 8px rgba(255, 180, 50, 0.5);
  border-color: #e6b422;
  animation: target-pulse 1.5s ease-in-out infinite;
}
.game-card.targetable:hover {
  box-shadow: 0 0 14px rgba(255, 180, 50, 0.7);
  border-color: #ffd060;
}
.game-card.target-selected {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(108, 140, 255, 0.5);
  animation: none;
}
.player-stats.targetable {
  cursor: crosshair;
  box-shadow: 0 0 8px rgba(255, 180, 50, 0.5);
  border: 1px solid #e6b422;
  border-radius: 8px;
  animation: target-pulse 1.5s ease-in-out infinite;
}
.player-stats.targetable:hover {
  box-shadow: 0 0 14px rgba(255, 180, 50, 0.7);
}
.player-stats.target-selected {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(108, 140, 255, 0.5);
  animation: none;
}
@keyframes target-pulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(255, 180, 50, 0.4);
  }
  50% {
    box-shadow: 0 0 16px rgba(255, 180, 50, 0.7);
  }
}

.targeting-bar {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.6rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 90;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: fade-in 0.15s ease-out;
}
.targeting-prompt {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

/* X-cost dialog */
.x-cost-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.x-cost-controls input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 2rem;
}
.x-cost-controls span {
  font-size: 1.3rem;
  font-weight: 700;
  min-width: 2ch;
  text-align: center;
  color: var(--accent);
}
.x-cost-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.x-btn {
  min-width: 3rem;
  height: 3rem;
  font-size: 1.3rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}
.x-btn:hover {
  border-color: var(--accent);
}
.x-btn.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Game log */
.game-log {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 30vh;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-top: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.25s ease;
  transform: translateY(0);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}
.game-log.collapsed {
  transform: translateY(100%);
  box-shadow: none;
  pointer-events: none;
}
.game-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  background: var(--surface);
  transition: color var(--transition);
}
.game-log-header:hover {
  color: var(--text);
}
.game-log-toggle-icon {
  font-size: 0.65rem;
  transition: transform 0.25s ease;
}
.game-log.collapsed .game-log-toggle-icon {
  transform: rotate(-90deg);
}
.game-log-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0.75rem 0.6rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-dim);
  scroll-behavior: smooth;
}
.game-log-entry {
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.game-log-entry.log-round {
  color: var(--accent);
  font-weight: 700;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(108, 140, 255, 0.15);
  border-bottom: none;
  font-size: 0.8rem;
}

/* Ability button on cards */
.btn-ability {
  position: absolute;
  bottom: 3px;
  left: 3px;
  right: 3px;
  padding: 4px 0;
  font-size: 0.7rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  z-index: 5;
  font-weight: 600;
  transition: all var(--transition);
  text-align: center;
}
.btn-ability:hover:not(:disabled) {
  background: #5a7ae8;
  box-shadow: 0 0 6px rgba(108, 140, 255, 0.3);
}
.btn-ability:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Game-over modal */
#game-over .modal-content {
  text-align: center;
  padding: 2.5rem 2rem;
}
#game-over h2 {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
}
#game-over p {
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  font-size: 1rem;
}
#game-over button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  padding: 0.65rem 2rem;
  font-size: 1rem;
}

/* Toast notification */
#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text);
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
#toast.toast-enter {
  animation: toast-in 0.25s ease-out forwards;
}
#toast.toast-exit {
  animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
}

/* Card context menu */
.card-context-menu {
  position: fixed;
  z-index: 300;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  min-width: 180px;
  padding: 0.3rem 0;
  animation: fade-in 0.1s ease-out;
}
.card-context-menu-item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.85rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}
.card-context-menu-item:hover {
  background: var(--accent-glow);
  color: var(--accent);
}
.card-context-menu-item:disabled {
  color: var(--text-dim);
  opacity: 0.4;
  cursor: not-allowed;
}
.card-context-menu-item:disabled:hover {
  background: none;
  color: var(--text-dim);
}
.card-context-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

/* Your-area emphasis when it's your turn */
.your-turn .your-area .play-zone {
  border-color: rgba(108, 140, 255, 0.2);
  background: rgba(108, 140, 255, 0.02);
}

/* Hand area glow during your turn */
.your-turn .hand-zone {
  background: rgba(108, 140, 255, 0.02);
  border-radius: 8px;
}

/* Adapt mode styling */
.your-turn .hand-zone .game-card[style*="crosshair"] {
  border-color: #ffd93d;
}

/* Waiting screen */
#waiting .lobby-panel {
  text-align: center;
}
#waiting h2 {
  color: var(--accent);
}
#waiting .hint {
  margin-top: 0.75rem;
}

/* Bug report floating button */
.bug-report-btn {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  transition: all var(--transition);
  padding: 0;
}
.bug-report-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--surface-hover);
  transform: scale(1.1);
}

/* Resign button */
.btn-resign {
  position: fixed;
  bottom: 1.2rem;
  left: 1.2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  transition: all var(--transition);
  font-size: 1.3rem;
  padding: 0;
}
.btn-resign:hover {
  color: #ff8888;
  border-color: #ff4444;
  background: rgba(255, 68, 68, 0.1);
  transform: scale(1.1);
}

/* Danger button */
.btn-danger {
  background: rgba(255, 68, 68, 0.2);
  border-color: #ff4444;
  color: #ff8888;
}
.btn-danger:hover {
  background: rgba(255, 68, 68, 0.35);
  box-shadow: 0 0 8px rgba(255, 68, 68, 0.3);
}

/* Resign modal */
.resign-modal-content {
  max-width: 380px;
}

/* Bug report modal */
.bug-report-content {
  max-width: 400px;
}
.bug-report-content h3 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}
.bug-report-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.bug-report-content textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  width: 100%;
  resize: vertical;
  font-family: inherit;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.bug-report-content textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.bug-report-status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  min-height: 1.2em;
}
.bug-report-status.success {
  color: #6bcb77;
}
.bug-report-status.error {
  color: #ff6b6b;
}

/* ---- Mobile (<768px) ---- */
@media (max-width: 768px) {
  /* Shrink game cards */
  .game-card {
    width: 95px;
    min-width: 95px;
    padding: 0.35rem;
    font-size: 0.65rem;
  }
  .game-card-name {
    font-size: 0.7rem;
  }
  .game-card-cost {
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.6rem;
  }
  .game-card-strength {
    font-size: 0.72rem;
  }
  .game-card-type {
    font-size: 0.55rem;
  }
  .game-card-text {
    display: none;
  }

  /* Hand cards — wrap into multiple rows on mobile */
  .hand-zone .game-card {
    width: 100px;
    min-width: 0;
    flex: 0 0 100px;
  }
  .hand-zone {
    min-height: 0;
    flex-wrap: wrap;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .hand-area {
    max-height: 30vh;
    overflow-y: auto;
  }
  .hand-zone .game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  }
  .hand-zone .game-card-text {
    display: block;
    max-height: 2rem;
  }

  /* Zone stacks — smaller */
  .discard-stack {
    min-width: 65px;
    max-width: 75px;
    padding: 0.3rem;
    font-size: 0.65rem;
  }

  /* Playable zone cards — smaller */
  .playable-card {
    min-width: 75px;
    padding: 3px 6px;
  }
  .playable-card-name {
    font-size: 0.6rem;
  }

  /* Stats bar — tighter */
  .player-stats {
    padding: 0.3rem 0.5rem;
    gap: 0.75rem;
    font-size: 0.8rem;
  }
  .stat-value {
    font-size: 1rem;
  }
  .stat-label {
    font-size: 0.6rem;
  }
  .player-name {
    font-size: 0.85rem;
  }

  /* Action bar — full width, smaller buttons */
  .action-bar {
    padding: 0.4rem;
    gap: 0.35rem;
  }
  .action-bar button {
    font-size: 0.78rem;
    padding: 0.45rem 0.7rem;
  }

  /* Board divider — tighter */
  .board-divider {
    padding: 0.3rem 0.5rem;
    gap: 0.75rem;
    font-size: 0.75rem;
  }

  /* Zone label — smaller */
  .zone-label {
    font-size: 0.6rem;
    padding: 0.15rem 0.35rem;
  }

  /* Field row — allow wrapping */
  .field-row {
    gap: 0.35rem;
  }
  .play-zone {
    gap: 0.35rem;
    padding: 0.35rem;
  }

  /* Zone stacks row on mobile */
  .zone-stacks {
    gap: 0.25rem;
  }

  /* Hidden cards (opp hand) — smaller */
  .game-card-hidden {
    width: 35px;
    min-width: 35px;
    height: 50px;
    font-size: 0.9rem;
  }

  /* Modals — near full screen */
  .modal-content {
    width: 95%;
    max-width: none;
    max-height: 90vh;
    padding: 1.25rem;
  }
  .discard-modal-content {
    max-width: none;
  }

  /* Effect panel — full width */
  .effect-panel {
    width: 95%;
    max-width: none;
    padding: 1.25rem;
  }

  /* Lobby — full width on mobile */
  .lobby-panel {
    margin: 1rem 0.5rem;
    padding: 1.25rem 1rem;
  }

  /* Game log drawer — taller on mobile */
  .game-log {
    max-height: 60vh;
  }

  /* Draft — smaller buttons on mobile */
  .draft-domain-btn {
    width: 3.5rem;
    height: 3.5rem;
  }
  .draft-domain-btn svg {
    width: 1.2rem;
    height: 1.2rem;
  }
  .draft-domain-name {
    font-size: 0.45rem;
  }
  .draft-domains {
    gap: 0.5rem;
  }
  .draft-step {
    min-width: 2.8rem;
    padding: 0.3rem 0.35rem;
  }
}
