:root {
  color-scheme: light;
  --bg: #f7f9fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --cyan: #06b6d4;
  --teal: #14b8a6;
  --blue: #0891b2;
  --green: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --indigo: #6366f1;
  --shadow: 0 8px 30px rgba(30, 41, 59, 0.04);
  --shadow-hover: 0 12px 36px rgba(8, 145, 178, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, "Noto Sans TC", sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.92em;
}

.shell {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid rgba(226, 232, 240, 0.7);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(6, 182, 212, 0.22);
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 9px;
  margin-top: 32px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  padding-bottom: 12px;
  scrollbar-gutter: stable;
}

.nav::-webkit-scrollbar {
  width: 8px;
}

.nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.24);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  text-align: left;
  transition: 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  color: #0891b2;
  border-color: rgba(226, 232, 240, 0.9);
  background: #fff;
  box-shadow: 0 8px 20px rgba(30, 41, 59, 0.04);
}

.nav-item.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  box-shadow: 0 8px 20px rgba(6, 182, 212, 0.22);
}

.nav-item strong {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  text-align: center;
  font-size: 12px;
}

.nav-item.active strong {
  color: #0f766e;
  background: rgba(255, 255, 255, 0.88);
}

.nav-item.is-hidden {
  display: none;
}

.main {
  min-width: 0;
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 32px 40px 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #0891b2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 20px;
  letter-spacing: 0;
}

.lead {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hero-panel > div {
  display: grid;
  align-content: center;
  min-height: 116px;
  padding: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 32px rgba(30, 41, 59, 0.04);
}

.hero-panel strong {
  font-size: 30px;
  line-height: 1;
}

.hero-panel span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 18px 60px rgba(30, 41, 59, 0.04);
  backdrop-filter: blur(12px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(30, 41, 59, 0.04);
}

.search-box svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
}

.result-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.sync-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid rgba(8, 145, 178, 0.2);
  border-radius: 18px;
  background: #ecfeff;
  color: #0e7490;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: 0.2s ease;
}

.sync-button:hover {
  border-color: rgba(8, 145, 178, 0.36);
  background: #cffafe;
  transform: translateY(-1px);
}

.sync-button.is-syncing {
  pointer-events: none;
  opacity: 0.68;
}

.sync-status {
  grid-column: 1 / -1;
  min-height: 18px;
  margin: -4px 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.sync-status.is-error {
  color: #be123c;
}

.sync-status.is-success {
  color: #0f766e;
}

.content-area {
  display: block;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.group-section,
.favorite-strip {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 18px 60px rgba(30, 41, 59, 0.04);
  backdrop-filter: blur(12px);
}

.favorite-strip {
  margin-top: 0;
  margin-bottom: 18px;
}

.section-head,
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head h2,
.view-header h2 {
  margin: 0;
}

.section-head > span,
.view-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.group-card {
  display: grid;
  gap: 12px;
  min-height: 248px;
  padding: 18px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: 0.2s ease;
}

.group-card:hover {
  transform: translateY(-2px);
  border-color: rgba(103, 232, 249, 0.7);
  box-shadow: var(--shadow-hover);
}

.group-card-head,
.group-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.group-count {
  padding: 4px 9px;
  border-radius: 999px;
  background: #ecfeff;
  color: #0891b2;
  font-size: 12px;
  font-weight: 800;
}

.group-card h3 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  letter-spacing: 0;
}

.group-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.group-card ul {
  display: grid;
  gap: 4px;
  min-height: 78px;
  margin: 0;
  padding-left: 18px;
  color: #64748b;
  font-size: 12px;
}

.group-card li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-meta {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(226, 232, 240, 0.72);
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
}

.favorite-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.favorite-empty {
  margin: 0;
  padding: 14px 16px;
  border: 1px dashed rgba(203, 213, 225, 0.9);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.76);
  color: var(--muted);
  font-size: 13px;
}

.inline-link,
.back-button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 12px;
  background: #fff;
  color: #0891b2;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  transition: 0.2s ease;
}

.inline-link:hover,
.back-button:hover {
  transform: translateY(-1px);
  background: #f8fafc;
}

.view-header {
  padding: 18px 20px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 10px 32px rgba(30, 41, 59, 0.04);
}

.tool-card {
  display: grid;
  gap: 14px;
  min-height: 236px;
  padding: 20px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transition: 0.2s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: rgba(103, 232, 249, 0.7);
  box-shadow: var(--shadow-hover);
}

.tool-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.tool-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #fff;
  font-weight: 800;
}

.tool-icon.ecf,
.tool-icon.ai {
  background: linear-gradient(135deg, #06b6d4, #14b8a6);
}

.tool-icon.docs {
  background: #475569;
}

.tool-icon.finance {
  background: #10b981;
}

.tool-icon.games {
  background: var(--rose);
}

.tool-icon.media {
  background: var(--amber);
}

.tool-icon.other {
  background: #64748b;
}

.tool-icon.becky {
  background: linear-gradient(135deg, #10b981, #14b8a6);
}

.tool-icon.links {
  background: var(--indigo);
}

.tool-card h3 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.28;
  letter-spacing: 0;
}

.tool-desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.version-tag {
  background: #ecfeff;
  color: #0891b2;
}

.version-list {
  border: 1px solid rgba(226, 232, 240, 0.88);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.72);
}

.version-list summary {
  min-height: 36px;
  padding: 8px 10px;
  color: #0891b2;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.version-list ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 10px 10px 26px;
  color: var(--muted);
  font-size: 13px;
}

.version-list li {
  padding-right: 4px;
}

.version-list a {
  color: #0891b2;
  font-weight: 750;
  text-decoration: none;
}

.version-list a:hover {
  text-decoration: underline;
}

.version-list span {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: auto;
}

.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  transition: 0.2s ease;
}

.action.primary {
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: #fff;
  box-shadow: 0 8px 20px rgba(6, 182, 212, 0.18);
}

.action.secondary {
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: #fff;
  color: #334155;
}

.action:hover {
  transform: translateY(-1px);
}

.empty-state {
  display: none;
  padding: 28px;
  border: 1px dashed rgba(203, 213, 225, 0.9);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  text-align: center;
}

.empty-state.show {
  display: block;
}

.guide {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  margin-top: 22px;
  padding: 20px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 18px 60px rgba(30, 41, 59, 0.04);
  backdrop-filter: blur(12px);
}

.guide ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.guide li + li {
  margin-top: 6px;
}

@media (max-width: 1040px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: block;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
    padding-right: 0;
  }

  .main {
    padding: 28px 22px 34px;
  }

  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-grid,
  .favorite-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main {
    padding: 22px 16px 28px;
  }

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

  .nav,
  .tools-grid,
  .group-grid,
  .favorite-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .view-header {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

  .result-text {
    white-space: normal;
  }

  .sync-button {
    width: 100%;
  }
}
