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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

:root {
  --primary-color: #5b7dbd;
  --primary-color-hover: #4a6cad;
  --section-bg: #f8fafc;
  --section-border: #e2e8f0;
  --success-color: #16a34a;
}

html.i18n-loading body {
  visibility: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 20px 0;
  margin-bottom: 30px;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-subtitle {
  font-size: 14px;
  color: #6b7280;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-mark img,
.logo-mark svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.site-title-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  object-fit: cover;
}

.category-nav {
  border-top: 1px solid #e5e7eb;
  margin-top: 16px;
  padding-top: 12px;
}

.category-nav-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  padding: 0 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.category-nav-item {
  position: relative;
}

.category-nav-link {
  color: #334155;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}

.category-nav-link:hover {
  background: #e0f2fe;
  color: #0369a1;
}

.category-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  padding: 12px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.category-nav-item:hover .category-dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.category-dropdown-list {
  display: grid;
  gap: 8px;
}

.category-dropdown-link {
  text-decoration: none;
  color: #475569;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.category-dropdown-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.lang-switcher select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.tool-card {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  text-decoration: none;
  color: #333;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  border-color: var(--primary-color);
}

.tool-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--primary-color);
}

.tool-card:hover h3 {
  color: var(--primary-color-hover);
}

.category-section {
  margin-bottom: 40px;
  background: var(--section-bg);
  border: 1px solid var(--section-border);
  border-radius: 16px;
  padding: 24px;
}

.category-section h2 {
  font-size: 24px;
  margin-bottom: 20px;
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-icon {
  width: 20px;
  height: 20px;
  color: var(--primary-color);
}

.tool-page {
  background: #fff;
  border-radius: 8px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

.tool-page h1 {
  font-size: 32px;
  margin-bottom: 20px;
  color: #333;
}

.tool-return {
  display: flex;
  gap: 16px;
  margin: 12px 0 24px;
  flex-wrap: wrap;
}

.return-button {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.return-button:hover {
  background: #1d4ed8;
}

.category-page {
  background: #fff;
  border-radius: 8px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

.category-description {
  background: #f8fafc;
  border: 1px dashed #cbd5f5;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  min-height: 80px;
}

.faq-section {
  margin-top: 30px;
}

.tool-page h2 {
  font-size: 24px;
  margin: 30px 0 15px 0;
  color: #333;
}

.tool-area {
  background: #f9f9f9;
  padding: 25px;
  border-radius: 8px;
  margin: 20px 0;
  border: 1px solid #e0e0e0;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.form-group textarea {
  min-height: 150px;
  font-family: 'Courier New', monospace;
}

.tool-desc-toggle-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.tool-desc-toggle {
  background: none;
  border: none;
  color: #2563eb;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 0;
}

.tool-desc-toggle:hover {
  background: none;
  color: #1d4ed8;
  text-decoration: underline;
}

button {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background 0.2s;
}

button:hover {
  background: #1d4ed8;
}

button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.output-area {
  background: #fff;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  min-height: 100px;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.result-display {
  background: #f0f9ff;
  border: 1px solid #bfdbfe;
  padding: 15px;
  border-radius: 4px;
  margin-top: 15px;
}

.status-success {
  color: var(--success-color);
}

.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px;
  border-radius: 4px;
  margin-top: 10px;
}

.related-tools {
  margin-top: 30px;
}

.related-tools ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.related-tools li a {
  display: inline-block;
  padding: 8px 16px;
  background: #e0f2fe;
  color: #0369a1;
  text-decoration: none;
  border-radius: 4px;
  font-size: 14px;
  transition: background 0.2s;
}

.related-tools li a:hover {
  background: #bae6fd;
}

.faq-item {
  margin-bottom: 20px;
}

.faq-item h3 {
  font-size: 18px;
  color: #333;
  margin-bottom: 8px;
}

.faq-item p {
  color: #666;
  line-height: 1.6;
}

footer {
  background: #fff;
  border-top: 1px solid #ddd;
  padding: 30px 0;
  margin-top: 50px;
  text-align: center;
  color: #666;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.footer-links a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

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

.privacy-notice {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 15px;
  border-radius: 4px;
  margin: 20px 0;
  color: #065f46;
}

.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.download-link {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 20px;
  background: var(--primary-color);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.2s;
}

.download-link:hover {
  background: var(--primary-color-hover);
}

.color-input {
  width: 100%;
  height: 60px;
  cursor: pointer;
  border: 1px solid var(--section-border);
  border-radius: 4px;
}

.color-preview {
  background: var(--primary-color);
  height: 100px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.density-table {
  width: 100%;
  border-collapse: collapse;
}

.density-table th,
.density-table td {
  padding: 8px;
}

.density-table th {
  text-align: left;
}

.density-table .numeric {
  text-align: right;
}

.density-table tr {
  border-bottom: 1px solid var(--section-border);
}

.file-input-wrapper {
  position: relative;
  display: inline-block;
}

.file-input-wrapper input[type="file"] {
  display: none;
}

.file-input-label {
  display: inline-block;
  padding: 12px 24px;
  background: #2563eb;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: background 0.2s;
}

.file-input-label:hover {
  background: #1d4ed8;
}

.file-name-display {
  display: inline-block;
  margin-left: 10px;
  color: #666;
  font-size: 14px;
}

@media (max-width: 768px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .header-content {
    flex-direction: column;
    gap: 15px;
  }

  .category-nav-list {
    justify-content: flex-start;
  }

  .tool-page {
    padding: 20px;
  }

  .tool-page h1 {
    font-size: 24px;
  }
}
