/* =====================================================================
   XIV SRD - Redesign Stylesheet
   Layout: left sidebar + main content column
   ===================================================================== */

/* ─── App Shell ─────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: 200px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 24px;
  background:
    linear-gradient(180deg, rgba(4, 10, 18, 0.97) 0%, rgba(6, 14, 24, 0.97) 100%);
  border-right: 1px solid rgba(210, 168, 78, 0.22);
  scrollbar-width: thin;
  scrollbar-color: rgba(210, 168, 78, 0.18) transparent;
}

.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(123, 198, 255, 0.22) 20%,
    rgba(210, 168, 78, 0.48) 50%,
    rgba(123, 198, 255, 0.22) 80%,
    transparent
  );
  pointer-events: none;
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 16px 18px;
  border-bottom: 1px solid rgba(210, 168, 78, 0.12);
}

.sidebar-logo-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(43, 134, 217, 0.5));
  transition: filter 0.3s ease;
}

.sidebar-logo-img:hover {
  filter: drop-shadow(0 0 20px rgba(43, 134, 217, 0.8));
}

/* Nav */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  position: relative;
}

.sidebar-nav-item:hover {
  background: rgba(43, 134, 217, 0.1);
  border-color: rgba(123, 198, 255, 0.18);
  color: var(--text-primary);
}

.sidebar-nav-item.is-active {
  background: linear-gradient(135deg, rgba(43, 134, 217, 0.18), rgba(21, 68, 136, 0.22));
  border-color: rgba(123, 198, 255, 0.28);
  color: var(--blue-light);
}

.sidebar-nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--blue-light), var(--gold));
}

.sidebar-nav-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(43, 134, 217, 0.3));
}

/* Divider */
.sidebar-divider {
  padding: 4px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-divider-img {
  width: 100%;
  max-width: 160px;
  height: auto;
  opacity: 0.7;
}

/* Data source section */
.sidebar-data-section,
.sidebar-status-section,
.sidebar-api-section {
  padding: 10px 14px;
  border-top: 1px solid rgba(105, 146, 185, 0.1);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sidebar-source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(43, 134, 217, 0.06);
  border: 1px solid rgba(43, 134, 217, 0.12);
}

.sidebar-source-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.sidebar-source-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.06em;
}

.sidebar-source-type {
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-conn-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.sidebar-conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
  flex-shrink: 0;
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.sidebar-conn-text {
  font-size: 12px;
  color: #4ade80;
  font-weight: 600;
}

.sidebar-conn-meta {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.5;
}

.sidebar-api-value .header-usage-area {
  min-height: 0;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11px;
}

/* ─── Main Content ───────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  margin-left: 200px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-image: url("assets/ui/bg-main-shell.webp");
  background-size: cover;
  background-position: top center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Hero bg overlay so content remains readable */
.main-content::before {
  content: "";
  position: fixed;
  top: 0;
  left: 200px;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(180deg, rgba(4, 10, 18, 0.46) 0%, rgba(6, 14, 24, 0.58) 40%, rgba(6, 10, 16, 0.70) 100%);
  pointer-events: none;
  z-index: 0;
}

.main-content > * {
  position: relative;
  z-index: 1;
}

/* ─── Top Bar ────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  background: linear-gradient(180deg, rgba(4, 8, 14, 0.94) 0%, rgba(8, 16, 26, 0.88) 100%);
  border-bottom: 1px solid rgba(210, 168, 78, 0.2);
  position: relative;
}

.topbar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(123, 198, 255, 0.18) 15%,
    rgba(210, 168, 78, 0.65) 50%,
    rgba(123, 198, 255, 0.18) 85%,
    transparent 100%
  );
  pointer-events: none;
}

.topbar-identity {
  flex-shrink: 0;
}

.topbar-brand-art {
  flex: 0 1 560px;
  min-width: 240px;
  max-width: 560px;
  display: flex;
  align-items: center;
}

.topbar-brand-art img {
  display: block;
  width: min(100%, 560px);
  max-height: 74px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 0 14px rgba(43, 134, 217, 0.25)) brightness(1.04);
}

.topbar-identity h1 {
  margin: 0 0 2px;
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(210, 168, 78, 0.3);
  white-space: nowrap;
}

.topbar-subtitle {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(105, 146, 185, 0.24);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.18s ease;
  white-space: nowrap;
  width: auto;
  margin: 0;
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(123, 198, 255, 0.34);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.topbar-btn.lang-btn {
  border-color: rgba(210, 168, 78, 0.3);
  color: var(--gold-light);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.topbar-btn.lang-btn:hover {
  border-color: rgba(242, 207, 122, 0.6);
  color: #fff5d6;
}

.topbar-btn-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.75;
}

.topbar-auth {
  min-width: 0;
}

/* ─── Steps Row ──────────────────────────────────────────────────────── */
.steps-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 280px;
  gap: 16px;
  padding: 20px 28px;
  align-items: start;
}

