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

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #ffffff;
  --bg-tool: #f8fafc;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --error: #dc2626;
  --radius: 8px;
  --max-width: 960px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

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

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-header a { color: var(--text); text-decoration: none; }
.site-logo { font-size: 1.1rem; font-weight: 700; }
.site-nav a { font-size: 0.9rem; color: var(--text-light); }
.site-nav a:hover { color: var(--primary); }

/* Main */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px;
}

/* Tool area */
.tool-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; }

.tool-area {
  background: var(--bg-tool);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

/* Form elements */
textarea, input[type="text"], input[type="number"], input[type="date"], select {
  width: 100%;
  padding: 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.15s;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
textarea { resize: vertical; min-height: 120px; }

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.input-group { margin-bottom: 16px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }

.btn-copy { min-width: 100px; }
.btn-copy.copied { background: var(--success); color: #fff; }

/* Results */
.result-area {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.result-row:last-child { border-bottom: none; }
.result-label { font-size: 0.9rem; color: var(--text-light); }
.result-value { font-size: 1.2rem; font-weight: 700; color: var(--primary); }

/* Radio / Check groups */
.option-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.option-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  cursor: pointer;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}
.option-group label:has(input:checked) {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}
.option-group input[type="radio"],
.option-group input[type="checkbox"] { accent-color: var(--primary); }

/* Two-column layout for PC tools */
.tool-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Description accordion */
.tool-desc { margin-top: 24px; }
.tool-desc summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-light);
  padding: 8px 0;
}
.tool-desc p {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.7;
  padding: 8px 0;
}

/* Ad placeholder */
.ad-slot {
  text-align: center;
  padding: 10px;
  margin: 16px 0;
  min-height: 90px;
}

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

/* Tool card grid (top page) */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.tool-card {
  display: block;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tool-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}
.tool-card-title { font-weight: 700; margin-bottom: 4px; }
.tool-card-desc { font-size: 0.85rem; color: var(--text-light); }

/* Category filter */
.category-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.category-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  color: var(--text);
}
.category-btn.active, .category-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Date select group */
.date-select {
  display: flex;
  align-items: center;
  gap: 4px;
}
.date-select select {
  width: auto;
  padding: 10px 8px;
  font-size: 1rem;
  text-align: center;
  appearance: auto;
}
.date-select .date-year { min-width: 90px; }
.date-select .date-month { min-width: 65px; }
.date-select .date-day { min-width: 65px; }
.date-select .date-sep {
  font-size: 0.9rem;
  color: var(--text-light);
  flex-shrink: 0;
}

/* Error */
.error-msg { color: var(--error); font-size: 0.85rem; margin-top: 4px; }

/* Breadcrumb */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-light); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); text-decoration: underline; }
.breadcrumb span { color: var(--text); }

/* FAQ Section */
.faq-section { margin-top: 32px; }
.faq-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.faq-item summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  list-style: none;
}
.faq-item summary::before { content: "Q. "; color: var(--primary); font-weight: 700; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p {
  padding: 0 16px 12px;
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.7;
}
.faq-item p::before { content: "A. "; color: var(--success); font-weight: 700; }
.faq-item[open] { background: var(--bg-tool); }

/* Related Tools */
.related-section { margin-top: 24px; }
.related-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.related-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.related-link {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s;
}
.related-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

/* Responsive */
@media (max-width: 640px) {
  .tool-columns { grid-template-columns: 1fr; }
  .tool-area { padding: 16px; }
  .tool-title { font-size: 1.3rem; }
  .result-value { font-size: 1.1rem; }
  .tool-grid { grid-template-columns: 1fr; }
  .date-select select { padding: 10px 4px; font-size: 0.95rem; }
  .date-select .date-year { min-width: 80px; }
  .date-select .date-month { min-width: 58px; }
  .date-select .date-day { min-width: 58px; }
}
