:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --panel-soft: #fbfaf7;
  --text: #171717;
  --muted: #6f6f67;
  --muted-strong: #42423c;
  --line: #e5e0d6;
  --line-strong: #d4cec1;
  --accent: #2f6f66;
  --accent-soft: #e8f2ef;
  --rust: #b45642;
  --gold: #9d7430;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(38, 33, 25, 0.08);
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', 'Noto Sans JP', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--text);
  line-height: 1.6;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0) 360px),
    var(--bg);
}

a { color: inherit; }

header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(229, 224, 214, 0.82);
  background: rgba(246, 244, 239, 0.88);
  backdrop-filter: blur(18px);
  padding: 0 clamp(1rem, 5vw, 4rem);
}

.header-inner {
  width: min(1120px, 100%);
  height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.logo::before {
  content: 'S';
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  font-size: 0.92rem;
  font-weight: 800;
}

.header-right { display: flex; align-items: center; gap: 1.35rem; }

nav a {
  color: var(--muted-strong);
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover { color: var(--accent); }

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.lang-btn {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1;
  padding: 0.48rem 0.62rem;
  white-space: nowrap;
}

.lang-btn:hover { color: var(--text); }

.lang-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

.hero {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(4.5rem, 10vw, 8rem) clamp(1rem, 5vw, 4rem) clamp(3rem, 7vw, 5rem);
}

.hero-label {
  display: inline-flex;
  align-items: center;
  margin-bottom: 1.2rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 860px;
  color: var(--muted-strong);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  font-weight: 500;
  line-height: 1.24;
}

.hero h1 span {
  display: block;
  margin-top: 0.2rem;
  color: var(--text);
  font-size: clamp(3.35rem, 9vw, 7.6rem);
  font-weight: 780;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero p {
  max-width: 620px;
  margin-top: 1.45rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.85;
}

.section {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 0 clamp(1rem, 5vw, 4rem) clamp(4rem, 8vw, 6rem);
}

main.section { counter-reset: section-counter; }

.section-title {
  counter-increment: section-counter;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: var(--text);
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: 0;
}

.section-title::before {
  content: counter(section-counter, decimal-leading-zero);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.section-title::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--line);
}

.grid + .section-title { margin-top: clamp(2.6rem, 6vw, 4.2rem); }

.grid {
  display: grid;
  gap: 1rem;
}

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

.card {
  min-height: 224px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card-head {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  font-size: 1.15rem;
}

.ic-blue, .ic-purple, .ic-green, .ic-amber,
.ic-rose, .ic-sky, .ic-orange, .ic-teal {
  background: var(--panel-soft);
}

.card-title {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 760;
  line-height: 1.28;
}

.card-subtitle {
  overflow: hidden;
  margin-top: 0.18rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-desc {
  flex: 1;
  color: var(--muted-strong);
  font-size: 0.94rem;
  line-height: 1.72;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
}

.badge {
  max-width: 100%;
  overflow: hidden;
  padding: 0.22rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-strong);
  background: var(--panel-soft);
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-gold { color: var(--gold); background: #fbf4e5; border-color: #ead9b7; }
.badge-sage { color: var(--accent); background: var(--accent-soft); border-color: #cfe3dd; }
.badge-rust { color: var(--rust); background: #f8ebe7; border-color: #edcfc6; }
.badge-mauve { color: #75599b; background: #f0ecf7; border-color: #ddd2ef; }

.arrow {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 1.05rem;
  transition: color 0.18s ease, transform 0.18s ease;
}

.card:hover .arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.card-featured {
  min-height: 210px;
  padding: 1.55rem;
  background: linear-gradient(135deg, #ffffff 0%, #f6fbf9 100%);
}

.card-featured .card-icon {
  width: 48px;
  height: 48px;
  font-size: 1.32rem;
  background: #fff;
}

footer {
  border-top: 1px solid var(--line);
  padding: 2rem clamp(1rem, 5vw, 4rem);
  background: rgba(255, 255, 255, 0.42);
}

.footer-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-inner > div {
  color: var(--muted);
  font-size: 0.86rem;
}

footer a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

footer a:hover { text-decoration: underline; }

.toc {
  position: fixed;
  right: clamp(0.8rem, 2.2vw, 1.5rem);
  top: 50%;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transform: translateY(-50%);
}

.toc-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  padding: 0.35rem 0;
  color: var(--muted);
  text-decoration: none;
}

.toc-label {
  opacity: 0;
  transform: translateX(5px);
  color: inherit;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.toc-dot {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
}

.toc-item:hover, .toc-item.active { color: var(--accent); }
.toc-item:hover .toc-label, .toc-item.active .toc-label { opacity: 1; transform: translateX(0); }
.toc-item.active .toc-dot { background: currentColor; }

@media (max-width: 960px) {
  .grid-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .header-inner { height: auto; min-height: 64px; padding: 0.75rem 0; align-items: flex-start; }
  .header-right { flex-direction: column-reverse; align-items: flex-end; gap: 0.65rem; }
  nav a { font-size: 0.82rem; }
  .lang-switcher { max-width: min(100%, 284px); overflow-x: auto; }
  .lang-btn { padding: 0.44rem 0.52rem; }
  .hero { padding-top: 3.7rem; }
  .grid-tools, .grid-apps, .grid-ent { grid-template-columns: 1fr; }
  .card { min-height: 0; padding: 1.15rem; }
  .toc { display: none; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
