@font-face {
  font-family: "Lora";
  src: url("/Font/Lora.ttf") format("truetype");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --app-pad-x: 26px;
  --app-pad-y: 32px;
  --bg: #faf9fd;
  --panel: #ffffff;
  --panel-2: #fcfbfe;
  --text: #142033;
  --muted: #617088;
  --line: #e0dbec;
  --blue: #7c3aed;
  --blue-dark: #6d28d9;
  --green: #0f766e;
  --shadow: 0 16px 40px rgba(30, 41, 59, 0.11);
  --sidebar-col-width: 400px;
  --action-col-width: 100px;
  --layout-gap: 18px;
  --panel-pad-x: 20px;
  --panel-pad-y: 22px;
  --panel-gap: 26px;
  --control-gap: 14px;
  --font-serif: "Lora", "Songti SC", "STSong", "SimSun", "NSimSun", "Noto Sans CJK SC", "Liberation Sans", "Noto Color Emoji", Georgia, serif;
  --font-title: "Lora", "Songti SC", "STSong", "SimSun", "NSimSun", "Noto Sans CJK SC", "Liberation Sans", "Noto Color Emoji", Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro Display", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Liberation Sans", "Noto Color Emoji", "Helvetica Neue", Arial, sans-serif;
  -webkit-user-select: text;
  user-select: text;
}

/* ── Language switch animation ── */
.i18n-ripple {
  position: fixed;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.18) 0%, rgba(124, 58, 237, 0.06) 60%, transparent 100%);
  pointer-events: none;
  z-index: 9999;
  animation: i18n-ripple-expand 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes i18n-ripple-expand {
  0% {
    transform: scale(0);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 0;
  }
}

[data-i18n],
[data-i18n-placeholder],
[data-i18n-html] {
  transition: opacity 0.25s ease;
}

.i18n-fade {
  opacity: 0 !important;
}

.run-duration-label {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--app-pad-y) var(--app-pad-x) 24px;
}

.topbar {
  position: relative;
  display: block;
  width: min(1600px, calc(100vw - 64px));
  margin-right: auto;
  margin-left: auto;
  margin-bottom: 18px;
  text-align: center;
}

.topbar-title {
  display: block;
  min-width: 0;
  width: 100%;
}

.topbar-heading {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: clamp(14px, 1.8vw, 24px);
  min-width: 0;
  transform: translateX(clamp(-250px, -12vw, -140px));
}

h1 {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(38px, 3.8vw, 60px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
  -webkit-text-stroke: 0.35px currentColor;
  text-shadow: 0.012em 0 0 currentColor;
}

.topbar-subtitle {
  margin: 0;
  max-width: none;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: clamp(20px, 1.45vw, 24px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.topbar-subtitle::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.92em;
  margin-right: clamp(14px, 1.8vw, 24px);
  background: rgba(97, 112, 136, 0.45);
  transform: translateY(0.12em);
}

.topbar-credit {
  margin: 14px 0 0;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  width: 100%;
  max-width: none;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, var(--sidebar-col-width)) minmax(0, 1fr);
  gap: var(--layout-gap);
  flex: 1;
  align-items: stretch;
  min-height: calc(100vh - 94px);
}

.sidebar,
.main-panel {
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
}

.main-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel,
.query-panel,
.tabs {
  background: var(--panel);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.panel {
  padding: var(--panel-pad-y) var(--panel-pad-x);
  margin-bottom: 0;
}

.connection-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 14px;
}

.connection-actions {
  display: grid;
  grid-template-columns: 226px 1fr;
  gap: 24px;
  align-items: center;
  margin-top: 0;
}

.connection-actions .metadata-info {
  justify-self: end;
  margin-right: 36px;
  display: flex;
}

.connection-toggles {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-left: 4px;
}

.connection-logo {
  display: block;
  width: 120px;
  height: auto;
  max-width: 100%;
  margin: 0;
  object-fit: contain;
}

.panel-title {
  font-weight: 750;
  font-size: 19px;
  margin-bottom: 0;
}

.connection-panel .panel-title {
  text-align: center;
}

label {
  display: block;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  margin: 0;
}

.connection-panel label {
  text-align: center;
}

.connection-panel label>input,
.connection-panel label>select {
  text-align: center;
}

.connection-panel .connection-heading-label {
  display: block;
  color: #6d28d9;
  font-family: "Lora", serif;
  font-size: 19px;
  font-weight: 800;
  margin: 0;
  text-align: center;
}

html[lang^="zh"] .connection-panel .connection-heading-label {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro Display", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Liberation Sans", "Noto Color Emoji", "Helvetica Neue", Arial, sans-serif;
}

.connection-panel .mode-heading {
  margin-bottom: -12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
  caret-color: var(--blue);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input,
textarea {
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

select {
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23617088' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 18px center;
  background-repeat: no-repeat;
  background-size: 18px;
  padding-right: 36px;
}

input,
select {
  height: 42px;
  padding: 0 12px;
  margin-top: 0;
}

label>input,
label>select {
  margin-top: 12px;
}

textarea {
  min-height: 124px;
  padding: 18px;
  resize: vertical;
  line-height: 1.6;
}

#query {
  font-size: 20px;
  line-height: 1.55;
  padding-right: 112px;
  padding-bottom: 78px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.11);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--control-gap);
  margin-bottom: 0;
}

