/* =========================================================
   eProfit ページの見た目（v6・2026-10-30 デザイン工場・林さん暫定 OK）
   手本：eLink の画面（紺の帯・白いカード）／日本の eBay 利益計算サイト（入れる順の番号・項目名を左にした1行）
   色　：eProfit のロゴ一式（グリーン #178052・ゴールド #EBB42A・eシリーズの紺 #132B53）
   幅　：〜679px＝スマホ（1列・結果は下に貼り付く）／680〜1199px＝2画面に割った時（2列・注意書きは「i」）
         1200px〜＝全画面（1段目リサーチ／2段目 ②〜⑤ を左から右へ／結果は下に横1本）
   決まりの紙：04_納品 の「見た目の決まり.png」
   ========================================================= */

:root {
  /* ブランドの色（ロゴ一式と同じ番号） */
  --navy: #132B53;          /* eシリーズの紺：上の帯・結果の欄 */
  --navy-deep: #0B1830;
  --green: #178052;         /* eProfit グリーン：選んでいる物・入力中の枠・リンク */
  --green-light: #58C48A;   /* 紺の上で使う緑 */
  --gold: #EBB42A;          /* eProfit ゴールド：差し色（帯の線・内訳を開く） */
  --gold-light: #FFDB4D;

  /* 明るい表示 */
  --bg: #F4F6FA;
  --card-bg: #FFFFFF;
  --card-border: #E3E8EF;
  --text: #0F1B2D;
  --text-secondary: #4A5568;
  --text-dim: #7A8699;
  --border: #E3E8EF;
  --row-bg: #F7F9FB;
  --row-border: #EDF1F5;
  --input-bg: #FFFFFF;
  --input-border: #D5DCE5;
  --input-focus: rgba(23, 128, 82, 0.18);
  --seg-bg: #EEF1F5;
  --chip-bg: #FFFFFF;
  --icon-bg: #E8F4EE;
  --icon-stroke: #178052;
  --link: #178052;
  --hint-bg: #E8F4EE;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);

  /* 下の数字の色分け（結果の欄は明るい／暗いどちらでも紺の地なので、紺の上の色） */
  --profit-positive: #58C48A;
  --profit-warning: #F5C451;
  --profit-negative: #FF7A7A;

  /* 前の版の名前（中の部品が参照している所のため残す） */
  --teal: var(--green);
  --accent: var(--gold);
  --accent-glow: rgba(235, 180, 42, 0.35);

  /* 検索先の色（小さな丸だけに使う） */
  --mercari: #ff0211;
  --yahoo: #ff0027;
  --ebay: #4A90D9;
  --ebay-sold: #e53238;
  --amazon: #ff9900;
  --rakuten: #bf0000;
  --yahooshop: #ff0033;

  /* 文字 */
  --font: "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 60px;
}

