:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #72e091;
  --primarySoft: #e9fbf1;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body.gated {
  overflow: hidden;
}

body.previewOpen {
  overflow: hidden;
}

body.gated .appShell {
  pointer-events: none;
  user-select: none;
  filter: none;
  opacity: 1;
}

.appShell {
  width: 100%;
  min-height: 100vh;
  display: block;
  padding: 14px 14px 14px 274px;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.sidebar {
  width: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  position: fixed;
  left: 14px;
  top: 14px;
  bottom: 14px;
  overflow: auto;
  scrollbar-width: none;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}

.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.brandBlock {
  border-bottom: 1px solid var(--line);
  padding: 21px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
}

.brandRow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brandLogo {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.brandTitle {
  margin: 0;
  font-size: 1.05rem;
}

.brandSub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.categoryList {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.categoryBtn {
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
  font-size: 0.92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.categoryBtn:hover {
  border-color: rgba(114, 224, 145, 0.35);
  background: rgba(114, 224, 145, 0.08);
}

.categoryBtn.active {
  border-color: rgba(114, 224, 145, 0.55);
  background: rgba(114, 224, 145, 0.14);
  color: var(--primary);
  font-weight: 600;
}

.categoryIcon {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  flex-shrink: 0;
  object-fit: cover;
}

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

.mainPanel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  left: 274px;
  width: auto;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mainHeader {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex: 0 0 auto;
}

.toolScroll {
  flex: 1 1 auto;
  overflow: auto;
  padding: 14px;
  scrollbar-width: none;
}

.toolScroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin: 0;
}

.toolbarRight {
  display: flex;
  align-items: center;
  gap: 8px;
}

.searchInput {
  border: 1px solid #d8deea;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
  width: 100%;
}

.searchInput:focus {
  outline: none;
  border-color: #8bb0ff;
  box-shadow: 0 0 0 3px #e9f1ff;
}

.countBadge {
  border: 1px solid #d8deea;
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  padding: 9px 12px;
  font-size: 0.86rem;
}

.authActionBtn {
  border: 1px solid #cdd8ee;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  padding: 9px 12px;
  font-size: 0.84rem;
  cursor: pointer;
}

.authActionBtn:hover {
  border-color: #adc4f4;
  background: #f5f8ff;
}

.toolGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
}

.toolCard {
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  padding: 16px;
  display: flex;
  gap: 22px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  appearance: none;
  box-shadow: 0 10px 28px rgba(8, 15, 30, 0.05);
}

.toolCard:hover {
  border-color: rgba(114, 224, 145, 0.45);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 34px rgba(8, 15, 30, 0.08);
}

.toolCard:focus-visible {
  outline: 2px solid #93b1ff;
  outline-offset: 2px;
}

.toolCardDisabled {
  cursor: default;
  opacity: 0.75;
}

.toolCardDisabled:hover {
  border-color: var(--line);
  background: #fff;
}

.toolIconWrap {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #e7ecf5;
  background: #f5f7fb;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.toolIconImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.toolIconFallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a5c87;
  font-size: 0.75rem;
  font-weight: 700;
}

.toolBody {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 3px;
}

.toolHead {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.toolName {
  margin: 0;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
  max-width: min(12ch, 100%);
}

.toolTag {
  font-size: 0.72rem;
  color: #64748b;
  border: 1px solid #e5eaf2;
  border-radius: 999px;
  padding: 2px 6px;
  background: #f5f7fa;
  flex-shrink: 0;
}

.toolDesc {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: min(24ch, 100%);
}

.toolPreviewPopover {
  position: fixed;
  z-index: 120;
  width: min(380px, calc(100vw - 20px));
  max-height: min(420px, calc(100vh - 20px));
  overflow: auto;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(8, 15, 30, 0.18);
  padding: 12px;
  backdrop-filter: blur(10px) saturate(1.05);
}

.toolPreviewOverlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(10px) saturate(1.05);
}

.toolPreviewModal {
  width: min(560px, calc(100vw - 28px));
  max-height: min(78vh, 720px);
  overflow: auto;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(8, 15, 30, 0.3);
  padding: 14px;
}

.toolPreviewCloseBtn {
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: #334155;
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
  position: absolute;
  top: 10px;
  right: 10px;
}

.toolPreviewCloseBtn:hover {
  border-color: rgba(148, 163, 184, 0.9);
  background: rgba(255, 255, 255, 1);
}

.toolPreviewMetaRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.toolPreviewChip {
  font-size: 0.78rem;
  color: #475569;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(248, 250, 252, 0.9);
}

.toolPreviewInner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 8px 6px 4px;
}

.toolPreviewIconWrap {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(248, 250, 252, 0.95);
  overflow: hidden;
  position: relative;
}

.toolPreviewIconImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.toolPreviewIconFallback {
  font-size: 0.95rem;
}

.toolPreviewName {
  color: #0f172a;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
}

.toolPreviewDesc {
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.toolPreviewDescCentered {
  text-align: center;
}

.toolPreviewVisitBtn {
  margin-top: 6px;
  width: min(360px, 100%);
  border: 1px solid rgba(114, 224, 145, 0.85);
  border-radius: 14px;
  background: rgba(114, 224, 145, 0.18);
  color: rgba(11, 111, 58, 0.98);
  padding: 12px 14px;
  font-size: 0.92rem;
  cursor: pointer;
}

.toolPreviewVisitBtn:hover {
  border-color: rgba(114, 224, 145, 0.95);
  background: rgba(114, 224, 145, 0.24);
}

.toolPreviewVisitBtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toolFoot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.toolDomain {
  color: #8a95a9;
  font-size: 0.75rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.toolLink {
  color: var(--primary);
  font-size: 0.78rem;
}

.emptyState {
  border: 1px dashed #d5ddeb;
  border-radius: 10px;
  padding: 20px;
  color: var(--muted);
  display: none;
  text-align: center;
}

.fogOverlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  overflow: hidden;
}

.fogOverlay.hidden {
  display: none;
}

.fogOverlay::before {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: var(--gateTop, 24vh);
  height: 190px;
  z-index: 1;
  background:
    radial-gradient(circle at 6% 92%, rgba(255, 255, 255, 0.82) 0 78px, transparent 82px),
    radial-gradient(circle at 18% 76%, rgba(255, 255, 255, 0.86) 0 92px, transparent 96px),
    radial-gradient(circle at 33% 90%, rgba(255, 255, 255, 0.8) 0 82px, transparent 86px),
    radial-gradient(circle at 48% 74%, rgba(255, 255, 255, 0.84) 0 102px, transparent 106px),
    radial-gradient(circle at 64% 90%, rgba(255, 255, 255, 0.8) 0 86px, transparent 90px),
    radial-gradient(circle at 78% 76%, rgba(255, 255, 255, 0.86) 0 96px, transparent 100px),
    radial-gradient(circle at 92% 92%, rgba(255, 255, 255, 0.82) 0 76px, transparent 80px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0));
  filter: blur(16px);
  opacity: 0.95;
  pointer-events: none;
  transform: translate3d(0, -50%, 0);
  animation: cloudWave 10s ease-in-out infinite alternate;
}

.fogLayer {
  position: absolute;
  inset: 0;
  z-index: 0;
  backdrop-filter: blur(26px) saturate(1.05) brightness(1.04);
  clip-path: polygon(0 24vh, 100% 24vh, 100% 100%, 0 100%);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.2), transparent 54%),
    radial-gradient(circle at 86% 46%, rgba(255, 255, 255, 0.16), transparent 58%),
    radial-gradient(circle at 24% 86%, rgba(114, 224, 145, 0.12), transparent 58%),
    radial-gradient(circle at 78% 86%, rgba(114, 224, 145, 0.1), transparent 56%),
    linear-gradient(180deg, rgba(233, 251, 241, 0.2), rgba(114, 224, 145, 0.06));
  animation: fogMove 14s ease-in-out infinite alternate;
}