.mode-group {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.02);
  padding: 4px;
  margin: 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: inset 0 2px 6px rgba(124, 58, 237, 0.01);
  transition: box-shadow 0.4s ease;
}

.mode-slider-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: calc(4px + (100% - 8px) / 3 * var(--active-index, 0));
  width: calc((100% - 8px) / 3);
  border-radius: 8px;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border: none;
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.45), 0 0 4px rgba(244, 114, 182, 0.25);
  transition: left 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

/* ── Glowing pink overlay layer ── */
.mode-slider-indicator::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #f472b6 0%, #a78bfa 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 2;
}

/* Pulse the pink overlay once when transitioning */
.mode-group.color-glow-active .mode-slider-indicator::after {
  animation: pulsePink 2.2s cubic-bezier(0.25, 0.8, 0.25, 1) 1 forwards;
}

@keyframes pulsePink {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Cyberpunk sliding stretch & direction skew animations ── */
.mode-group.slide-right .mode-slider-indicator {
  animation: slide-stretch-right 0.38s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.mode-group.slide-left .mode-slider-indicator {
  animation: slide-stretch-left 0.38s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes slide-stretch-right {
  0% { transform: scaleX(1) skewX(0deg); }
  35% { transform: scaleX(1.22) skewX(-8deg); }
  100% { transform: scaleX(1) skewX(0deg); }
}

@keyframes slide-stretch-left {
  0% { transform: scaleX(1) skewX(0deg); }
  35% { transform: scaleX(1.22) skewX(8deg); }
  100% { transform: scaleX(1) skewX(0deg); }
}

/* ── shockwave ring pulse when clicked ── */
.mode-group.sliding {
  animation: group-pulse 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes group-pulse {
  0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.25); }
  70% { box-shadow: 0 0 0 6px rgba(124, 58, 237, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

.mode-group .mode-button {
  position: relative;
  z-index: 2;
  min-height: 38px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent !important;
  font-size: 16.5px;
  font-weight: 700;
  box-shadow: none !important;
  border: none !important;
  outline: none !important;
  cursor: pointer;
  transition: color 0.25s ease, transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.mode-group .mode-button:hover {
  color: var(--blue-dark);
  background: transparent !important;
}

.mode-group .mode-button:active {
  transform: scale(0.95);
}

.mode-group .mode-button.active {
  color: #ffffff !important;
  background: transparent !important;
  box-shadow: none !important;
  text-shadow: 0 1px 2px rgba(124, 58, 237, 0.3);
}

.toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 46px;
  border: 1px solid rgba(124, 58, 237, 0.08);
  border-radius: 12px;
  padding: 10px 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  margin: 0;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.01);
}

.connection-actions .toggle {
  width: 100%;
  margin: 0;
}

.toggle:hover {
  background: rgba(124, 58, 237, 0.04);
  border-color: rgba(124, 58, 237, 0.22);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.05);
}

.toggle:active {
  transform: translateY(0);
}

.toggle input {
  position: absolute;
  width: 0;
  height: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 38px;
  height: 20px;
  flex: 0 0 38px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #f472b6 0%, #a78bfa 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.toggle-label {
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: color 0.22s ease;
}

.toggle input:checked+.toggle-track {
  border-color: transparent;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.2);
}

.toggle.color-glow-active input:checked+.toggle-track::after {
  animation: pulsePink 2.2s cubic-bezier(0.25, 0.8, 0.25, 1) 1 forwards;
}

.toggle input:checked+.toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.toggle input:checked~.toggle-label {
  color: #000000;
}

.toggle:has(input:checked) {
  border-color: rgba(124, 58, 237, 0.25);
  background: rgba(124, 58, 237, 0.03);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.03);
}

.toggle input:focus-visible+.toggle-track {
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.export-row {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 12px;
  align-items: center;
  margin-top: 2px;
}

.export-row input {
  margin-top: 0;
}

.query-panel {
  position: relative;
  display: block;
  padding: 16px;
  margin-bottom: 14px;
}

.panel-divider {
  border: 0;
  height: 1px;
  background: rgba(148, 163, 184, 0.25);
  margin: -10px 0 4px;
}

.metadata-filter-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.metadata-filter-heading {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 0;
  margin-bottom: 12px;
}

.metadata-info {
  position: relative;
  z-index: 80;
}

.metadata-info-trigger {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #ede9fe 0%, #f5f3ff 50%, #e0e7ff 100%);
  color: #7c3aed;
  font-size: 31px;
  line-height: 1;
  box-shadow:
    0 2px 8px rgba(124, 58, 237, 0.15),
    0 0 0 1px rgba(124, 58, 237, 0.12);
  transform: translateZ(0);
  transition: box-shadow 0.25s ease, transform 0.25s ease, background 0.25s ease;
  animation: popover-btn-breathe 3s ease-in-out infinite;
}

@keyframes popover-btn-breathe {

  0%,
  100% {
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15), 0 0 0 1px rgba(124, 58, 237, 0.12);
  }

  50% {
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.22), 0 0 0 1px rgba(124, 58, 237, 0.18), 0 0 16px rgba(167, 139, 250, 0.12);
  }
}

