/* css/rift.css — Endless Rift UI (Phase 4, workstream 4).
   Dark-fantasy palette, WCAG 2.1 AA: text contrast >= 4.5:1,
   visible focus indicators, keyboard-operable controls. */

.rift-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 3, 10, 0.82);
  backdrop-filter: blur(3px);
  padding: 16px;
}
.rift-overlay.hidden { display: none; }

.rift-panel {
  width: min(680px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #141021 0%, #0d0a14 100%);
  border: 2px solid #5b3a8c;
  border-radius: 12px;
  box-shadow: 0 0 42px rgba(120, 60, 220, 0.35), inset 0 0 60px rgba(0, 0, 0, 0.6);
  padding: 20px 22px 24px;
  color: #e8e4d8;
  font-family: 'Inter', system-ui, sans-serif;
}

.rift-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.rift-panel-head h2 {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: #c9a7ff;
  text-shadow: 0 0 18px rgba(150, 90, 255, 0.6);
}
.rift-close {
  background: #241a33;
  color: #e8e4d8;
  border: 1px solid #5b3a8c;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
}
.rift-close:hover { background: #3a2a52; }
.rift-close:focus-visible,
.rift-tier-btn:focus-visible,
.rift-enter:focus-visible,
.rift-pay-opt input:focus-visible + span {
  outline: 3px solid #ff8c1a;
  outline-offset: 2px;
}

.rift-lore { color: #b9b2c7; font-size: 0.92rem; line-height: 1.5; }
.rift-lore strong { color: #ffd98a; }

.rift-keystones {
  margin: 10px 0 4px;
  padding: 8px 12px;
  background: #191223;
  border: 1px solid #3d2f5c;
  border-radius: 8px;
  color: #ffd98a;
  font-size: 0.95rem;
}

.rift-locked {
  margin: 14px 0;
  padding: 16px;
  border: 1px dashed #5b3a8c;
  border-radius: 8px;
  color: #b9b2c7;
  text-align: center;
  line-height: 1.6;
}
.rift-locked.hidden, .rift-body.hidden, #rift-body.hidden { display: none; }

.rift-h {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  color: #c9a7ff;
  margin: 16px 0 8px;
  border-bottom: 1px solid #3d2f5c;
  padding-bottom: 4px;
}

.rift-tiers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 150px;
  overflow-y: auto;
  padding: 2px;
}
.rift-tier-btn {
  min-width: 44px;
  height: 40px;
  padding: 0 10px;
  background: #1c1428;
  color: #e8e4d8;
  border: 1px solid #5b3a8c;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.rift-tier-btn:hover { background: #2c2140; border-color: #8a63c9; }
.rift-tier-btn.selected {
  background: #5b2b8c;
  border-color: #ff8c1a;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 140, 26, 0.5);
}
.rift-tiers-more { color: #8f87a3; align-self: center; font-size: 0.85rem; }

.rift-preview { min-height: 64px; }
.rift-muted { color: #8f87a3; font-style: italic; }
.rift-affix-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.rift-affix-chip {
  background: #241a12;
  border: 1px solid #8c5a2b;
  color: #ffd9a8;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.88rem;
  cursor: help;
}
.rift-scale { color: #b9b2c7; font-size: 0.88rem; }
.rift-scale strong { color: #ff9c4a; }
.rift-warn { color: #ff9c4a; margin-top: 6px; font-size: 0.9rem; }

.rift-pay { display: flex; flex-direction: column; gap: 8px; }
.rift-pay-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #191223;
  border: 1px solid #3d2f5c;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  color: #e8e4d8;
}
.rift-pay-opt:hover { border-color: #8a63c9; }
.rift-pay-opt input { width: 18px; height: 18px; accent-color: #ff8c1a; }

.rift-error { color: #ff7a7a; min-height: 1.4em; margin: 8px 0; font-size: 0.92rem; }
.rift-enter { width: 100%; margin-top: 4px; }
.rift-enter:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- In-rift HUD ---- */
.rift-hud {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8000;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 10, 20, 0.88);
  border: 1px solid #5b3a8c;
  border-radius: 999px;
  padding: 6px 14px;
  color: #e8e4d8;
  font-size: 0.9rem;
  pointer-events: auto;
}
.rift-hud.hidden { display: none; }
.rift-hud-tier {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #c9a7ff;
}
.rift-hud-chip {
  font-size: 1.05rem;
  cursor: help;
  filter: drop-shadow(0 0 4px rgba(255, 140, 26, 0.6));
}
.rift-hud-pact { color: #ff7a7a; font-size: 1rem; cursor: help; }

/* ---- Tier-clear banner ---- */
.rift-banner {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(60, 20, 120, 0.25), transparent 70%);
}
.rift-banner.hidden { display: none; }
.rift-banner-card {
  text-align: center;
  background: rgba(13, 10, 20, 0.94);
  border: 2px solid #ff8c1a;
  border-radius: 14px;
  padding: 26px 44px;
  box-shadow: 0 0 60px rgba(255, 140, 26, 0.45);
  animation: rift-banner-in 0.5s ease-out;
}
.rift-banner-title {
  font-family: 'Cinzel', serif;
  font-size: 1.9rem;
  color: #ffd98a;
  letter-spacing: 0.1em;
  text-shadow: 0 0 24px rgba(255, 140, 26, 0.7);
}
.rift-banner-sub { color: #e8e4d8; margin-top: 8px; font-size: 1.05rem; }
.rift-banner-bonus { color: #ffd98a; margin-top: 6px; }
.rift-banner-rank { color: #c9a7ff; margin-top: 6px; font-weight: 700; }
@keyframes rift-banner-in {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .rift-banner-card { animation: none; }
}

/* ---- Toasts ---- */
.rift-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 9600;
  background: rgba(13, 10, 20, 0.95);
  border: 1px solid #5b3a8c;
  color: #e8e4d8;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.92rem;
  opacity: 0;
  transition: opacity 0.35s, transform 0.35s;
  max-width: 90vw;
  text-align: center;
}
.rift-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .rift-toast { transition: none; }
}
