:root {
  --bg-a: #0e2f8a;
  --bg-b: #0aa6c8;
  --card: rgba(255, 255, 255, 0.22);
  --card-line: rgba(255, 255, 255, 0.7);
  --text: #f4fbff;
  --muted: #c9ddf4;
  --line: rgba(199, 226, 255, 0.4);
  --primary: #9cf4e4;
  --primary-press: #7be5d2;
  --danger: #ff3b30;
  --shadow: 0 26px 70px -46px rgba(2, 15, 46, 0.8);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 75% 85%, rgba(191, 255, 243, 0.34), rgba(191, 255, 243, 0) 40%),
    linear-gradient(160deg, var(--bg-a), #1550bf 43%, var(--bg-b));
  background-attachment: fixed;
  font-family:
    "SF Pro Text",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.login-page {
  min-height: 100vh;
}

.ambient-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.cursor-trail-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  opacity: 0.92;
  mix-blend-mode: screen;
}

.ambient-layer::before,
.ambient-layer::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  mix-blend-mode: screen;
  will-change: transform, opacity;
}

.ambient-layer::before {
  width: 46vmax;
  height: 46vmax;
  left: 32vw;
  top: 8vh;
  background: radial-gradient(circle, rgba(198, 238, 255, 0.34), rgba(198, 238, 255, 0) 62%);
  filter: blur(3px);
  animation: haloDriftA 16s ease-in-out infinite alternate;
}

.ambient-layer::after {
  width: 34vmax;
  height: 34vmax;
  right: -8vmax;
  bottom: 10vh;
  background: radial-gradient(circle, rgba(178, 250, 238, 0.3), rgba(178, 250, 238, 0) 64%);
  filter: blur(4px);
  animation: haloDriftB 14s ease-in-out infinite alternate;
}

.ambient-blob,
.ambient-ring,
.ambient-beam {
  position: absolute;
  will-change: transform, opacity;
}

.noise-film {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  opacity: 0.13;
  mix-blend-mode: soft-light;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.8) 0 0.55px, transparent 0.95px),
    radial-gradient(circle at 70% 45%, rgba(255, 255, 255, 0.78) 0 0.55px, transparent 0.95px),
    radial-gradient(circle at 35% 76%, rgba(255, 255, 255, 0.76) 0 0.6px, transparent 1px),
    radial-gradient(circle at 88% 82%, rgba(255, 255, 255, 0.74) 0 0.55px, transparent 0.95px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, rgba(0, 0, 0, 0) 1px 3px);
  background-size: 3px 3px, 4px 4px, 3px 3px, 5px 5px, 100% 100%;
  animation: noiseShift 0.95s steps(2, end) infinite;
}


.ambient-blob {
  border-radius: 50%;
  filter: blur(3px);
}

.ambient-ring {
  border-radius: 50%;
  border: 1px solid rgba(226, 250, 255, 0.46);
  box-shadow:
    inset 0 0 45px rgba(220, 248, 255, 0.2),
    0 0 20px rgba(210, 242, 255, 0.22);
}

.ambient-beam {
  border-radius: 999px;
  filter: blur(1.4px);
}

.blob-a {
  width: 16vmax;
  height: 16vmax;
  left: 11vw;
  top: 24vh;
  background: radial-gradient(circle, rgba(214, 255, 245, 0.56), rgba(214, 255, 245, 0));
  animation: floatBlobA 19s ease-in-out infinite alternate;
}

.blob-b {
  width: 12vmax;
  height: 12vmax;
  right: 20vw;
  bottom: 22vh;
  background: radial-gradient(circle, rgba(196, 236, 255, 0.5), rgba(196, 236, 255, 0));
  animation: floatBlobB 22s ease-in-out infinite alternate;
}

.ring-a {
  width: 24vmax;
  height: 24vmax;
  right: -8vmax;
  top: 22vh;
  opacity: 0.72;
  animation: driftRingA 22s linear infinite;
}

.ring-b {
  width: 18vmax;
  height: 18vmax;
  left: 6vw;
  bottom: -7vmax;
  opacity: 0.56;
  animation: driftRingB 26s linear infinite;
}

.beam-a {
  width: 54vmax;
  height: 1.5vmax;
  left: -10vmax;
  top: 58vh;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(228, 252, 255, 0.86), rgba(255, 255, 255, 0));
  transform: rotate(-8deg);
  animation: sweepBeamA 10s ease-in-out infinite alternate;
}

