:root {
  --bg: #f4f7f9;
  --card: #fff;
  --text: #333;
  --muted: #666;
  --line: #dee2e6;
  --accent: #0056b3;
  --accent-dark: #004494;
  --soft: #e7f3ff;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding: 20px;
}

.wrap {
  max-width: 600px;
  margin: 0 auto;
}

.header-area {
  margin-bottom: 22px;
}

.header-logo-wrap {
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  max-width: 100%;
}

.header-logo-wrap picture {
  display: block;
  width: 100%;
  max-width: 100%;
}

.header-logo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.sub-title {
  margin: 0;
  color: #555;
  font-size: 0.9rem;
}

.affiliate-box {
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.affiliate-title {
  font-weight: 700;
  font-size: 0.8rem;
  color: #555;
  margin-bottom: 8px;
}

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

a.affiliate-link {
  display: block;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  line-height: 1.4;
  font-weight: 700;
}

a.affiliate-link:hover,
a.affiliate-link:focus-visible {
  background: var(--soft);
  outline: none;
}

.affiliate-note {
  font-size: 0.72rem;
  color: #777;
  line-height: 1.5;
  margin: 8px 0 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 14px;
  color: #444;
  border-left: 4px solid #6c757d;
  padding-left: 10px;
}

.field-actions {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 14px;
}

label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 5px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid #b3d7ff;
  border-color: var(--accent);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 16px;
  font-size: 0.95rem;
}

.check-row input {
  margin-top: 4px;
}

.check-row label {
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.hint {
  font-size: 0.8rem;
  color: #777;
  margin: -8px 0 14px;
}

.price-source {
  font-size: 0.8rem;
  color: #555;
  background: #f8f9fa;
  border-radius: 6px;
  padding: 10px 12px;
  margin: -4px 0 14px;
}

.btn {
  width: 100%;
  padding: 13px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover { background: var(--accent-dark); }
.btn:disabled {
  background: #8aa7c7;
  cursor: wait;
}

.btn-ghost {
  width: auto;
  padding: 6px 10px;
  font-size: 0.75rem;
  background: #eef3f8;
  color: var(--accent);
  margin-top: -8px;
  margin-bottom: 12px;
}

.btn-reset {
  width: auto;
  padding: 8px 14px;
  font-size: 0.85rem;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-reset:hover {
  background: var(--soft);
  color: var(--accent);
}

.map-wrap {
  position: relative;
  width: 100%;
  height: 240px;
}

#map {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: #e9eef3;
  border: 1px solid var(--line);
}

.map-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 0.85rem;
  padding: 16px;
  text-align: center;
  background: #e9eef3;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.banner {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.banner.warn {
  background: #fff6e5;
  border: 1px solid #f5d79a;
  color: #7a4b00;
}

.banner.error {
  background: #fdecec;
  border: 1px solid #f5c2c2;
  color: var(--danger);
}

.banner.ok {
  background: #e9f7ee;
  border: 1px solid #b7e0c2;
  color: var(--ok);
}

.totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.total-box {
  background: var(--soft);
  border: 1px solid #b3d7ff;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.total-box.round {
  background: #eef8ee;
  border-color: #b7e0c2;
}

.total-box .k {
  font-size: 0.75rem;
  color: #555;
}

.total-box .v {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.3;
}

.total-box.round .v { color: #0f7a32; }

table.breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.breakdown th,
table.breakdown td {
  border-bottom: 1px solid #edf0f2;
  padding: 8px 4px;
  text-align: right;
}

table.breakdown th:first-child,
table.breakdown td:first-child {
  text-align: left;
}

table.breakdown thead th {
  color: #666;
  font-weight: 600;
  font-size: 0.75rem;
}

.route-meta {
  font-size: 0.85rem;
  color: #444;
  margin: 0 0 12px;
}

.copy-btn {
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  border: 0;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}

.copy-btn.copied { background: #28a745; }

.disclaimer {
  font-size: 0.75rem;
  color: #777;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid #ddd;
}

.disclaimer p { margin: 0 0 5px; }

.footer {
  text-align: center;
  margin-top: 8px;
  padding-bottom: 12px;
  font-size: 0.85rem;
  color: #666;
}

.footer p { margin: 5px 0; }
.footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.ofuse-link {
  display: inline-block;
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  padding: 10px 20px;
  border-radius: 8px;
  margin-bottom: 16px;
  text-decoration: none !important;
  color: #d84315 !important;
  font-weight: 700;
}

.hidden { display: none !important; }

.pac-container { z-index: 10000; }

@media screen and (min-width: 900px) {
  body { padding: 16px 20px; }
  .wrap {
    max-width: 980px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    align-items: start;
  }
  .header-area,
  .banner,
  .footer-block {
    grid-column: 1 / -1;
  }
  .header-logo-wrap picture {
    width: auto;
  }
  .header-logo {
    width: 400px;
  }
  #map { height: 100%; }
  .map-wrap { height: 320px; }
}
