/* ===== 全体 ===== */
:root {
  --text: #5a4a5e;
  --panel: #fff0f7;
  --btn: #bde7ff;
  --btn-hover: #a6dcff;
  --btn-text: #3a5a6e;
  --accent: #ff8fb1;
  --border: #666;
  --content-max-width: 756px;
}

body {
  background: #fffdf9; /* レトロ紙色 */
  font-family: "Yu Gothic", sans-serif;
}

body.force-desktop {
  min-width: 0;
}

.container {
  max-width: 1000px;   /* PC風幅 */
  margin: 20px auto;
  padding: 20px;
  background: #f5f0e6;
  border: 3px solid #5a4634;
  box-shadow: 4px 4px 0 #5a4634;
}

.item {
  display: flex;
  flex-wrap: wrap;  /* スマホで折り返す */
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.item label {

.credit {
  max-width: var(--content-max-width);
  margin: 14px 0 10px;
  text-align: center;
  font-size: 0.9em;
  color: var(--text);
}
  min-width: 150px;
}


html,
body {
  overflow-x: hidden;
}

button {
  padding: 12px 20px;
  font-size: 16px;
  background: #7a5c3e;
  color: white;
  border: none;
  cursor: pointer;
}

button:hover {
  background: #5a4634;
}

.usage-guide {
  max-width: var(--content-max-width);
  margin-bottom: 10px;
  font-size: 0.92em;
  line-height: 1.5;
}

/* 汎用コンテンツ幅揃え */
.content-wrap {
  max-width: var(--content-max-width);
  box-sizing: border-box;
  margin-bottom: 10px;
}

.desktop-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: var(--content-max-width);
  margin-bottom: 10px;
}

#desktopViewToggle {
  padding: 8px 14px;
  font-size: 0.92em;
  background: #7a5c3e;
  color: #fff;
  border-radius: 8px;
}

#desktopViewToggle[aria-pressed="false"] {
  background: #999;
}

#desktopViewStatus {
  font-size: 0.92em;
  color: #5a3a1e;
}

.usage-guide summary {
  cursor: pointer;
  margin-bottom: 4px;
}

.usage-guide[open] summary {
  margin-bottom: 6px;
}

/* ===== メイン枠 ===== */
#capture {
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  border: 2px solid var(--border);
  padding: 18px;
  max-width: var(--content-max-width);
}

/* ===== 見出し ===== */
h2 {
  margin-top: 10px;
  margin-bottom: 10px;
  font-size: 1.3em;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
}

h3{
  margin-top: 5px;
  margin-bottom: 5px;
  font-size: 0.8em;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
}

/* ===== 名前欄 ===== */
.name {
  margin-bottom: 12px;
  font-size: 1.05em;
  font-weight: 700;
}

input[type="text"] {
  width: 220px;
  max-width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-family: inherit;
  font-size: 1.05em;
  font-weight: 600;
  line-height: 1.5;
  padding-bottom: 5px;
}

/* ===== テーブル ===== */
table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.95em;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

th, td {
  border: 1px solid var(--border);
  padding: 6px;
  text-align: center;
  max-width: 90px;
  overflow-wrap: break-word;
}

#capture:not(.export-mode) table th:nth-child(6),
#capture:not(.export-mode) table td:nth-child(6) {
  display: none;
}

th {
  background: #ffe6f1;
  font-weight: normal;
}

th:first-child,
td:first-child {
  text-align: left;
  background: #ffdceb;
  max-width: 180px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.parent-row td:first-child {
  background: #ffdceb;
}

.sub-row td:first-child {
  background: #f9c8df;
}

.no-break {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  display: inline-block;
}

.major-suffix {
  line-height: 1.4;
}

.sub-row {
  display: none;
}

.item-group-row .item-group-cell {
  max-width: none;
  width: auto;
  cursor: pointer;
}

.parent-row td:first-child {
  cursor: pointer;
}

.sub-row td:first-child {
  padding-left: 22px;
}

.category-toggle {
  margin: 0 6px 0 0;
  padding: 0;
  width: 1.4em;
  height: 1.4em;
  min-height: 1.4em;
  font-size: 0.95em;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  box-shadow: none;
  vertical-align: middle;
}

.category-toggle:hover {
  background: #fff5fa;
}

.category-toggle:active {
  transform: none;
  box-shadow: none;
}

.category-toggle:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ===== ラジオボタン ===== */
input[type="radio"] {
  accent-color: var(--accent);
  transform: scale(1.24);
}

input[type="checkbox"] {
  accent-color: var(--accent);
  transform: scale(1.28);
}

/* ===== 備考 ===== */
.memo {
  margin-top: 12px;
  max-width: 100%;
}

textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  height: 70px;
  min-height: 70px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 1.02em;
  font-weight: 700;
  resize: vertical;
}

