/* ECコンビニ 共通スタイル */

:root {
  --accent: #129b5b;
  --accent-dark: #0c7a47;
  --accent-soft: #e8f6ee;
  --text: #1f2a24;
  --text-sub: #5c6862;
  --border: #dde4e0;
  /* 入力欄・select の枠線。白背景に対してコントラスト比 3.6:1 */
  --border-input: #7d8a84;
  --bg: #ffffff;
  --bg-sub: #f6f8f7;
  --negative: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 40, 30, 0.08), 0 4px 12px rgba(20, 40, 30, 0.05);
  --max: 760px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.75;
}

a {
  color: var(--accent-dark);
}

img,
svg {
  max-width: 100%;
}

/* キーボード操作時のフォーカス表示 */
a:focus-visible,
input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

/* 見た目だけ隠し、読み上げには残す */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 単語の途中で改行させない */
.nowrap {
  white-space: nowrap;
}

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- ヘッダー ---------- */

.site-header {
  border-top: 6px solid var(--accent);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.logo-mark {
  width: 28px;
  height: 28px;
  flex: none;
}

.logo-text .ec {
  color: var(--accent);
}

.header-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  margin-right: -8px;
  color: var(--text-sub);
  font-size: 0.9rem;
  text-decoration: none;
}

.header-nav a:hover {
  color: var(--accent-dark);
}

/* ---------- メイン ---------- */

main {
  padding: 24px 0 48px;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.6rem;
  line-height: 1.4;
}

h2 {
  margin: 40px 0 12px;
  padding-left: 12px;
  border-left: 5px solid var(--accent);
  font-size: 1.3rem;
  line-height: 1.4;
}

h3 {
  margin: 24px 0 8px;
  font-size: 1.05rem;
}

p {
  margin: 0 0 1em;
}

.lead {
  color: var(--text-sub);
}

.breadcrumb {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--text-sub);
}

.breadcrumb li {
  display: inline;
}

.breadcrumb li + li::before {
  content: "›";
  margin: 0 6px;
}

/* タップしやすいよう縦方向に余白を取る（高さ約44px） */
.breadcrumb a {
  display: inline-block;
  padding: 10px 4px;
  margin: -6px -4px;
  line-height: 24px;
}

/* ---------- トップページ ---------- */

.hero {
  margin: 0 0 8px;
  padding: 32px 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  text-align: center;
}

.hero h1 {
  font-size: 1.5rem;
}

.hero .catch {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.9rem;
}

.hero p:last-child {
  margin: 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 600px) {
  .tool-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

a.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.tool-card.is-soon {
  background: var(--bg-sub);
  box-shadow: none;
  color: var(--text-sub);
}

.tool-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.is-soon .tool-icon {
  background: #e9edeb;
  color: #8a9590;
}

.tool-icon svg {
  width: 26px;
  height: 26px;
}

.tool-card-title {
  display: block;
  font-weight: 700;
  line-height: 1.4;
}

.tool-card-desc {
  display: block;
  margin-top: 2px;
  color: var(--text-sub);
  font-size: 0.85rem;
  line-height: 1.5;
}

.badge-soon {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 4px;
  background: #e1e6e3;
  color: var(--text-sub);
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: 2px;
}

.features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 600px) {
  .features {
    grid-template-columns: repeat(3, 1fr);
  }
}

.features li {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--bg-sub);
  text-align: center;
}

.features strong {
  display: block;
  color: var(--accent-dark);
  font-size: 1.05rem;
}

.features span {
  color: var(--text-sub);
  font-size: 0.85rem;
}

/* ---------- ツール：フォーム ---------- */

.tool-box {
  margin: 20px 0;
  padding: 20px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.field {
  margin-bottom: 16px;
}

.field > label,
.field > .field-label {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  font-size: 0.95rem;
}

.field .optional,
.cost-group .optional {
  margin-left: 4px;
  color: var(--text-sub);
  font-weight: 400;
  font-size: 0.8rem;
}

.field-hint {
  margin: 4px 0 0;
  color: var(--text-sub);
  font-size: 0.8rem;
  line-height: 1.5;
}

.input-yen {
  position: relative;
}

.input-yen input {
  padding-right: 2.4em;
}

.input-yen::after {
  content: attr(data-unit);
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--text-sub);
  pointer-events: none;
}

input[type="text"],
select {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 155, 91, 0.2);
}

input[type="text"]:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

input[aria-invalid="true"] {
  border-color: var(--negative);
}

