@import url("../akari-chat.css");

:root {
  --ink: #3a2417;
  --muted: #7a6657;
  --orange: #f47a10;
  --orange-dark: #c95f00;
  --paper: #fff6e9;
  --surface: #fffdf8;
  --line: #efcda9;
  --soft: #fff0de;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: linear-gradient(180deg, #fffdf8 0%, var(--paper) 100%);
  font-family: "Yu Gothic", "Meiryo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.72;
}

a,
button {
  font: inherit;
}

.article-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
}

.article-header__inner,
main,
.article-footer {
  width: min(960px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  margin: 0 auto;
}

.article-header__inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  color: inherit;
  text-decoration: none;
  font-weight: 900;
}

.brand span {
  color: var(--orange);
}

.back-link {
  color: var(--orange-dark);
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
}

main {
  padding: 28px 0 46px;
}

.hero {
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 12%, rgba(255, 174, 72, 0.26), transparent 24%),
    linear-gradient(135deg, #fffef9 0%, #fff0dc 100%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--orange-dark);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 2.75rem;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.lead {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.content {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  min-width: 0;
}

.section,
.summary-card,
.check-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.section {
  padding: 22px;
  min-width: 0;
}

.section h2 {
  margin-bottom: 12px;
  font-size: 1.35rem;
  line-height: 1.28;
}

.summary-grid,
.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-card,
.check-card {
  padding: 16px;
}

.summary-card strong,
.check-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--orange-dark);
}

.summary-card p,
.check-card p,
.section li {
  color: var(--muted);
  font-weight: 750;
}

.mobile-example-list {
  display: none;
  gap: 10px;
  margin-top: 14px;
}

.example-card,
.type-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.example-card strong,
.type-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--orange-dark);
  line-height: 1.3;
}

.example-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.example-card dt {
  color: var(--orange-dark);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.3;
}

.example-card dd {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.55;
}

.example-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.example-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--orange-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.type-card p {
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 750;
}

.type-card ul {
  display: grid;
  gap: 6px;
}

.section ul,
.section ol {
  margin: 0;
  padding-left: 1.25rem;
}

.section li + li {
  margin-top: 8px;
}

.notice {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 850;
}

.article-table {
  width: 100%;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border-radius: 14px;
}

.table-scroll .article-table {
  min-width: 760px;
}

.section > p + .summary-grid,
.section > p + .check-grid,
.section > p + .table-scroll,
.summary-grid + .table-scroll,
.check-grid + .table-scroll,
.table-scroll + .table-scroll,
.table-scroll + .next-links,
.table-scroll + .notice {
  margin-top: 14px;
}

.article-table--wide {
  min-width: 980px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--orange-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.tool-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tool-tab {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--orange-dark);
  font-weight: 900;
  cursor: pointer;
}

.tool-tab.is-active {
  border-color: var(--orange);
  background: var(--orange);
  color: #fff;
}

.tool-pane[hidden] {
  display: none;
}

.simulator-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.simulator-form,
.simulator-result {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.simulator-form {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.simulator-result {
  position: sticky;
  top: 14px;
  padding: 20px;
  background:
    radial-gradient(circle at 92% 10%, rgba(244, 122, 16, 0.16), transparent 28%),
    linear-gradient(180deg, #fffdf8 0%, #fff2e2 100%);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.field-row--four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field label,
.choice-group legend {
  display: block;
  margin-bottom: 7px;
  color: var(--orange-dark);
  font-size: 0.9rem;
  font-weight: 900;
}

.field select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 850;
}

.choice-group {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.simulator-form fieldset,
.diag__form fieldset {
  min-width: 0;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.choice-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #fffefb 0%, #fff7ed 100%);
  color: var(--ink);
  font-weight: 850;
}

.choice input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--orange);
}

.choice:has(input:checked) {
  border-color: rgba(244, 122, 16, 0.72);
  background: linear-gradient(180deg, #fff4e4 0%, #ffe6ca 100%);
  color: var(--orange-dark);
}

.sim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sim-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--orange);
  border-radius: 10px;
  background: var(--orange);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.sim-button--light {
  background: var(--surface);
  color: var(--orange-dark);
}

.result-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--orange-dark);
  font-weight: 900;
}

.result-title {
  margin: 12px 0 6px;
  font-size: 1.45rem;
  line-height: 1.25;
}

.result-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
  color: var(--orange-dark);
  font-weight: 900;
}

