/* Tracedroute ecosystem blade — frosted left overlay, blade silhouette, flush to screen. */
:root {
  --tr-blade-w: 3.85rem;
  --tr-blade-w-open: 12.25rem;
  --tr-blade-glass: rgba(6, 12, 20, 0.42);
  --tr-blade-glass-strong: rgba(6, 12, 20, 0.55);
  --tr-blade-edge: rgba(255, 255, 255, 0.14);
  --tr-blade-fg: rgba(245, 250, 255, 0.94);
  --tr-blade-muted: rgba(190, 210, 226, 0.78);
  --tr-blade-accent: #6eb4c4;
  --tr-blade-accent-soft: rgba(110, 180, 196, 0.22);
  --tr-blade-badge: #e06b3a;
  --tr-blade-shadow: 10px 0 36px rgba(0, 0, 0, 0.35);
  /* Vertical katana-style silhouette: flat spine on the left, beveled edge + tip on the right. */
  --tr-blade-shape: polygon(
    0% 0%,
    78% 0%,
    100% 2.2rem,
    100% calc(100% - 3.25rem),
    62% 100%,
    0% 100%
  );
}

/* Never pad/push the host page — this is a floating overlay. */
html.tr-blade-ready body {
  padding-left: 0 !important;
}

.tr-blade {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  width: var(--tr-blade-w);
  height: 100vh;
  height: 100dvh;
  padding: 0.85rem 0.45rem 1rem 0.4rem;
  box-sizing: border-box;
  pointer-events: auto;
  color: var(--tr-blade-fg);
  font-family: "Manrope", "Segoe UI", system-ui, sans-serif;
  border: 0;
  border-radius: 0;
  clip-path: var(--tr-blade-shape);
  -webkit-clip-path: var(--tr-blade-shape);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, transparent 18%),
    linear-gradient(90deg, rgba(110, 180, 196, 0.16) 0%, transparent 42%),
    var(--tr-blade-glass);
  box-shadow: var(--tr-blade-shadow);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  transition: width 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.2s ease;
  overflow: hidden;
  transform: none;
}
.tr-blade::before {
  /* Bright cutting edge along the right bevel */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 72%,
    rgba(255, 255, 255, 0.18) 88%,
    rgba(110, 180, 196, 0.35) 100%
  );
  pointer-events: none;
}
.tr-blade::after {
  /* Spine highlight flush to the screen edge */
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(
    180deg,
    rgba(110, 180, 196, 0.75),
    rgba(255, 255, 255, 0.25) 40%,
    rgba(110, 180, 196, 0.55)
  );
  pointer-events: none;
}
.tr-blade.is-open {
  width: var(--tr-blade-w-open);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, transparent 18%),
    linear-gradient(90deg, rgba(110, 180, 196, 0.18) 0%, transparent 36%),
    var(--tr-blade-glass-strong);
}

/* Fully tucked: no glass overlay — toggle stays fixed mid-edge (see .tr-blade__toggle). */
.tr-blade.is-peek {
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  clip-path: none;
  -webkit-clip-path: none;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: visible;
  pointer-events: none;
  transform: none;
}
.tr-blade.is-peek::before,
.tr-blade.is-peek::after {
  display: none;
}
.tr-blade.is-peek .tr-blade__inbox,
.tr-blade.is-peek .tr-blade__list,
.tr-blade.is-peek .tr-blade__foot {
  display: none !important;
}

/* Always pinned to the left mid-center edge in every mode. */
.tr-blade__toggle {
  position: fixed;
  top: 50%;
  left: 0.4rem;
  transform: translateY(-50%);
  z-index: 2147483002;
  width: 2.2rem;
  height: 2.2rem;
  margin: 0;
  border: 1px solid var(--tr-blade-edge);
  border-radius: 999px;
  background: rgba(6, 12, 20, 0.72);
  color: var(--tr-blade-fg);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  border-color: rgba(110, 180, 196, 0.55);
}
.tr-blade__toggle:hover,
.tr-blade__toggle:focus-visible {
  border-color: var(--tr-blade-accent);
  background: var(--tr-blade-accent-soft);
  outline: none;
}

.tr-blade__inbox {
  position: relative;
  z-index: 1;
  margin: 0 0 0.55rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.tr-blade__inbox-link {
  width: 100%;
}

.tr-blade__icon[data-icon="inbox"] {
  color: #f0c27a;
}

.tr-blade__list {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  overflow: auto;
  scrollbar-width: thin;
}

.tr-blade__item {
  margin: 0;
}

.tr-blade__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.55rem;
  padding: 0.2rem 0.3rem;
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}
.tr-blade__link:hover,
.tr-blade__link:focus-visible {
  background: var(--tr-blade-accent-soft);
  outline: none;
  transform: translateX(2px);
}
.tr-blade__link.is-active {
  background: rgba(110, 180, 196, 0.28);
  box-shadow: inset 0 0 0 1px rgba(110, 180, 196, 0.35);
}

.tr-blade__icon {
  flex: 0 0 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.28);
  color: var(--tr-blade-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.tr-blade__icon svg {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tr-blade__icon[data-icon="hayabusa"] {
  color: #7ec8d8;
}
.tr-blade__icon[data-icon="orders"] {
  color: #9ad4a8;
}
.tr-blade__icon[data-icon="support"] {
  color: #e0c07a;
}
.tr-blade__icon[data-icon="website"] {
  color: #8eb8ef;
}
.tr-blade__icon[data-icon="donations"] {
  color: #e89a9a;
}
.tr-blade__icon[data-icon="donations"] svg {
  fill: currentColor;
  stroke: none;
  overflow: visible;
}
.tr-blade__icon[data-icon="billing"] {
  color: #e8a57a;
}
.tr-blade__icon[data-icon="staff"] {
  color: #d4c06a;
}

.tr-blade__label {
  flex: 1;
  min-width: 0;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
  max-width: 0;
  color: var(--tr-blade-fg);
  transition: opacity 0.2s ease, max-width 0.28s ease;
}
.tr-blade.is-open .tr-blade__label {
  opacity: 1;
  max-width: 9rem;
}

.tr-blade__badge {
  position: absolute;
  top: 0.1rem;
  left: 1.65rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--tr-blade-badge);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
  box-sizing: border-box;
  box-shadow: 0 0 0 2px rgba(6, 12, 20, 0.45);
}

.tr-blade__foot {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 720px) {
  .tr-blade:not(.is-peek) {
    --tr-blade-shape: polygon(
      0% 0%,
      100% 0%,
      100% calc(100% - 1.1rem),
      88% 100%,
      0% 100%
    );
    top: auto;
    left: 0;
    bottom: 0;
    height: auto;
    width: min(100vw, 22rem);
    max-width: 100vw;
    flex-direction: row;
    align-items: center;
    padding: 0.45rem 0.75rem 0.55rem 0.4rem;
  }
  .tr-blade.is-open:not(.is-peek) {
    width: min(100vw, 22rem);
    flex-wrap: wrap;
  }
  .tr-blade:not(.is-peek) .tr-blade__list {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }
  .tr-blade:not(.is-peek) .tr-blade__foot {
    border-top: 0;
    padding-top: 0;
  }
  .tr-blade.is-open .tr-blade__label {
    max-width: 7rem;
  }
  .tr-blade.is-peek {
    top: 0;
    bottom: auto;
    left: 0;
    width: 0;
    height: 0;
    max-width: none;
    transform: none;
    flex-direction: column;
  }
  .tr-blade__toggle {
    top: 50%;
    left: 0.35rem;
    bottom: auto;
    transform: translateY(-50%);
  }
}