.beam-b {
  width: 42vmax;
  height: 1.25vmax;
  right: -8vmax;
  top: 34vh;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(205, 247, 255, 0.8), rgba(255, 255, 255, 0));
  transform: rotate(-15deg);
  animation: sweepBeamB 11s ease-in-out infinite alternate;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(2px);
  z-index: 0;
  will-change: transform;
}

body::before {
  width: 62vmax;
  height: 62vmax;
  left: -18vmax;
  bottom: -10vmax;
  background: radial-gradient(circle at 55% 45%, rgba(185, 255, 236, 1), rgba(185, 255, 236, 0.44) 58%, transparent 72%);
  animation: driftOrbA 18s ease-in-out infinite alternate;
}

body::after {
  width: 66vmax;
  height: 66vmax;
  right: -24vmax;
  top: -22vmax;
  background: radial-gradient(circle at 45% 55%, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.22) 52%, transparent 74%);
  animation: driftOrbB 20s ease-in-out infinite alternate;
}

button,
input {
  font: inherit;
}

.app {
  width: min(1180px, 95vw);
  margin: 2.4rem auto;
  position: relative;
  z-index: 1;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 3.2rem 0;
}

.login-card {
  width: min(560px, 92vw);
  padding: 2rem 2.2rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(214, 239, 255, 0.55);
  backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 24px 50px -40px rgba(3, 18, 55, 0.55);
}

.login-header h1 {
  font-size: 1.5rem;
  color: #0b1c2e;
  text-align: center;
  margin-bottom: 1.1rem;
}

.login-header.simple {
  text-align: center;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0b2c48;
  background: rgba(214, 246, 255, 0.6);
  border: 1px solid rgba(190, 232, 255, 0.75);
  margin-bottom: 1rem;
}

.login-actions {
  display: grid;
  gap: 0.75rem;
}

.login-btn {
  width: 100%;
  justify-content: center;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.65rem 1rem;
  text-decoration: none;
}

.login-btn.primary-btn {
  background: #ffffff;
  color: #0b233a;
  border: 1px solid rgba(17, 24, 39, 0.25);
  box-shadow: none;
  border-radius: 10px;
}

.login-btn.primary-btn:hover {
  background: #f6f8fb;
}

.login-icon {
  width: 1.1rem;
  height: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.login-note {
  margin: 0;
  height: 0;
  overflow: hidden;
}

@keyframes driftOrbA {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(3.5vmax, -2.5vmax, 0) scale(1.03);
  }
  100% {
    transform: translate3d(1.5vmax, 1.5vmax, 0) scale(0.99);
  }
}

@keyframes driftOrbB {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-4vmax, 2vmax, 0) scale(1.04);
  }
  100% {
    transform: translate3d(-1.5vmax, -1vmax, 0) scale(1);
  }
}

@keyframes floatBlobA {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.56;
  }
  100% {
    transform: translate3d(5vw, -3vh, 0) scale(1.1);
    opacity: 0.3;
  }
}

@keyframes floatBlobB {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.5;
  }
  100% {
    transform: translate3d(-4vw, 3vh, 0) scale(1.08);
    opacity: 0.26;
  }
}

@keyframes driftRingA {
  0% {
    transform: rotate(0deg) translate3d(0, 0, 0);
  }
  100% {
    transform: rotate(360deg) translate3d(1.2vmax, -0.8vmax, 0);
  }
}

@keyframes driftRingB {
  0% {
    transform: rotate(0deg) translate3d(0, 0, 0);
  }
  100% {
    transform: rotate(-360deg) translate3d(-1vmax, 0.9vmax, 0);
  }
}

@keyframes sweepBeamA {
  0% {
    transform: translate3d(0, 0, 0) rotate(-8deg);
    opacity: 0.38;
  }
  100% {
    transform: translate3d(14vw, -2vh, 0) rotate(-7deg);
    opacity: 0.62;
  }
}

@keyframes sweepBeamB {
  0% {
    transform: translate3d(0, 0, 0) rotate(-15deg);
    opacity: 0.28;
  }
  100% {
    transform: translate3d(-10vw, 2vh, 0) rotate(-14deg);
    opacity: 0.5;
  }
}

