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

:root {
  --bg: #f5f6f8;
  --surface: #fff;
  --surface-muted: #f1f3f6;
  --surface2: #e8eaef;
  --border: #e4e7ec;
  --border-strong: #cfd6e1;
  --text: #1a1d24;
  --text2: #646b78;
  --text3: #9aa0ad;
  --accent: #3d5a80;
  --accent-hover: #314c70;
  --accent-soft: #e8eef6;
  --accent-glow: rgba(61, 90, 128, 0.18);
  --sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  --max-w: 880px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(26, 29, 36, 0.04);
  --shadow-card: 0 4px 20px rgba(26, 29, 36, 0.06);
  --shadow-md: 0 6px 18px rgba(26, 29, 36, 0.12);
  --shadow-lg: 0 12px 28px rgba(26, 29, 36, 0.18);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

body.home-bg #lissajous-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

body.home-bg .site-header,
body.home-bg .site-main,
body.home-bg .site-footer {
  position: relative;
  z-index: 1;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
}

.brand-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.header-hero {
  text-align: right;
  min-width: 0;
}

.header-tag {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.header-desc {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
}

/* Main */
.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.site-main--tool {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.site-main--tool .workspace {
  flex: 1;
  min-height: calc(100vh - 120px);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text3);
}

.site-footer a {
  color: var(--text3);
  text-decoration: none;
}
.site-footer a:hover { color: var(--accent); }
.footer-sep { color: var(--border); }

/* ── Homepage ── */
.home {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 40px 20px 72px;
}

.home-section {
  margin-bottom: 44px;
}

.home-section:last-child {
  margin-bottom: 0;
}

.home-section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 360px));
  gap: 14px;
}

.home .tool-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 20px;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
  position: relative;
}

.home .tool-card {
  width: 100%;
  max-width: none;
  padding: 16px 14px;
  gap: 10px;
}

.tool-card:hover {
  border-color: rgba(61, 90, 128, 0.35);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

.tool-card.is-disabled {
  opacity: 0.5;
  cursor: default;
}

.tool-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}
.tool-card-icon svg {
  width: 22px;
  height: 22px;
}

.tool-card-name {
  font-size: 16px;
  font-weight: 600;
}

.tool-card-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}

.tool-card-go {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  align-self: flex-start;
  margin-top: 4px;
}

.tool-card-soon {
  font-size: 12px;
  color: var(--text3);
  padding: 3px 10px;
  background: var(--bg);
  border-radius: 20px;
  align-self: flex-start;
  margin-top: 4px;
}

@media (max-width: 1200px) {
  .home .tool-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

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

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

@media (max-width: 520px) {
  .header-inner {
    padding: 14px 16px;
    gap: 12px;
  }

  .header-title {
    font-size: 15px;
  }

  .header-desc {
    display: none;
  }

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

  .home .tool-grid {
    grid-template-columns: 1fr;
  }
  .home {
    padding: 24px 16px 60px;
  }
}
