/* ─── 육효점 전용 스타일 ────────────────────────────────────────────── */

/* ── 전체 레이아웃 ── */
.yuhyo-page {
  min-height: 100vh;
  background: #08080f;
  color: #e2e8f0;
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  padding-bottom: 60px;
}

.yuhyo-container {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px;
  padding-top: 52px;
}

/* ── 헤더 ── */
.yuhyo-header {
  text-align: center;
  padding: 40px 0 28px;
}

.yuhyo-header > h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f6c90e;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.yuhyo-header > p {
  font-size: 0.82rem;
  color: #64748b;
}

/* ── 질문 입력 ── */
.question-section {
  margin-bottom: 20px;
}

.question-section > textarea {
  width: 100%;
  background: #111118;
  border: 1px solid #2d2d3d;
  border-radius: 12px;
  color: #e2e8f0;
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 14px 16px;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.question-section > textarea:focus {
  border-color: #f6c90e;
}

.question-section > textarea::placeholder {
  color: #3d3d5c;
}

.draw-btn {
  width: 100%;
  background: linear-gradient(135deg, #c9940a, #f6c90e);
  color: #0a0a10;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 10px;
}

.draw-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.draw-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── 현재 4기둥 바 ── */
.today-bar {
  background: #111118;
  border: 1px solid #1e1e2e;
  border-radius: 14px;
  padding: 16px 14px 14px;
  margin-bottom: 20px;
}

.pillar-bar {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.pillar > .p-label {
  font-size: 0.72rem;
  color: #8a93a8;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

/* 년주·시주는 투명하게 (월·일이 더 중요) */
.pillar.minor {
  opacity: 0.42;
}

/* 천간 원형 — 지지 배지와 같은 디자인, 살짝 작게 */
.pillar > .jiji.gan {
  width: 46px;
  height: 46px;
  font-size: 1.5rem;
}

.pillar > .jiji {
  width: 46px;
  height: 46px;
  font-size: 1.5rem;
}

/* 공망 라인 */
.gongmang-line {
  text-align: center;
  margin-top: 14px;
  font-size: 0.82rem;
  color: #64748b;
}

.gongmang-line > strong {
  color: #f87171;
  font-weight: 700;
  margin-left: 4px;
  letter-spacing: 0.08em;
}

/* ── 결과 카드 ── */
.result-card {
  background: #0e0e18;
  border: 1px solid #2d2d3d;
  border-radius: 16px;
  overflow: hidden;
  display: none;
}

.result-card.visible {
  display: block;
  animation: fadeSlideUp 0.5s ease forwards;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 괘 제목 */
.gwae-title {
  padding: 18px 20px 14px;
  border-bottom: 1px solid #1e1e2e;
  text-align: center;
}

.gwae-title > h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f6c90e;
  margin-bottom: 4px;
}

.gwae-title > h3 > .arrow {
  color: #4b5563;
  margin: 0 6px;
  font-size: 0.9rem;
}

.gwae-title > p {
  font-size: 1.15rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

/* 궁 — 오행 색 */
.gwae-title > p.el-wood  { color: #5ac47f; text-shadow: 0 0 10px rgba(90,196,127,.45); }
.gwae-title > p.el-fire  { color: #ef6a55; text-shadow: 0 0 10px rgba(239,106,85,.45); }
.gwae-title > p.el-earth { color: #e0b95e; text-shadow: 0 0 10px rgba(224,185,94,.45); }
.gwae-title > p.el-metal { color: #aecbe8; text-shadow: 0 0 10px rgba(174,203,232,.45); }
.gwae-title > p.el-water { color: #4f9fd4; text-shadow: 0 0 10px rgba(79,159,212,.45); }

/* 괘 특성 뱃지 */
.gwae-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.badge-item {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-yuhon    { background: #1e3040; color: #67e8f9; }
.badge-gwihon   { background: #2a1e3a; color: #c084fc; }
.badge-yukchoong{ background: #3a1e1e; color: #f87171; }
.badge-yukhap   { background: #1e3a20; color: #4ade80; }

/* ── 효 도표 (가운데 정렬) ── */
.hyo-table {
  width: auto;
  margin: 6px auto;
  border-collapse: collapse;
}

.hyo-table td {
  padding: 11px 6px;
  vertical-align: middle;
  border-bottom: 1px solid #1a1a28;
}

.hyo-table tr:last-child td {
  border-bottom: none;
}

/* 동효 행 강조 */
.hyo-row.dong {
  background: rgba(246, 201, 14, 0.05);
}

/* 위치 (왼쪽 끝, 작게) */
.td-wi {
  color: #5b6478;
  font-size: 0.72rem;
  width: 34px;
  white-space: nowrap;
  text-align: center;
}

/* 육수 */
.td-yuksu {
  width: 32px;
  font-size: 0.92rem;
  color: #9aa3b8;
  text-align: center;
  line-height: 1.3;
}

/* 세응 — 크게 */
.td-seung {
  width: 34px;
  text-align: center;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1;
}

.td-seung.se  { color: #f6c90e; text-shadow: 0 0 10px rgba(246,201,14,.5); }
.td-seung.eung{ color: #67e8f9; text-shadow: 0 0 10px rgba(103,232,249,.5); }

/* ── 효선 그래픽 (두껍고 길게) ── */
.td-hyo {
  text-align: center;
  width: 138px;
}

.hyo-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  height: 26px;
}

/* 양 정효 */
.yang-jung .hyo-line::before {
  content: '';
  display: block;
  width: 122px;
  height: 12px;
  background: #e8edf5;
  border-radius: 3px;
}

/* 음 정효 */
.eum-jung .hyo-line::before,
.eum-jung .hyo-line::after {
  content: '';
  display: block;
  width: 52px;
  height: 12px;
  background: #e8edf5;
  border-radius: 3px;
}

/* 노양 동효 (9) — 양이 동함 */
.yang-dong .hyo-line {
  position: relative;
}

.yang-dong .hyo-line::before {
  content: '';
  display: block;
  width: 122px;
  height: 12px;
  background: #f6c90e;
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(246, 201, 14, 0.7);
}

.yang-dong .hyo-line::after {
  content: '○';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.15rem;
  color: #0a0a10;
  font-weight: 900;
  line-height: 1;
}

/* 노음 동효 (6) — 음이 동함 */
.eum-dong .hyo-line::before,
.eum-dong .hyo-line::after {
  content: '';
  display: block;
  width: 52px;
  height: 12px;
  background: #f6c90e;
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(246, 201, 14, 0.7);
}

.eum-dong {
  position: relative;
}

.eum-dong .dong-x {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.15rem;
  color: #f6c90e;
  font-weight: 900;
  line-height: 1;
}

/* ── 지지·육친 데이터 (효 오른쪽) ── */
.td-data {
  text-align: left;
  padding-left: 10px;
}

.data-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

/* 지지 + 육친 한 묶음 (원국 지지 디자인) */
.gz-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* 지지 원형 배지 — 사주원국과 동일 */
.jiji {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  text-shadow: 0 1px 5px rgba(0,0,0,.8);
  box-shadow: 0 3px 10px rgba(0,0,0,.5), inset 0 2px 6px rgba(255,255,255,.12);
}

.jiji.el-wood  { background: radial-gradient(circle at 42% 38%, #5a9e6f, #1a4428); }
.jiji.el-fire  { background: radial-gradient(circle at 42% 38%, #d9604a, #6a1410); }
.jiji.el-earth { background: radial-gradient(circle at 42% 38%, #c9a85c, #5e3a0e); }
.jiji.el-metal { background: radial-gradient(circle at 42% 38%, #c8d8e8, #38506a); }
.jiji.el-water { background: radial-gradient(circle at 42% 38%, #4a8ab4, #0a2440); }

/* 공망 표시 */
.jiji.is-gongmang::after {
  content: '空';
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  background: #e0384a;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: none;
}

/* 육친 라벨 */
.gz-unit > .yc {
  font-size: 0.96rem;
  font-weight: 700;
  color: #cbd5e1;
  line-height: 1;
}

/* 변괘 묶음 */
.gz-unit.byeong > .jiji { border-color: rgba(246,201,14,.55); }
.gz-unit.byeong > .yc   { color: #f6c90e; }

/* 복신 묶음 */
.gz-unit.bokshin > .jiji {
  width: 40px;
  height: 40px;
  font-size: 1.25rem;
  border-style: dashed;
  border-color: rgba(192,132,252,.6);
  opacity: 0.92;
}
.gz-unit.bokshin > .yc { color: #c084fc; }

/* 화살표 */
.data-arrow {
  color: #f6c90e;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── 복신 칸 (화면 가장 오른쪽) ── */
.td-bokshin {
  text-align: right;
  white-space: nowrap;
  padding-left: 14px;
  padding-right: 4px;
}

.bokshin-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.bokshin-tag {
  font-size: 0.62rem;
  font-weight: 700;
  color: #c084fc;
  letter-spacing: 0.08em;
}

/* ── 모바일: 넘치지 않게 축소 ── */
@media (max-width: 520px) {
  .hyo-table td { padding: 9px 3px; }
  .td-wi    { width: 26px; font-size: 0.64rem; }
  .td-yuksu { width: 26px; font-size: 0.82rem; }
  .td-seung { width: 26px; font-size: 1.4rem; }
  .td-hyo   { width: 92px; }
  .hyo-line { gap: 12px; height: 22px; }
  .yang-jung .hyo-line::before,
  .yang-dong .hyo-line::before { width: 80px; height: 11px; }
  .eum-jung .hyo-line::before, .eum-jung .hyo-line::after,
  .eum-dong .hyo-line::before, .eum-dong .hyo-line::after { width: 34px; height: 11px; }
  .jiji { width: 38px; height: 38px; font-size: 1.22rem; }
  .gz-unit.bokshin > .jiji { width: 34px; height: 34px; font-size: 1.05rem; }
  .gz-unit > .yc { font-size: 0.84rem; }
  .data-flow { gap: 5px; }
  .td-data { padding-left: 5px; }
  .td-bokshin { padding-left: 7px; }
  .pillar-bar { gap: 9px; }
  .pillar > .jiji, .pillar > .jiji.gan { width: 40px; height: 40px; font-size: 1.3rem; }
}

/* ── 공망 범례 ── */
.legend-section {
  padding: 12px 20px;
  border-top: 1px solid #1e1e2e;
  font-size: 0.75rem;
  color: #4b5563;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.legend-section span { display: flex; align-items: center; gap: 4px; }
.leg-gongmang { color: #f87171; font-weight: 700; }
.leg-dong     { color: #f6c90e; font-weight: 700; }
.leg-bokshin  { color: #c084fc; font-weight: 700; }

/* ══════════════════════════════════════════════════════
   로딩 오버레이 & 헥사그램 비행 애니메이션
   ══════════════════════════════════════════════════════ */

.yuhyo-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 12, 0.97);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.yuhyo-loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* 중앙 로딩 텍스트 */
.loading-center {
  position: relative;
  z-index: 10;
  text-align: center;
  pointer-events: none;
}

.loading-center > .loading-symbol-big {
  font-size: 3.5rem;
  color: #f6c90e;
  display: block;
  animation: spinPulse 2s linear infinite;
  text-shadow: 0 0 30px rgba(246, 201, 14, 0.8), 0 0 60px rgba(246, 201, 14, 0.4);
  margin-bottom: 16px;
}

.loading-center > p {
  font-size: 0.9rem;
  color: #94a3b8;
  letter-spacing: 0.1em;
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes spinPulse {
  0%   { transform: rotate(0deg) scale(1);    }
  50%  { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1);   }
}

@keyframes blink {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1;   }
}

/* 비행하는 헥사그램 심벌 */
.hex-fly {
  position: absolute;
  font-family: serif;
  pointer-events: none;
  animation: hexFly var(--dur, 2s) var(--delay, 0s) ease-out forwards;
  opacity: 0;
  will-change: transform, opacity;
}

@keyframes hexFly {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg) scale(var(--sc-start, 0.4));
  }
  12% {
    opacity: var(--max-opacity, 0.85);
  }
  80% {
    opacity: var(--max-opacity, 0.6);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx, 0px), var(--ty, 0px)) rotate(var(--rot, 0deg)) scale(var(--sc-end, 1));
  }
}

/* ══════════════════════════════════════════════════════
   입력 모드 전환 / Manual Select
   기존 육효 visual language 로 맞춘다 — #111118 패널,
   #2d2d3d 테두리, #f6c90e 금색 액센트, 12px radius.
   ══════════════════════════════════════════════════════ */

.mode-section {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* ★ My Readings 버튼은 .my-readings 안에 있어 직계 자식 선택자에 걸리지
   않는다. 같은 모양을 쓰도록 함께 지정한다(브라우저 기본 버튼 금지). */
.mode-section > button,
.mode-section .my-readings > button {
  flex: 1;
  background: #111118;
  border: 1px solid #2d2d3d;
  border-radius: 12px;
  color: #8a93a8;
  font-size: 0.88rem;
  font-family: inherit;
  letter-spacing: 0.03em;
  padding: 11px 8px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.mode-section > button:hover,
.mode-section .my-readings > button:hover { border-color: #4a4a5e; color: #c9bb8a; }

.mode-section > button.active,
.mode-section .my-readings > button[aria-expanded="true"] {
  border-color: #f6c90e;
  color: #f6c90e;
  background: rgba(246, 201, 14, 0.08);
}

.cast-panel { margin-bottom: 20px; }

/* ── 상괘 / 하괘 선택 ── */
.trigram-grid {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}

.trigram-col { flex: 1; min-width: 0; }

.trigram-col > h3 {
  font-size: 0.78rem;
  font-weight: 600;
  color: #f6c90e;
  letter-spacing: 0.06em;
  text-align: center;
  margin-bottom: 8px;
}

.trigram-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.trigram-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  background: #111118;
  border: 1px solid #2d2d3d;
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 0.86rem;
  font-family: inherit;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.trigram-list button:hover { border-color: #4a4a5e; }

.trigram-list button.active {
  border-color: #f6c90e;
  background: rgba(246, 201, 14, 0.1);
  color: #f6c90e;
}

.trigram-list .tri-num {
  font-size: 0.72rem;
  color: #64748b;
  min-width: 0.9em;
}

/* ── 괘 미리보기 ── */
.hex-preview {
  margin: 12px 0;
  padding: 11px 14px;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #f6c90e;
  background: #0e0e18;
  border: 1px solid #2d2d3d;
  border-radius: 12px;
}

/* ── 동효 선택 ── */
.moving-fieldset {
  border: 1px solid #2d2d3d;
  border-radius: 12px;
  padding: 12px 14px 10px;
  margin-bottom: 14px;
}

.moving-fieldset > legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: #f6c90e;
  letter-spacing: 0.06em;
  padding: 0 6px;
}

.moving-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 10px;
}

.moving-list label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.84rem;
  color: #e2e8f0;
  cursor: pointer;
}

.moving-list input[type="checkbox"] { accent-color: #f6c90e; cursor: pointer; }

.moving-hint {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 9px;
  line-height: 1.5;
}

@media (max-width: 420px) {
  .trigram-grid { flex-direction: column; gap: 14px; }
  .moving-list  { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════
   좁은 화면 + 영문 라벨
   ──────────────────────────────────────────────────────
   원본 ≤520px 축소 규칙은 '형제·부모' 같은 2글자 한글 기준이라
   Friends / Official / Soaring Serpent 가 들어가면 효 도표가
   화면 밖으로 잘렸다. 디자인은 그대로 두고 글자만 줄이고,
   본효 → 변효 묶음이 넘칠 때만 아래로 접히게 한다.
   ══════════════════════════════════════════════════════ */

/* 길어서 넘치는 쪽은 영문뿐이다. 한글 표기는 원본 크기를 그대로 둔다.
   (html[lang] 은 언어 전환 시 갱신된다) */
@media (max-width: 430px) {
  html[lang="en"] .gz-unit > .yc { font-size: 0.78rem; }
  html[lang="en"] .td-yuksu { font-size: 0.7rem; line-height: 1.25; }
  html[lang="en"] .bokshin-tag { font-size: 0.56rem; }
  /* 넘칠 때만 접히므로 언어와 무관하게 안전하다 */
  .data-flow { flex-wrap: wrap; gap: 4px; row-gap: 2px; }
  .data-flow > .data-arrow { font-size: 0.95rem; }
  .td-data { padding-left: 4px; }
  .td-bokshin { padding-left: 4px; }
}

@media (max-width: 340px) {
  .hyo-table td { padding: 8px 2px; }
  .td-wi    { width: 22px; font-size: 0.58rem; }
  .td-seung { width: 22px; }
  .td-hyo   { width: 64px; }
  .yang-jung .hyo-line::before,
  .yang-dong .hyo-line::before { width: 54px; }
  .eum-jung .hyo-line::before, .eum-jung .hyo-line::after,
  .eum-dong .hyo-line::before, .eum-dong .hyo-line::after { width: 22px; }
  .hyo-line { gap: 10px; }
  .jiji { width: 28px; height: 28px; font-size: 0.95rem; }
  .gz-unit.bokshin > .jiji { width: 26px; height: 26px; font-size: 0.85rem; }
  .gz-unit > .yc { font-size: 0.64rem; }
  .td-yuksu { font-size: 0.62rem; }
  html[lang="en"] .gz-unit > .yc { font-size: 0.58rem; }
  html[lang="en"] .td-yuksu { font-size: 0.56rem; }
  html[lang="en"] .td-bokshin { padding-left: 2px; padding-right: 0; }
  .pillar > .jiji, .pillar > .jiji.gan { width: 34px; height: 34px; font-size: 1.1rem; }
  .pillar-bar { gap: 6px; }
}

/* ══════════════════════════════════════════════════════
   LIGHT THEME — override layer
   ──────────────────────────────────────────────────────
   ★ 위쪽 dark baseline 은 손대지 않는다. light 는 전부
     [data-theme="light"] 로 시작하는 이 블록에서만 덮는다.
     dark 로 돌아가면 원본 화면이 글자 그대로 복원된다.
   ★ 오행 색(.el-*)·공망 red·복신 purple 처럼 의미가 고정된
     색은 바꾸지 않는다. 효선 금색만 ivory 위에서 읽히도록
     짙은 금색으로 내린다.
   ══════════════════════════════════════════════════════ */

[data-theme="light"] .yuhyo-page {
  background: #ffffff;
  color: #202020;
}

[data-theme="light"] .yuhyo-header > h2,
[data-theme="light"] .gwae-title > h3,
[data-theme="light"] .trigram-col > h3,
[data-theme="light"] .moving-fieldset > legend,
[data-theme="light"] .hex-preview,
[data-theme="light"] .data-arrow,
[data-theme="light"] .td-seung.se,
[data-theme="light"] .leg-dong { color: #8a6a1e; }

[data-theme="light"] .yuhyo-header > p,
[data-theme="light"] .gongmang-line,
[data-theme="light"] .moving-hint,
[data-theme="light"] .trigram-list .tri-num,
[data-theme="light"] .pillar > .p-label { color: #666666; }

[data-theme="light"] .question-section > textarea,
[data-theme="light"] .mode-section > button,
[data-theme="light"] .trigram-list button {
  background: #ffffff;
  border-color: #e7e7e7;
  color: #202020;
}

[data-theme="light"] .mode-section > button { color: #666666; }

/* 선택 상태는 테두리·글자색으로만 표시한다.
   금색 반투명 배경은 흰 바탕에서 크림색으로 보여 쓰지 않는다. */
[data-theme="light"] .mode-section > button.active,
[data-theme="light"] .trigram-list button.active {
  border-color: #8a6a1e;
  color: #8a6a1e;
  background: #fafafa;
}

[data-theme="light"] .question-section > textarea:focus { border-color: #8a6a1e; }

[data-theme="light"] .result-card,
[data-theme="light"] .hex-preview,
[data-theme="light"] .moving-fieldset {
  background: #ffffff;
  border-color: #e7e7e7;
}

[data-theme="light"] .gwae-title { border-bottom-color: #e7e7e7; }
[data-theme="light"] .hyo-table td { border-bottom-color: #e7e7e7; }
[data-theme="light"] .legend-section {
  background: #fafafa;
  border-top-color: #e7e7e7;
}

[data-theme="light"] .moving-list label,
[data-theme="light"] .gwae-title > p,
[data-theme="light"] .td-wi,
[data-theme="light"] .td-yuksu { color: #202020; }

/* 육친·응효는 다크 배경용 밝은 색이라 ivory 위에서 읽히지 않는다 */
[data-theme="light"] .gz-unit > .yc { color: #2f2a20; }
[data-theme="light"] .td-seung.eung { color: #0f6f86; text-shadow: none; }
[data-theme="light"] .td-seung.se { text-shadow: none; }
[data-theme="light"] .gz-unit.bokshin > .yc { color: #6d3fa8; }
[data-theme="light"] .leg-gongmang,
[data-theme="light"] .gongmang-line > strong { color: #b53333; }
[data-theme="light"] .leg-bokshin { color: #6d3fa8; }
[data-theme="light"] .jiji { border-color: rgba(32, 32, 32, .22); }

/* 효선 — 원본의 '정효=무채색 / 동효=금색' 대비를 그대로 지킨다.
   ivory 위에서는 흰 막대가 보이지 않으므로 정효만 짙은 먹색으로 내린다. */
[data-theme="light"] .yang-jung .hyo-line::before,
[data-theme="light"] .eum-jung .hyo-line::before,
[data-theme="light"] .eum-jung .hyo-line::after {
  background: #202020;
}
[data-theme="light"] .yang-dong .hyo-line::before,
[data-theme="light"] .eum-dong .hyo-line::before,
[data-theme="light"] .eum-dong .hyo-line::after {
  background: #8a6a1e;
  box-shadow: 0 0 6px rgba(138, 106, 30, .35);
}
[data-theme="light"] .yang-dong .hyo-line::after { color: #ffffff; }

[data-theme="light"] .eum-dong .dong-x { color: #8a6a1e; }
[data-theme="light"] .gz-unit.byeong > .yc { color: #8a6a1e; }
[data-theme="light"] .gz-unit.byeong > .jiji { border-color: rgba(138, 106, 30, .55); }

/* 로딩 오버레이는 연출이므로 light 에서도 어둡게 둔다 (원본 연출 보존) */

/* ══════════════════════════════════════════════════════
   저장한 괘 — Save Reading · My Readings
   기존 육효 visual language(#111118 패널 · #2d2d3d 테두리
   · #f6c90e 금색 · 12px radius)를 그대로 따른다.
   ══════════════════════════════════════════════════════ */

.reading-save-box {
  padding: 12px 20px;
  border-top: 1px solid #1e1e2e;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.reading-save-btn {
  background: transparent;
  border: 1px solid rgba(246, 201, 14, .45);
  color: #f6c90e;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.84rem;
  font-family: inherit;
  cursor: pointer;
}
.reading-save-btn:hover { background: rgba(246, 201, 14, .1); }

.reading-msg { font-size: 0.78rem; color: #94a3b8; }
.reading-msg.ok { color: #4ade80; }
.reading-msg.warn { color: #f87171; }
.reading-msg a { color: #f6c90e; }

/* My Readings 드롭다운 — 좁은 화면에서는 한 줄을 통째로 쓴다 */
.my-readings { position: relative; flex: 1 1 100%; }
.my-readings > button { width: 100%; }

@media (min-width: 560px) {
  .my-readings { flex: 1 1 auto; }
}

/* ★ display:flex 가 [hidden] 을 이겨서 닫힌 메뉴가 작괘 버튼을 덮었다 */
.my-readings-menu[hidden] { display: none; }

.my-readings-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: min(24rem, calc(100vw - 2rem));
  background: #111118;
  border: 1px solid #2d2d3d;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.my-readings-menu > input[type="search"] {
  width: 100%;
  background: #0e0e18;
  border: 1px solid #2d2d3d;
  border-radius: 10px;
  color: #e2e8f0;
  padding: 7px 10px;
  font-size: 0.84rem;
  font-family: inherit;
}
.my-readings-menu > input[type="search"]:focus {
  outline: none;
  border-color: #f6c90e;
}

.my-readings-list {
  list-style: none;
  max-height: min(22rem, 55vh);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reading-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #e2e8f0;
  padding: 8px 9px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.reading-item:hover,
.reading-item:focus {
  background: rgba(246, 201, 14, .08);
  border-color: rgba(246, 201, 14, .4);
  outline: none;
}
.reading-q {
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reading-hex { font-size: 0.78rem; color: #f6c90e; }
.reading-date { font-size: 0.72rem; color: #64748b; }
.reading-empty { font-size: 0.8rem; color: #64748b; padding: 8px 9px; }

@media (max-width: 430px) {
  .my-readings-menu { width: calc(100vw - 2rem); }
}

/* light override — dark baseline 은 건드리지 않는다 */
[data-theme="light"] .reading-save-box { border-top-color: #e7e7e7; }
[data-theme="light"] .reading-save-btn { border-color: rgba(138, 106, 30, .5); color: #8a6a1e; }
[data-theme="light"] .reading-msg { color: #666666; }
[data-theme="light"] .reading-msg a { color: #8a6a1e; }
[data-theme="light"] .mode-section .my-readings > button {
  background: #ffffff; border-color: #e7e7e7; color: #666666;
}
[data-theme="light"] .mode-section .my-readings > button[aria-expanded="true"] {
  border-color: #8a6a1e; color: #8a6a1e; background: #fafafa;
}
[data-theme="light"] .my-readings-menu { background: #ffffff; border-color: #e7e7e7; }
[data-theme="light"] .my-readings-menu > input[type="search"] {
  background: #ffffff; border-color: #e7e7e7; color: #202020;
}
[data-theme="light"] .reading-item { color: #202020; }
[data-theme="light"] .reading-hex { color: #8a6a1e; }
[data-theme="light"] .reading-date,
[data-theme="light"] .reading-empty { color: #666666; }

/* ── 6Q 브랜딩 (2026-10-11) — 부제 · 소개 문단. 원본 위에 덧붙이는 층 ── */
.yuhyo-header > h2 + p {
  font-size: 0.95rem;
  color: #cbd5e1;
  margin-bottom: 12px;
}

.yuhyo-header > h2 + p + p {
  line-height: 1.6;
  margin-bottom: 10px;
  word-break: keep-all;
}

[data-theme="light"] .yuhyo-header > h2 + p { color: #333333; }

/* ══════════════════════════════════════════════════════
   6Q 결과 카드 — 좁은 카드에서 넘치지 않게 (2026-10-20)
   ──────────────────────────────────────────────────────
   · 기준은 화면 폭이 아니라 카드 폭이다 (PC 에서도 카드는 최대 488px).
   · 본효 → 변효 의미 순서는 그대로. 「→ 변효」 묶음째 다음 줄로 내려간다.
   · 제목은 한 줄에 들어가면 그대로, 넘치면 본괘 / ↓ / 변괘 (JS 가 data-stack 표시).
   · 계산값·표기는 바꾸지 않는다. 글자를 줄이지 않는다.
   ══════════════════════════════════════════════════════ */
.result-card { container-type: inline-size; }

/* 제목 — 괘 이름은 각각 한 덩어리, 번호 부분은 끊지 않는다 */
#gwaeName > span:not(.arrow) { display: inline-block; text-wrap: balance; }
#gwaeName > span:not(.arrow) > span:first-child { white-space: nowrap; }
#gwaeName[data-stack] > span:not(.arrow) { display: block; }
#gwaeName[data-stack] > .arrow {
  display: block;
  font-size: 0;
  line-height: 1;
  margin: 4px 0;
}
#gwaeName[data-stack] > .arrow::before { content: '↓'; font-size: 0.95rem; }

/* 효 도표 — 카드 안에서만 */
.hyo-table { max-width: 100%; }
.data-flow { flex-wrap: wrap; row-gap: 4px; }
.data-flow > span {
  display: inline-flex;
  align-items: center;
  gap: inherit;
}
.data-flow .data-arrow { flex-shrink: 0; }
@media (max-width: 430px) {
  .data-flow .data-arrow { font-size: 0.95rem; }
}

/* 영문 카드 — 한글판과 같은 한 줄 구조 (위치 · 육수 · 세응 · 효선 · 지지/육친 → 변효 · 복신)
   영어 낱말이 길어서 카드(최대 488px)를 넘던 폭을, 글자가 아닌 효선 그림 길이와
   칸 여백으로 줄여 맞춘다. 그래도 모자라면 「→ 변효」 묶음만 같은 칸 안 아랫줄로 내려간다. */
@container (max-width: 560px) {
  html[lang="en"] .hyo-table td { padding-left: 3px; padding-right: 3px; }
  html[lang="en"] .td-wi { white-space: normal; width: 26px; line-height: 1.25; }
  html[lang="en"] .td-yuksu { line-height: 1.25; }
  html[lang="en"] .td-seung { font-size: 1.3rem; }
  html[lang="en"] .td-hyo { width: 100px; }
  html[lang="en"] .hyo-line { gap: 12px; }
  html[lang="en"] .yang-jung .hyo-line::before,
  html[lang="en"] .yang-dong .hyo-line::before { width: 92px; }
  html[lang="en"] .eum-jung .hyo-line::before, html[lang="en"] .eum-jung .hyo-line::after,
  html[lang="en"] .eum-dong .hyo-line::before, html[lang="en"] .eum-dong .hyo-line::after { width: 40px; }
  html[lang="en"] .td-bokshin { padding-left: 4px; }
}
@container (max-width: 420px) {
  html[lang="en"] .td-seung { font-size: 1.1rem; }
  html[lang="en"] .td-hyo { width: 62px; }
  html[lang="en"] .hyo-line { gap: 8px; }
  html[lang="en"] .yang-jung .hyo-line::before,
  html[lang="en"] .yang-dong .hyo-line::before { width: 58px; }
  html[lang="en"] .eum-jung .hyo-line::before, html[lang="en"] .eum-jung .hyo-line::after,
  html[lang="en"] .eum-dong .hyo-line::before, html[lang="en"] .eum-dong .hyo-line::after { width: 25px; }
  html[lang="en"] .data-flow { gap: 3px; }
  html[lang="en"] .td-data .jiji { width: 34px; height: 34px; font-size: 1.1rem; }
  html[lang="en"] .gz-unit.bokshin > .jiji { width: 30px; height: 30px; font-size: 0.95rem; }
}
/* 작은 폰(카드 ≤370px · ≤340px) — 한글판처럼 「본효 → 변효」가 옆으로 나란히 들어가도록
   효선 그림과 칸 여백만 더 줄인다 */
@container (max-width: 370px) {
  html[lang="en"] .hyo-table td { padding-left: 2px; padding-right: 2px; }
  html[lang="en"] .td-hyo { width: 54px; }
  html[lang="en"] .yang-jung .hyo-line::before,
  html[lang="en"] .yang-dong .hyo-line::before { width: 50px; }
  html[lang="en"] .eum-jung .hyo-line::before, html[lang="en"] .eum-jung .hyo-line::after,
  html[lang="en"] .eum-dong .hyo-line::before, html[lang="en"] .eum-dong .hyo-line::after { width: 21px; }
}
@container (max-width: 340px) {
  html[lang="en"] .hyo-table td { padding-left: 1px; padding-right: 1px; }
  html[lang="en"] .td-seung { font-size: 0.95rem; }
  html[lang="en"] .td-hyo { width: 40px; }
  html[lang="en"] .hyo-line { gap: 6px; }
  html[lang="en"] .yang-jung .hyo-line::before,
  html[lang="en"] .yang-dong .hyo-line::before { width: 38px; }
  html[lang="en"] .eum-jung .hyo-line::before, html[lang="en"] .eum-jung .hyo-line::after,
  html[lang="en"] .eum-dong .hyo-line::before, html[lang="en"] .eum-dong .hyo-line::after { width: 16px; }
  html[lang="en"] .data-flow { gap: 2px; }
  html[lang="en"] .td-bokshin { padding-left: 2px; padding-right: 0; }
}
