@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&family=Manrope:wght@500;700&family=Zen+Kaku+Gothic+New:wght@400;700&display=swap');

:root {
  --bg: #f7fbf5;
  --surface: #ffffff;
  --surface-2: #fbfef9;
  --border: #d5e5d5;
  --text: #10231b;
  --muted: #4b5d54;
  --accent: #1f8f68;
  --accent-2: #f59e0b;
  --shadow: 0 18px 48px rgba(15, 36, 28, 0.12);
  font-family: 'Noto Sans JP', 'Zen Kaku Gothic New', 'Manrope', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.6;
  font-size: 13px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #eef5ec 0, #f7faf4 40%, #ecf7f1 70%, #f8faf5 100%);
  color: var(--text);
}

html,
body {
  height: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.layout-split {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(12, 70, 49, 0.12);
}

.top-nav .home-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f1f1a;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
}

.top-nav .home-link:hover {
  border-color: #1f8f68;
}

.top-nav .nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.top-nav .nav-links a {
  color: #0f1f1a;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.top-nav .nav-links a:hover {
  color: #0f1f1a;
  border-color: var(--border);
  background: #ffffff;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.hero-compact {
  padding: 12px 4px 0;
}

.hero h1 {
  margin: 6px 0 10px;
  font-size: 28px;
  letter-spacing: -0.01em;
}

.hero p {
  margin: 0;
}

.lede {
  color: var(--muted);
  max-width: 840px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #c7f0d8, #a1e3c1);
  color: #0b3a2b;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(12, 70, 49, 0.12);
}

.pill.small {
  padding: 6px 10px;
  font-size: 12px;
}

.pill.muted {
  background: #eef2ec;
  color: var(--muted);
  box-shadow: none;
}

.callouts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.callout {
  padding: 10px 12px;
  border-radius: 12px;
  background: #122925;
  color: #d9efe5;
  font-weight: 700;
  min-width: 160px;
  text-align: center;
  box-shadow: var(--shadow);
}

.chart-wrapper {
  width: 100%;
  overflow: hidden;
}
.chart-wrapper canvas {
  width: 100%;
}

.layout {
  position: relative;
  min-height: calc(100vh - 80px);
}

.layout-plain {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controls.wide {
  width: 100%;
}
.map-full {
  width: 100%;
  min-height: calc(100vh - 80px);
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  border: none;
  position: relative;
}

.map-half {
  position: relative;
  min-height: 52vh;
}

.map-half .map-full {
  min-height: 52vh;
}

.panel {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 360px;
  max-width: calc(100% - 28px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
  pointer-events: none;
  padding-right: 8px;
}

.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 12px 32px rgba(12, 70, 49, 0.12);
  backdrop-filter: blur(8px);
}

.panel .card {
  padding: 10px;
  pointer-events: auto;
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 14px 38px rgba(12, 70, 49, 0.14);
}

.hero-card h1 {
  margin: 6px 0 6px;
  font-size: 22px;
}

.hero-card .lede {
  margin: 0;
  color: var(--muted);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 4px 0 0;
  font-size: 20px;
}

.kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #0d6e4f;
  color: #e9f6ef;
  border-radius: 10px;
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.field-grid.stacked {
  display: flex;
  flex-direction: column;
}

.field-grid.three {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.field label {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.field input,
.field select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  background: #ffffff;
  color: #000000;
  transition: border 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #3ee0a6;
  box-shadow: 0 0 0 3px rgba(62, 224, 166, 0.25);
  background: #f7fffb;
}

.field select option {
  color: #000000;
  background: #ffffff;
}

.field .hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

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

button {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.2s ease;
}

button.primary {
  background: linear-gradient(135deg, #1f8f68, #167853);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(22, 120, 83, 0.25);
}

button.secondary {
  background: #eef2ec;
  color: var(--text);
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px dashed var(--border);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

input[type='range'] {
  accent-color: #1f8f68;
}

.map {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 80px);
}

.legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #eef2ec;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.dot span {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 50%;
}

.notice {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  color: #0f1f1a;
  background: #fef9c3;
  border: 1px solid #fcd34d;
}

.notice.error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #9f1239;
}

.soil-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.soil-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(135deg, #fbfef9, #f3f9f1);
}

.soil-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.soil-name {
  font-weight: 700;
  font-size: 16px;
}

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ec;
  border: 1px solid var(--border);
  font-weight: 700;
}

.meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filters-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.chip {
  border: 1px solid var(--border);
  background: #f8fbf6;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--accent);
}

.chip.active {
  background: #1f8f68;
  color: #ffffff;
  border-color: #1f8f68;
  box-shadow: 0 10px 18px rgba(31, 143, 104, 0.25);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 16px 0;
}

.footer-note {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}
.footer-copy {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.footer-copy a {
  color: inherit;
  text-decoration: none;
}
.report-content {
  line-height: 1.7;
  font-size: 13px;
  white-space: normal;
  color: #e5e7eb;
}
.report-content h1,
.report-content h2,
.report-content h3,
.report-content h4 {
  margin: 6px 0 4px 0;
  font-size: 15px;
  color: #f8fafc;
}
.report-content ul,
.report-content ol {
  padding-left: 18px;
  margin: 6px 0;
}
.report-content strong {
  font-weight: 700;
  color: #fcd34d;
}
.report-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  color: #e5e7eb;
}
.report-content th,
.report-content td {
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 6px;
  font-size: 12px;
  color: #e5e7eb;
}
.report-content th {
  background: #111827;
  color: #f8fafc;
}
.report-content .bar {
  display: inline-block;
  height: 8px;
  background: linear-gradient(90deg, #38bdf8, #1f8f68);
  border-radius: 4px;
}
.report-content a {
  color: #93c5fd;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 30;
}

.modal.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 31, 26, 0.35);
}

.modal-body {
  position: absolute;
  right: 12px;
  top: 12px;
  bottom: 12px;
  width: min(420px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 20px 48px rgba(12, 70, 49, 0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-head h2 {
  margin: 4px 0 0;
}

.modal .soil-list {
  max-height: none;
  flex: 1;
  overflow-y: auto;
}

.table-wrapper {
  width: 100%;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  background: #f5f8f2;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table td.num {
  text-align: right;
}

.data-table tr:hover {
  background: #f9fdf7;
}

.data-table .up {
  color: #0f766e;
  font-weight: 700;
}

.data-table .down {
  color: #b45309;
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.summary-card {
  background: linear-gradient(135deg, #fbfef9, #f0f7ef);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 6px 18px rgba(12, 70, 49, 0.08);
}

.summary-card .label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-card .value {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

@media (max-width: 1024px) {
  .panel {
    position: static;
    width: 100%;
    pointer-events: auto;
  }
  .map-full {
    min-height: 520px;
  }
  .map {
    min-height: 520px;
  }
}

@media (max-width: 640px) {
  .hero {
    flex-direction: column;
  }
  .card {
    padding: 12px;
  }
  .section-head h2 {
    font-size: 18px;
  }
  button {
    width: 100%;
  }
  .actions {
    flex-direction: column;
  }
  .top-nav {
    align-items: flex-start;
    padding: 10px 12px;
  }
  .top-nav .home-link {
    width: 100%;
    justify-content: center;
  }
  .top-nav .nav-links {
    width: 100%;
    justify-content: flex-start;
  }
  .top-nav .nav-links a {
    padding: 10px 12px;
  }
}
