:root {
  --bg-app: #0b1532;
  --bg-card: #16294e;
  --bg-input: #1c2f58;
  --accent: #a78bfa;
  --accent-deep: #442d99;
  --text-main: #f5f6fc;
  --text-sub: #9aa6cc;
  --border: rgba(255, 255, 255, 0.08);
  --pill-bg: #f2f4fa;
  --pill-text: #29365f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-app);
  color: var(--text-main);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  position: relative;
  overflow-x: hidden;
}

.stars-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,.5) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 70% 65%, rgba(255,255,255,.4) 50%, transparent 100%),
    radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,.4) 50%, transparent 100%),
    radial-gradient(1px 1px at 85% 20%, rgba(255,255,255,.4) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 55% 45%, rgba(255,255,255,.3) 50%, transparent 100%),
    radial-gradient(1px 1px at 10% 60%, rgba(255,255,255,.4) 50%, transparent 100%),
    radial-gradient(1px 1px at 92% 80%, rgba(255,255,255,.3) 50%, transparent 100%);
  background-repeat: repeat;
  background-size: 400px 400px;
}

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 56px 20px 80px;
}

.page-header {
  text-align: center;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--accent);
}

.page-header h1 {
  margin: 0 0 12px;
  font-size: 32px;
  font-weight: 700;
  color: var(--text-main);
}

.lead {
  margin: 0 auto;
  max-width: 440px;
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.7;
}

/* ------- カード共通（アプリのカードUIに準拠） ------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}

.card + .card { margin-top: 20px; }

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.card-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  border-radius: 3px;
  background: linear-gradient(180deg, #c9a3ff, var(--accent));
}

.birth-form {
  max-width: 640px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}

.birth-form label {
  display: block;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.required {
  color: var(--accent);
  font-size: 11px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}

.field {
  margin-bottom: 18px;
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 15px;
}

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

/* time inputのネイティブ時計アイコンは黒固定でダーク背景に同化するため、白っぽく反転させる */
.field input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.5);
  cursor: pointer;
}

.date-select-row {
  display: flex;
  gap: 10px;
}

.date-select-row select,
.date-select-row input {
  width: auto;
  flex: 1 1 0;
  min-width: 0;
}

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-sub);
}