select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235c6862' stroke-width='2'/%3E%3C/svg%3E");
  background-position: right 14px center;
  background-repeat: no-repeat;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented legend {
  margin-bottom: 4px;
  padding: 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.segmented label {
  flex: 1 1 0;
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: block;
  padding: 10px 8px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  background: #fff;
  font-size: 0.9rem;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

.segmented input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

/* .field > label（display:block）より優先させる */
.field > .checkbox {
  display: flex;
  align-items: flex-start;
}

.checkbox input {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 4px;
  accent-color: var(--accent);
}

.sub-field {
  margin-top: 10px;
}

.shipping-platform-note {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff6e5;
  color: #7a5200;
}

[hidden] {
  display: none !important;
}

/* ---------- ツール：結果 ---------- */

.result {
  margin-top: 8px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.result-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.result-main div {
  padding: 12px;
  border-radius: 10px;
  background: #fff;
  text-align: center;
}

/* 横幅いっぱいに出す主結果（② 推奨販売価格など） */
.result-main .result-main-wide {
  grid-column: 1 / -1;
}

.result-main dt {
  color: var(--text-sub);
  font-size: 0.85rem;
}

.result-main dd {
  margin: 0;
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.result-table th,
.result-table td {
  padding: 6px 4px;
  border-bottom: 1px dashed #bcd9c8;
}

.result-table th {
  font-weight: 400;
  text-align: left;
}

.result-table td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.result-table tr:last-child th,
.result-table tr:last-child td {
  border-bottom: 0;
}

.result-table .total th,
.result-table .total td {
  border-top: 2px solid var(--accent);
  border-bottom: 0;
  font-weight: 700;
}

.negative {
  color: var(--negative) !important;
}

.data-note {
  margin: 12px 0 0;
  color: var(--text-sub);
  font-size: 0.8rem;
  line-height: 1.5;
}

.error-message {
  margin: 12px 0 0;
  /* 背景 #e8f6ee で 4.88:1、白で 5.44:1（WCAG AA 4.5:1 以上） */
  color: #c0392b;
  font-size: 0.9rem;
}

.error-message .error-item {
  display: block;
}

/* エラーではない案内（送料未入力など） */
.notice-message {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff6e5;
  color: #7a5200;
  font-size: 0.9rem;
  font-weight: 700;
}

/* ---------- ③ 送料比較 ---------- */

.dims {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.dims legend {
  margin-bottom: 4px;
  padding: 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.dims-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dims-grid label {
  display: block;
  margin-bottom: 2px;
  font-size: 0.9rem;
}

.dims-grid input[type="text"] {
  padding-left: 10px;
}

.ship-summary {
  margin: 0;
  font-weight: 700;
}

.ship-summary:empty {
  display: none;
}

.ship-measured {
  margin: 4px 0 0;
  color: var(--text-sub);
  font-size: 0.8rem;
  line-height: 1.5;
}

.ship-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.ship-list:empty {
  display: none;
}

.ship-card {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.ship-card:first-child {
  margin-top: 0;
}

.ship-card.is-cheapest {
  border: 2px solid var(--accent);
}

.ship-name {
  margin: 0;
  font-weight: 700;
  line-height: 1.4;
}

.badge-cheapest {
  display: inline-block;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--accent-dark);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: 2px;
  white-space: nowrap;
}

.ship-service {
  margin: 0;
  color: var(--text-sub);
  font-size: 0.8rem;
}

.ship-prices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 0;
}

.ship-prices div {
  padding: 6px 4px;
  border-radius: 6px;
  background: var(--bg-sub);
  text-align: center;
}

.ship-prices dt {
  color: var(--text-sub);
  font-size: 0.75rem;
}

.ship-prices dd {
  margin: 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.ship-mat-name {
  display: block;
  color: var(--text-sub);
  font-size: 0.7rem;
}

.ship-prices .ship-total {
  background: var(--accent-soft);
}

.ship-prices .ship-total dd {
  font-weight: 800;
  font-size: 1.05rem;
}

.ship-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
}

.ship-tags li {
  padding: 0 8px;
  border-radius: 4px;
}

.ship-tags .is-yes {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.ship-tags .is-no {
  background: #eef1ef;
  color: var(--text-sub);
}

.ship-note {
  margin: 8px 0 0;
  color: #7a5200;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.5;
}

/* 注意書きの文（1文ずつ） */
.ship-cautions {
  margin: 6px 0 0;
  padding: 0 0 0 1.2em;
  color: var(--text-sub);
  font-size: 0.8rem;
  line-height: 1.5;
}

.ship-cautions li + li {
  margin-top: 4px;
}

/* 最小サイズで外れた配送方法の案内 */
.ship-too-small {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  font-size: 0.85rem;
  line-height: 1.5;
}

.ship-too-small-title {
  margin: 0;
  font-weight: 700;
}

.ship-detail {
  margin: 2px 0 0;
  color: var(--text-sub);
  font-size: 0.8rem;
  line-height: 1.5;
}

/* ---------- ④ 消費税計算 ---------- */

.invoice-lines {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.invoice-line {
  padding: 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-sub);
}

.invoice-line + .invoice-line {
  margin-top: 10px;
}

.invoice-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.invoice-line-no {
  font-weight: 700;
  font-size: 0.9rem;
}

.invoice-line-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 8px;
}

.invoice-line-grid label {
  display: block;
  margin-bottom: 2px;
  color: var(--text-sub);
  font-size: 0.8rem;
}

.invoice-name {
  grid-column: 1 / -1;
}

@media (min-width: 600px) {
  .invoice-line-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  }

  .invoice-name {
    grid-column: auto;
  }
}

/* 明細の削除・追加ボタン（タップしやすいよう高さ44px以上） */
.invoice-remove,
.button-sub {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.invoice-remove {
  color: var(--text-sub);
  font-weight: 400;
}

.button-sub {
  width: 100%;
}

.invoice-remove:hover,
.button-sub:hover {
  border-color: var(--accent);
}

.invoice-remove:disabled,
.button-sub:disabled {
  border-color: var(--border);
  color: #8a948f;
  cursor: not-allowed;
}

/* 金額が大きくなる（請求書の合計は1億円を超えうる）ため、狭い画面では結果を1列に並べる */
@media (max-width: 479px) {
  .tax-result-main {
    grid-template-columns: 1fr;
  }

  .tax-result-main div:not(.result-main-wide) dd {
    font-size: 1.35rem;
  }
}

.invoice-groups {
  margin-top: 4px;
}

.invoice-group {
  margin-top: 12px;
  padding: 4px 12px;
  border-radius: 10px;
  background: #fff;
}

.invoice-group-title {
  padding: 8px 0 2px;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: left;
}

/* ---------- 解説・FAQ ---------- */

.article p,
.article li {
  font-size: 0.97rem;
}

.formula {
  margin: 0 0 1em;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--bg-sub);
  font-weight: 700;
  font-size: 0.95rem;
}

.faq dt {
  margin-top: 16px;
  font-weight: 700;
}

.faq dt::before {
  content: "Q. ";
  color: var(--accent);
}

.faq dd {
  margin: 4px 0 0;
}

.faq dd::before {
  content: "A. ";
  color: var(--text-sub);
  font-weight: 700;
}

.related-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-list li {
  border-bottom: 1px solid var(--border);
}

.related-list a,
.related-list span {
  display: block;
  padding: 12px 4px;
}

.related-list span {
  color: var(--text-sub);
}

.button {
  display: inline-block;
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--accent-dark);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.button:hover {
  background: #095f37;
}

/* ---------- 広告枠 ---------- */

.ad-slot {
  margin: 32px 0;
  min-height: 0;
}

/* AdSense導入前はプレースホルダーを非表示にしたい場合は display:none にする */
.ad-slot:empty::before {
  content: "広告";
  display: block;
  padding: 24px 0;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: #a7b1ac;
  font-size: 0.75rem;
  text-align: center;
}

.pr-notice {
  margin: 0 0 16px;
  color: var(--text-sub);
  font-size: 0.8rem;
}

/* ---------- フッター ---------- */

.site-footer {
  padding: 24px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-sub);
  font-size: 0.85rem;
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 16px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

/* タップしやすいよう高さ44pxを確保 */
.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  color: var(--text-sub);
}

.copyright {
  margin: 0;
  color: var(--text-sub);
}

/* ---------- ⑤ 損益分岐点計算 ---------- */

.cost-group {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.cost-group legend {
  margin-bottom: 4px;
  padding: 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.cost-group .sub-field {
  margin-top: 6px;
}

.cost-group .sub-field label {
  display: block;
  margin-bottom: 2px;
  font-size: 0.9rem;
}

/* 損益分岐点売上高は桁が大きくなりうるため、狭い画面では結果を1列に並べる */
@media (max-width: 479px) {
  .breakeven-result-main {
    grid-template-columns: 1fr;
  }

  .breakeven-result-main div:not(.result-main-wide) dd {
    font-size: 1.35rem;
  }
}