@keyframes fogMove {
  0% {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  100% {
    transform: scale(1.08) translate3d(-2.6%, 2.2%, 0);
  }
}

@keyframes cloudWave {
  0% {
    transform: translate3d(-1.2%, 0, 0);
  }
  100% {
    transform: translate3d(1.2%, 0, 0);
  }
}

.authModal {
  position: absolute;
  top: var(--gateTop, 24vh);
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 26px));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(233, 251, 241, 0.84));
  border: 1px solid rgba(114, 224, 145, 0.38);
  border-radius: 18px;
  padding: 18px 16px 16px;
  z-index: 2;
  display: grid;
  gap: 10px;
  box-shadow:
    0 24px 70px rgba(8, 15, 30, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.45) inset;
}

.authModal::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
  opacity: 0.7;
  pointer-events: none;
}

.authTitle {
  margin: 0;
  font-size: 1rem;
  color: rgba(15, 23, 42, 0.92);
}

.authTabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(114, 224, 145, 0.28);
}

.authTabBtn {
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 0.88rem;
  color: rgba(15, 23, 42, 0.82);
}

.authTabBtn.active {
  background: rgba(114, 224, 145, 0.22);
  border-color: rgba(114, 224, 145, 0.55);
  color: rgba(11, 111, 58, 0.98);
  font-weight: 600;
}

