/* AIトークン数カウンター専用スタイル */

.tc-description {
  color: #475569;
  margin-bottom: 16px;
  line-height: 1.8;
}

.tc-tool {
  max-width: 800px;
  margin: 0 auto 10px;
  text-align: left;
}

/* ---------- 入力 ---------- */

.tc-input-area {
  width: 100%;
  box-sizing: border-box;
  padding: 14px;
  font-size: 16px;
  line-height: 1.7;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  resize: vertical;
  font-family: inherit;
}

.tc-input-area:focus {
  outline: none;
  border-color: var(--accent, #3b82f6);
}

.tc-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.tc-toolbar-spacer {
  flex: 1 1 auto;
}

.tc-btn {
  background: #fff;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.tc-btn:hover {
  background: #f1f5f9;
}

/* ---------- 状態表示（主役） ---------- */

.tc-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.tc-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 16px 18px;
}

.tc-card-main {
  background: #fff;
  border-color: var(--accent, #3b82f6);
}

.tc-card-label {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
  line-height: 1.5;
}

.tc-card-value {
  font-size: 34px;
  font-weight: 700;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.tc-card-main .tc-card-value {
  color: var(--accent, #3b82f6);
}

.tc-card-value .tc-unit {
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
  margin-left: 3px;
}

.tc-card-value .tc-approx {
  font-size: 20px;
  font-weight: 600;
  color: #64748b;
  margin-right: 2px;
}

.tc-card-note {
  margin-top: 6px;
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.6;
}

.tc-card-value.tc-loading {
  font-size: 18px;
  color: #94a3b8;
  font-weight: 600;
}

/* ---------- 小さい統計 ---------- */

.tc-minis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.tc-mini {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px 12px;
}

.tc-mini-label {
  font-size: 11.5px;
  color: #64748b;
  margin-bottom: 2px;
}

.tc-mini-value {
  font-size: 18px;
  font-weight: 700;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

/* ---------- コンテキスト上限バー ---------- */

.tc-section {
  margin-top: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  background: #fff;
}

.tc-section h2 {
  font-size: 15px;
  font-weight: 700;
  color: #334155;
  margin: 0 0 12px;
  width: auto;
  max-width: none;
}

.tc-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.tc-bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 58px;
  align-items: center;
  gap: 10px;
}

.tc-bar-label {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

.tc-bar-track {
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.tc-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: #bfdbfe;
  transition: width 0.25s ease;
}

.tc-bar-row.is-over .tc-bar-fill {
  background: #fbcfe8;
}

.tc-bar-pct {
  font-size: 12px;
  color: #64748b;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tc-bar-row.is-over .tc-bar-pct {
  color: #be185d;
}

/* ---------- 料金のめやす ---------- */

.tc-cost-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tc-cost-label {
  font-size: 13px;
  color: #475569;
}

.tc-rate-input {
  width: 120px;
  padding: 8px 10px;
  font-size: 15px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: inherit;
}

.tc-rate-input:focus {
  outline: none;
  border-color: var(--accent, #3b82f6);
}

.tc-cost-result {
  margin-top: 12px;
  font-size: 15px;
  color: #334155;
}

.tc-cost-value {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

.tc-cost-result .tc-unit {
  font-size: 12.5px;
  color: #94a3b8;
}

.tc-note {
  margin-top: 10px;
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.7;
}

.tc-error {
  margin-top: 10px;
  font-size: 12.5px;
  color: #b45309;
  line-height: 1.7;
  display: none;
}

.tc-error.is-shown {
  display: block;
}

.tc-credit {
  margin-top: 22px;
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.8;
  text-align: center;
}

.tc-credit a {
  color: #94a3b8;
  text-decoration: underline;
}

@media (max-width: 640px) {
  /* スマホでは入力欄を低くして、結果カードがひと目に入るようにする
     （文字サイズはiOSの自動ズームを避けるため16pxのまま） */
  .tc-input-area {
    height: 122px;
  }

  .tc-cards {
    grid-template-columns: 1fr;
  }

  .tc-minis {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .tc-mini-value {
    font-size: 15px;
  }

  .tc-bar-row {
    grid-template-columns: 96px 1fr 50px;
  }
}