.result-score strong {
  font-size: 2.4rem;
  line-height: 1;
}

.meter {
  height: 10px;
  margin: 12px 0 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #f4dbc0;
}

.meter span {
  display: block;
  width: var(--score, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f47a10, #ffb14f);
}

.result-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.result-list li {
  padding: 9px 10px;
  border: 1px solid rgba(239, 205, 169, 0.82);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-weight: 800;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.result-actions a {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 10px;
  border: 1px solid var(--orange);
  border-radius: 10px;
  background: #fff;
  color: var(--orange-dark);
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.result-actions a:first-child {
  background: var(--orange);
  color: #fff;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.tag-list span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--orange-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.article-table th,
.article-table td {
  padding: 13px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.article-table th {
  background: var(--soft);
  color: var(--orange-dark);
  font-weight: 900;
}

.article-table td {
  color: var(--muted);
  font-weight: 750;
}

.article-table th:last-child,
.article-table td:last-child {
  border-right: 0;
}

.article-table tr:last-child td {
  border-bottom: 0;
}

.next-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.next-links a {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fffefb 0%, #fff4e6 100%);
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.article-footer {
  padding: 24px 0 34px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

@media (max-width: 720px) {
  .article-header__inner,
  main,
  .article-footer {
    width: calc(100% - 32px);
    max-width: calc(100% - 32px);
  }

  .hero {
    padding: 22px;
    border-radius: 16px;
  }

  h1 {
    font-size: 1.9rem;
  }

  .article-header__inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
    gap: 4px;
  }

  .summary-grid,
  .check-grid,
  .type-grid,
  .next-links,
  .simulator-shell,
  .field-row,
  .field-row--four,
  .choice-grid,
  .choice-grid--three {
    grid-template-columns: 1fr;
  }

  .simulator-result {
    position: static;
  }

  .mobile-example-list {
    display: grid;
  }

  .desktop-on-mobile {
    display: none;
  }

  .article-table {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    border-radius: 12px;
  }

  .article-table th,
  .article-table td {
    padding: 11px 10px;
  }
}

/* M1_POLICY_FOOTER */
.article-footer {
  display: grid;
  gap: 8px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.footer-links a {
  color: var(--orange-dark);
  text-decoration: none;
}

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

.footer-links a.footer-ofuse {
  color: #fff;
  background: var(--orange-dark, #e8772e);
  border-radius: 999px;
  padding: 2px 12px;
  text-decoration: none;
}
.footer-ofuse:hover { filter: brightness(1.08); text-decoration: none !important; }

.support-box {
  margin: 18px 0;
  padding: 18px 20px;
  border: 1px solid #e7d8bf;
  border-radius: 12px;
  background: #fff7ea;
  text-align: center;
}
.support-box p { margin: 0 0 12px; }
.support-box a.support-btn {
  display: inline-block;
  background: var(--orange-dark, #e8772e);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  padding: 10px 22px;
  border-radius: 999px;
}
.support-box a.support-btn:hover { filter: brightness(1.08); }

/* === M3 mobile readability for character/DB tables (2026-06-13) === */
@media (max-width: 720px) {
  /* tables scroll horizontally instead of squishing (fixes cramped feel) */
  .article-table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* give cells breathing room + readable size */
  .article-table th,
  .article-table td {
    padding: 13px 14px;
    font-size: 15px;
    line-height: 1.65;
    white-space: nowrap;
  }
  /* long free-text cells may wrap; keep them from getting too narrow */
  .article-table td.wrap,
  .article-table td[colspan] {
    white-space: normal;
    min-width: 16em;
  }
  /* dense/wide tables: scroll with comfortable width, not squished */
  .article-table--wide { min-width: 720px; }
  .uma-db-wrap .article-table { min-width: 640px; }
  /* keep the first column (name) visible while scrolling sideways */
  .article-table--wide th:first-child,
  .article-table--wide td:first-child,
  .uma-db-wrap .article-table th:first-child,
  .uma-db-wrap .article-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
    box-shadow: 1px 0 0 var(--line, #e7d8bf);
  }
  .article-table--wide th:first-child { background: var(--soft, #fff7ea); }
  /* subtle hint that the table scrolls */
  .article-table--wide,
  .uma-db-wrap .article-table {
    background-image: linear-gradient(to right, rgba(0,0,0,0.04), rgba(0,0,0,0) 24px);
    background-attachment: local;
  }
}