.metadata-info-trigger::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #c084fc, #8b5cf6, #7c3aed, #c084fc);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
  animation: popover-border-spin 4s linear infinite;
}

@keyframes popover-border-spin {
  to {
    transform: rotate(360deg);
  }
}

.metadata-info-trigger:hover::before,
.metadata-info-trigger:focus-visible::before {
  opacity: 1;
}

.metadata-info-trigger:hover,
.metadata-info-trigger:focus-visible {
  background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 50%, #e0e7ff 100%);
  box-shadow:
    0 6px 24px rgba(99, 102, 241, 0.28),
    0 0 0 2px rgba(99, 102, 241, 0.1),
    0 0 24px rgba(167, 139, 250, 0.15);
  transform: translateY(-2px) scale(1.08);
  animation: none;
}

.metadata-info-trigger:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.08s;
}

.metadata-corpus-popover {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(680px, calc(100vw - 80px));
  max-height: min(680px, calc(100vh - 100px));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.95);
  color: #122033;
  text-align: left;
  box-shadow:
    0 32px 80px -12px rgba(15, 23, 42, 0.22),
    0 8px 24px rgba(124, 58, 237, 0.07),
    0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -46%) scale(0.96);
  transform-origin: center center;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

.metadata-corpus-popover::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 20px;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(90deg, #c084fc, #8b5cf6, #7c3aed);
  background-size: 100% 4px;
  background-repeat: no-repeat;
  z-index: 2;
  pointer-events: none;
}



.metadata-corpus-popover::after {
  display: none;
}

.metadata-info:hover .metadata-corpus-popover,
.metadata-info:focus-within .metadata-corpus-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.metadata-corpus-section {
  position: relative;
  z-index: 1;
  padding: 0 22px;
}

.metadata-corpus-heading {
  text-align: center;
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  background: linear-gradient(180deg, rgba(243, 245, 255, 0.6) 0%, transparent 100%);
  color: #0f172a;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.metadata-corpus-section+.metadata-corpus-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.metadata-corpus-heading+.metadata-corpus-section {
  margin-top: 16px;
}

.metadata-corpus-section:last-of-type {
  padding-bottom: 18px;
}

.metadata-corpus-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: transparent;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metadata-corpus-title span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  -webkit-background-clip: unset;
  background-clip: unset;
  -webkit-text-fill-color: #ffffff;
}

.metadata-corpus-popover ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.metadata-corpus-popover li {
  position: relative;
  padding: 4px 10px 4px 26px;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 8px;
  transition: background 0.18s ease, transform 0.18s ease;
}