@keyframes noiseShift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  33% {
    transform: translate3d(-1px, 1px, 0);
  }
  66% {
    transform: translate3d(1px, -1px, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes haloDriftA {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.42;
  }
  100% {
    transform: translate3d(4vw, -2vh, 0) scale(1.08);
    opacity: 0.68;
  }
}

@keyframes haloDriftB {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.34;
  }
  100% {
    transform: translate3d(-3vw, 2vh, 0) scale(1.07);
    opacity: 0.6;
  }
}


@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: none;
  }

  .ambient-blob,
  .ambient-ring,
  .ambient-beam {
    animation: none;
  }

  .ambient-layer::before,
  .ambient-layer::after {
    animation: none;
  }

  .noise-film {
    animation: none;
  }

  .cursor-trail-canvas {
    display: none;
  }

  .panel {
    transition: none;
    transform: translate3d(0, 0, 0);
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.08rem;
  color: #0f3f67;
}

.subtitle {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(128, 185, 236, 0.14), rgba(110, 171, 228, 0.1)),
    var(--card);
  border: 1px solid rgba(230, 247, 255, 0.55);
  border-radius: 22px;
  padding: 1.1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(160%);
  transform: translate3d(var(--panel-px, 0px), var(--panel-py, 0px), 0);
  transition: transform 220ms ease-out;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 30%, transparent 58%),
    radial-gradient(circle at 12% 0%, rgba(184, 229, 255, 0.24), transparent 36%);
}

.panel-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.header-tools {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(231, 246, 255, 0.32);
  border: 1px solid rgba(218, 241, 255, 0.45);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  min-width: 320px;
  backdrop-filter: blur(10px);
}

.search-wrap input {
  border: 0 !important;
  outline: 0;
  background: transparent;
  box-shadow: none !important;
  width: 100%;
  color: #0f4a75;
  padding: 0;
  border-radius: 0;
}

.search-meta {
  color: #2c5a84;
  font-size: 0.84rem;
  min-height: 1.05rem;
  margin-top: 0.75rem;
}

.modal-body {
  color: #0f172a;
}

.tree {
  position: relative;
  padding-top: 0.45rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 16px;
  padding: 0.65rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(5px) saturate(112%);
  overflow: visible;
}

.panel-footer {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.node-wrap {
  margin: 0.18rem 0;
}

.node-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.7rem;
  padding: 0.22rem 0.24rem;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: 160ms ease;
}

.node-row:hover {
  background: rgba(238, 251, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.node-row.dragging {
  opacity: 0.48;
}

.node-row.drop-before {
  border-top-color: var(--primary);
}

.node-row.drop-after {
  border-bottom-color: var(--primary);
}

.node-row.drop-inside {
  background: rgba(162, 246, 231, 0.25);
  border-color: rgba(190, 252, 242, 0.72);
}

.node-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.16rem;
  width: 100%;
}

.node-title-btn {
  border: 0;
  background: transparent;
  text-align: left;
  color: #103c66;
  border-radius: 10px;
  cursor: pointer;
  min-width: 0;
  font-size: 0.95rem;
  padding: 0.38rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.38rem;
}

.node-title-btn:hover {
  background: rgba(216, 247, 255, 0.2);
}

.node-title-btn.bookmark {
  color: #06233f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
  position: relative;
  z-index: 2;
}

.url-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: min(520px, 70vw);
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  background: rgba(8, 24, 44, 0.8);
  border: 1px solid rgba(180, 220, 255, 0.35);
  color: #f1f8ff;
  font-size: 0.78rem;
  line-height: 1.2;
  box-shadow: 0 16px 30px -18px rgba(8, 19, 38, 0.7);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 160ms ease;
}

.url-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.node-title-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.favicon-wrap {
  width: 1.28rem;
  height: 1.28rem;
  position: relative;
  flex: 0 0 auto;
}

.favicon-img,
.favicon-fallback {
  width: 1.28rem;
  height: 1.28rem;
  border-radius: 3px;
}

.favicon-img {
  display: inline-block;
  object-fit: contain;
}

.favicon-fallback {
  color: #6ea0c9;
}

.toggle-btn {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  color: #3f6f98;
  background: transparent;
  cursor: pointer;
}

.toggle-btn:hover {
  border-color: rgba(216, 244, 255, 0.58);
  background: rgba(224, 249, 255, 0.18);
}

