:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #1d2a3b;
  --muted: #5c6b7f;
  --primary: #0c4a8a;
  --primary-soft: #e7f0fb;
  --border: #d7e0ec;
  --success: #0d7a3b;
  --warn: #9a6700;
  --danger: #9b1c1c;
  --radius: 12px;
  --shadow: 0 8px 20px rgba(13, 40, 72, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
body.nav-open { overflow: hidden; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 0.8rem;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; z-index: 1000; }

.site-header {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(3px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.nav-wrap {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
}
.brand {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  font-size: 1.02rem;
}
.nav-toggle {
  width: 42px;
  height: 38px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
}
.nav-toggle .bar {
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.28s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: min(82vw, 320px);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 5rem 1rem 1rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 0 18px 36px rgba(13, 40, 72, 0.16);
  transform: translateX(-110%);
  transition: transform 0.32s ease;
  z-index: 140;
}
.main-nav.open { transform: translateX(0); }
.main-nav a {
  text-decoration: none;
  color: var(--text);
  padding: 0.58rem 0.5rem;
  border-bottom: 0;
  border-radius: 8px;
}
.main-nav a:hover {
  background: #f4f8ff;
}
.main-nav a.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}
.nav-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(8, 22, 39, 0.46);
  z-index: 130;
}
.nav-backdrop[hidden] { display: none; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav-search {
  display: flex;
  position: relative;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.nav-search input {
  min-width: 0;
  width: 100%;
  margin-top: 0;
  padding: 0.42rem 0.55rem;
}

.nav-search button {
  border: 1px solid #bfd3ee;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 8px;
  padding: 0.42rem 0.6rem;
  font: inherit;
  cursor: pointer;
  width: 100%;
}

.live-search-results {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.35rem;
  z-index: 120;
}

.live-search-item,
.live-search-all {
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
}

.live-search-item:hover,
.live-search-all:hover {
  background: #f4f8ff;
}

.live-search-title {
  display: block;
  font-weight: 600;
}

.live-search-type {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.live-search-all {
  border-top: 1px solid var(--border);
  color: var(--primary);
  margin-top: 0.2rem;
  padding-top: 0.55rem;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.2rem 1rem 2.5rem;
}
.hero {
  background: linear-gradient(145deg, #fff, #edf4fc);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.grid { display: grid; gap: 1rem; }
.two-col { grid-template-columns: 1fr; }
.three-col { grid-template-columns: 1fr; }

h1, h2, h3 {
  line-height: 1.25;
  margin: 0.3rem 0 0.65rem;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0.4rem 0 0.8rem; }
.small { color: var(--muted); font-size: 0.95rem; }

.btn {
  display: inline-block;
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--primary-soft); color: var(--primary); border: 1px solid #bfd3ee; }

label { font-weight: 600; display: block; margin-top: 0.75rem; }
input, select {
  width: 100%;
  margin-top: 0.35rem;
  border: 1px solid #bfcde0;
  border-radius: 8px;
  padding: 0.58rem 0.62rem;
  font: inherit;
  background: #fff;
}
input:focus { outline: 2px solid #9cc0ea; outline-offset: 1px; }

.help-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.35rem;
  border: 1px solid #be8a00;
  border-radius: 999px;
  background: #ffd84d;
  color: #4b3600;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: text-top;
  cursor: help;
}

.help-mark::after {
  content: attr(data-help);
  position: absolute;
  left: 0;
  top: calc(100% + 0.4rem);
  width: min(18rem, 80vw);
  background: #fff8dd;
  border: 1px solid #e2c562;
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  padding: 0.5rem 0.6rem;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 90;
}

.help-mark:hover::after,
.help-mark:focus::after,
.help-mark:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.help-mark:focus-visible {
  outline: 2px solid #9cc0ea;
  outline-offset: 1px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.checkbox-label .help-mark,
.radio-label .help-mark {
  margin-left: 0.15rem;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin-top: 0;
  padding: 0;
  flex: 0 0 auto;
}


.notice {
  border-left: 4px solid var(--primary);
  padding: 0.65rem 0.8rem;
  background: #f4f9ff;
  margin: 0.8rem 0;
  border-radius: 0 8px 8px 0;
}
.notice.warn { border-left-color: var(--warn); background: #fff9ec; }
.notice.ok { border-left-color: var(--success); background: #eefaf2; }
.notice.danger { border-left-color: var(--danger); background: #fff1f1; }

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px dashed var(--border);
  padding: 0.45rem 0;
}
.result-row strong { white-space: nowrap; }

.inline-options {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.radio-label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-weight: 500;
}

.radio-label input[type="radio"] {
  width: auto;
  margin-top: 0.2rem;
  padding: 0;
  flex: 0 0 auto;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.8rem;
}

.breakdown-table th,
.breakdown-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.breakdown-table th {
  font-size: 0.95rem;
  color: var(--muted);
}

.breakdown-table td:last-child,
.breakdown-table th:last-child {
  text-align: right;
}

details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  background: #fff;
}
summary { cursor: pointer; font-weight: 600; }

.breadcrumbs {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.breadcrumbs a { color: var(--primary); text-decoration: none; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.2rem 1rem;
  color: var(--muted);
  background: #fff;
}
.footer-wrap {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: flex-start;
}
.footer-links a { color: var(--primary); text-decoration: none; }

.footer-download-panel {
  margin-left: auto;
  padding-left: 1rem;
  border-left: 1px dashed #bfd3ee;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-download-panel .footer-download-link {
  border: 1px solid #0a5a2f;
  background: linear-gradient(145deg, #19a45c, #0d7a3b);
  color: #fff;
  font-weight: 700;
  border-radius: 10px;
  padding: 0.38rem 0.62rem;
  box-shadow: 0 6px 14px rgba(13, 122, 59, 0.22);
  align-self: flex-start;
}

.footer-download-panel .footer-download-link:hover {
  background: linear-gradient(145deg, #1eb966, #0f8a43);
  color: #fff;
}

.footer-offline-note {
  margin: 0;
  color: #21405f;
  font-size: 0.92rem;
  line-height: 1.35;
  max-width: 290px;
}

.suggestion-block {
  margin-top: 1.2rem;
  padding: 0.8rem;
  border-radius: 10px;
  background: #f0f5fb;
  border: 1px dashed #9db8da;
}

.search-results {
  margin-top: 1rem;
}

.search-results li {
  margin-bottom: 0.85rem;
}

.search-results a {
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.search-results p {
  margin: 0.25rem 0 0;
}

@media (min-width: 760px) {
  .nav-toggle { display: none; }
  .nav-backdrop { display: none !important; }
  .main-nav {
    display: flex !important;
    position: static;
    transform: none;
    transition: none;
    height: auto;
    width: auto;
    padding: 0;
    flex-direction: row;
    gap: 0.8rem;
    align-items: center;
    background: transparent;
    border-right: 0;
    box-shadow: none;
    z-index: auto;
  }
  .main-nav.open { transform: none; }
  .main-nav a {
    padding: 0.35rem 0.2rem;
    border-radius: 0;
    border-bottom: 2px solid transparent;
  }
  .main-nav a:hover {
    background: transparent;
  }
  .main-nav a.active {
    background: transparent;
    border-bottom: 2px solid var(--primary);
  }
  .nav-search {
    margin-top: 0;
    margin-left: 0.3rem;
    flex-direction: row;
    gap: 0.35rem;
  }
  .nav-search input { min-width: 230px; }
  .nav-search button { width: auto; }
  .container { padding: 1.8rem 1rem 3rem; }
  .hero { padding: 1.8rem; }
  .two-col { grid-template-columns: 1.1fr 0.9fr; }
  .three-col { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 759px) {
  .live-search-results {
    position: static;
    margin-top: 0.35rem;
  }
  .footer-download-panel {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
    width: 100%;
  }
}

@media print {
  .site-header, .site-footer, .btn, .nav-toggle { display: none !important; }
  body { background: #fff; }
  .card, .hero { box-shadow: none; border: 1px solid #ddd; }
}