/* ─── Step Cards ─────────────────────────────────────────────────────── */
.step-card {
  position: relative;
  overflow: visible;
}

.step-card-number {
  position: absolute;
  top: -10px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-corner-ornament {
  position: absolute;
  top: -18px;
  left: -18px;
  width: 60px;
  height: 60px;
  object-fit: contain;
  opacity: 0.7;
  pointer-events: none;
}

.step-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(210, 168, 78, 0.55);
  background: linear-gradient(135deg, rgba(210, 168, 78, 0.2), rgba(43, 134, 217, 0.14));
  color: var(--gold-light);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow:
    0 0 12px rgba(210, 168, 78, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.step-card h2 {
  margin: 8px 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: none;
  color: var(--gold-light);
}

.step-card .submessage {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.5;
}

/* Input label text */
.input-label-text {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

/* Shrink inputs in step cards */
.step-card input[type="url"],
.step-card select {
  padding: 9px 12px;
  font-size: 12px;
  border-radius: 8px;
  margin-top: 4px;
}

.step-card .player-grid {
  gap: 10px;
}

/* Label styling (text node is firstChild — do not wrap in span) */
.step-card label {
  display: block;
  margin: 12px 0 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

/* Action buttons: icon via ::before, survives JS textContent replacement */
#loadBtn::before,
#loadPlayersBtn::before,
#compareBtn::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 7px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.85;
  filter: brightness(3) saturate(0.5);
}

#loadBtn::before,
#loadPlayersBtn::before {
  background-image: url("assets/ui/icon-load.webp");
}

#compareBtn::before {
  background-image: url("assets/ui/icon-compare.webp");
}

/* Topbar button icons (also survive textContent replacement) */
#contactBtn::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 5px;
  background: url("assets/ui/icon-external.webp") center/contain no-repeat;
  opacity: 0.65;
}

#tutorialBtn::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 5px;
  background: url("assets/ui/icon-guide.webp") center/contain no-repeat;
  opacity: 0.65;
}

#langToggle::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 5px;
  background: url("assets/ui/icon-lang-switch.webp") center/contain no-repeat;
  opacity: 0.65;
}

#loadBtn,
#loadPlayersBtn,
#compareBtn {
  margin-top: 14px;
}

/* ─── Mothercrystal Panel ────────────────────────────────────────────── */
.mothercrystal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 18%),
    linear-gradient(135deg, rgba(43, 134, 217, 0.12), rgba(21, 68, 136, 0.1) 50%, rgba(8, 17, 27, 0.9));
  border: 1px solid rgba(43, 134, 217, 0.28);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), 0 0 40px rgba(43, 134, 217, 0.08) inset;
  backdrop-filter: blur(12px);
  text-align: center;
  overflow: hidden;
}

.mc-status-card,
.mc-loader-card {
  position: relative;
  z-index: 1;
  width: 100%;
  border: 1px solid rgba(123, 198, 255, 0.16);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 30%),
    rgba(4, 10, 18, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  box-sizing: border-box;
}

.mc-status-card {
  padding: 12px 12px 11px;
}

.mc-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 12px 12px;
}

.mothercrystal-panel::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(123, 198, 255, 0.5), rgba(210, 168, 78, 0.6), rgba(123, 198, 255, 0.5), transparent);
}

/* Subtle animated glow behind panel */
.mothercrystal-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(43, 134, 217, 0.1), transparent 65%);
  pointer-events: none;
  animation: mc-pulse 4s ease-in-out infinite;
}

@keyframes mc-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.mc-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  z-index: 1;
}

.mc-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(43, 134, 217, 0.6));
}

.mc-header-text {
  text-align: center;
}

.mc-title {
  font-size: clamp(18px, 1.55vw, 24px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-light);
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(59, 190, 255, 0.38);
}

.mc-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.mc-rate-limit {
  display: grid;
  gap: 5px;
  justify-items: center;
  width: min(180px, 100%);
  margin: 4px auto 0;
}

.mc-rate-track {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border: 1px solid rgba(123, 198, 255, 0.22);
  border-radius: 999px;
  background: rgba(7, 16, 28, 0.72);
}

