/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --max-width: 800px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Header === */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header a {
  text-decoration: none;
  color: var(--text);
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-nav a:hover {
  color: var(--primary);
}

/* === Main Content === */
main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px;
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.tool-description {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* === Tool UI Components === */
.tool-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.result-area {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 48px;
}

.result-area pre {
  white-space: pre-wrap;
  word-break: break-all;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.9rem;
}

.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.stat-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  text-align: center;
  flex: 1;
  min-width: 120px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-group {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.option-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.option-row label {
  margin-bottom: 0;
  font-weight: normal;
}

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: auto;
}

.ad-placeholder {
  background: var(--bg);
  border: 1px dashed var(--border);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 16px;
  border-radius: var(--radius);
}

/* === Tool Card Grid (top page) === */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.tool-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.tool-card h2 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.tool-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* === Blog Article === */
.article-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.article-body h2 {
  font-size: 1.35rem;
  margin-top: 40px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary);
}

.article-body h3 {
  font-size: 1.1rem;
  margin-top: 28px;
  margin-bottom: 8px;
}

.article-body p {
  margin-bottom: 16px;
}

.article-body ul, .article-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.article-body li {
  margin-bottom: 6px;
}

.article-body code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.9em;
}

.article-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 16px;
  line-height: 1.5;
}

.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.article-body th, .article-body td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  font-size: 0.9rem;
}

.article-body th {
  background: var(--bg);
  font-weight: 600;
}

.cta-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 32px;
  text-align: center;
}

.cta-box p {
  margin-bottom: 12px;
  font-size: 1.05rem;
  font-weight: 600;
}

.cta-box .btn {
  text-decoration: none;
  font-size: 1.05rem;
  padding: 12px 28px;
}

.article-toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 28px;
}

.article-toc p {
  font-weight: 700;
  margin-bottom: 8px;
}

.article-toc ol {
  padding-left: 20px;
  margin-bottom: 0;
}

.article-toc li {
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.article-toc a {
  color: var(--primary);
  text-decoration: none;
}

.article-toc a:hover {
  text-decoration: underline;
}

/* === Breadcrumb === */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--primary);
}
.breadcrumb span {
  margin: 0 6px;
}

/* === Responsive === */
@media (max-width: 600px) {
  main { padding: 20px 16px; }
  h1 { font-size: 1.3rem; }
  .tool-area { padding: 16px; }
  .stats { gap: 8px; }
  .stat-item { padding: 8px 12px; min-width: 80px; }
  .stat-value { font-size: 1.4rem; }
  .option-row { flex-direction: column; align-items: flex-start; }
}