.tiny-btn,
.primary-btn,
.ghost-btn,
.danger-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: 120ms ease;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.89rem;
}

.primary-btn {
  background:
    linear-gradient(180deg, rgba(189, 255, 243, 0.98), rgba(133, 243, 227, 0.98)),
    var(--primary);
  color: #0b3140;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 10px 20px -12px rgba(79, 173, 194, 0.64);
}

.primary-btn:hover {
  background: var(--primary-press);
}

.icon-btn {
  position: relative;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  justify-content: center;
  backdrop-filter: blur(12px) saturate(145%);
}

.ghost-btn {
  background: rgba(234, 249, 255, 0.18);
  border-color: rgba(214, 239, 255, 0.5);
  color: #ecfaff;
}

.ghost-btn:hover {
  background: rgba(241, 252, 255, 0.28);
}

.danger-btn {
  background: rgba(255, 59, 48, 0.1);
  border-color: rgba(255, 59, 48, 0.3);
  color: #9f241d;
}

.danger-btn:hover {
  background: rgba(255, 59, 48, 0.15);
}

.children {
  margin-left: 1.08rem;
  padding-left: 0.72rem;
  border-left: 1px dashed rgba(65, 109, 147, 0.4);
}

.modal {
  border: 0;
  width: min(460px, 92vw);
  border-radius: 22px;
  padding: 0;
  box-shadow: 0 30px 90px -48px #1f2937;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.26);
  backdrop-filter: blur(3px);
}

.modal-body {
  background: #ffffff;
  padding: 1rem;
  display: grid;
  gap: 0.6rem;
}

.modal-body h3 {
  color: #0b1730;
}

.modal-body label {
  color: #334155;
  font-size: 0.88rem;
}

.modal-body input[type="text"] {
  border: 1px solid #cfddee;
  color: #0f172a;
  background: #f8fbff;
}

.modal-body input[type="text"]::placeholder {
  color: #7a8aa0;
}

.modal-body input[type="text"]:focus {
  border-color: #7aa6cf;
  box-shadow: 0 0 0 3px rgba(122, 166, 207, 0.2);
}

.modal-body .ghost-btn {
  background: #ffffff;
  border-color: #cdd8e7;
  color: #334155;
}

.modal-body .ghost-btn:hover {
  background: #f6f9fd;
}

.modal-body .primary-btn {
  background: linear-gradient(180deg, #9af2e3, #76e6d3);
  color: #06353f;
  border-color: #76d8c8;
}

input[type="text"] {
  width: 100%;
  border: 1px solid rgba(212, 237, 255, 0.45);
  border-radius: 12px;
  padding: 0.58rem 0.66rem;
  outline: 0;
  color: #f4fcff;
  background: rgba(229, 247, 255, 0.14);
}

input[type="text"]:focus {
  border-color: rgba(180, 245, 233, 0.8);
  box-shadow: 0 0 0 3px rgba(123, 228, 212, 0.26);
}

.actions {
  margin-top: 0.45rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.search-icon,
.btn-icon,
.node-icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  align-items: center;
  justify-content: center;
}

.search-icon svg,
.btn-icon svg,
.node-icon svg {
  width: 100%;
  height: 100%;
}

.context-menu {
  position: fixed;
  z-index: 999;
  min-width: 190px;
  padding: 0.35rem;
  border-radius: 14px;
  border: 1px solid rgba(212, 237, 255, 0.55);
  background: rgba(214, 240, 255, 0.52);
  backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 18px 34px -24px #0f172a;
}

.context-item {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 10px;
  text-align: left;
  padding: 0.52rem 0.62rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #0b3f67;
  cursor: pointer;
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.36);
}

.context-item:hover {
  background: rgba(255, 255, 255, 0.52);
  color: #08324f;
}

.context-item.danger {
  color: #ab1f15;
}

.context-item .node-icon {
  color: inherit;
}

@media (max-width: 840px) {
  .stack-mobile {
    flex-direction: column;
    align-items: stretch;
  }

  .search-wrap {
    min-width: 0;
    width: 100%;
  }

  .header-tools {
    flex-wrap: wrap;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 680px) {
  .node-row {
    padding-right: 0.35rem;
  }
}

.search-wrap input[type="text"],
.search-wrap input[type="text"]:focus {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
}