.metadata-corpus-popover li:hover {
  background: rgba(99, 102, 241, 0.06);
  transform: translateX(3px);
}

.metadata-corpus-popover li::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.25);
  transform: translateY(-50%);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.metadata-corpus-popover li:hover::before {
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
  transform: translateY(-50%) scale(1.25);
}

/* Custom scrollbar for metadata corpus popover */
.metadata-corpus-popover::-webkit-scrollbar {
  width: 5px;
}

.metadata-corpus-popover::-webkit-scrollbar-track {
  background: transparent;
}

.metadata-corpus-popover::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 999px;
}

.metadata-corpus-popover::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.35);
}

.metadata-filter-section label {
  text-align: left;
}

.metadata-filter-section input,
.metadata-filter-section select {
  text-align: left;
}

.metadata-expression-label {
  display: block;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  text-align: left;
}

.metadata-expression-label input {
  margin-top: 8px;
  height: 40px;
  border-color: rgba(148, 163, 184, 0.38);
  background: #fff;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
}

.metadata-expression-label input::placeholder {
  color: #8794a8;
  opacity: 0.82;
}

.run-duration {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: var(--action-col-width);
  height: 86px;
  min-width: 0;
  overflow: hidden;
  border: 0px solid rgba(0, 0, 0, 1);
  border-radius: 14px;
  background: var(--bg);
  color: #627088;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-duration-label {
  display: block;
  color: #627088;
  font-size: clamp(63px, 1.45vw, 72px);
  font-weight: 500;
}

.lang-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 6px;
  line-height: 1;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

button {
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--blue);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.15s, transform 0.15s, opacity 0.15s;
}

button:hover {
  background: var(--blue-dark);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.55;
  cursor: progress;
}

#runButton {
  position: absolute;
  right: 32px;
  bottom: 32px;
  display: grid;
  place-items: center;
  width: 51px;
  height: 51px;
  border: 0px solid #000000;
  border-radius: 50%;
  background: #f5f2fa;
  color: #142033;
  box-shadow: none;
  letter-spacing: 0;
  min-height: 0;
  line-height: 1;
  z-index: 2;
  transition: box-shadow 0.15s ease;
}

#runButton:hover {
  background: #f5f2fa;
  color: #142033;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

#runButton:active {
  transform: none;
}

#runButton:disabled {
  opacity: 0.55;
  background: #f5f2fa;
  color: #142033;
  box-shadow: none;
}

#runButton.is-stop {
  background: #f5f2fa;
  color: #e05555;
  box-shadow: none;
}

#runButton.is-stop:hover {
  background: #f5f2fa;
  color: #e05555;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16);
}

.run-icon {
  display: block;
  font-size: 28px;
  line-height: 1;
  color: inherit;
  transform: translateX(2px) translateY(-1px);
}

#runButton.is-stop .run-icon {
  font-size: 32px;
  color: #e05555;
  transform: translateY(-1px);
}

.run-state {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 0 16px;
  margin-bottom: 14px;
  color: var(--muted);
}

.progress-track {
  flex: 0 0 85%;
  height: 13px;
  border-radius: 999px;
  background: #dbe3ee;
  overflow: hidden;
}

#statusText {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#progressBar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #c084fc, var(--blue));
  transition: width 0.25s;
}

#progressBar.is-running {
  width: 100%;
  background: linear-gradient(90deg, var(--blue) 0%, #e9d5ff 40%, #f3e8ff 50%, #e9d5ff 60%, var(--blue) 100%);
  background-size: 200% 100%;
  animation: progress-indeterminate 1.5s linear infinite;
  transition: none;
}

@keyframes progress-indeterminate {
  from {
    background-position: 0 0;
  }

  to {
    background-position: -200% 0;
  }
}

.tabs {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.tab-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 10px 0;
  background: #fcfbfe;
  border-bottom: 1px solid var(--line);
}