.chart-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chart-tab {
  flex: 1 1 auto;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.chart-tab:hover {
  color: var(--text-main);
}

.chart-tab.active {
  background: linear-gradient(120deg, #c9a3ff, var(--accent));
  border-color: transparent;
  color: #1b1240;
}

.checkbox-field {
  margin-top: -6px;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.radio-field {
  margin-top: -6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-field[hidden] {
  display: none;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
}

.radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.manual-place-fields[hidden] {
  display: none;
}

.manual-place-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: -6px 0 18px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.field-inline {
  flex: 1 1 130px;
}

.field-inline label {
  display: block;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.field-inline input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 14px;
}

.birth-form > button {
  width: 100%;
  padding: 14px 22px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(120deg, #c9a3ff, var(--accent));
  color: #1b1240;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}

.birth-form > button:hover { opacity: 0.9; }
.birth-form > button:active { transform: scale(0.98); }

.form-note {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.6;
}

.result {
  max-width: 960px;
  margin: 40px auto 0;
}

.edit-conditions-btn {
  display: block;
  margin: 0 auto 16px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}

.edit-conditions-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.calc-summary {
  margin: -4px 0 16px;
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.7;
}

/* ------- 動くホロスコープ（期間スライダー） ------- */

.timeline-scrubber {
  margin: 0 0 20px;
}

.timeline-scrubber[hidden] {
  display: none;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timeline-play-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(120deg, #c9a3ff, var(--accent));
  color: #1b1240;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}

.timeline-play-btn:hover { opacity: 0.9; }
.timeline-play-btn:active { transform: scale(0.94); }

.timeline-slider {
  flex: 1 1 auto;
  accent-color: var(--accent);
  height: 6px;
  cursor: pointer;
}

.timeline-position-label {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  text-align: center;
}

.period-end-label {
  display: block;
  margin-top: 12px;
}

.result-title {
  text-align: center;
  margin: 0 0 20px;
  font-size: 20px;
}

.sun-sign-label {
  color: var(--accent);
  font-weight: 700;
  font-family: "Apple Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", "Hiragino Sans", "Yu Gothic", sans-serif;
  font-variant-emoji: text;
}

.wheel-container {
  display: flex;
  justify-content: center;
}

.wheel-svg {
  width: 100%;
  max-width: 760px;
  height: auto;
}

/* ------- ホロスコープ・ホイール ------- */

.wheel-outer {
  fill: var(--bg-app);
}

.wheel-disc {
  fill: #ffffff;
}

.wheel-divider {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.wheel-ring-divider {
  fill: none;
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.wheel-sign-symbol {
  fill: #ffffff;
  font-size: 19px;
  font-family: "Apple Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif;
  font-variant-emoji: text;
}

.house-divider {
  stroke: #94a3b8;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.house-number {
  fill: #475569;
  font-size: 13px;
  font-weight: 600;
}

.axis-line {
  vector-effect: non-scaling-stroke;
}

.axis-asc { stroke: #ff4500; stroke-width: 2.2; }
.axis-mc { stroke: #007aff; stroke-width: 1.8; }

/* 出生時刻不明・正午出生と仮定した参考値のハウス/ASC/MCは点線で区別する */
.estimated-houses {
  stroke-dasharray: 4 3;
  opacity: 0.75;
}

.angle-label {
  font-size: 13px;
  font-weight: 600;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 2px;
}

.angle-label-asc { fill: #ff4500; }
.angle-label-mc { fill: #007aff; }

.angle-degree-tspan {
  font-size: 10px;
  font-weight: 600;
}

.planet-symbol-label {
  font-size: 20px;
  font-weight: 700;
  font-family: "Apple Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif;
  font-variant-emoji: text;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.planet-degree-label {
  fill: #475569;
  font-size: 11px;
  font-weight: 600;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* 逆行マーク（℞）。SVG内(tspan)とテーブル内(span)の両方で使う */
.retrograde-mark {
  fill: #ef4444;
  color: #ef4444;
  font-weight: 700;
  margin-left: 2px;
}

.aspect-ring {
  fill: none;
  stroke: #e2e5ea;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.aspect-line {
  stroke-width: 0.6;
  opacity: 0.6;
  vector-effect: non-scaling-stroke;
}

.aspect-conjunction { stroke: #ef4444; }
.aspect-square { stroke: #ef4444; }
.aspect-opposition { stroke: #ef4444; }
.aspect-sextile { stroke: #3b82f6; }
.aspect-trine { stroke: #3b82f6; }

.aspect-symbol-bg {
  fill: #ffffff;
  stroke: #ffffff;
  stroke-width: 1;
}

.aspect-symbol-label {
  font-size: 13px;
  font-weight: 700;
  font-family: "Apple Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif;
  font-variant-emoji: text;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

/* アスペクトパターン（Tスクエア等）: 関与する天体を黄色い図形で囲って強調する。
   気づける程度の控えめな強さに留める（濃すぎて画面がうるさくならないように）。 */
.pattern-highlight {
  fill: rgba(250, 204, 21, 0.04);
  stroke: rgba(250, 204, 21, 0.45);
  stroke-width: 1.3;
  stroke-dasharray: 5 4;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* ------- 天体配置リスト（アプリのリストUIに準拠） ------- */

.table-container { margin-top: 20px; }

.chart-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.chart-card-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-card-header h3::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  border-radius: 3px;
  background: linear-gradient(180deg, #c9a3ff, var(--accent));
}

.angles-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 700;
}

.angle-asc { color: #ff6a3d; }
.angle-mc { color: #4098ff; }

.planet-list {
  display: flex;
  flex-direction: column;
}

.planet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.planet-row:last-child { border-bottom: none; }

.planet-row-icon {
  width: 22px;
  text-align: center;
  font-size: 16px;
}

.planet-row-name {
  flex: 0 0 auto;
  min-width: 44px;
  color: var(--text-main);
  font-weight: 600;
}

.planet-row-deg {
  color: var(--text-sub);
  margin-left: auto;
}

.pill {
  display: inline-block;
  background: var(--pill-bg);
  color: var(--pill-text);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.table-note {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-sub);
  text-align: center;
}

/* 検出されたアスペクトパターンのバッジ一覧 */
.pattern-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.pattern-badge {
  display: inline-block;
  background: rgba(250, 204, 21, 0.10);
  border: 1px solid rgba(250, 204, 21, 0.35);
  color: #facc15;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ------- アスペクトグリッド ------- */

.aspect-grid-header {
  margin-top: 28px;
}

.aspect-grid-axis-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-sub);
  text-align: center;
}

.aspect-grid-scroll-hint {
  display: none;
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--text-sub);
  text-align: center;
}

.aspect-grid-container {
  overflow-x: auto;
}

.aspect-grid {
  border-collapse: collapse;
  margin: 0 auto;
}

.aspect-grid th {
  width: 30px;
  height: 30px;
  min-width: 30px;
  text-align: center;
  font-size: 15px;
  font-family: "Apple Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif;
  font-variant-emoji: text;
}

.aspect-grid thead th {
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.aspect-grid-corner-label {
  font-family: inherit !important;
  font-size: 9px !important;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--text-sub);
  width: auto !important;
  min-width: 46px !important;
  padding: 0 4px 6px;
  text-align: center !important;
}

.aspect-grid tbody th {
  border-right: 1px solid var(--border);
  padding-right: 6px;
  text-align: right;
}

.aspect-cell {
  width: 38px;
  min-width: 38px;
  height: 40px;
  border: 1px solid var(--border);
  text-align: center;
  padding: 2px;
}

.aspect-cell-empty {
  border: none;
}

.aspect-cell-symbol {
  display: block;
  font-size: 15px;
  font-weight: 700;
  font-family: "Apple Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif;
  font-variant-emoji: text;
  line-height: 1.1;
}

.aspect-cell-orb {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-sub);
  line-height: 1.1;
}

.aspect-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  justify-content: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-sub);
}

.aspect-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.aspect-legend-symbol {
  font-family: "Apple Symbols", "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif;
  font-variant-emoji: text;
  font-weight: 700;
  font-size: 14px;
}

.page-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 12px;
  color: var(--text-sub);
}

@media (max-width: 480px) {
  .page-header h1 { font-size: 26px; }
  .manual-place-fields { flex-direction: column; }
  .planet-row { flex-wrap: wrap; }
  .planet-row-deg { margin-left: 32px; }
  .aspect-grid-scroll-hint { display: block; }
}