.mc-rate-bar {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(45, 181, 163, 0.9), rgba(217, 184, 104, 0.95));
  box-shadow: 0 0 10px rgba(123, 198, 255, 0.42);
  transition: width 180ms ease;
}

.mc-crystal-wrap {
  position: relative;
  width: clamp(118px, 10vw, 150px);
  height: clamp(118px, 10vw, 150px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 8px;
  z-index: 1;
}

.mc-crystal-img {
  width: 80px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(43, 134, 217, 0.7));
  animation: crystal-float 3.5s ease-in-out infinite;
}

.crystal-loader {
  position: relative;
  width: clamp(112px, 9vw, 142px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  --loader-intensity: 0;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.crystal-loader.is-hidden,
.loading-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
}

.crystal-loader::before,
.crystal-loader::after {
  content: "";
  position: absolute;
  inset: 21%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 210, 255, 0.28), rgba(43, 134, 217, 0.08) 46%, transparent 70%);
  filter: blur(calc(7px + (16px * var(--loader-intensity))));
  opacity: calc(0.22 + (0.78 * var(--loader-intensity)));
  transform: scale(calc(0.88 + (0.42 * var(--loader-intensity))));
  transition: opacity 0.28s ease, transform 0.28s ease, filter 0.28s ease;
  z-index: 1;
}

.crystal-loader::after {
  inset: 33%;
  filter: blur(calc(12px + (20px * var(--loader-intensity))));
  opacity: calc(0.18 + (0.82 * var(--loader-intensity)));
}

.magic-circle,
.loader-crystal {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  transform-origin: center;
  pointer-events: none;
  user-select: none;
}

.magic-circle {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.46;
  z-index: 0;
  transform: translate(-50%, -50%) rotate(0deg);
  filter:
    drop-shadow(0 0 calc(5px + (36px * var(--loader-intensity))) rgba(59, 190, 255, calc(0.22 + (0.78 * var(--loader-intensity)))))
    brightness(calc(0.9 + (0.76 * var(--loader-intensity))));
  transition: opacity 0.28s ease, filter 0.28s ease;
}

.loader-crystal {
  width: 42%;
  height: auto;
  object-fit: contain;
  z-index: 2;
  transform: translate(-50%, -50%) translateY(0) scale(1);
  filter:
    drop-shadow(0 0 calc(10px + (44px * var(--loader-intensity))) rgba(53, 197, 255, calc(0.48 + (0.52 * var(--loader-intensity)))))
    brightness(calc(1 + (0.64 * var(--loader-intensity))));
  transition: filter 0.28s ease;
}

.crystal-loader-text {
  position: absolute;
  left: 50%;
  top: calc(100% + 5px);
  transform: translateX(-50%);
  z-index: 3;
  color: rgba(216, 243, 255, 0.86);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(59, 190, 255, 0.65);
  opacity: calc(0.58 + (0.4 * var(--loader-intensity)));
  transition: opacity 0.28s ease, text-shadow 0.28s ease;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(43, 134, 217, 0.16), transparent 42%),
    rgba(2, 6, 12, 0.72);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

@media (prefers-reduced-motion: reduce) {
  .magic-circle,
  .loader-crystal,
  .crystal-loader::before,
  .crystal-loader::after,
  .crystal-loader-text {
    animation: none !important;
  }

  .magic-circle {
    opacity: 0.52;
    transform: translate(-50%, -50%) rotate(0deg);
  }

  .loader-crystal {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes crystal-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.mc-glow-ring {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43, 134, 217, 0.18), transparent 65%);
  animation: mc-pulse 3.5s ease-in-out infinite;
}

.mc-status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  z-index: 1;
}

.mc-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
  animation: pulse-dot 2s ease-in-out infinite;
}

.mc-online-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #4ade80;
}

.mc-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 8px 0 0;
  z-index: 1;
}

.mc-power-section {
  width: 100%;
  z-index: 1;
}

.mc-power-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.mc-power-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mc-power-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(43, 134, 217, 0.14);
  overflow: hidden;
  border: 1px solid rgba(43, 134, 217, 0.2);
}

.mc-power-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--blue-light));
  box-shadow: 0 0 8px rgba(123, 198, 255, 0.6);
  transition: width 0.6s ease;
}

.mc-power-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-light);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ─── Step 4 / Timeline ──────────────────────────────────────────────── */
#step4 {
  margin: 0 28px;
}

#step4 .step4-header h2 {
  font-size: 14px;
}

.zoom-label-prefix {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 2px;
}