.tab-stat {
  margin-right: 0;
  align-self: center;
  transform: translateY(-5px);
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.tab-export-btn {
  display: inline-grid;
  place-items: center;
  margin-left: auto;
  align-self: center;
  transform: translateY(-5px);
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 999px;
  background: #ecfdf5;
  color: var(--green);
  padding: 8px 16px;
  font-size: 16px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.tab-export-btn:hover {
  background: #d1fae5;
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.15);
}

.tab-export-btn.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.tab {
  color: var(--muted);
  background: transparent;
  border-radius: 10px 10px 0 0;
  padding: 12px 18px;
  font-size: 15px;
  box-shadow: none;
}

.tab:hover {
  background: #ede9fe;
  color: var(--text);
}

.tab.active {
  color: var(--blue-dark);
  background: #ffffff;
  border: 1px solid var(--line);
  border-bottom-color: #ffffff;
  transform: translateY(1px);
}

.tab-panel {
  flex: 1;
  display: none;
  padding: 20px;
  min-height: 0;
  overflow: auto;
}

#hybrid.tab-panel.active,
#interpret.tab-panel.active {
  padding-bottom: 12px;
  max-height: none;
  overflow-y: auto;
}

#interpret.tab-panel.active {
  overflow: visible;
}

.tab-panel.active {
  display: block;
}

.prose {
  white-space: pre-wrap;
  line-height: 1.72;
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.cards {
  display: grid;
  gap: 14px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 16px;
}

.result-card h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 750;
}

.evidence {
  color: #334155;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.pdf-download {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.pdf-download strong {
  flex: 0 0 auto;
}

.pdf-download-link-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 auto;
  min-width: 0;
  vertical-align: top;
}

.pdf-download a {
  flex: 0 1 auto;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.pdf-download a:hover {
  text-decoration: underline;
}

.evidence-tooltip {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  margin-left: auto;
}

.evidence-info {
  position: relative;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #ede9fe 0%, #f5f3ff 50%, #e0e7ff 100%);
  color: #7c3aed;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow:
    0 2px 8px rgba(124, 58, 237, 0.15),
    0 0 0 1px rgba(124, 58, 237, 0.12);
  transform: none;
  transition: box-shadow 0.25s ease, transform 0.25s ease, background 0.25s ease;
  animation: popover-btn-breathe 3s ease-in-out infinite;
}

.evidence-info::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  background: conic-gradient(from 0deg, #c084fc, #8b5cf6, #7c3aed, #c084fc);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
  animation: popover-border-spin 4s linear infinite;
}

.evidence-info:hover::before,
.evidence-info:focus-visible::before {
  opacity: 1;
}

.evidence-info:hover,
.evidence-info:focus-visible {
  background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 50%, #e0e7ff 100%);
  box-shadow:
    0 6px 24px rgba(99, 102, 241, 0.28),
    0 0 0 2px rgba(99, 102, 241, 0.1),
    0 0 24px rgba(167, 139, 250, 0.15);
  color: #4f46e5;
  transform: translateY(-2px) scale(1.12);
  animation: none;
}

.evidence-info:active {
  transform: translateY(0) scale(0.95);
  transition-duration: 0.08s;
}

.evidence-popover {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  z-index: 80;
  width: min(750px, calc(100vw - 96px));
  max-height: min(620px, calc(100vh - 72px));
  overflow: visible;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  color: #122033;
  white-space: normal;
  box-shadow:
    0 32px 80px -12px rgba(15, 23, 42, 0.22),
    0 8px 24px rgba(124, 58, 237, 0.07),
    0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-18px, -50%) scale(0.92);
  transform-origin: right center;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.evidence-popover::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  height: 20px;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(90deg, #c084fc, #8b5cf6, #7c3aed);
  background-size: 100% 4px;
  background-repeat: no-repeat;
  z-index: 2;
  pointer-events: none;
}

.evidence-popover::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  width: 14px;
  height: 14px;
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.92);
  transform: translateY(-50%) rotate(45deg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.evidence-tooltip:hover .evidence-popover,
.evidence-tooltip:focus-within .evidence-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translate(0, -50%) scale(1);
}

.evidence-popover-title {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 8px;
  padding: 0 22px;
  color: transparent;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.evidence-popover-body {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 4px;
  max-height: min(496px, calc(100vh - 174px));
  overflow-y: auto;
  padding: 16px 22px 18px;
  color: #334155;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.25;
  border-radius: 0 0 20px 20px;
}

/* Custom scrollbar for popover body */
.evidence-popover-body::-webkit-scrollbar {
  width: 5px;
}

.evidence-popover-body::-webkit-scrollbar-track {
  background: transparent;
}

.evidence-popover-body::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 999px;
}

