@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #07080d;
  --bg-2: #0b0d16;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.075);
  --panel-border: rgba(255, 255, 255, 0.11);
  --panel-border-hover: rgba(255, 255, 255, 0.22);
  --text: #edeff5;
  --text-dim: #9aa1b8;
  --text-faint: #676e85;
  --accent: #8b93ff;
  --accent-2: #3ddcc7;
  --accent-grad: linear-gradient(135deg, #8b93ff 0%, #6f7bff 40%, #3ddcc7 100%);
  --success: #3ddc97;
  --success-bg: rgba(61, 220, 151, 0.1);
  --danger: #ff7085;
  --danger-bg: rgba(255, 112, 133, 0.1);
  --warn: #ffb84d;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow-soft: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(139, 147, 255, 0.35); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ---------- Ambient background ---------- */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(1200px 800px at 15% -10%, rgba(139,147,255,0.16), transparent 60%),
              radial-gradient(1000px 700px at 110% 10%, rgba(61,220,199,0.12), transparent 55%),
              radial-gradient(900px 900px at 50% 120%, rgba(139,80,255,0.10), transparent 60%),
              var(--bg);
}
.bg-decor::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 75%);
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  animation: float 22s ease-in-out infinite;
}
.orb.o1 { width: 420px; height: 420px; background: #4b57ff; top: -120px; left: -100px; }
.orb.o2 { width: 380px; height: 380px; background: #2fe0c4; bottom: -140px; right: -80px; animation-delay: -8s; }
.orb.o3 { width: 260px; height: 260px; background: #a56bff; top: 40%; right: 15%; animation-delay: -14s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.08); }
  66% { transform: translate(-25px, 25px) scale(0.95); }
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 48px);
  background: rgba(7, 8, 13, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px -4px rgba(111, 123, 255, 0.55);
  flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; stroke: #0a0b12; }
.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-text p {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
  font-weight: 500;
}
.header-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color .18s ease, background .18s ease, transform .12s ease, box-shadow .18s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--panel-border-hover); background: var(--panel-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ghost { background: transparent; }
.btn-primary {
  background: var(--accent-grad);
  color: #090a10;
  border: none;
  box-shadow: 0 8px 22px -8px rgba(111, 123, 255, 0.6);
}
.btn-primary:hover { box-shadow: 0 10px 26px -6px rgba(111, 123, 255, 0.75); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  gap: 2px;
}
.lang-opt {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
}
.lang-opt:hover { color: var(--text); }
.lang-opt.active {
  background: var(--accent-grad);
  color: #0a0b12;
  box-shadow: 0 4px 14px -4px rgba(111, 123, 255, 0.6);
}

/* ---------- Layout ---------- */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px clamp(14px, 4vw, 32px) 100px;
}

.intro {
  text-align: center;
  margin: 18px auto 34px;
  max-width: 620px;
}
.intro h2 {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  background: linear-gradient(135deg, #fff 20%, #b9c0ff 60%, #7cf0dc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro p { color: var(--text-dim); font-size: 15px; line-height: 1.6; margin: 0; }

/* ---------- Breadcrumb ---------- */
.crumbs-bar {
  position: sticky;
  top: 73px;
  z-index: 30;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 0 0 26px;
  border-radius: 999px;
  background: rgba(11, 13, 22, 0.8);
  backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.crumbs-bar::-webkit-scrollbar { display: none; }
.crumbs-bar.visible { display: flex; }
.crumb {
  flex-shrink: 0;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.crumb:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.crumb.current { background: var(--accent-grad); color: #0a0b12; }
.crumb-sep { color: var(--text-faint); flex-shrink: 0; font-size: 12px; }
.crumb-reset {
  margin-left: auto;
  flex-shrink: 0;
}

/* ---------- Tree ---------- */
.tree-wrap { position: relative; }
#connector-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}
.connector-path {
  fill: none;
  stroke: url(#connectorGradient);
  stroke-width: 2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(139,147,255,0.35));
}
.connector-node {
  fill: #0b0d16;
  stroke: url(#connectorGradient);
  stroke-width: 2;
}

#tree-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 46px;
}

.q-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3.5vw, 30px);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-soft);
  animation: cardIn .5s cubic-bezier(.2,.8,.2,1) both;
  scroll-margin-top: 140px;
}
.q-card.resolved { opacity: 0.9; }
.q-card .step-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 10px;
}
.q-card .step-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.q-card h3 {
  margin: 0 0 6px;
  font-size: clamp(17px, 2.4vw, 21px);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.q-card .q-subtitle {
  margin: 0 0 20px;
  color: var(--text-dim);
  font-size: 13.5px;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.opt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.opt-grid.root-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.opt-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  transition: transform .15s ease, border-color .18s ease, background .18s ease, box-shadow .2s ease;
}
.opt-btn:hover {
  border-color: rgba(139, 147, 255, 0.55);
  background: rgba(139, 147, 255, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px -12px rgba(111, 123, 255, 0.55);
}
.opt-btn:active { transform: translateY(0); }
.opt-btn .opt-icon {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}
.opt-btn .opt-icon svg { width: 17px; height: 17px; stroke: var(--accent-2); }
.opt-btn .opt-chevron { margin-left: auto; opacity: 0.4; flex-shrink: 0; width: 15px; height: 15px; }

.opt-btn.selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(139,147,255,0.16), rgba(61,220,199,0.09));
  box-shadow: 0 0 0 1px rgba(139,147,255,0.3), 0 10px 30px -12px rgba(111,123,255,0.5);
}
.opt-btn.selected .opt-icon { background: var(--accent-grad); }
.opt-btn.selected .opt-icon svg { stroke: #0a0b12; }
.opt-btn.dim { opacity: 0.42; }
.opt-btn.dim:hover { opacity: 0.75; }
.opt-btn .opt-check {
  margin-left: auto;
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--accent-2);
  opacity: 0;
  transform: scale(0.5);
  transition: all .2s ease;
}
.opt-btn.selected .opt-check { opacity: 1; transform: scale(1); }

/* root option cards look a bit bigger / centered icon-on-top */
.root-grid .opt-btn {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 16px;
  min-height: 108px;
}
.root-grid .opt-btn .opt-icon { width: 38px; height: 38px; }
.root-grid .opt-btn .opt-icon svg { width: 19px; height: 19px; }

/* ---------- Result / leaf card ---------- */
.result-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(139, 147, 255, 0.35);
  background: linear-gradient(180deg, rgba(139,147,255,0.08), rgba(61,220,199,0.04) 40%, var(--panel) 100%);
  padding: clamp(20px, 4vw, 34px);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 30px 80px -30px rgba(111,123,255,0.35);
  animation: cardIn .55s cubic-bezier(.2,.8,.2,1) both;
  scroll-margin-top: 140px;
}
.result-head {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.result-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(26px, 5vw, 38px);
  letter-spacing: -0.02em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.result-title-wrap { flex: 1; min-width: 200px; }
.result-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 4px;
}
.result-title { margin: 0; font-size: clamp(17px, 2.6vw, 21px); font-weight: 700; }
.result-badge-status {
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.status-ok { background: var(--success-bg); color: var(--success); }
.status-na { background: rgba(255,184,77,0.12); color: var(--warn); }

.na-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(255,184,77,0.08);
  border: 1px solid rgba(255,184,77,0.25);
  color: #ffd9a0;
  font-size: 13.5px;
  line-height: 1.6;
}
.na-notice svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; stroke: var(--warn); }

.section-block {
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}
.section-block.can { border-color: rgba(61,220,151,0.3); background: var(--success-bg); }
.section-block.cannot { border-color: rgba(255,112,133,0.3); background: var(--danger-bg); }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 16px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
}
.section-head .sec-icon {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06);
}
.section-block.can .sec-icon { background: rgba(61,220,151,0.18); }
.section-block.cannot .sec-icon { background: rgba(255,112,133,0.18); }
.section-head .sec-icon svg { width: 15px; height: 15px; }
.section-block.can .sec-icon svg { stroke: var(--success); }
.section-block.cannot .sec-icon svg { stroke: var(--danger); }
.section-head .sec-title { flex: 1; }
.section-head .sec-caret { width: 16px; height: 16px; opacity: 0.5; transition: transform .2s ease; flex-shrink: 0; }
.section-block.open .sec-caret { transform: rotate(180deg); }

