:root {
  color-scheme: light dark;
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #18202b;
  --muted: #5f6b7a;
  --line: #e3e8ef;
  --accent: #3f75e6;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.04), 0 1px 3px rgb(16 24 40 / 0.06);
  --shadow-hover: 0 4px 12px rgb(16 24 40 / 0.08), 0 2px 4px rgb(16 24 40 / 0.04);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11151c;
    --card: #1a2029;
    --ink: #e8ecf2;
    --muted: #97a3b3;
    --line: #2a323e;
    --shadow: none;
    --shadow-hover: 0 4px 16px rgb(0 0 0 / 0.35);
  }
}

* { box-sizing: border-box; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.7 system-ui, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
  /* 日本語を文節で折り返す（未対応ブラウザでは通常の折り返し） */
  word-break: auto-phrase;
}

a { color: inherit; }
a, button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.top {
  padding: 1rem clamp(16px, 4vw, 32px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  text-decoration: none;
}
.brand img { border-radius: 7px; }

main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(2rem, 8vw, 5rem) 16px 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.hero {
  padding-bottom: 2rem;
  text-align: center;
}
.hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  line-height: 1.3;
  text-wrap: balance;
}
.hero p {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

/* ツールが少ないうちも中央に寄るよう、カード幅を固定して中央揃えにする */
.grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.grid li { width: min(100%, 240px); }

.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 1.75rem 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
  text-decoration: none;
  position: relative;
  transition: translate 200ms var(--ease), scale 150ms var(--ease);
}
/* 影は box-shadow を直接アニメせず、重ねた疑似要素の opacity で出し入れする */
.tool::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  transition: opacity 200ms var(--ease);
  pointer-events: none;
}
@media (hover: hover) {
  .tool:hover { translate: 0 -2px; }
  .tool:hover::after { opacity: 1; }
}
.tool:active { scale: 0.98; }

.icon { border-radius: 14px; }
.name {
  margin-top: 1rem;
  overflow-wrap: anywhere;
  font-weight: 700;
  font-size: 1.0625rem;
}
.desc {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.foot {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 3rem 16px 2rem;
  color: var(--muted);
  font-size: 0.8125rem;
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .tool, .tool::after { transition: none; }
}
