body {
  font-family: sans-serif;
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px;
  line-height: 1.6;
}

.form-group {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

input[type="text"],
input[type="url"] {
  flex: 1;
  padding: 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

button {
  padding: 12px 24px;
  font-size: 16px;
  background-color: #0070f3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* 注記テキスト */
.notice-text {
  font-size: 0.85rem;
  color: #666;
  margin-top: 5px;
  margin-bottom: 0;
}

#loading {
  display: none;
  color: #666;
  font-weight: bold;
  margin: 20px 0;
}

#result-area {
  margin-top: 30px;
  display: none;
}

/* 上限通知領域 */
#truncatedNotice {
  display: none;
  background-color: #fff3cd;
  color: #856404;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
}

/* スライド形式のヘッダー配置 */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}

.section-header h3 {
  margin: 0;
}

/* ダウンロードリンクおよび緑ボタン */
.download-link {
  text-decoration: none;
}

.btn-download {
  background-color: #2e7d32;
}

.mt-30 {
  margin-top: 30px;
}

.status-badge {
  padding: 2px 8px;
  border-radius: 4px;
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.bg-green {
  background-color: #2e7d32;
}

.bg-red {
  background-color: #d32f2f;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  table-layout: fixed;
}

table th:nth-child(1), table td:nth-child(1) { width: 10%; }
table th:nth-child(2), table td:nth-child(2) { width: 15%; }
table th:nth-child(3), table td:nth-child(3) { width: 35%; }
table th:nth-child(4), table td:nth-child(4) { width: 40%; }

th, td {
  border: 1px solid #eee;
  padding: 8px 12px;
  text-align: left;
  word-break: break-all;
}

th {
  background-color: #f5f5f5;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover {
  background-color: #e0e0e0;
}

.sort-icon {
  font-size: 10px;
  color: #0070f3;
}

#errorMessage {
  display: none;
  background-color: #fde8e8;
  color: #d32f2f;
  border: 1px solid #f8b4b4;
  padding: 12px;
  border-radius: 4px;
  margin-top: 15px;
  font-weight: bold;
}

button.btn-cancel {
  background-color: #d32f2f;
  color: #ffffff;
  border-color: #b71c1c;
}

button.btn-cancel:hover {
  background-color: #b71c1c;
}

.option-group {
  margin-bottom: 15px;
}

.filter-label {
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.success-details {
  margin-top: 20px;
  border: 1px solid #eee;
  border-radius: 4px;
  background-color: #fafafa;
  padding: 10px;
}

.success-details summary {
  font-weight: bold;
  cursor: pointer;
  color: #2e7d32;
  outline: none;
}

.success-details summary:hover {
  text-decoration: underline;
}

.nested-table {
  margin-top: 10px;
  background-color: #ffffff;
  table-layout: fixed;
}

.nested-table th:nth-child(1), .nested-table td:nth-child(1) { width: 10%; }
.nested-table th:nth-child(2), .nested-table td:nth-child(2) { width: 15%; }
.nested-table th:nth-child(3), .nested-table td:nth-child(3) { width: 35%; }
.nested-table th:nth-child(4), .nested-table td:nth-child(4) { width: 40%; }

.image-container {
  width: 100%;
  max-height: none;
  overflow: hidden;
  border: 2px solid #ccc;
  border-radius: 6px;
  margin-top: 15px;
  background-color: #f0f0f0;
  position: relative;
  box-sizing: border-box;
}

:root {
  --zoom-scale: 2;
}

.image-container.zoomed-container {
  overflow: auto !important;
}

#resultImage {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
  margin: 0;
  border: none;
  border-radius: 0;
}

#resultImage.zoomed {
  cursor: zoom-out;
}

/* テーブル行のハイライトアニメーション */
tr.row-highlight {
  transition: background-color 0.3s ease;
  background-color: #fff9c4 !important;
}

/* テーブル内No.リンクのスタイル */
.row-id-link {
  text-decoration: none;
  color: #0070f3;
  font-weight: bold;
}

.row-id-link:hover {
  text-decoration: underline;
  color: #0051a8;
}

