/**
 * ツボタン 建築費シミュレーション（KR-1067）
 * 色・角丸・余白は共通スタイル（/ts.css）の変数に合わせる。
 * 共通スタイルの .bar / .seg / .range / .tag / .empty などと衝突しないよう、独自の部品は ts-simulation- で始める。
 */

.ts-simulation {
  padding-block: 8px 24px;
}

.ts-simulation-title {
  text-align: center;
  font-size: 22px;
  margin-bottom: 6px;
}

.ts-simulation-lead {
  text-align: center;
  color: var(--ts-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.ts-simulation-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.ts-simulation-layout > * {
  min-width: 0;
}

/* 条件パネル */
.ts-simulation-panel {
  border: 1px solid var(--ts-line);
  border-radius: var(--ts-radius);
  background: #fff;
  padding: 20px;
}

.ts-simulation-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.ts-simulation-panel-head h3 {
  font-size: 17px;
}

.ts-simulation-reset {
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  color: var(--ts-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.ts-simulation-field {
  margin-bottom: 22px;
}

.ts-simulation-field:last-child {
  margin-bottom: 0;
}

.ts-simulation-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.ts-simulation-value {
  color: var(--ts-orange-strong);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.ts-simulation-value small {
  font-size: 13px;
  font-weight: 400;
  color: var(--ts-muted);
  margin-left: 2px;
}

.ts-simulation-slider {
  display: block;
  width: 100%;
  height: 28px;
  margin: 0;
  accent-color: var(--ts-orange);
}

.ts-simulation-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ts-muted);
}

.ts-simulation-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ts-simulation-preset-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 2px solid var(--ts-line);
  border-radius: var(--ts-radius-sm);
  background: #fff;
  color: var(--ts-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ts-simulation-preset-btn[aria-pressed='true'] {
  background: var(--ts-orange);
  border-color: var(--ts-orange);
  color: var(--ts-navy);
}

.ts-simulation-hint {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--ts-cream);
  color: var(--ts-muted);
  font-size: 13px;
}

.ts-simulation-hint b {
  color: var(--ts-orange-text);
}

/* チップ（エリア・特徴）。共通の .chip を土台に、押した状態を塗りで示す */
.ts-simulation .chip {
  font-family: inherit;
  cursor: pointer;
}

.ts-simulation .chip[hidden] {
  display: none;
}

.ts-simulation .chip[aria-pressed='true'] {
  background: var(--ts-orange);
  color: var(--ts-navy);
}

.ts-simulation .chip[aria-pressed='true'] i {
  color: var(--ts-navy);
}

.ts-simulation .chip.area[aria-pressed='true'] {
  background: var(--c, var(--ts-r-kanto));
  border-color: var(--c, var(--ts-r-kanto));
  color: #fff;
}

.ts-simulation .chip.area[aria-pressed='true']::before {
  background: #fff;
}

.ts-simulation-more {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--ts-orange-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* 結果 */
.ts-simulation-hero {
  border: 2px solid var(--ts-orange);
  border-radius: var(--ts-radius);
  background: #fff;
  padding: 22px 24px;
}

.ts-simulation-hero-cap {
  font-size: 14px;
  font-weight: 700;
  color: var(--ts-muted);
}

.ts-simulation-range {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 2px;
  color: var(--ts-orange-strong);
  font-weight: 700;
  line-height: 1.2;
}

.ts-simulation-range b {
  font-size: 44px;
  font-variant-numeric: tabular-nums;
}

.ts-simulation-range span {
  font-size: 18px;
}

.ts-simulation-hero-sub {
  font-size: 13px;
  color: var(--ts-muted);
}

.ts-simulation-bar {
  position: relative;
  height: 14px;
  margin: 34px 0 8px;
  border-radius: 7px;
  background: #f1e8dc;
}

.ts-simulation-bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 7px;
  background: linear-gradient(90deg, #f9b57d, var(--ts-orange));
}

.ts-simulation-bar-mark {
  position: absolute;
  top: -26px;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--ts-navy);
  white-space: nowrap;
}

.ts-simulation-bar-mark::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 22px;
  width: 2px;
  height: 24px;
  background: var(--ts-navy);
  transform: translateX(-50%);
}

.ts-simulation-bar-scale {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ts-muted);
}

.ts-simulation-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 15px;
  font-weight: 700;
}