/* ─── Main content padding ───────────────────────────────────────────── */
.main-content > .card:not(#step4) {
  margin: 0 28px;
}

/* ─── Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  padding: 18px 28px 20px;
  background: rgba(4, 8, 14, 0.94);
  border-top: 1px solid rgba(210, 168, 78, 0.14);
}

.footer-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.footer-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: 0.7;
}

.footer-site-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.footer-legal {
  flex: 1;
  min-width: 0;
}

.footer-legal small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: left;
  margin: 0;
  max-width: none;
}

.footer-legal a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Override old grid-column assignments ───────────────────────────── */
/* styles-base.css assigns grid-columns for the old 12-col main grid.
   We're now using .steps-row so we reset these. */
#step1,
#step2,
#step3,
#step4,
#debugNormal,
#debugError {
  grid-column: auto;
}

/* Step cards: stack selects vertically since cards are narrower */
.step-card .player-grid {
  grid-template-columns: 1fr;
}

/* ─── Card tweaks for new layout ─────────────────────────────────────── */
.step-card.card {
  padding: 20px 18px 18px;
}

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .steps-row {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .mothercrystal-panel {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    padding: 16px 24px;
  }
  .mc-crystal-wrap {
    height: 80px;
    width: 70px;
  }
  .mc-crystal-img {
    width: 56px;
  }
}

@media (max-width: 960px) {
  .steps-row {
    grid-template-columns: 1fr 1fr;
    padding: 16px 20px;
  }
  #step4 {
    margin: 0 20px;
  }
  .main-content > .card:not(#step4) {
    margin: 0 20px;
  }
}

@media (max-width: 680px) {
  .sidebar {
    width: 60px;
  }
  .sidebar-nav-item span,
  .sidebar-source-info,
  .sidebar-data-section .sidebar-section-label,
  .sidebar-status-section,
  .sidebar-api-section,
  .sidebar-conn-meta {
    display: none;
  }
  .sidebar-nav-item {
    justify-content: center;
    padding: 10px;
  }
  .main-content {
    margin-left: 60px;
  }
  .main-content::before {
    left: 60px;
  }
  .steps-row {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }
  #step4,
  .main-content > .card:not(#step4) {
    margin: 0 16px;
  }
  .topbar {
    padding: 12px 16px;
  }
  .topbar-btn span {
    display: none;
  }
  .topbar-btn {
    padding: 8px 10px;
  }
  .header-ad {
    display: none;
  }
}

/* =====================================================================
   ASSET ENHANCEMENT
   image (28) card-window-bg · (5) border-frame · (7)/(8) buttons
   (19-22) corners · (25)/(26) banners · (27) v-divider · (4) ornate
   ===================================================================== */

/* ─── All cards: image (28) base + corners (19-22) ──────────────────── */
.card {
  background:
    url("assets/ui/corner-tl.webp")      left top     / 54px auto no-repeat,
    url("assets/ui/corner-tr.webp")      right top    / 54px auto no-repeat,
    url("assets/ui/corner-bl.webp")      left bottom  / 54px auto no-repeat,
    url("assets/ui/corner-br.webp")      right bottom / 54px auto no-repeat,
    url("assets/ui/card-window-bg.webp") center       / 100% 100% no-repeat;
  border-color: rgba(43, 134, 217, 0.28);
  /* suppress the base gradient from styles-base.css — card-window-bg handles it */
}

/* Keep the top-edge highlight line from card::before readable */
.card::before {
  background: linear-gradient(90deg, transparent, rgba(123, 198, 255, 0.3), rgba(242, 207, 122, 0.5), rgba(123, 198, 255, 0.3), transparent);
}

/* ─── Step cards: image (30) warm bg, no ornate corner ──────────────── */
.step-card {
  background:
    url("assets/ui/corner-tl.webp")         left top     / 54px auto no-repeat,
    url("assets/ui/corner-tr.webp")         right top    / 54px auto no-repeat,
    url("assets/ui/corner-bl.webp")         left bottom  / 54px auto no-repeat,
    url("assets/ui/corner-br.webp")         right bottom / 54px auto no-repeat,
    url("assets/ui/card-window-warm.webp")  center       / 100% 100% no-repeat;
}

/* Remove the old step-corner-ornament class (now CSS-driven) */
.step-corner-ornament {
  display: none;
}

/* ─── Step card h2 headers: same banner as sidebar labels (image 25) ── */
.step-card h2 {
  background: url("assets/ui/banner-ornate.webp") center / 100% 100% no-repeat;
  padding: 9px 16px;
  margin: 2px -8px 12px;
  border-radius: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--gold-light);
  text-shadow: 0 0 10px rgba(210, 168, 78, 0.45);
}