.authForm {
  display: none;
  gap: 8px;
}

.authForm.active {
  display: grid;
}

.authInput {
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 12px;
  padding: 10px 10px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.78);
  color: rgba(15, 23, 42, 0.92);
}

.authInput:focus {
  outline: none;
  border-color: rgba(114, 224, 145, 0.9);
  box-shadow: 0 0 0 3px rgba(233, 251, 241, 0.92);
}

.authSubmitBtn {
  border: 1px solid rgba(114, 224, 145, 0.9);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(114, 224, 145, 0.95), rgba(62, 204, 132, 0.98));
  color: #fff;
  padding: 10px 10px;
  font-size: 0.9rem;
  cursor: pointer;
}

.authSubmitBtn:hover {
  background: linear-gradient(135deg, rgba(114, 224, 145, 1), rgba(54, 196, 124, 1));
}

.authMessage {
  margin: 0;
  min-height: 18px;
  font-size: 0.82rem;
  color: #b42318;
}

.authMessage.success {
  color: #197a3a;
}

.authAltLink {
  border: 0;
  padding: 2px 0 0;
  background: transparent;
  color: rgba(11, 111, 58, 0.92);
  font-size: 0.84rem;
  cursor: pointer;
  text-align: left;
  justify-self: start;
}

.authAltLink:hover {
  text-decoration: underline;
}

@media (max-height: 720px) {
  .fogOverlay {
    top: 18vh;
    padding-top: 16px;
  }
}

@media (max-width: 980px) {
  .appShell {
    padding: 12px;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    max-height: none;
    border-radius: var(--radius);
    border-right: 1px solid var(--line);
    border-top-right-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    border-top-left-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
    border-left: 1px solid var(--line);
  }

  .categoryList {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
  }

  .categoryList::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .categoryBtn {
    white-space: nowrap;
    width: auto;
  }

  .mainPanel {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    border-left: 1px solid var(--line);
    border-top-left-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
    padding: 14px;
    display: block;
    overflow: visible;
  }

  .mainHeader {
    padding: 0 0 10px;
    border-bottom: 1px solid var(--line);
    background: transparent;
  }

  .toolScroll {
    overflow: visible;
    padding: 12px 0 0;
  }
}

@media (max-width: 640px) {
  .appShell {
    padding: 10px;
  }

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

  .toolbarRight {
    width: 100%;
  }

  .countBadge,
  .authActionBtn {
    flex: 1;
    text-align: center;
  }



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