/* 暗い表示（eLink の LP の濃い紺に寄せる） */
body.dark {
  --bg: #0B1830;
  --card-bg: #11264A;
  --card-border: rgba(255, 255, 255, 0.07);
  --text: #E8EDF5;
  --text-secondary: #A9B6CB;
  --text-dim: #7D8FAD;
  --border: rgba(255, 255, 255, 0.09);
  --row-bg: rgba(255, 255, 255, 0.04);
  --row-border: rgba(255, 255, 255, 0.06);
  --input-bg: #0D1F3D;
  --input-border: rgba(255, 255, 255, 0.14);
  --input-focus: rgba(88, 196, 138, 0.22);
  --seg-bg: rgba(255, 255, 255, 0.06);
  --chip-bg: rgba(255, 255, 255, 0.04);
  --icon-bg: rgba(88, 196, 138, 0.12);
  --icon-stroke: #58C48A;
  --link: #58C48A;
  --hint-bg: rgba(88, 196, 138, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  --teal: var(--green-light);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  padding-bottom: 250px;            /* 下に貼り付く結果の欄の分 */
  font-feature-settings: "palt" 0;
}

/* 暗い表示の地に、eLink の LP のような薄い方眼をうっすら */
body.dark::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(88, 196, 138, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 196, 138, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse at 70% 0%, #000, transparent 70%);
  mask-image: radial-gradient(ellipse at 70% 0%, #000, transparent 70%);
}

/* ---------- 上の帯（明るい／暗いどちらも紺） ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  color: #fff;
}
body.dark .header { background: #0F2347; }
.header::after {                    /* 緑から金へ流れる細い線（eLink の LP の光る線を eProfit の色で） */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, #0B5134 0%, #178052 30%, #58C48A 55%, #EBB42A 80%, #FFDB4D 100%);
}
.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 10px 16px 13px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header h1 { margin: 0; line-height: 0; }
.header-logo { height: 26px; width: auto; display: block; }
.header-sub {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
}
.header .rate-display {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
  text-align: right;
  min-width: 0;
}
.header .rate-display > * { white-space: nowrap; }
.header .rate-display #rateDisplay {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.header .rate-display #rateDate { font-size: 10.5px; color: rgba(255, 255, 255, 0.62); }
.header .rate-display .rate-credit {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
}
.header .rate-display .rate-credit:hover { color: #fff; text-decoration: underline; }

/* 明るい／暗いの切り替え（絵文字の代わりに線の絵。中の文字は残して見せないだけ） */
.theme-toggle {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: 0;
  color: transparent;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.14); }
.theme-toggle::before {
  content: "";
  width: 18px;
  height: 18px;
  background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E") center / contain no-repeat;
}
body.dark .theme-toggle::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 14.5A8.5 8.5 0 0 1 9.5 3.5a8.5 8.5 0 1 0 11 11z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 14.5A8.5 8.5 0 0 1 9.5 3.5a8.5 8.5 0 1 0 11 11z'/%3E%3C/svg%3E");
}

/* ---------- 並べ方 ---------- */
.layout {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 12px 0;
}
.inputs { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.half, .col, .ship-grid, .ship-a, .ship-b { display: contents; }   /* スマホでは列の箱を無くし、上から順に1列に並べる */
.inputs .section { margin: 0; }
/* 入れる順の番号（①リサーチ ②価格 ③カテゴリ ④サイズ ⑤送料。為替レートは「その他」なので番号なし） */
.inputs { counter-reset: step; }
.section:not(.section--rate) { counter-increment: step; }
.section:not(.section--rate) .section-icon { background: var(--green); }
.section:not(.section--rate) .section-icon svg { display: none; }
.section:not(.section--rate) .section-icon::before { content: counter(step); color: #fff; font: 800 15px/1 var(--font); }
.section { position: relative; }
/* 「i」の説明：スマホでは押す物を出さず、注意書きをそのまま見せる */
.tip-btn { display: none; }

/* ---------- カード ---------- */
.section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--icon-bg);
  display: grid;
  place-items: center;
}
.section-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--icon-stroke);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.section-title { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: 0.01em; line-height: 1.35; }

/* ---------- 入れる欄 ---------- */
.field { margin-bottom: 14px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font: 500 16px/1.2 var(--font);
  font-variant-numeric: tabular-nums;
  background: var(--input-bg);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237A8699' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}
.field input:hover, .field select:hover { border-color: #B8C2CF; }
body.dark .field input:hover, body.dark .field select:hover { border-color: rgba(255, 255, 255, 0.26); }
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px var(--input-focus);
}
.field input::placeholder { color: var(--text-dim); font-weight: 400; }

.row { display: flex; gap: 10px; align-items: stretch; }
.row .field { flex: 1; margin-bottom: 0; }
.row .field.grow-2 { flex: 2; }
.row .field.grow-1 { flex: 1; }
.same-currency { display: flex; align-items: center; font-size: 13px; color: var(--text-secondary); }
.fuel-link-wrap { display: flex; align-items: center; }

/* 2つから選ぶ（eLink の設定画面のタブと同じ形） */
.toggle-group {
  display: flex;
  height: 46px;
  padding: 3px;
  gap: 3px;
  background: var(--seg-bg);
  border-radius: 10px;
}
.toggle-group button {
  flex: 1;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font: 700 14px/1.2 var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  padding: 0 0.6em;
}
.toggle-group button:hover { color: var(--text); }
.toggle-group button.active {
  background: var(--card-bg);
  color: var(--link);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.14);
}
body.dark .toggle-group button.active { background: #1B3765; color: #fff; box-shadow: inset 0 0 0 1px rgba(88, 196, 138, 0.55); }

/* 自動で出る数字の行（eLink の一覧の行の形） */
.auto-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--row-bg);
  border: 1px solid var(--row-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 8px;
  font-size: 14px;
}
.auto-display .label { color: var(--text-secondary); min-width: 0; }
.auto-display .value {
  flex: none;
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
}
.auto-display.total { background: var(--card-bg); border: 1.5px solid var(--green); }
body.dark .auto-display.total { border-color: rgba(88, 196, 138, 0.6); }
.auto-display.total .label { color: var(--text); font-weight: 700; }
.auto-display.total .value { font-size: 17px; }
.auto-display + .field { margin-top: 14px; }