/* Step4 title doesn't use the small banner */
#step4 h2 {
  background: none;
  padding: 0;
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: none;
}

/* ─── Mothercrystal panel: base (image 28) only, no border-frame/corners */
.mothercrystal-panel {
  background:
    url("assets/ui/corner-tl.webp")      left top     / 54px auto no-repeat,
    url("assets/ui/corner-tr.webp")      right top    / 54px auto no-repeat,
    url("assets/ui/corner-bl.webp")      left bottom  / 54px auto no-repeat,
    url("assets/ui/corner-br.webp")      right bottom / 54px auto no-repeat,
    url("assets/ui/card-window-bg.webp") center       / 100% 100% no-repeat;
  border-color: rgba(43, 134, 217, 0.28);
  box-shadow: var(--shadow), 0 0 40px rgba(43, 134, 217, 0.1) inset;
  align-self: stretch;
}

/* ─── Action buttons: dark default (image 7), bright on hover (image 8) */
#loadBtn,
#loadPlayersBtn,
#compareBtn {
  background: url("assets/ui/btn-blue-dark.webp") center / 100% 100% no-repeat;
  border: none !important;
  color: #e8f6ff;
  text-shadow: 0 0 10px rgba(123, 198, 255, 0.55);
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: none;
  padding: 12px 16px;
}

#loadBtn:hover,
#loadPlayersBtn:hover,
#compareBtn:hover {
  background: url("assets/ui/btn-blue-bright.webp") center / 100% 100% no-repeat;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(43, 134, 217, 0.35);
}

/* ─── Sidebar section labels: small banner (image 25) ───────────────── */
.sidebar-section-label {
  background: url("assets/ui/banner-ornate.webp") center / 100% 100% no-repeat;
  padding: 5px 12px;
  margin-bottom: 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-light);
  text-align: center;
  text-shadow: 0 0 6px rgba(210, 168, 78, 0.3);
}

/* ─── Sidebar: vertical accent bar (image 27) ───────────────────────── */
.sidebar::before {
  content: "";
  position: absolute;
  top: 120px;
  right: 0px;
  width: 6px;
  height: calc(100% - 200px);
  background: url("assets/ui/divider-v-light.webp") center top / 100% auto repeat-y;
  opacity: 0.25;
  pointer-events: none;
  z-index: 2;
}

/* ─── Topbar: ornate corner decoration (image 4) ────────────────────── */
.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 80px;
  background: url("assets/ui/corner-tl-ornate.webp") top left / contain no-repeat;
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

/* ─── Step4 card: image (29) alt panel, no corners ──────────────────── */
#step4 {
  background:
    url("assets/ui/corner-tl.webp")       left top     / 54px auto no-repeat,
    url("assets/ui/corner-tr.webp")       right top    / 54px auto no-repeat,
    url("assets/ui/corner-bl.webp")       left bottom  / 54px auto no-repeat,
    url("assets/ui/corner-br.webp")       right bottom / 54px auto no-repeat,
    url("assets/ui/panel-step4.webp")     center       / 100% 100% no-repeat;
  min-height: 300px;
}

/* ─── UI adjustment patches ─────────────────────────────────────────── */

/* Hide external step number badges (h2 already contains the number) */
.step-card-number { display: none; }

/* Hide step1 loading log messages */
#step1Message { display: none !important; }

/* Match step1 height to step2/3 */
.steps-row { align-items: stretch; }
.mothercrystal-panel { align-self: stretch; }

/* Hide Mothercrystal description text */
.mc-desc { display: none; }

/* Status area in sidebar API section */
.sidebar-api-section .header-status-area {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  margin-bottom: 6px;
  border-radius: 999px;
  border: 1px solid rgba(43, 134, 217, 0.3);
  background: rgba(43, 134, 217, 0.08);
  font-size: 11px;
  color: var(--blue-light);
  width: 100%;
  box-sizing: border-box;
}

/* Sidebar lang toggle button styling */
.sidebar-lang-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  text-align: left;
}
.sidebar-lang-btn:hover {
  background: rgba(43, 134, 217, 0.1);
  border-color: rgba(123, 198, 255, 0.18);
  color: var(--text-primary);
}

/* Keep langToggle accessible but visually hidden */
#langToggle { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; overflow: hidden; }

/* Hide topbar buttons moved to sidebar */
#tutorialBtn, #langToggle-topbar-placeholder { display: none !important; }