.evidence-popover-body::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.35);
}

.evidence-popover-section {
  display: block;
}

.evidence-popover-section+.evidence-popover-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.evidence-popover-section-title {
  display: inline-block;
  margin-bottom: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(124, 58, 237, 0.08));
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  background-image: linear-gradient(135deg, #8b5cf6, #7c3aed);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.evidence-popover-section-title {
  /* pill background visible behind gradient text */
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(124, 58, 237, 0.08));
  color: #4f46e5;
  -webkit-background-clip: unset;
  background-clip: unset;
  -webkit-text-fill-color: unset;
}

.evidence-popover-section-body {
  display: block;
  text-align: justify;
}

.modal-open {
  overflow: hidden;
}

.rerank-tip-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.rerank-tip-overlay[hidden] {
  display: none;
}

.rerank-tip-dialog {
  width: min(616px, 100%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
  padding: 28px;
  color: var(--text);
  text-align: center;
}

.rerank-tip-title {
  margin: 0 0 14px;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 850;
  letter-spacing: 0;
}

.rerank-tip-body {
  margin: 0;
  color: #334155;
  font-size: 17px;
  line-height: 1.7;
}

.rerank-tip-confirm {
  display: block;
  width: 100%;
  min-height: 50px;
  margin-top: 24px;
  border-radius: 14px;
  font-size: 18px;
}

.rerank-tip-confirm:focus-visible {
  outline: 3px solid rgba(124, 58, 237, 0.35);
  outline-offset: 3px;
}

.export-format-toggle {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.export-format-overlay {
  position: fixed;
  inset: 0;
  z-index: 8500;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.export-format-toggle:checked + .export-format-overlay {
  display: grid;
}

.export-format-dialog {
  position: relative;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.26);
  color: var(--text);
}

.export-format-close {
  position: absolute;
  top: 12px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(20, 32, 51, 0.46);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.export-format-close:hover {
  background: rgba(124, 58, 237, 0.08);
  color: var(--text);
}

.export-format-title {
  margin: 0;
  padding-right: 28px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 0;
}

.export-format-subtitle {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.export-format-options {
  display: grid;
  gap: 10px;
}

.export-format-option {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(124, 58, 237, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.01);
  transition: background 0.22s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.22s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.22s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.22s ease,
    transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-format-option input {
  position: absolute;
  width: 0;
  height: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.export-format-option:hover {
  background: rgba(124, 58, 237, 0.04);
  border-color: rgba(124, 58, 237, 0.22);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.05);
}

.export-format-option:active {
  transform: translateY(0);
}

.export-format-option:has(.export-format-input:checked) {
  border-color: rgba(124, 58, 237, 0.25);
  background: rgba(124, 58, 237, 0.03);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.03);
}

.export-format-toggle-track {
  position: relative;
  width: 38px;
  height: 20px;
  flex: 0 0 38px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-format-toggle-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #f472b6 0%, #a78bfa 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.export-format-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 2;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-format-input:checked + .export-format-toggle-track {
  border-color: transparent;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.2);
}

.export-format-input:checked + .export-format-toggle-track .export-format-toggle-thumb {
  transform: translateX(18px);
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.export-format-input:focus-visible + .export-format-toggle-track {
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.export-format-input:checked ~ .export-format-label {
  color: #000000;
}

.export-format-label {
  line-height: 1;
}

.export-format-error {
  margin: 12px 0 0;
  color: #dc2626;
  font-size: 13px;
  font-weight: 700;
}

.export-format-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.export-format-cancel,
.export-format-confirm {
  min-height: 44px;
  border-radius: 10px;
  font-size: 15px;
}

.export-format-cancel {
  background: #eef2f7;
  color: #334155;
}

.export-format-cancel:hover {
  background: #e2e8f0;
}

.export-format-confirm {
  background: #a164ef;
  color: #fff;
  font-weight: 700;
}

.export-format-confirm:hover {
  background: #7c39ed;
  box-shadow: 0 4px 14px rgba(124, 57, 237, 0.3);
}

@media (max-width: 980px) {
  .app {
    padding-right: 16px;
    padding-left: 16px;
  }

  h1 {
    font-size: clamp(30px, 8vw, 48px);
  }

  .topbar {
    width: calc(100vw - 32px);
    padding-top: 8px;
    text-align: center;
  }

  .topbar-title {
    display: block;
    max-width: calc(100vw - 32px);
  }

  .topbar-heading {
    display: block;
    transform: translateX(clamp(-120px, -12vw, -72px));
  }

  .topbar-subtitle {
    margin-top: 8px;
    font-size: clamp(17px, 4vw, 22px);
    white-space: normal;
  }

  .topbar-subtitle::before {
    display: none;
  }

  .topbar-credit {
    margin-top: 8px;
    font-size: 15px;
    white-space: normal;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .metadata-corpus-popover {
    position: fixed;
    left: 50%;
    right: auto;
    top: 50vh;
    width: min(520px, calc(100vw - 52px));
    max-height: min(620px, calc(100vh - 90px));
    transform: translate(-50%, calc(-50% - 6px)) scale(0.98);
    transform-origin: center center;
  }

  .metadata-corpus-popover::after {
    display: none;
  }

  .metadata-info:hover .metadata-corpus-popover,
  .metadata-info:focus-within .metadata-corpus-popover {
    transform: translate(-50%, -50%) scale(1);
  }

  .query-panel {
    display: block;
  }

  #query {
    padding-right: 92px;
    padding-bottom: 70px;
  }

  .run-duration {
    position: relative;
    width: 100%;
    height: 58px;
    margin-top: 12px;
  }

  #runButton {
    right: 28px;
    bottom: 28px;
    width: 45px;
    height: 45px;
    min-height: 0;
  }

  .rerank-tip-dialog {
    padding: 22px;
  }

  .rerank-tip-title {
    font-size: 21px;
  }

  .rerank-tip-body {
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  .topbar-heading {
    transform: none;
  }

  .pdf-download-link-wrap {
    align-items: center;
  }

  .evidence-popover {
    right: calc(100% + 10px);
    top: 50%;
    width: min(320px, calc(100vw - 44px));
    transform: translate(-12px, -50%) scale(0.92);
    transform-origin: right center;
  }

  .evidence-popover::after {
    display: none;
  }

  .evidence-popover-body {
    max-height: 165px;
  }

  .evidence-tooltip:hover .evidence-popover,
  .evidence-tooltip:focus-within .evidence-popover {
    transform: translate(0, -50%) scale(1);
  }
}

/* ── Welcome Overlay Styling ── */
.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: welcome-fade-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.welcome-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
}

.welcome-card {
  font-family: var(--font-serif);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  padding: 40px;
  width: min(520px, calc(100vw - 32px));
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: translateY(20px) scale(0.95);
  animation: welcome-card-slide-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.welcome-overlay.fade-out .welcome-card {
  transform: translateY(10px) scale(0.95);
  opacity: 0;
}

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

@keyframes welcome-card-slide-in {
  to {
    transform: translateY(0) scale(1);
  }
}

.welcome-logo-container {
  margin-bottom: 20px;
}

.welcome-logo {
  height: 100px;
  width: auto;
  filter: drop-shadow(0 4px 10px rgba(255, 255, 255, 0.85));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.welcome-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  margin: 0 0 8px 0;
  letter-spacing: -0.5px;
}

.welcome-subtitle {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  margin: 12px 0 28px 0;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  margin-bottom: 32px;
}

.welcome-feature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  padding: 14px 20px;
  transition: transform 0.2s ease, background-color 0.2s ease;
  text-align: center;
}

.welcome-feature:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(124, 58, 237, 0.15);
}

.feature-text {
  font-size: 16px;
  font-weight: 600;
  color: #334155;
  line-height: 1.45;
  text-align: center;
  width: 100%;
}

.welcome-btn {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(135deg, #1e293b, #0b0f19);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border: none;
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.welcome-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #334155, #0f172a);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.35);
}

.welcome-btn:active {
  transform: translateY(0);
}

/* ── Access Key Authentication Modal ─────────────────────────────── */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 20, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: auth-overlay-in 0.3s ease;
}

.auth-overlay[hidden] {
  display: none;
}

@keyframes auth-overlay-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.auth-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(400px, 90vw);
  padding: 36px 32px 28px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(145deg, rgba(30, 32, 48, 0.95), rgba(20, 22, 36, 0.98));
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  animation: auth-card-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  color: rgba(200, 210, 230, 0.45);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s, transform 0.2s;
  z-index: 10;
}

.auth-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #e8eaf0;
}

.auth-close-btn:active {
  transform: scale(0.92);
}

.auth-icon {
  font-size: 44px;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 8px rgba(100, 140, 255, 0.3));
  animation: auth-icon-pulse 2s ease-in-out infinite;
}

