/* === Cipher 21 Game-Specific Styles === */

/* Cipher color palette */
:root {
  --cipher-green: #39ff14;
  --cipher-amber: #ffbf00;
  --cipher-dim: #2a6e1e;
  --cipher-bg: rgba(0, 40, 0, 0.15);
  --cracked-glow: rgba(57, 255, 20, 0.4);
}

/* Shoe info bar */
.shoe-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 2px 0;
  background: var(--cipher-bg);
  border-bottom: 1px solid var(--border);
}
.shoe-label {
  color: var(--cipher-amber);
  font-weight: 700;
}
.shoe-sep {
  opacity: 0.4;
}
.key-status {
  color: var(--cipher-green);
}
.cipher-lock {
  font-size: 11px;
}
.key-status.cracked {
  color: var(--cipher-green);
  text-shadow: 0 0 6px var(--cracked-glow);
}
.key-status.cracked .cipher-lock {
  display: none;
}

/* Value badge (replaces res-badge for blackjack) */
.val-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.val-badge.vq {
  color: var(--text-muted);
}
.val-badge.vgood {
  color: var(--win);
  border-color: var(--win);
}
.val-badge.vdanger {
  color: var(--lose);
  border-color: var(--lose);
}
.val-badge.vbj {
  color: var(--gold);
  border-color: var(--gold);
  text-shadow: 0 0 6px var(--gold);
}
.val-badge.pop {
  animation: popBadge 0.3s ease;
}
@keyframes popBadge {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

/* Encrypted card pip */
.enc-pip {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--cipher-green);
  border: 1px solid rgba(57, 255, 20, 0.3);
  white-space: nowrap;
  letter-spacing: 0.5px;
}
.enc-pip.cracked {
  color: var(--gold);
  border-color: rgba(255, 191, 0, 0.4);
  background: rgba(0, 0, 0, 0.8);
}

/* Card in cracked state */
.card.cipher-cracked {
  box-shadow:
    0 0 8px var(--cracked-glow),
    0 1px 3px rgba(0, 0, 0, 0.25);
}
.card.cipher-cracked .card-rank {
  position: relative;
}
.card.cipher-cracked .true-rank-overlay {
  position: absolute;
  top: -2px;
  right: -8px;
  font-size: 8px;
  color: var(--cipher-green);
  background: rgba(0, 0, 0, 0.8);
  border-radius: 2px;
  padding: 0 2px;
}

/* Cipher action row */
.cipher-row {
  margin-top: 4px;
}
.cipher-btn {
  background: var(--cipher-bg) !important;
  border-color: var(--cipher-dim) !important;
  color: var(--cipher-green) !important;
  font-size: 12px !important;
}
.cipher-btn:hover:not(:disabled) {
  border-color: var(--cipher-green) !important;
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.2);
}
.cipher-btn:disabled {
  opacity: 0.35 !important;
  color: var(--cipher-dim) !important;
}

/* Crack modal - key grid */
.cipher-modal {
  text-align: center;
}
.cipher-prompt {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cipher-green);
  margin: 8px 0;
}
.key-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  max-width: 220px;
  margin: 10px auto;
}
.key-btn {
  padding: 10px 4px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--cipher-green);
  border: 2px solid var(--border);
  transition: all 0.15s;
}
.key-btn:hover {
  border-color: var(--cipher-green);
  background: var(--cipher-bg);
}
.key-btn.selected {
  border-color: var(--cipher-green);
  background: rgba(57, 255, 20, 0.15);
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}

/* Plaintext attack modal */
.plain-card-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 8px 0;
  flex-wrap: wrap;
}
.plain-card-btn {
  padding: 6px 10px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 2px solid var(--border);
  transition: all 0.15s;
  min-width: 38px;
}
.plain-card-btn:hover {
  border-color: var(--cipher-amber);
}
.plain-card-btn.selected {
  border-color: var(--cipher-amber);
  background: rgba(255, 191, 0, 0.1);
  color: var(--cipher-amber);
}
.rank-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  max-width: 260px;
  margin: 8px auto;
}
.rank-btn {
  padding: 8px 4px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--cipher-amber);
  border: 2px solid var(--border);
  transition: all 0.15s;
}
.rank-btn:hover {
  border-color: var(--cipher-amber);
}
.rank-btn.selected {
  border-color: var(--cipher-amber);
  background: rgba(255, 191, 0, 0.15);
  box-shadow: 0 0 8px rgba(255, 191, 0, 0.2);
}

/* Frequency chart */
.freq-modal {
  max-width: 360px;
}
.freq-chart {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 140px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.freq-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.freq-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--cipher-green);
  opacity: 0.8;
  transition: height 0.4s ease;
}
.freq-label {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-muted);
  white-space: nowrap;
}
.freq-count {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--cipher-green);
}

/* Split hand */
.split-hand {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}
.split-indicator {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--cipher-amber);
  margin-left: 8px;
  letter-spacing: 0.5px;
}

/* Bust shake */
@keyframes bust-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  50%,
  90% {
    transform: translateX(-3px);
  }
  30%,
  70% {
    transform: translateX(3px);
  }
}
.card.busted {
  animation: bust-shake 0.4s ease;
  box-shadow:
    0 0 12px var(--lose),
    0 0 24px rgba(224, 64, 96, 0.3) !important;
}

/* History row */
.history-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeSlideUp 0.4s ease-out both;
}
.hist-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  opacity: 0.85;
}

/* Blackjack glow on natural */
@keyframes bj-glow {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(255, 191, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 16px rgba(255, 191, 0, 0.6);
  }
}
.card.blackjack-card {
  animation: bj-glow 1.5s ease-in-out infinite;
}
