* { margin: 0; padding: 0; box-sizing: border-box; }
button { touch-action: manipulation; }

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.7;
  overflow-x: hidden;
}

header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 1rem 0;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.logo {
  font-size: 1.2rem;
  font-weight: bold;
  color: #f97316;
  text-decoration: none;
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ━━━ ヒーロー ━━━ */
.hero {
  text-align: center;
  padding: 2rem 0 1.25rem;
}

.hero-icon { font-size: 2.5rem; margin-bottom: 0.4rem; }

h1 {
  font-size: 1.75rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.05rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.description {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ━━━ カード共通 ━━━ */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid #e0e0e0;
}

/* ━━━ 計算ラッパー ━━━ */
.calc-wrap {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e0e0e0;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* ━━━ モードタブ ━━━ */
.mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.mode-tab {
  flex: 1;
  padding: 0.6rem 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-tab.active {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
}

.mode-tab:hover:not(.active) {
  border-color: #f97316;
  color: #f97316;
}

/* ━━━ プラットフォーム ━━━ */
.platform-section {
  margin-bottom: 1.1rem;
}

.section-label {
  font-size: 0.75rem;
  font-weight: bold;
  color: #aaa;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.platform-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.ptab {
  padding: 0.5rem 0.2rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: bold;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  line-height: 1.2;
}

.ptab span {
  font-size: 0.68rem;
  font-weight: normal;
  color: #aaa;
}

.ptab.active {
  background: #fff7ed;
  border-color: #f97316;
  color: #ea580c;
}

.ptab.active span { color: #f97316; }
.ptab:hover:not(.active) { border-color: #fdba74; color: #ea580c; }

/* ━━━ フィールド ━━━ */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.field-label {
  font-size: 0.82rem;
  color: #666;
  min-width: 8.5rem;
  flex-shrink: 0;
  line-height: 1.3;
}

/* 円マーク付き入力 */
.yen-input {
  display: flex;
  align-items: center;
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s;
}

.yen-input:focus-within { border-color: #f97316; }

.yen-sign {
  padding: 0.55rem 0.65rem;
  font-size: 0.88rem;
  color: #999;
  background: #f9fafb;
  border-right: 1px solid #e5e7eb;
  line-height: 1;
  flex-shrink: 0;
}

.num-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  color: #333;
  background: transparent;
  min-width: 0;
  -moz-appearance: textfield;
}

.num-input::-webkit-inner-spin-button,
.num-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.num-input::placeholder { color: #d1d5db; font-weight: normal; }

/* セレクト */
.select-input {
  flex: 1;
  padding: 0.55rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.82rem;
  color: #555;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s;
  min-width: 0;
}

.select-input:focus { outline: none; border-color: #f97316; }

/* ━━━ 結果カード ━━━ */
.result-card {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.28rem 0;
}

.result-row.sub {
  font-size: 0.87rem;
  color: #888;
}

.result-label { color: #555; }
.result-value { font-weight: bold; font-variant-numeric: tabular-nums; }
.result-value.neg { color: #ef4444; }
.result-value.pos { color: #16a34a; }

.result-divider {
  border-top: 1px solid #fdba74;
  margin: 0.45rem 0 0.2rem;
}

.result-total .result-label {
  font-size: 1rem;
  font-weight: bold;
  color: #333;
}

.result-total .result-value {
  font-size: 1.5rem;
  color: #f97316;
}

.result-total .result-value.pos { color: #16a34a; }
.result-total .result-value.neg { color: #ef4444; }

/* 逆算内訳 */
.rev-breakdown {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid #fdba74;
}

.hidden { display: none; }

/* ━━━ Amazonおすすめ ━━━ */
.amazon-card h2 { margin-bottom: 0.25rem; }
.amazon-note { font-size: 0.82rem; color: #999; margin-bottom: 1rem; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.amazon-item {
  display: block;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 0.9rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.amazon-item:hover {
  border-color: #FF9900;
  box-shadow: 0 2px 8px rgba(255,153,0,0.15);
  transform: translateY(-1px);
}
.amazon-item-icon { font-size: 1.7rem; margin-bottom: 0.35rem; }
.amazon-item-name { font-size: 0.88rem; font-weight: bold; margin-bottom: 0.2rem; }
.amazon-item-desc { font-size: 0.76rem; color: #888; line-height: 1.5; margin-bottom: 0.45rem; }
.amazon-item-link { font-size: 0.78rem; color: #FF9900; font-weight: bold; }

/* ━━━ 使い方 ━━━ */
.how-item { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #f0f0f0; }
.how-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.how-item h3 { font-size: 0.9rem; font-weight: bold; margin-bottom: 0.3rem; color: #f97316; }
.how-item p { font-size: 0.875rem; color: #666; line-height: 1.7; }

footer {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-size: 0.875rem;
}
footer a { color: #999; text-decoration: none; margin: 0 0.5rem; }
footer a:hover { color: #f97316; }
footer p { margin-bottom: 0.3rem; }

/* ━━━ レスポンシブ ━━━ */

/* ─── Tips grid (rank-tracker 統一パターン) ──────── */
.tips-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.tip-item { display: flex; gap: .65rem; }
.tip-icon { font-size: 1.4rem; flex-shrink: 0; }
.tip-text strong { display: block; font-weight: 700; margin-bottom: .15rem; font-size: .88rem; }
.tip-text p { font-size: .8rem; color: #78716c; line-height: 1.55; }
@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  .calc-wrap { padding: 1rem; }
  .field-label { min-width: 6.5rem; font-size: 0.78rem; }
  .ptab { font-size: 0.72rem; padding: 0.45rem 0.1rem; }
  .ptab span { font-size: 0.64rem; }
  .result-total .result-value { font-size: 1.3rem; }

  .tips-grid { grid-template-columns: 1fr; }
}

.amazon-notice {
  font-size: 0.72rem;
  color: #bbb;
  margin-top: 0.2rem;
}

/* ━━━ FAQ ━━━ */
.faq-list { display: flex; flex-direction: column; }
.faq-item { padding: .9rem 0; border-bottom: 1px solid #f0f0f0; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .9rem; font-weight: 700; color: #f97316; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #555; line-height: 1.75; }

/* ━━━ 手取り早見表 ━━━ */
.table-wrap { overflow-x: auto; }
.table-note-top { font-size: .8rem; color: #aaa; margin-bottom: .65rem; }
.table-note     { font-size: .75rem; color: #bbb; margin-top: .5rem; }

.fee-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
  min-width: 440px;
}
.fee-table th {
  background: #f97316;
  color: #fff;
  padding: .5rem .75rem;
  text-align: center;
  font-weight: 700;
  font-size: .78rem;
  white-space: nowrap;
}
.fee-table td {
  padding: .45rem .75rem;
  border-bottom: 1px solid #f0f0f0;
  text-align: center;
  color: #444;
}
.fee-table td:first-child { text-align: left; font-weight: 600; color: #555; }
.fee-table tr:nth-child(even) td { background: #fafafa; }
.fee-table tr:hover td { background: #fff7ed; }
.hl-row td { background: #fff7ed !important; font-weight: 600; }

/* ━━━ ヒーローバッジ ━━━ */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.badge {
  display: inline-block;
  padding: 5px 13px;
  background: #fff7ed;
  color: #ea580c;
  border: 1.5px solid #fed7aa;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ━━━ 活用シーン ━━━ */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.scene-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  background: #fff7ed;
  border: 1.5px solid #fed7aa;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong {
  display: block;
  font-size: .88rem;
  font-weight: 700;
  color: #ea580c;
  margin-bottom: .2rem;
}
.scene-body p { font-size: .78rem; color: #78716c; line-height: 1.55; margin: 0; }

/* ━━━ 関連ツール ━━━ */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.related-tool-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1.5px solid #ffe4c4;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover {
  border-color: #f97316;
  box-shadow: 0 2px 8px rgba(249,115,22,.12);
}
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong {
  display: block;
  font-size: .88rem;
  font-weight: 700;
  color: #f97316;
  margin-bottom: .2rem;
}
.related-tool-item p { font-size: .76rem; color: #888; line-height: 1.5; margin: 0; }

@media (max-width: 600px) {
  .scene-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.4rem; }
}
