/* ===================================================
   算命学 命式鑑定 — style.css
   =================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  background: #f5f5f5;
  color: #2d2d2d;
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Layout --- */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* --- Header --- */
.site-header {
  text-align: center;
  padding: 32px 0 24px;
}

.site-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #1a1a2e;
}

/* --- Card --- */
.card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* --- Section Title --- */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: 0.06em;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px solid #e8eaf6;
}

/* --- Form --- */
.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.form-label {
  font-weight: 600;
  min-width: 90px;
  color: #3d3d3d;
}

.date-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.date-sep {
  font-size: 0.9rem;
  color: #555;
}

.select {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  cursor: pointer;
  color: #2d2d2d;
  appearance: auto;
}

.select:focus {
  outline: 2px solid #5c6bc0;
  outline-offset: 1px;
  border-color: #5c6bc0;
}

.radio-group {
  display: flex;
  gap: 20px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: #5c6bc0;
  cursor: pointer;
}

.form-submit {
  justify-content: flex-start;
}

.btn-submit {
  padding: 12px 32px;
  background: #5c6bc0;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.18s ease, transform 0.1s ease;
}

.btn-submit:hover {
  background: #3949ab;
}

.btn-submit:active {
  transform: scale(0.98);
}

.btn-submit:focus-visible {
  outline: 3px solid #5c6bc0;
  outline-offset: 3px;
}

.btn-submit:disabled {
  background: #b0bec5;
  cursor: not-allowed;
}

.error-msg {
  color: #c62828;
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* --- Loading --- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: #5c6bc0;
  font-size: 1rem;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e8eaf6;
  border-top-color: #5c6bc0;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===================================================
   Section 1: 三柱テーブル
   =================================================== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pillar-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.pillar-table th,
.pillar-table td {
  padding: 10px 20px;
  text-align: center;
  border: 1px solid #e0e0e0;
}

.pillar-table thead th {
  background: #f3f4f9;
  font-weight: 700;
  color: #3949ab;
}

.pillar-table tbody th {
  background: #fafafa;
  font-weight: 600;
  color: #555;
  text-align: right;
  padding-right: 16px;
}

.pillar-table tbody td {
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  color: #1a1a2e;
}

/* ===================================================
   Section 2: 人体星図
   =================================================== */
.star-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 480px;
  margin: 0 auto;
}

.star-cell {
  border-radius: 6px;
  padding: 14px 8px 10px;
  text-align: center;
  position: relative;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.star-cell::before {
  content: attr(data-label);
  font-size: 0.68rem;
  color: #666;
  display: block;
  margin-bottom: 2px;
}

.star-cell.pink {
  background: #ffcdd2;
}

.star-cell.orange {
  background: #ffe0b2;
}

.star-main {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  display: block;
}

.star-sub {
  font-size: 0.75rem;
  color: #555;
  display: block;
}

/* ===================================================
   Section 3: 天中殺
   =================================================== */
.large-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: 0.08em;
}

/* ===================================================
   Section 4: 五行バランス
   =================================================== */
.gogyo-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gogyo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gogyo-label {
  width: 24px;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  color: #1a1a2e;
}

.gogyo-bar-track {
  flex: 1;
  background: #f0f0f0;
  border-radius: 4px;
  height: 20px;
  overflow: hidden;
}

.gogyo-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.gogyo-count {
  width: 24px;
  text-align: right;
  font-size: 0.9rem;
  color: #555;
}

/* 五行カラー */
.gogyo-bar-fill[data-gogyo="木"] { background: #81c784; }
.gogyo-bar-fill[data-gogyo="火"] { background: #e57373; }
.gogyo-bar-fill[data-gogyo="土"] { background: #ffb74d; }
.gogyo-bar-fill[data-gogyo="金"] { background: #90a4ae; }
.gogyo-bar-fill[data-gogyo="水"] { background: #64b5f6; }

/* ===================================================
   Section 5: 位相法
   =================================================== */
.isouhou-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.isouhou-list li {
  padding: 8px 12px;
  background: #f3f4f9;
  border-radius: 4px;
  font-size: 0.95rem;
  color: #1a1a2e;
}

.isouhou-empty {
  color: #999;
  font-size: 0.9rem;
}

/* ===================================================
   Section 6: 数理法
   =================================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  padding: 8px 14px;
  text-align: center;
  border: 1px solid #e0e0e0;
}

.data-table thead th {
  background: #f3f4f9;
  font-weight: 700;
  color: #3949ab;
}

.data-table tbody tr:nth-child(even) td {
  background: #fafafa;
}

.data-table tfoot td,
.data-table tfoot th {
  background: #e8eaf6;
  font-weight: 700;
}

.data-table .highlight-row td,
.data-table .highlight-row th {
  background: #e8eaf6;
  font-weight: 700;
}

/* ===================================================
   Section 7: 気図法
   =================================================== */
.kizu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  max-width: 300px;
  margin: 0 auto 16px;
}

.kizu-cell {
  background: #f3f4f9;
  border: 1px solid #dde;
  border-radius: 6px;
  padding: 12px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kizu-cell.kizu-center {
  background: #e8eaf6;
  font-weight: 700;
}

.kizu-dir {
  font-size: 0.72rem;
  color: #888;
}

.kizu-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a2e;
}

.hachimon-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 6px 16px;
  background: #3949ab;
  color: #fff;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* ===================================================
   Section 8: 才能占技
   =================================================== */
.sainou-detail {
  margin-top: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 0.95rem;
}

.sainou-detail dt {
  font-weight: 600;
  color: #555;
}

.sainou-detail dd {
  color: #1a1a2e;
  font-weight: 700;
}

/* ===================================================
   Section 9: 格局
   =================================================== */
.kakkyoku-display {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.kakkyoku-badge {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.kakkyoku-badge.shinkyo { background: #e3f2fd; color: #1565c0; }
.kakkyoku-badge.shinchuu { background: #e8f5e9; color: #2e7d32; }
.kakkyoku-badge.shinjaku { background: #fff3e0; color: #e65100; }
.kakkyoku-badge.default  { background: #f3f4f9; color: #1a1a2e; }

.kakkyoku-sub {
  font-size: 0.9rem;
  color: #555;
}

/* ===================================================
   Section 10 & 11: 大運・年運表
   =================================================== */
.data-table .tenchusatsu-row td {
  background: #fff8e1;
  color: #b71c1c;
  font-weight: 600;
}

/* ===================================================
   Responsive
   =================================================== */
@media (max-width: 600px) {
  .site-header h1 { font-size: 1.4rem; }
  .card { padding: 16px; }
  .form-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .star-grid { max-width: 100%; }
  .kizu-grid { max-width: 100%; }
  .sainou-detail { grid-template-columns: 1fr 1fr; }
  .pillar-table tbody td { font-size: 1.1rem; }
}
