/**
 * modal-base.css - Dialog Backdrop, Modal Box Containers, Headers, Rules, and Victory Screen
 */

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: oklch(0.1 0.02 264 / 0.62);
  backdrop-filter: blur(8px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

#confirm-home-modal {
  z-index: 2000;
}

.modal-confirm-home {
  max-width: 420px;
  text-align: center;
  gap: 18px;
}

.confirm-home-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-home-actions .btn-glass {
  min-width: 120px;
}

.confirm-home-warning {
  display: none;
  background: oklch(0.25 0.08 30 / 0.85);
  border: 1px solid oklch(0.65 0.2 35 / 0.85);
  border-radius: var(--radius-md, 8px);
  padding: 12px 14px;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #ffb4a2;
  text-align: left;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.confirm-home-warning.active {
  display: flex;
}

.confirm-home-warning .warning-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1.2;
}

.modal-box {
  background: oklch(0.2 0.014 264 / 0.94);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.trade-inputs-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.trade-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.trade-res-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  color: #ffffff;
  width: 100%;
  text-align: center;
}

.trade-res-tag.res-wood {
  background: var(--res-wood);
}

.trade-res-tag.res-brick {
  background: var(--res-brick);
}

.trade-res-tag.res-wool {
  background: var(--res-wool);
}

.trade-res-tag.res-wheat {
  background: var(--res-wheat);
}

.trade-res-tag.res-ore {
  background: var(--res-ore);
}

.trade-field .form-input {
  width: 100%;
  text-align: center;
  padding: 6px 4px;
  font-weight: 700;
}

.rules-badge {
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  color: #ffffff;
}

.rules-badge.wood {
  background: var(--res-wood);
}

.rules-badge.brick {
  background: var(--res-brick);
}

.rules-badge.wool {
  background: var(--res-wool);
}

.rules-badge.wheat {
  background: var(--res-wheat);
}

.rules-badge.ore {
  background: var(--res-ore);
}

.victory-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.3);
  color: var(--gold-primary);
}

.victory-icon-badge .ico {
  font-size: 40px;
}

/* Badge count on buttons (e.g. dev cards in hand) */
.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--gold-primary);
  color: var(--gold-foreground);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  margin-left: 6px;
}

/* Segmented Tabs */
.segmented-tabs {
  display: flex;
  background: oklch(0 0 0 / 0.32);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}

.segmented-tab {
  flex: 1;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.segmented-tab:hover {
  color: var(--text-primary);
}

.segmented-tab.active {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}


.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-header-row.tight {
  margin-bottom: 8px;
}

.modal-header-row.mid {
  margin-bottom: 10px;
}

.modal-header-row.loose {
  margin-bottom: 12px;
}

.modal-title {
  margin: 0;
}

.modal-title.danger {
  color: var(--crimson-accent);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}


.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.section-head-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-primary);
}

.section-head-hint {
  font-size: 11px;
  color: var(--text-secondary);
}

.modal-actions-end {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.modal-box.modal-sm {
  max-width: 420px;
  width: 94%;
}

.modal-box.modal-md {
  max-width: 440px;
  width: 94%;
}

.modal-box.modal-lg {
  max-width: 480px;
  width: 94%;
}

.modal-box.modal-xl {
  max-width: 560px;
  width: 94%;
}

.modal-box.modal-rules {
  max-width: 680px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-lede {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.modal-lede.tight {
  margin-bottom: 8px;
}


.btn-modal-close-block {
  margin-top: 8px;
  width: 100%;
}

.field-label-sm {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.form-select.full-width {
  width: 100%;
}

.rules-copy {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rules-copy strong {
  color: var(--text-primary);
}

.btn-after-copy {
  margin-top: 12px;
}

.modal-box.victory-box {
  text-align: center;
  align-items: center;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10001;
  width: 100vw;
  height: 100vh;
}

.victory-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  width: 100%;
  margin: 18px 0;
}

.victory-stat-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.victory-stat-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-primary, #f59e0b);
}

.victory-stat-lbl {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.victory-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  width: 100%;
}

.victory-icon-badge {
  margin-bottom: 8px;
}

.victory-avatar-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0 14px;
}

.victory-winner-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold-primary);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

.victory-message {
  font-size: 18px;
  margin: 12px 0;
}

.victory-winner-name {
  color: var(--gold-primary);
}

.btn-play-again {
  padding: 14px 28px;
  font-size: 16px;
  margin: 0 auto;
}