/* ユーティリティ */
.text-center { text-align: center; }
.text-muted { color: #666; }

.text-badge-error {
  color: #d32f2f;
  font-weight: bold;
}

.text-badge-success {
  color: #1976d2;
  font-weight: bold;
}

.notice-list {
  margin-top: 4px;
  margin-bottom: 15px;
  padding-left: 20px;
  font-size: 0.85rem;
  color: #666;
}

/* フッターのスタイル */
footer {
  margin-top: 60px;
  padding: 30px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: #888;
  border-top: 1px solid #e5e5e5;
}

footer p {
  margin: 0;
}

footer a {
  color: #555;
  text-decoration: none;
}

footer a:hover {
  color: #0070f3;
  text-decoration: underline;
}

footer a::after {
  content: "|";
  margin-left: 12px;
  color: #ccc;
  font-weight: normal;
}

td, th, a {
  word-break: break-all;
}

/* ヘッダー全体（横並びレイアウト） */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.top-header h1 {
  margin: 0;
}

/* 言語切り替えエリア */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-btn {
  background: none;
  border: none;
  color: #888888;
  font-size: 0.95rem;
  font-weight: normal;
  padding: 2px 6px;
  cursor: pointer;
  min-width: 32px;
  text-align: center;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.lang-btn:hover {
  color: #0066cc;
}

.lang-btn.active {
  color: #0066cc;
  font-weight: bold;
  border-bottom: 2px solid #0066cc;
}

.lang-divider {
  color: #ccc;
  font-size: 0.85rem;
}

/* スマホ表示時のレイアウト調整（画面幅 768px 以下） */
@media (max-width: 768px) {
  html {
    font-size: 80% !important;
  }

  header,
  .header,
  .container,
  .main-container,
  .app-container {
    margin-top: 0 !important;
    padding-top: 8px !important;
  }

  h1, .title, .app-title, header h1, .header h1 {
    font-size: 1.5em !important;
    line-height: 1.2 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  body *,
  input,
  input[type="text"],
  input[type="url"],
  input::placeholder,
  button,
  label {
    font-size: 0.8em !important;
    line-height: 1.4 !important;
  }

  div[class*="error"],
  div[class*="alert"],
  div[class*="message"],
  div[id*="error"],
  div[id*="alert"] {
    padding: 6px 10px !important;
    font-size: 0.8em !important;
  }

  input[type="checkbox"] {
    width: 0.8rem !important;
    height: 0.8rem !important;
    margin-right: 0.4rem !important;
    transform: scale(0.8);
    transform-origin: left center;
  }

  .form-group, 
  .input-container {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0 12px !important;
    box-sizing: border-box !important;
  }

  input[type="text"],
  input[type="url"] {
    width: 100% !important;
    margin-top: 12px !important;
    margin-bottom: 12px !important;
    padding: 8px 10px !important;
    box-sizing: border-box !important;
  }

  form button,
  .form-group button {
    width: 100% !important;
    padding: 8px !important;
    box-sizing: border-box !important;
  }

  #results,
  .result-container,
  .results-section,
  .section-container {
    margin-top: 12px !important;
    padding-top: 0 !important;
  }

  h2, .result-title, .section-title {
    margin-top: 8px !important;
    margin-bottom: 4px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .section-header,
  .result-header,
  .section-title-container {
    margin-bottom: 2px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px;
  }

  .section-header:first-of-type,
  .result-container > .section-header:first-child {
    margin-top: 0 !important;
  }

  .section-header.mt-30,
  .mt-30,
  div[class*="mt-30"] {
    margin-top: 20px !important;
    margin-bottom: 2px !important;
  }

  .section-header h3,
  .section-header h4,
  .section-header .sub-title {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .result-header button,
  .section-header button,
  .section-title-container button,
  button[class*="pdf"],
  button[class*="download"] {
    width: auto !important;
    padding: 4px 12px !important;
    display: inline-block !important;
    margin-top: 0 !important;
  }

  .table-container,
  .table-wrapper {
    width: 100% !important;
    margin-top: 2px !important;
    padding: 0 !important;
    overflow-x: auto;
  }

  table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
  }

  table th:nth-child(1), table td:nth-child(1) { width: 12%; }
  table th:nth-child(2), table td:nth-child(2) { width: 22%; }
  table th:nth-child(3), table td:nth-child(3) { width: 33%; }
  table th:nth-child(4), table td:nth-child(4) { width: 33%; }

  table th, table td {
    padding: 4px 2px !important;
    word-break: break-all !important;
    font-size: 0.75rem !important;
  }

  .status-badge,
  td:nth-child(2) span {
    display: inline-block !important;
    font-size: 0.7rem !important;
    padding: 2px 4px !important;
  }
}