/* どっちがお得？単価くらべ /tanka-kurabe/ 専用スタイル。
   .tk- プレフィックスで共通CSSとの名前衝突を避ける。
   お店の棚の前でスマホ片手に使う想定なので、入力欄とボタンは大きめ・タップ域を広く取る。 */

.tk-area {
  --tk-accent: #d97706;
  --tk-best: #0f766e;
  max-width: 720px;
  margin: 22px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tk-lead {
  max-width: 720px;
  margin: 0 auto 2px;
  padding: 0 16px;
  font-size: 15px;
  line-height: 1.7;
  color: #334155;
}

.tk-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

/* ---- 商品の入力 ---- */
.tk-item[hidden] {
  display: none;
}

.tk-item-error {
  border-color: #fcd34d;
  background: #fffdf5;
}

.tk-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tk-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--tk-accent);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.tk-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  padding: 8px 10px;
  min-height: 40px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  box-sizing: border-box;
}

.tk-field-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
}

.tk-field {
  min-width: 0;
}

.tk-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}

.tk-amount-row {
  display: flex;
  gap: 8px;
}

.tk-input {
  width: 100%;
  font-size: 20px;
  font-weight: 700;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  box-sizing: border-box;
  color: #1e293b;
  min-height: 52px;
  font-variant-numeric: tabular-nums;
}

.tk-input::placeholder {
  color: #cbd5e1;
  font-weight: 500;
}

.tk-input:focus,
.tk-name:focus,
.tk-select:focus {
  outline: 2px solid var(--tk-accent);
  outline-offset: 1px;
  border-color: var(--tk-accent);
}

.tk-amount-row .tk-input {
  flex: 1;
  min-width: 0;
}

.tk-select {
  flex: 0 0 auto;
  width: 88px;
  min-height: 52px;
  font-size: 16px;
  font-weight: 700;
  padding: 8px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  box-sizing: border-box;
}

.tk-item-msg {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #b45309;
}

/* ---- 操作ボタン ---- */
.tk-actions {
  display: flex;
  gap: 10px;
}

.tk-add-btn,
.tk-clear-btn {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  padding: 13px 12px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 48px;
}

.tk-add-btn {
  color: var(--tk-accent);
  background: #fff;
  border: 1px dashed var(--tk-accent);
}

.tk-add-btn:hover {
  background: #fffbeb;
}

.tk-add-btn[hidden] {
  display: none;
}

.tk-clear-btn {
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.tk-clear-btn:hover {
  background: #e2e8f0;
}

/* ---- 結果 ---- */
.tk-result-card {
  background: #f8fafc;
}

.tk-result-title {
  font-size: 14px;
  font-weight: 800;
  color: #475569;
  margin: 0 0 12px;
}

.tk-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tk-row {
  list-style: none;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}

.tk-row-best {
  border: 2px solid var(--tk-best);
  background: #f0fdfa;
  box-shadow: 0 2px 10px rgba(15, 118, 110, 0.12);
}

.tk-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.tk-row-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.tk-row-best .tk-row-badge {
  background: var(--tk-best);
  color: #fff;
}

.tk-row-name {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

.tk-best-tag {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--tk-best);
  border-radius: 999px;
  padding: 4px 10px;
}

.tk-row-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.tk-row-unit {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
}

.tk-row-value {
  font-size: 30px;
  font-weight: 800;
  color: #334155;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.tk-row-best .tk-row-value {
  color: var(--tk-best);
  font-size: 34px;
}

.tk-row-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.tk-row-diff {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.6;
}

.tk-row-diff.tk-diff-good {
  color: var(--tk-best);
}

.tk-hint-line {
  margin: 0;
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.7;
}

.tk-rows + .tk-hint-line {
  margin-top: 12px;
}

.tk-warn {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 11px 13px;
}

.tk-example {
  margin: 0;
  font-size: 12.5px;
  color: #94a3b8;
  line-height: 1.7;
}

@media (max-width: 430px) {
  .tk-field-grid {
    grid-template-columns: 1fr;
  }
  .tk-row-value {
    font-size: 26px;
  }
  .tk-row-best .tk-row-value {
    font-size: 30px;
  }
}