.memo-preview {
  display: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 70px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.95em;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 2px 4px;
}

/* ===== 抽出欄 ===== */
.summary {
  margin-top: 14px;
  border: 2px solid var(--accent);
  padding: 8px;
  background: #ffe9f3;
  font-size: 0.95em;
}

/* ===== 記号説明 ===== */
.legend {
  margin-top: 12px;
  font-size: 0.85em;
  line-height: 1.6;
}

.export-credit {
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px solid #ddd;
  text-align: right;
  font-size: 0.78em;
  color: #666;
  word-break: break-all;
}

/* ===== ボタン ===== */
#saveBtn {
  margin-top: 18px;
  padding: 10px 22px;
  font-size: 1em;
  font-family: inherit;
  background: var(--btn);
  color: var(--btn-text);
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 0 #7eb9d8, 0 8px 16px rgba(0, 120, 255, 0.2);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
  margin-bottom: 22px;
}

#saveBtn:hover {
  background: var(--btn-hover);
}

#saveBtn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #7eb9d8, 0 4px 8px rgba(0, 120, 255, 0.18);
}


/* ===== モードセレクト ===== */
.mode-select {
  margin-bottom: 10px;
}
.mode-select label {
  margin-right: 10px;
}

.mode-warning {
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}

.mode-display {
  margin-bottom: 6px;
  font-size: 0.92em;
  color: #5a3a1e;
}

.twitter {
  max-width: var(--content-max-width);
  margin-top: 8px;
  font-size: 0.9em;
  line-height: 1.5;
}

.license {
  max-width: var(--content-max-width);
  margin-top: 8px;
  font-size: 0.9em;
  color: #8a7a6a;
  line-height: 1.5;
}

a {
  color: #0088dd;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

hr {
  width: 100%;
  max-width: var(--content-max-width);
  box-sizing: border-box;
  margin-left: 0;
}

/* ===== UPDATE ===== */
.info {
  display: block;
  margin: 2px 0 1px;
  font-size: 0.8em;
  letter-spacing: -0.05em;
  color: #5a3a1e;
  max-width: var(--content-max-width);
  box-sizing: border-box;
}

.info ul {
  margin: 0;
  padding-left: 1.2em;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  body.force-desktop {
    font-size: 17px;
  }

  body.force-desktop #capture {
    padding: 14px;
  }

  body.force-desktop .usage-guide,
  body.force-desktop .mode-display,
  body.force-desktop .mode-warning,
  body.force-desktop .twitter,
  body.force-desktop .license,
  body.force-desktop .info {
    font-size: 1em;
  }

  body.force-desktop h2 {
    font-size: 1.4em;
  }

  body.force-desktop table {
    min-width: 100%;
    font-size: 0.95em;
  }

  body.force-desktop th,
  body.force-desktop td {
    font-size: 0.65em;
  }

  body.force-desktop th:first-child,
  body.force-desktop td:first-child {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.force-desktop #saveBtn {
    font-size: 1.05em;
    padding: 11px 20px;
  }

  body:not(.force-desktop) {
    font-size: 17px;
  }

  body:not(.force-desktop) #capture {
    padding: 14px;
  }

  body:not(.force-desktop) .usage-guide,
  body:not(.force-desktop) .mode-display,
  body:not(.force-desktop) .mode-warning,
  body:not(.force-desktop) .twitter,
  body:not(.force-desktop) .license,
  body:not(.force-desktop) .info {
    font-size: 1em;
  }

  body:not(.force-desktop) h2 {
    font-size: 1.4em;
  }

  body:not(.force-desktop) table {
    min-width: 100%;
    font-size: 0.95em;
  }

  body:not(.force-desktop) th:first-child,
  body:not(.force-desktop) td:first-child {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body:not(.force-desktop) #saveBtn {
    font-size: 1.05em;
    padding: 11px 20px;
  }
}

@media (min-width: 521px) and (max-width: 768px) {
  :root {
    --content-max-width: 100%;
  }

  body.force-desktop {
    font-size: 18px;
    padding: 8px;
  }

  body.force-desktop table {
    font-size: 1.05em;
  }

  body.force-desktop th,
  body.force-desktop td {
    font-size: 0.82em;
  }

  body:not(.force-desktop) {
    font-size: 17px;
    padding: 8px;
  }

  body:not(.force-desktop) table {
    font-size: 1em;
  }

  body:not(.force-desktop) .container {
    padding: 15px;
  }

  body:not(.force-desktop) h1 {
    font-size: 20px;
  }

  body:not(.force-desktop) .item {
    flex-direction: column;
    align-items: flex-start;
  }
}