.section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}
.section-block.open .section-body { max-height: 2000px; }
.section-body-inner {
  padding: 0 16px 16px 54px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-dim);
}
.section-body-inner ul { margin: 0; padding-left: 18px; }
.section-body-inner li { margin-bottom: 6px; }
.section-body-inner p { margin: 0 0 8px; }
.section-body-inner p:last-child { margin-bottom: 0; }

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ---------- Modal (browse all) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4,5,9,0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }
.modal-panel {
  width: 100%;
  max-width: 680px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: #0c0e17;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 100px -30px rgba(0,0,0,0.8);
  transform: translateY(14px) scale(0.98);
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.modal-overlay.visible .modal-panel { transform: translateY(0) scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.modal-header h3 { margin: 0; font-size: 15.5px; flex: 1; }
.modal-search {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.modal-search input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color .18s ease;
}
.modal-search input:focus { border-color: var(--accent); }
.modal-body { padding: 14px 20px 24px; overflow-y: auto; }
.modal-body.detail-mode { padding: 20px; }

.visa-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .15s ease, border-color .15s ease;
}
.visa-list-item:hover { background: rgba(255,255,255,0.05); border-color: var(--panel-border); }
.visa-list-item .vli-idx {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--accent-2);
  width: 52px;
  flex-shrink: 0;
}
.visa-list-item .vli-title { flex: 1; font-size: 13px; color: var(--text-dim); }
.visa-list-item .vli-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--success); }
.visa-list-item .vli-dot.na { background: var(--text-faint); }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--panel-border-hover); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 28px 16px 40px;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.7;
}
footer a { color: var(--accent-2); text-decoration: none; }
footer a:hover { text-decoration: underline; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .opt-grid, .opt-grid.root-grid { grid-template-columns: 1fr; }
  .crumbs-bar { top: 66px; }
  .app-header { padding: 14px 16px; }
  .brand-text p { display: none; }
}