.ts-simulation-status-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ts-r-tohoku);
}

.ts-simulation-status--partial .ts-simulation-status-dot {
  background: var(--ts-r-kinki);
}

.ts-simulation-status--over .ts-simulation-status-dot {
  background: var(--ts-r-kyushu);
}

.ts-simulation-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 24px 0 12px;
}

.ts-simulation-seg {
  display: inline-flex;
  overflow: hidden;
  border: 2px solid var(--ts-orange);
  border-radius: var(--ts-radius-sm);
}

.ts-simulation-seg button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  background: #fff;
  color: var(--ts-orange-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.ts-simulation-seg button[aria-pressed='true'] {
  background: var(--ts-orange);
  color: var(--ts-navy);
}

.ts-simulation-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ts-muted);
}

.ts-simulation-sort select {
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--ts-line);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
}

/* 比較テーブル */
.ts-simulation-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ts-line);
  border-radius: var(--ts-radius);
}

.ts-simulation-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
}

.ts-simulation-table th,
.ts-simulation-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--ts-line);
  text-align: right;
  white-space: nowrap;
}

.ts-simulation-table th:first-child,
.ts-simulation-table td:first-child {
  position: sticky;
  left: 0;
  background: inherit;
  text-align: left;
}

.ts-simulation-table thead th {
  background: #fcfaf7;
  color: var(--ts-muted);
  font-size: 13px;
}

.ts-simulation-table tbody tr:last-child td {
  border-bottom: 0;
}

.ts-simulation-table td .star {
  width: 36px;
  height: 36px;
}

.ts-simulation-cell-name a {
  font-weight: 700;
}

.ts-simulation-cell-cost {
  color: var(--ts-orange-strong);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ts-simulation-cell-diff.is-ok {
  color: #2f8a66;
  font-weight: 700;
}

.ts-simulation-cell-diff.is-ng {
  color: #c0392b;
}

.ts-simulation-table tr.is-over td {
  background: #faf8f5;
  color: #767676;
}

.ts-simulation-table tr.is-over .ts-simulation-cell-cost {
  color: #767676;
}

/* カード */
.ts-simulation-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ts-simulation-builder-card.is-over {
  opacity: 0.6;
}

.ts-simulation-card-note {
  text-align: center;
}

.ts-simulation-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 13px;
  color: var(--ts-muted);
}

.ts-simulation-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--ts-muted);
}

.ts-simulation-no-result {
  text-align: center;
}

.ts-simulation-noscript {
  margin-top: 16px;
  text-align: center;
  color: var(--ts-muted);
}

/* スマホの固定バー */
.ts-simulation-sticky {
  display: none;
}

@media (max-width: 900px) {
  .ts-simulation-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .ts-simulation-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .ts-simulation-range b {
    font-size: 34px;
  }

  .ts-simulation {
    padding-bottom: 80px;
  }

  .ts-simulation-col-base {
    display: none;
  }

  .ts-simulation-table td.ts-simulation-cell-name {
    min-width: 7em;
    white-space: normal;
  }

  .ts-simulation-sticky:not([hidden]) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-top: 2px solid var(--ts-orange);
    background: #fff;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  }

  .ts-simulation-sticky small {
    display: block;
    font-size: 12px;
    color: var(--ts-muted);
  }

  .ts-simulation-sticky-value {
    color: var(--ts-orange-strong);
    font-size: 15px;
  }

  .ts-simulation-sticky .btn {
    white-space: nowrap;
  }
}