@keyframes auth-icon-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

.auth-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #e8eaf0;
  letter-spacing: 0.3px;
}

.auth-subtitle {
  margin: 0;
  font-size: 13px;
  color: rgba(200, 210, 230, 0.65);
  text-align: center;
  line-height: 1.5;
}

.auth-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid rgba(120, 140, 200, 0.25);
  border-radius: 10px;
  background: rgba(15, 17, 30, 0.7);
  color: #d0d6e8;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 15px;
  letter-spacing: 2px;
  text-align: center;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
  box-sizing: border-box;
}

.auth-input:focus {
  border-color: rgba(100, 160, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(100, 160, 255, 0.12);
}

.auth-input::placeholder {
  color: rgba(160, 170, 200, 0.4);
  letter-spacing: 0.5px;
}

.auth-error {
  margin: 0;
  font-size: 12.5px;
  color: #f87171;
  text-align: center;
  animation: auth-shake 0.35s ease;
}

@keyframes auth-shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-6px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

.auth-submit {
  width: 100%;
  padding: 11px 0;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f6ef7, #6c5ce7);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 110, 247, 0.35);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── UNLOCKED Badge ────────────────────────────────────────────────── */

.unlock-badge {
  display: block;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.8px;
  color: #059669;
  text-align: center;
  margin-bottom: 2px;
  animation: unlock-glow 2.5s ease-in-out infinite;
  cursor: pointer;
  transition: color 0.2s, opacity 0.2s;
}

.unlock-badge:hover {
  color: #ef4444;
  /* Soft red on hover to indicate lock action */
  opacity: 1;
}

.unlock-badge[hidden] {
  display: none;
}

@keyframes unlock-glow {

  0%,
  100% {
    opacity: 0.85;
  }

  50% {
    opacity: 1;
    color: #10b981;
  }
}

/* ── LOCKED Badge ────────────────────────────────────────────────── */

.lock-badge {
  display: block;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 9px;
  font-weight: 800;
  /* Bolder text */
  letter-spacing: 1.8px;
  color: #dc2626;
  /* Strong primary red */
  text-align: center;
  margin-bottom: 2px;
  animation: lock-glow 2.5s ease-in-out infinite;
  cursor: pointer;
  transition: color 0.2s, opacity 0.2s;
}

.lock-badge:hover {
  color: #10b981;
  /* Green color on hover to indicate unlocking */
  opacity: 1;
}

.lock-badge[hidden] {
  display: none;
}

@keyframes lock-glow {

  0%,
  100% {
    opacity: 0.85;
    color: #b91c1c;
  }

  /* Deep crimson red */
  50% {
    opacity: 1;
    color: #ff0033;
  }

  /* Vibrant hot red */
}

/* Custom Select Dropdown styles */
.custom-select-container {
  position: relative;
  width: 100%;
  margin-top: 8px;
  text-align: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro Display", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Liberation Sans", "Noto Color Emoji", "Helvetica Neue", Arial, sans-serif;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 650;
  cursor: pointer;
  position: relative;
  user-select: none;
  box-sizing: border-box;
  text-align: center;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23617088' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 18px center;
  background-repeat: no-repeat;
  background-size: 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-select-trigger:focus,
.custom-select-container.active .custom-select-trigger {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.11);
  outline: none;
}

.custom-select-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  max-height: 240px;
  overflow-y: auto;
  display: none;
  animation: selectFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 4px 0;
}

@keyframes selectFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-select-container.active .custom-select-options {
  display: block;
}

.custom-select-option {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.custom-select-option:hover {
  background: #f1f5f9;
}

.custom-select-option.selected {
  background: rgba(124, 58, 237, 0.07);
  color: #7c3aed;
  font-weight: 600;
}

.custom-select-option-check {
  display: inline-block;
  width: 16px;
  margin-right: 8px;
  color: #7c3aed;
  font-weight: bold;
  visibility: hidden;
  flex-shrink: 0;
}

.custom-select-option.selected .custom-select-option-check {
  visibility: visible;
}

.custom-select-option-text {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
