:root {
  --paper: #ffffff;
  --utility: #f3f5f7;
  --line: #bcc5cf;
  --line-strong: #8a96a3;
  --ink: #101820;
  --muted: #5a6673;
  --link: #1c57a5;
  --link-hover: #0f3f7f;
  --accent: #e7edf5;
  --soft: #f8fafc;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 14px/1.7 "Yu Gothic UI", "Hiragino Sans", "Meiryo", sans-serif;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover,
a:focus-visible {
  color: var(--link-hover);
}

button,
input {
  font: inherit;
}

.utility-header {
  border-bottom: 1px solid var(--line);
  background: var(--utility);
}

.utility-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
}

.service-name a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.utility-links,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.lang-tools {
  display: flex;
  gap: 8px;
}

.lang-tools button,
.search-box button,
.service-button,
.vote-widget button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 7px 12px;
  text-decoration: none;
  cursor: pointer;
}

.lang-tools button[aria-pressed="true"] {
  background: var(--accent);
}

.page-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

.record-header {
  border-bottom: 2px solid var(--line-strong);
  padding-bottom: 14px;
}

.record-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1.2;
}

.record-lead {
  margin: 10px 0 0;
  max-width: 70rem;
}

.search-panel,
.detail-section,
.service-section,
.result-section,
.page-footer {
  margin-top: 18px;
}

.search-panel,
.detail-section,
.service-section,
.result-section {
  border: 1px solid var(--line);
  background: #fff;
  padding: 14px 16px;
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tab {
  border: 1px solid var(--line);
  padding: 6px 10px;
  background: var(--soft);
}

.tab.active {
  background: var(--accent);
  border-color: var(--line-strong);
}

.search-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 8px 10px;
  min-height: 38px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 12px;
  color: var(--muted);
}

.search-status {
  margin: 12px 0 0;
  color: var(--muted);
}

.detail-section h2,
.service-section h2,
.result-section h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  border-top: 1px solid var(--line);
}

.detail-grid > div {
  display: contents;
}

.detail-grid dt,
.detail-grid dd {
  margin: 0;
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
}

.detail-grid dt {
  background: var(--soft);
  font-weight: 700;
}

.link-row,
.source-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.source-lines {
  flex-direction: column;
  gap: 4px;
}

.service-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  margin-top: 12px;
}

.service-button {
  background: var(--soft);
}

.vote-widget {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: var(--soft);
}

.vote-widget button {
  background: var(--accent);
}

.vote-count,
.vote-status {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.vote-reveal {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.result-list,
.history-list {
  margin: 0;
  padding-left: 20px;
}

.result-list li,
.history-list li {
  margin-bottom: 12px;
}

.result-list p,
.history-list p {
  margin: 4px 0 0;
}

.history-list span {
  display: inline-block;
  min-width: 7.5rem;
  color: var(--muted);
}

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

.subject-grid > div {
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 10px;
}

.subject-grid p {
  margin: 6px 0 0;
}

.page-footer {
  border-top: 1px solid var(--line);
  background: var(--utility);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 18px 20px;
}

.footer-note {
  margin: 10px 0 0;
  color: var(--muted);
}

@media (max-width: 820px) {
  .utility-inner {
    grid-template-columns: 1fr;
  }

  .search-box,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .subject-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid dt {
    border-bottom: 0;
  }

  .detail-grid dd {
    padding-top: 0;
  }
}