.note {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim);
  margin-top: 8px;
}

/* ---------- 商品リサーチ ---------- */
.translated-text {
  min-height: 46px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--hint-bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  border: 1px solid transparent;
  overflow-wrap: anywhere;
}
.translated-text.loading { color: var(--text-dim); }

.search-links-group { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.search-row { display: flex; align-items: flex-start; gap: 10px; }
.search-row .lang-tag {
  flex: none;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 5px;
  color: #fff;
  line-height: 1.3;
}
.search-row .lang-tag.ja { background: var(--navy); }
body.dark .search-row .lang-tag.ja { background: #2A4677; }
.search-row .lang-tag.en { background: var(--green); }
.search-row .links { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.search-row .links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0.45em 0.85em;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--chip-bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.search-row .links a::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot, var(--text-dim));
}
#linkMercari { --dot: var(--mercari); }
#linkYahoo { --dot: var(--yahoo); }
#linkAmazon { --dot: var(--amazon); }
#linkRakuten { --dot: var(--rakuten); }
#linkYahooShop { --dot: var(--yahooshop); }
#linkEbay { --dot: var(--ebay); }
#linkEbaySold { --dot: var(--ebay-sold); }
.search-row .links a:hover { border-color: var(--link); background: var(--hint-bg); }
.search-row .links a:active { transform: translateY(1px); }
.search-row .links a.disabled { opacity: 0.42; pointer-events: none; }

/* ---------- サイズ・重量 ---------- */
.size-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.size-presets button {
  min-width: 52px;
  height: 36px;
  padding: 0 0.8em;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--chip-bg);
  color: var(--text);
  font: 700 14px/1 var(--font);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.size-presets button:hover { border-color: var(--link); }
.size-presets button:active { transform: translateY(1px); }
.size-presets button.selected { border-color: var(--link); background: var(--hint-bg); color: var(--link); }
.size-row { display: flex; align-items: center; gap: 6px; }
.size-row .field { flex: 1; margin-bottom: 0; }
.size-row .x-mark { flex: none; color: var(--text-dim); font-size: 14px; }

.or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-size: 12.5px;
  color: var(--text-dim);
}
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.weight-result {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--hint-bg);
  border-left: 3px solid var(--green);
}
.weight-result .main { font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.weight-result .detail { font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; margin-top: 2px; }

.category-hint {
  display: none;
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--link);
}
.category-hint.show { display: block; }

.fuel-link {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  font-size: 14px;
  font-weight: 700;
  color: var(--link);
  text-decoration: none;
}
.fuel-link:hover { text-decoration: underline; }

/* ---------- 結果の欄（下に貼り付く・明るい／暗いどちらも紺） ---------- */
.result-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: var(--navy);
  color: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 24px rgba(11, 24, 48, 0.22);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
}
body.dark .result-panel { background: #15305C; box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.45); border-top: 1px solid rgba(255, 255, 255, 0.08); }
.result-panel > * { max-width: 656px; margin-left: auto; margin-right: auto; }

.result-profits {
  display: flex;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.result-profit-col { flex: 1; text-align: center; min-width: 0; padding: 0 6px; }
.result-profit-col:first-child { border-right: 1px solid rgba(255, 255, 255, 0.12); }
.result-profit-col .profit-label { font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, 0.68); }
.result-profit-col .profit-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  overflow-wrap: anywhere;
  transition: color 0.25s;
}
.result-profit-col .profit-rate { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.7); margin-top: 1px; }
.result-profit-col .refund-note { font-size: 11.5px; color: rgba(255, 255, 255, 0.6); margin-top: 1px; font-variant-numeric: tabular-nums; }

