:root { color-scheme: light; font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif; color: #302b39; background: #f7f3ef; font-size: 14px; }
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 1180px; margin: 0 auto; padding: 28px 32px 26px; }
p, h1, h2, h3 { margin: 0; }
button, input { font: inherit; }
button { border: 1px solid transparent; border-radius: 9px; background: #70516f; color: white; padding: 12px 20px; font-weight: 600; cursor: pointer; }
button:hover { filter: brightness(.94); }
button:active { transform: translateY(1px); }
button:focus-visible, summary:focus-visible { outline: 3px solid #70516f; outline-offset: 3px; }
.secondary { background: #f1ebf1; color: #60435f; }
.language { background: #ebe2ea; padding: 10px 16px; flex-shrink: 0; margin-top: 4px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.eyebrow { color: #70516f; font-size: 11px; font-weight: 600; letter-spacing: .12em; }
h1 { font-size: clamp(24px, 2.5vw, 29px); font-weight: 600; line-height: 1.35; margin: 5px 0; }
.muted, .field-hint, footer { color: #665f70; }
h2 { font-size: 18px; font-weight: 600; line-height: 1.5; }
.input-panel { background: white; border: 1px solid #e4dde4; border-radius: 16px; padding: 20px 22px; }
.input-hint { margin: 6px 0 15px; line-height: 1.6; }
.input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
label { display: block; margin-bottom: 6px; }
input { width: 100%; min-width: 0; font-size: 18px; border: 1px solid #c5bccb; background: #fffefc; border-radius: 9px; padding: 11px 13px; color: #302b39; }
input:focus { outline: 2px solid #70516f; outline-offset: 1px; }
.field-hint { font-size: 12px; margin-top: 7px; line-height: 1.6; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 17px; }
.status { color: #9b343f; margin-top: 12px; line-height: 1.7; }
.empty { margin-top: 22px; background: #efe9ef; border-radius: 16px; padding: 35px 24px; text-align: center; }
.empty p { margin-top: 12px; line-height: 1.8; }
.preserve-lines { white-space: pre-line; }
#results { margin-top: 22px; }
#result-title { font-size: 20px; overflow-wrap: anywhere; }
.result-hint { font-size: 12px; line-height: 1.7; margin: 6px 0 14px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card { --accent: #6d4b79; background: #f1eaf3; border: 1px solid #dfd0e5; border-radius: 15px; padding: 18px; }
.card:nth-child(2) { --accent: #346756; background: #e8f0ed; border-color: #caddd5; }
.card:nth-child(3) { --accent: #826126; background: #f7eedd; border-color: #e7d8b9; }
.role { font-size: 12px; font-weight: 600; color: var(--accent); }
.card h3 { font-size: 15px; font-weight: 600; margin-top: 7px; }
.number { color: var(--accent); font-size: 58px; font-weight: 300; line-height: 1.35; margin-top: 5px; }
.theme { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.description { line-height: 1.72; }
.card details { font-size: 12px; color: var(--accent); margin-top: 16px; }
summary { cursor: pointer; width: fit-content; line-height: 1.7; }
.letters, .calculation { overflow-wrap: anywhere; margin-top: 8px; line-height: 1.7; }
footer { margin-top: 21px; font-size: 12px; }
.rules { margin: 10px 5px 0; line-height: 1.85; }
.privacy { font-size: 11px; margin-top: 16px; line-height: 1.7; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  main { padding: 22px 18px; }
  .page-header { gap: 12px; }
  h1 { font-size: 24px; }
  .input-grid, .cards { grid-template-columns: 1fr; gap: 18px; }
  .input-panel { padding: 20px 18px; }
  .card { padding: 20px; }
  .language { padding: 9px 12px; }
}
@media (prefers-reduced-motion: reduce) { button:active { transform: none; } }
.tool-nav, .source-links { display: flex; gap: 12px 20px; flex-wrap: wrap; }
.tool-nav { margin: 0 0 18px; }
a { color: #60435f; text-underline-offset: 3px; }
.tool-nav a { padding: 9px 14px; background: #ebe2ea; border-radius: 8px; text-decoration: none; font-weight: 600; }
.inverse-tool { margin-top: 40px; padding-top: 30px; border-top: 2px solid #dfd0e5; scroll-margin-top: 20px; }
.inverse-tool > h2 { font-size: 24px; margin-top: 5px; }
.inverse-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
select { font: inherit; width: 100%; min-width: 0; padding: 11px 8px; border: 1px solid #c5bccb; border-radius: 8px; background: #fffefc; color: #302b39; }
select:focus-visible, a:focus-visible { outline: 3px solid #70516f; outline-offset: 2px; }
select:disabled { color: #665f70; background: #f5f2f4; opacity: 1; }
.numbers-grid { margin-top: 18px; }
.inverse-status { margin: 18px 0; line-height: 1.7; }
#inverse-summary { font-size: 20px; }
#inverse-total { margin-top: 6px; }
.candidate-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; table-layout: fixed; }
.candidate-table th, .candidate-table td { border-bottom: 1px solid #e4dde4; padding: 10px 8px; text-align: left; overflow-wrap: anywhere; }
.candidate-table thead { background: #ebe2ea; }
.candidate-table tbody th { font-weight: 500; }
.candidate-table tbody tr:nth-child(even) { background: #fffcfa; }
.candidate-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.pagination { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin: 20px 0; }
.pagination span { text-align: center; }
button:disabled { opacity: .45; cursor: default; transform: none; }
.inverse-limit, .inverse-sources { font-size: 12px; line-height: 1.8; margin-top: 18px; }
.inverse-sources p { margin: 12px 0; }
@media (max-width: 720px) { .inverse-grid { grid-template-columns: 1fr; gap: 14px; } .candidate-table { font-size: 12px; } .candidate-table th, .candidate-table td { padding: 10px 4px; } }

#inverse-initial { max-width: 110px; }
#inverse-views { margin: 12px 0; }
#inverse-view-title { margin: 16px 0 8px; }
.explorer { margin-top: 16px; padding: 20px; background: white; border: 1px solid #e4dde4; border-radius: 16px; }
.explorer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.explorer-filter { display: grid; grid-template-columns: repeat(2,minmax(0,220px)); gap: 14px; margin: 16px 0; }
.browse-scope { line-height: 1.7; margin-top: 12px; font-weight: 600; }
.combination-table { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 12px; }
.combination-table th, .combination-table td { padding: 8px 5px; border-bottom: 1px solid #e4dde4; text-align: center; overflow-wrap: anywhere; }
.combination-table thead { background: #ebe2ea; }
.combination-table th:nth-child(-n+3) { width: 12%; }
.combination-table th:nth-child(4) { width: 25%; }
.combination-table button { padding: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 720px) { .explorer { padding: 16px 10px; } .combination-table { font-size: 12px; } .combination-table button { font-size: 12px; padding: 8px 4px; } }

/* baseka.net integration and tool selection */
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(112, 81, 111, .09), transparent 28rem),
    #f7f3ef;
}
.site-bar {
  background: #17141b;
  color: #f4eff5;
}
.site-bar-inner, .site-footer-inner {
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}
.site-bar-inner { min-height: 64px; }
.site-logo {
  color: #f4eff5;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 700;
  text-decoration: none;
}
.site-links, .site-footer-inner > div {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.site-links a {
  color: #c9c0cc;
  text-decoration: none;
  font-size: 13px;
}
.site-links a:hover, .site-logo:hover { color: white; }
.page-header { margin-top: 4px; }
.tool-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 24px;
}
.tool-nav .tool-choice {
  min-height: 116px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: center;
  gap: 5px 13px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid #ded4de;
  border-radius: 14px;
  color: #443846;
  text-decoration: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.tool-nav .tool-choice:hover {
  background: white;
  border-color: #9b7d9a;
  transform: translateY(-1px);
}
.tool-nav .tool-choice.active {
  background: #70516f;
  border-color: #70516f;
  color: white;
  box-shadow: 0 9px 24px rgba(70, 45, 69, .14);
}
.tool-choice-number {
  grid-row: 1 / span 2;
  color: #8c6e8a;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}
.tool-choice.active .tool-choice-number { color: #eadfea; }
.tool-choice strong {
  font-size: 16px;
  line-height: 1.35;
}
.tool-choice-copy {
  color: #716676;
  font-size: 12px;
  line-height: 1.55;
}
.tool-choice.active .tool-choice-copy { color: #eadfea; }
html[lang="ja"] .tool-copy-en, html[lang="en"] .tool-copy-ja { display: none; }
.tool-view { scroll-margin-top: 18px; }
.inverse-tool {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.tool-notes { margin-top: 21px; }
.site-footer {
  margin-top: 28px;
  padding: 25px 0 34px;
  background: #17141b;
  color: #aaa0ad;
  font-size: 12px;
}
.site-footer a {
  color: #c9c0cc;
  text-decoration: none;
}
.site-footer a:hover { color: white; }
@media (max-width: 720px) {
  .site-bar-inner, .site-footer-inner {
    width: min(100% - 36px, 1180px);
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .site-bar-inner { padding: 14px 0; }
  .tool-nav { grid-template-columns: 1fr; }
  .tool-nav .tool-choice { min-height: 100px; }
  .site-footer-inner { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-nav .tool-choice { transition: none; }
  .tool-nav .tool-choice:hover { transform: none; }
}

.checkbox-label{display:flex;align-items:center;gap:.6rem;margin-top:1rem;font-weight:500}.checkbox-label input[type=checkbox]{width:1.1rem;height:1.1rem;flex:0 0 auto;margin:0}.comparison{margin-top:.8rem;padding:.8rem;background:#f1eaf3;border-radius:.6rem;line-height:1.7}.candidate-table td{white-space:pre-line;overflow-wrap:anywhere}

.sex-field { margin-top: 14px; }
#inverse-sex { max-width: 220px; }

/* Optional forward readings; inverse layouts are unchanged. */
.optional-tools { margin-top: 14px; }
.optional-tools > details { border: 1px solid #e4dde4; border-radius: 12px; background: #fffefa; margin-top: 10px; }
.optional-tools > details > summary { padding: 14px 18px; color: #60435f; font-weight: 600; cursor: pointer; }
.optional-tools summary:focus-visible { outline: 2px solid #70516f; outline-offset: 3px; }
.optional-content { padding: 0 20px 20px; overflow-wrap: anywhere; }
.optional-content h3 { margin-top: 24px; font-size: 1.05rem; }
.optional-content p { line-height: 1.85; }
.optional-spelling { font-weight: 600; }
.optional-date-fields { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; max-width: 540px; }
.optional-date-fields > div { min-width: 0; }
.optional-date-fields input { width: 100%; min-width: 0; }
.optional-birth-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.optional-card { border: 1px solid #ded6e2; border-radius: 12px; padding: 18px; background: #f7f1f8; min-width: 0; }
.optional-card h3 { margin: 0; }
.optional-card .optional-number { font-size: 2.8rem; line-height: 1.2; margin: 12px 0; color: #70516f; }
.optional-card h4 { margin: 12px 0; }
.optional-method { margin-top: 14px; }
.optional-calculation { font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .optional-birth-cards { grid-template-columns: 1fr; }
  .optional-content { padding: 0 14px 16px; }
  .optional-tools .actions { align-items: stretch; }
  .optional-tools .actions button { white-space: normal; max-width: 100%; }
}
