.ts-per-square-block {
  color: #f37724;
  display: inline-flex;
  align-items: flex-end;
  gap: 0.1em;
}

.ts-per-square-price {
  font-size: 4.5em !important;
  font-style: normal !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  vertical-align: bottom !important;
  min-width: 3em !important;
  display: inline-block !important;
  text-align: left !important;
}

.ts-per-square-unit {
  font-size: 1em;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  vertical-align: bottom;
  margin-left: 0.1em;
}

/* リスト表示での坪単価表示の調整 */
.wp-block-columns .ts-per-square-block {
  max-width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: baseline;
}

/* 坪単価カラム全体の中央揃え */
.wp-block-columns .wp-block-column:first-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 120px;
}

.wp-block-columns .ts-per-square-price {
  font-size: 4.5em !important;
  min-width: 2.8em !important;
  text-align: right !important;
}

.wp-block-columns .ts-per-square-unit {
  text-align: left;
}

/* 詳細ページでの大きな表示を維持 */
.cr-overview-column .ts-per-square-price {
  font-size: 8.5em !important;
  min-width: 3.2em;
  text-align: right;
}

.cr-overview-column .ts-per-square-unit {
  text-align: left;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .wp-block-columns .ts-per-square-block {
    max-width: 200px !important;
  }

  .wp-block-columns .wp-block-column:first-child {
    min-height: 100px !important;
  }

  .wp-block-columns .ts-per-square-price {
    font-size: 4.5em !important;
    min-width: 2.8em !important;
  }

  .cr-overview-column .ts-per-square-price {
    font-size: 6.5em !important;
    min-width: 3em !important;
  }
}

/* 小数点のドットを小さく表示 */
.ts-per-square-price {
  position: relative;
}

/* 数字内の小数点を小さくするための追加スタイル */
.ts-per-square-price .decimal-point {
  font-size: 0.4em;
  vertical-align: bottom;
  margin: 0 -0.02em;
  position: relative;
  bottom: 0.1em;
}

/* リスト表示での小数点調整 */
.wp-block-columns .ts-per-square-price .decimal-point {
  font-size: 0.45em;
  bottom: 0.05em;
}

/* 詳細ページでの小数点調整 */
.cr-overview-column .ts-per-square-price .decimal-point {
  font-size: 0.4em;
  bottom: 0.15em;
}

:root {
  --ts-popover-z-index: 100;
}

/* 算出根拠の注釈ラベル（ポップオーバー） */
.ts-per-square-note {
  display: inline-block;
  position: relative;
  margin-top: 2px;
}

/* ℹ トリガーボタン */
.ts-per-square-note-trigger {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--wp--preset--color--vk-color-primary);
  font-size: 0.875rem;
  line-height: 1;
}
.ts-per-square-note-trigger:hover {
  opacity: 0.75;
}

/* ポップオーバー本体 */
/* デフォルトで非表示（hidden属性はARIA/アクセシビリティ用、表示制御は --open クラスで管理） */
.ts-per-square-popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 10px 14px;
  width: 240px;
  z-index: var(--ts-popover-z-index);
  text-align: left;
}
.ts-per-square-popover--open {
  display: block;
}
.ts-per-square-popover::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
}
.ts-per-square-popover::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #ddd;
  margin-top: 1px;
}
.ts-per-square-popover-text {
  font-size: 0.75rem;
  color: #555;
  margin: 0 0 8px;
  line-height: 1.5;
}
.ts-per-square-popover-link {
  font-size: 0.75rem;
  color: var(--wp--preset--color--vk-color-primary);
  text-decoration: none;
}
.ts-per-square-popover-link:hover {
  text-decoration: underline;
}

/* 詳細ページ用 */
.ts-per-square-note.detail-page {
  margin-top: 8px;
}
.ts-per-square-note.detail-page .ts-per-square-note-trigger {
  font-size: 1rem;
}

/* モバイル: 画面外はみ出し防止 */
@media (max-width: 576px) {
  .ts-per-square-popover {
    left: 0;
    transform: none;
  }
  .ts-per-square-popover::after,
  .ts-per-square-popover::before {
    left: 14px;
    transform: none;
  }
  .ts-per-square-popover::before {
    margin-top: 1px;
  }
}

/* TODO: 将来的に削除候補 - 現在は --open クラスで表示制御しているため不要になる可能性が高い */
/* フォールバック: テーマのCSSリセットによる [hidden] 無効化を防止 */
.ts-per-square-popover[hidden] {
  display: none !important;
}

/* 実質坪単価 説明ページ */
.ts-actual-explanation {
  max-width: 800px;
  margin: 0 auto;
}

.ts-actual-explanation-section {
  margin-bottom: 2em;
}

.ts-actual-explanation-formula {
  background: #fff8f3;
  border-left: 4px solid #f37724;
  padding: 0.75em 1.25em;
  font-size: 1.25em;
  font-weight: 700;
  color: #f37724;
  border-radius: 0 4px 4px 0;
  margin: 0.75em 0;
}

.ts-actual-explanation-breakdown {
  padding-left: 1.5em;
  margin: 0.5em 0;
}

.ts-actual-explanation-breakdown li {
  margin-bottom: 0.4em;
}

.ts-actual-explanation-note {
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 1em 1.25em;
}