.result-summary { display: flex; gap: 6px; }
.result-summary .item { flex: 1; text-align: center; font-size: 11.5px; color: rgba(255, 255, 255, 0.66); line-height: 1.4; min-width: 0; }
.result-summary .item .val { font-size: 15px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; margin-top: 2px; }
.result-summary .item .val-sub { font-size: 11px; color: rgba(255, 255, 255, 0.55); font-variant-numeric: tabular-nums; }

.detail-toggle { text-align: center; margin-top: 8px; }
.detail-toggle button {
  border: none;
  background: none;
  color: var(--gold);
  font: 700 13px/1 var(--font);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.detail-toggle button:hover { background: rgba(235, 180, 42, 0.12); }

.detail-breakdown {
  display: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  max-height: 42vh;
  overflow-y: auto;
}
.detail-breakdown.open { display: block; }
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 2px;
  font-size: 13px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}
.detail-row .label { color: rgba(255, 255, 255, 0.72); min-width: 0; }
.detail-row .value { flex: none; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.detail-row.total { border-bottom: none; padding-top: 8px; font-weight: 700; }
.detail-row.total .label { color: #fff; }
.detail-row.total .value { color: var(--gold); font-size: 14px; }
.detail-row.refund { margin-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.12); border-bottom: none; padding-top: 8px; }
.detail-row.refund .value { color: var(--green-light); }

/* 利益の良し悪しの色分け（中の計算が付ける名前はそのまま） */
.profit-positive { color: var(--profit-positive) !important; }
.profit-warning { color: var(--profit-warning) !important; }
.profit-negative { color: var(--profit-negative) !important; }

/* ---------- 検索先のボタン（ファビコンで小さく。JP は絵だけで横1列、EN は絵＋文字） ---------- */
.search-row .links a .fav { width: 16px; height: 16px; border-radius: 3px; flex: none; display: block; }
.search-row .links a::before { content: none; }
.links--icons { flex-wrap: nowrap; }
.links--icons a { width: 40px; min-height: 36px; padding: 0 !important; justify-content: center; }
.links--icons a .fav { width: 20px; height: 20px; }
/* JP は絵だけ。名前は title（指を置くと出る）と aria-label（読み上げ）に持たせる */
.search-row .links a.disabled .fav { filter: grayscale(1); }
body.dark .links--icons a { background: #F4F6FA; border-color: rgba(255, 255, 255, 0.2); }   /* 暗い表示でも印が沈まないよう白い地に */

/* ---------- 自動で出る数字を、領収書のような行にまとめる（カテゴリ・送料） ---------- */
.calc-rows {
  border: 1px solid var(--row-border);
  background: var(--row-bg);
  border-radius: var(--radius-sm);
  padding: 2px 12px;
  margin-bottom: 8px;
}
.calc-rows .auto-display {
  background: none;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 7px 0;
  font-size: 13px;
}
.calc-rows .auto-display + .auto-display { border-top: 1px dashed var(--border); }
.calc-rows .auto-display .value { font-size: 14px; }
.calc-rows .auto-display.total { border: none; border-top: 1.5px solid var(--green); background: none; padding-top: 8px; }
body.dark .calc-rows .auto-display.total { border-top-color: rgba(88, 196, 138, 0.6); }
.calc-rows .auto-display.total .value { font-size: 16px; color: var(--link); }
.calc-rows + .field { margin-top: 12px; }

/* ---------- 為替レート（その他：1行で小さく） ---------- */
.section--mini { padding-top: 12px; padding-bottom: 12px; }
.section--mini .section-header { margin-bottom: 8px; }
.section--mini .field { display: flex; align-items: center; gap: 10px; margin: 0; }
.section--mini .field label { flex: 1; margin: 0; }
.section--mini .field input { flex: 0 0 120px; width: 120px; text-align: right; }

/* ---------- スマホ・拡張機能の横の欄（ロゴの下に「eBay利益計算」） ---------- */
@media (max-width: 480px) {
  .header-brand { flex-direction: column; align-items: flex-start; gap: 1px; }
  .header-logo { height: 24px; }
  .header-sub { font-size: 11px; }
}

/* ---------- 狭い所（拡張機能の横の欄 360px など） ---------- */
@media (max-width: 380px) {
  .header-inner { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .header-logo { height: 22px; }
  .layout { padding-left: 8px; padding-right: 8px; }
  .section { padding: 14px 12px 16px; }
  .result-profit-col .profit-value { font-size: 26px; }
}

/* =========================================================
   パソコンで画面を2つに割った時など、横 680〜1199px（左に商品のページ・右に eProfit）
   この幅でも「1画面に収める」形。手本：オガタの eBay 生活（番号の順）・e-Shikumi-Labo（項目名を左にした1行）
   ・入れる欄は2列（左＝①リサーチ ②価格 ③カテゴリ／右＝④サイズ ⑤送料・為替）。左上から順に入れる
   ・項目名は欄の左に置いて1行にする
   ・長い注意書きは「i」に指を置くか押すと出る（スマホでは今まで通り見えたまま）
   ・結果は画面の下に貼り付く。内訳は帯から上に重ねて出す
   ========================================================= */
@media (min-width: 680px) and (max-width: 1199px) {
  :root { --side: 12px; --label-w: 92px; }
  body { padding-bottom: 96px; }

  .header-inner { max-width: none; min-height: 44px; padding: 6px var(--side) 9px; gap: 10px; }
  .header-brand { flex-direction: row; align-items: center; gap: 8px; }
  .header-logo { height: 22px; }
  .header-sub { font-size: 11.5px; }
  .header .rate-display { flex-direction: row; align-items: baseline; gap: 10px; }
  .header .rate-display #rateDisplay { font-size: 13px; }
  .header .rate-display #rateDate, .header .rate-display .rate-credit { font-size: 10.5px; }
  .theme-toggle { width: 30px; height: 30px; }
  .theme-toggle::before { width: 16px; height: 16px; }

  .layout { max-width: none; padding: 8px var(--side) 0; }
  .inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
  }
  .half { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
  .half-a .section--category, .half-b .section--shipping { flex: 1; }

  /* カードと欄を詰める */
  .section { padding: 10px 12px 11px; border-radius: 10px; }
  .section-header { gap: 7px; margin-bottom: 8px; padding-right: 26px; }
  .section-icon { width: 22px; height: 22px; border-radius: 6px; }
  .section-icon svg { width: 13px; height: 13px; }
  .section-icon::before { font-size: 12px; }
  .section-title { font-size: 14px; }
  .field { margin-bottom: 6px; }
  .field label { font-size: 11.5px; margin-bottom: 3px; line-height: 1.3; }
  .field input, .field select { height: 34px; font-size: 14px; padding: 0 10px; border-radius: 7px; }
  .field select { padding-right: 30px; background-position: right 8px center; }
  .row { gap: 6px; }
  .toggle-group { height: 34px; padding: 2px; gap: 2px; border-radius: 8px; }
  .toggle-group button { font-size: 12px; border-radius: 6px; padding: 0 0.3em; min-width: 0; }
  .translated-text { min-height: 34px; padding: 6px 10px; font-size: 13.5px; line-height: 1.45; }
  .search-links-group { margin-top: 6px; gap: 5px; }
  .search-row { gap: 6px; }
  .search-row .lang-tag { margin-top: 5px; font-size: 10px; padding: 2px 6px; }
  .search-row .links { gap: 4px; }
  .search-row .links a { min-height: 28px; font-size: 12px; padding: 0.3em 0.6em; gap: 5px; border-radius: 6px; }
  .links--icons a { width: 34px; min-height: 28px; }
  .links--icons a .fav { width: 18px; height: 18px; }
  .size-presets { gap: 4px; margin-bottom: 6px; }
  .size-presets button { min-width: 0; flex: 1; height: 28px; font-size: 12.5px; padding: 0 0.3em; border-radius: 6px; }
  .size-row .field input { height: 34px; }
  .or-divider { margin: 4px 0; font-size: 11.5px; }
  .weight-result { margin-top: 6px; padding: 6px 10px; }
  .weight-result .main { font-size: 13.5px; }
  .weight-result .detail { font-size: 12px; line-height: 1.45; }
  .auto-display { padding: 7px 10px; margin-bottom: 6px; font-size: 12.5px; }
  .auto-display .value { font-size: 13.5px; }
  .auto-display.total .value { font-size: 15px; }
  .calc-rows { padding: 0 10px; margin-bottom: 6px; }
  .calc-rows .auto-display { padding: 5px 0; margin: 0; }
  .calc-rows .auto-display.total { padding-top: 6px; }
  .auto-display + .field, .calc-rows + .field { margin-top: 6px; }
  .note { font-size: 12.5px; line-height: 1.6; margin-top: 4px; }
  .category-hint { margin-top: 3px; font-size: 12px; }
  .fuel-link { min-height: 34px; font-size: 12.5px; white-space: nowrap; }
  .same-currency { font-size: 12px; line-height: 1.3; }

  /* 項目名を左に置いて1行にする（3辺サイズだけは上のまま） */
  .field:not(.stack):has(> label) {
    display: grid;
    grid-template-columns: var(--label-w) minmax(0, 1fr);
    column-gap: 8px;
    align-items: center;
  }
  .field:not(.stack):has(> label) > label { margin: 0; grid-column: 1; grid-row: 1; }
  .field:not(.stack):has(> label) > :not(label):not(.tip) { grid-column: 2; }
  .section .field:not(.stack):has(> label) > .note,
  .section .field:not(.stack):has(> label) > .category-hint { grid-column: 1 / -1; }
  .section .field:not(.stack):has(> label) > .note { margin-top: 2px; font-size: 11.5px; }
  .section--price .row .field.grow-1 { flex: 0 0 auto; }
  .section--shipping .row .field.grow-1 { flex: 0 0 88px; }
  #currencyToggle { width: 86px; }
  .same-currency { width: 86px; font-size: 11px; }
  .fuel-link-wrap { flex: 1 1 auto; min-width: 0; }
  .section--mini .field input { flex: none; width: 100%; }

  /* 為替レート（その他）は見出しと欄を1行に */
  .section--mini { display: flex; align-items: center; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .section--mini .section-header { margin: 0; padding-right: 0; flex: none; }
  .section--mini .field { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 96px; margin: 0; }
  .section--mini .field label { text-align: right; font-size: 11px; }
  .section--mini .field input { grid-column: 2; text-align: right; }

  /* 「i」の説明（指を置くか押すと出る） */
  .tip { position: absolute; top: 9px; right: 10px; z-index: 5; }
  .tip-btn {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--text-dim);
    background: var(--card-bg);
    color: var(--text-dim);
    font: 800 11px/1 var(--font);
    font-style: italic;
    cursor: pointer;
  }
  .tip-btn:hover, .tip:focus-within .tip-btn { border-color: var(--link); color: var(--link); }
  .tip .note {
    position: absolute;
    top: calc(100% + 6px);
    right: -4px;
    width: 300px;
    margin: 0;
    padding: 10px 12px;
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(11, 24, 48, 0.18);
    display: none;
  }
  .tip:hover .note, .tip:focus-within .note { display: block; }
  .field > .tip { position: relative; top: auto; right: auto; grid-column: 1; grid-row: 1; justify-self: end; margin-right: 4px; }
  .field > .tip .note { right: auto; left: -8px; }

  /* 結果の帯（画面の下に貼り付く） */
  .result-panel {
    display: flex;
    align-items: center;
    gap: 16px;
    border-radius: 14px 14px 0 0;
    padding: 9px var(--side) calc(9px + env(safe-area-inset-bottom, 0px));
  }
  .result-panel > * { max-width: none; margin: 0; }
  .result-profits { flex: none; gap: 0; padding: 0; margin: 0; border: none; }
  .result-profit-col { flex: none; text-align: left; padding: 0 16px 0 4px; min-width: 112px; white-space: nowrap; }
  .result-profit-col:first-child { border-right: 1px solid rgba(255, 255, 255, 0.14); }
  .result-profit-col + .result-profit-col { padding-left: 16px; }
  .result-profit-col .profit-label { font-size: 11px; }
  .result-profit-col .profit-value { font-size: 26px; line-height: 1.1; }
  .result-profit-col .profit-rate { font-size: 12px; display: inline-block; margin-right: 8px; }
  .result-profit-col .refund-note { display: inline-block; font-size: 11px; }
  .result-summary { flex: 1; gap: 14px; padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, 0.14); align-self: stretch; align-items: center; }
  .result-summary .item { flex: none; text-align: left; font-size: 11px; }
  .result-summary .item .val { font-size: 15px; margin-top: 1px; }
  .detail-toggle { position: absolute; top: -15px; right: var(--side); margin: 0; }
  .detail-toggle button {
    background: var(--navy);
    border: 1px solid rgba(235, 180, 42, 0.55);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    box-shadow: 0 -2px 10px rgba(11, 24, 48, 0.2);
  }
  body.dark .detail-toggle button { background: #15305C; }
  .detail-toggle button:hover { background: #1B3765; }
  .detail-breakdown {
    position: absolute;
    bottom: calc(100% + 22px);
    right: var(--side);
    width: min(400px, calc(100vw - 24px));
    margin: 0;
    padding: 12px 16px 14px;
    border-top: none;
    background: var(--navy);
    border-radius: 14px;
    box-shadow: 0 -12px 40px rgba(11, 24, 48, 0.35);
    max-height: calc(100vh - 170px);
  }
  body.dark .detail-breakdown { background: #15305C; border: 1px solid rgba(255, 255, 255, 0.08); }
}

/* =========================================================
   パソコンの全画面（横 1200px 以上）：1画面に収める
   ・1段目：①商品リサーチを横いっぱい（商品名・英語翻訳・検索先を1行に）
   ・2段目：左から ②価格（下に為替レート＝その他）→ ③カテゴリ → ④サイズ → ⑤送料（カードの中を2列）
   ・下：結果を横1本で画面の下に貼り付ける。内訳は帯から上に重ねて出す
   ・注意書きは隠さず見せる（全画面は場所があるため）
   ========================================================= */
@media (min-width: 1200px) {
  :root { --side: max(20px, calc((100vw - 1680px) / 2 + 20px)); }
  body { padding-bottom: 104px; }

  .header-inner { max-width: none; min-height: 50px; padding: 7px var(--side) 10px; }
  .header-logo { height: 26px; }
  .header-sub { font-size: 12.5px; }
  .header .rate-display { flex-direction: row; align-items: baseline; gap: 12px; }
  .header .rate-display #rateDisplay { font-size: 14px; }
  .header .rate-display #rateDate, .header .rate-display .rate-credit { font-size: 11px; }
  .theme-toggle { width: 32px; height: 32px; }

  .layout { max-width: none; padding: 14px var(--side) 0; }
  .inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.16fr) minmax(0, 2.2fr);
    grid-template-rows: auto 1fr auto;
    gap: 14px;
    align-items: stretch;
  }
  .half, .col { display: contents; }
  .section--research { grid-column: 1 / -1; grid-row: 1; }
  .section--price { grid-column: 1; grid-row: 2; }
  .section--rate { grid-column: 1; grid-row: 3; }
  .section--category { grid-column: 2; grid-row: 2 / 4; }
  .section--size { grid-column: 3; grid-row: 2 / 4; }
  .section--shipping { grid-column: 4; grid-row: 2 / 4; }

  /* カードと欄（スマホより少し詰める） */
  .section { padding: 13px 14px 14px; }
  .section-header { margin-bottom: 10px; gap: 8px; }
  .section-icon { width: 26px; height: 26px; border-radius: 7px; }
  .section-icon svg { width: 15px; height: 15px; }
  .section:not(.section--rate) .section-icon::before { font-size: 13.5px; }
  .section-title { font-size: 15px; }
  .field { margin-bottom: 10px; }
  .field label { font-size: 12.5px; margin-bottom: 4px; }
  .field input, .field select { height: 40px; font-size: 15px; padding: 0 12px; }
  .field select { padding-right: 34px; background-position: right 10px center; }
  .row { gap: 8px; }
  .toggle-group { height: 40px; }
  .toggle-group button { font-size: 13px; padding: 0 0.4em; }
  .translated-text { min-height: 40px; padding: 9px 12px; font-size: 14.5px; }
  .size-presets { gap: 4px; margin-bottom: 8px; }
  .size-presets button { min-width: 0; flex: 1; height: 32px; font-size: 13px; padding: 0 0.3em; }
  .size-row .field input { height: 40px; }
  .or-divider { margin: 8px 0; }
  .weight-result { margin-top: 8px; padding: 8px 12px; }
  .weight-result .main { font-size: 14px; }
  .weight-result .detail { font-size: 12.5px; }
  .auto-display { padding: 8px 12px; margin-bottom: 6px; font-size: 13px; }
  .auto-display .value { font-size: 14px; }
  .auto-display.total .value { font-size: 15.5px; }
  .calc-rows { margin-bottom: 8px; }
  .calc-rows .auto-display { padding: 6px 0; margin: 0; }
  .calc-rows .auto-display.total { padding-top: 7px; }
  .auto-display + .field, .calc-rows + .field { margin-top: 10px; }
  .note { font-size: 12.5px; line-height: 1.6; margin-top: 6px; }
  .category-hint { margin-top: 4px; font-size: 12px; }
  .fuel-link { min-height: 40px; font-size: 13px; white-space: nowrap; }
  .section--shipping .calc-rows .auto-display .label { white-space: nowrap; }
  .section--shipping .auto-display.total .label { font-size: 12.5px; }
  .same-currency { font-size: 12px; line-height: 1.35; }
  .section--price .row .field.grow-1 { flex: 0 0 96px; }

  /* ①商品リサーチ：商品名・英語翻訳・検索先を横1行に */
  .section--research { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; align-items: end; }
  .section--research .section-header { grid-column: 1 / -1; }
  .research-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
  .research-grid .field { margin: 0; }
  .search-links-group { margin: 0; gap: 6px; }
  .search-row .lang-tag { margin-top: 7px; }
  .search-row .links a { min-height: 34px; }
  .links--icons a { width: 40px; min-height: 34px; }

  /* 為替レート（その他）：見出しと欄を1行に */
  .section--mini { padding-top: 10px; padding-bottom: 10px; align-self: end; }
  .section--mini .section-header { margin-bottom: 6px; }
  .section--mini .field label { font-size: 12px; }
  .section--mini .field input { flex: 0 0 104px; width: 104px; }

  /* ⑤送料：カードの中を2列に */
  .ship-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 14px; }
  .ship-a, .ship-b { display: block; min-width: 0; }
  .ship-b > .field:first-child { margin-top: 0; }
  .section--shipping .row .field.grow-1 { flex: 0 0 92px; }
  .fuel-link-wrap { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; }

  /* 結果の帯（画面の下に貼り付く） */
  .result-panel {
    display: flex;
    align-items: center;
    gap: 28px;
    border-radius: 16px 16px 0 0;
    padding: 12px var(--side) calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .result-panel > * { max-width: none; margin: 0; }
  .result-profits { flex: none; gap: 0; padding: 0; margin: 0; border: none; }
  .result-profit-col { flex: none; text-align: left; padding: 0 28px 0 0; min-width: 200px; white-space: nowrap; }
  .result-profit-col:first-child { border-right: 1px solid rgba(255, 255, 255, 0.14); }
  .result-profit-col + .result-profit-col { padding-left: 28px; }
  .result-profit-col .profit-label { font-size: 12px; }
  .result-profit-col .profit-value { font-size: 30px; line-height: 1.1; }
  .result-profit-col .profit-rate { font-size: 13px; display: inline-block; margin-right: 10px; }
  .result-profit-col .refund-note { display: inline-block; }
  .result-summary { flex: 1; gap: 32px; padding-left: 28px; border-left: 1px solid rgba(255, 255, 255, 0.14); align-self: stretch; align-items: center; }
  .result-summary .item { flex: none; text-align: left; font-size: 12px; }
  .result-summary .item .val { font-size: 18px; margin-top: 2px; }
  .detail-toggle { flex: none; margin: 0; }
  .detail-toggle button { border: 1px solid rgba(235, 180, 42, 0.5); padding: 9px 14px; }
  .detail-breakdown {
    position: absolute;
    bottom: calc(100% + 8px);
    right: var(--side);
    width: 400px;
    margin: 0;
    padding: 12px 18px 14px;
    border-top: none;
    background: var(--navy);
    border-radius: 14px;
    box-shadow: 0 -12px 40px rgba(11, 24, 48, 0.35);
    max-height: calc(100vh - 200px);
  }
  body.dark .detail-breakdown { background: #15305C; border: 1px solid rgba(255, 255, 255, 0.08); }
}

::selection { background: rgba(235, 180, 42, 0.3); }
