﻿* {
  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: #1a73e8;
  text-decoration: none;
}

main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* ━━━ ヒーロー ━━━ */
.hero { text-align: center; padding: 1.5rem 0 1rem; }
.hero-icon { font-size: 2.8rem; margin-bottom: .4rem; }

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

h2 {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.description {
  color: #666;
  margin-bottom: 1.5rem;
}

/* タブ */
.tab-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tab-btn {
  padding: 0.55rem 1.25rem;
  border: 1px solid #e0e0e0;
  border-radius: 999px;
  background: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  color: #555;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab-btn.active {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

.tab-panel.hidden {
  display: none;
}

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

.summary-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e0e0e0;
}

.input-group {
  margin-bottom: 1.2rem;
}

.input-group:last-child {
  margin-bottom: 0;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.5rem;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1.05rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input[type="number"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: #1a73e8;
}

/* 2カラムグリッド */
.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* カウンター */
.counter-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.counter-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #f9f9f9;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}

.counter-btn:hover {
  background: #e8f0fe;
  border-color: #1a73e8;
  color: #1a73e8;
}

#s-people-val {
  font-size: 1.5rem;
  font-weight: bold;
  min-width: 2.5rem;
  text-align: center;
}

/* セグメントコントロール */
.seg-control {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.seg-btn {
  padding: 0.45rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #f9f9f9;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  color: #555;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.seg-btn.active {
  background: #e8f0fe;
  color: #1a73e8;
  border-color: #1a73e8;
  font-weight: 600;
}

/* メトリクス */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric {
  background: #fff;
  border-radius: 12px;
  padding: 1.2rem;
  border: 1px solid #e0e0e0;
  text-align: center;
}

.metric-label {
  font-size: 0.78rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.metric-value {
  font-size: 1.4rem;
  font-weight: bold;
}

.metric-value.highlight {
  color: #1a73e8;
}

.metric-value.surplus {
  color: #4CAF50;
}

.metric-value.shortage {
  color: #e53935;
}

/* 内訳テーブル */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.detail-table th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  color: #666;
  font-weight: normal;
  border-bottom: 1px solid #f0f0f0;
  width: 55%;
}

.detail-table td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #f0f0f0;
  font-weight: 600;
  text-align: right;
}

/* カスタム割り勘 */
.custom-header {
  display: grid;
  grid-template-columns: 1fr 120px 36px;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #888;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 0.75rem;
}

.person-row {
  display: grid;
  grid-template-columns: 1fr 120px 36px;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.person-row input[type="text"],
.person-row input[type="number"] {
  padding: 0.5rem 0.7rem;
  font-size: 0.95rem;
}

.del-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fff;
  color: #999;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.del-btn:hover {
  background: #fff0f0;
  color: #e53935;
  border-color: #e53935;
}

.add-btn {
  margin-top: 0.5rem;
  padding: 0.5rem 1.2rem;
  border: 1px dashed #1a73e8;
  border-radius: 8px;
  background: #fff;
  color: #1a73e8;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.add-btn:hover {
  background: #e8f0fe;
}

/* カスタム結果テーブル */
#custom-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

#custom-result-table thead th {
  text-align: left;
  padding: 0.5rem 0.8rem;
  font-size: 0.8rem;
  color: #888;
  font-weight: normal;
  border-bottom: 1px solid #e0e0e0;
}

#custom-result-table thead th.num-col {
  text-align: right;
}

#custom-result-table tbody td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #f0f0f0;
}

#custom-result-table tbody td.num-col {
  text-align: right;
  font-weight: 600;
}

.total-row td {
  padding: 0.8rem 0.8rem;
  font-weight: bold;
  font-size: 1.05rem;
  color: #1a73e8;
  border-top: 2px solid #e0e0e0;
  text-align: left;
}

.total-row td.num-col {
  text-align: right;
}

.kuchi-note {
  font-size: 0.82rem;
  color: #888;
  margin-top: 0.5rem;
}

/* ━━━ 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; }

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: #1a73e8;
}

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: 600px) {
  h1 { font-size: 1.4rem; }

  .two-col {
    grid-template-columns: 1fr;
  }

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

  .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: #1a73e8; 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; }

.warikan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
  min-width: 520px;
}
.warikan-table th {
  background: #1a73e8;
  color: #fff;
  padding: .5rem .65rem;
  text-align: right;
  font-weight: 700;
  font-size: .78rem;
  white-space: nowrap;
}
.warikan-table th:first-child { text-align: left; }
.warikan-table td {
  padding: .42rem .65rem;
  border-bottom: 1px solid #f0f0f0;
  text-align: right;
  color: #444;
  font-variant-numeric: tabular-nums;
}
.warikan-table td:first-child { text-align: left; font-weight: 600; color: #555; }
.warikan-table tr:hover td { background: #f0f4ff; }
.hl-row td { background: #eff6ff !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: #dbeafe;
  color: #1a73e8;
  border: 1.5px solid #bfdbfe;
  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: #f0f6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #1a56db; margin-bottom: .2rem; }
.scene-body p { font-size: .78rem; color: #4b5563; 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 #e8edf5;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #1a73e8; box-shadow: 0 2px 8px rgba(26,115,232,.1); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #1a73e8; 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; }
}
