/* 주역 64괘 백과 전용. iching.css 의 토큰/.zeo-toggle/.container/.iching-header/.iching-footer/.hex-yao/.yao/.hex-symbol 재활용 */

.back-link {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
}
.back-link a {
  color: var(--zeo-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.back-link a:hover { color: var(--zeo-accent); }

/* 데스크탑 8×8 매트릭스 (행=상괘, 열=하괘) */
.hex-matrix {
  display: grid;
  grid-template-columns: auto repeat(8, 1fr);
  gap: 4px;
  margin: 2rem 0;
}

.matrix-corner { /* 좌상단 빈 코너 */ }

.trigram-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--zeo-muted);
  padding: 4px 0;
}

.trigram-header .sym {
  font-size: 1.2rem;
  color: var(--zeo-fg);
  line-height: 1.1;
}

.hex-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.2rem;
  border: 1px solid var(--case-line);
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  background: var(--raise);
  transition: transform 0.15s, border-color 0.15s;
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--raise) 60%, #FFFFFF 40%),
    0 1px 2px color-mix(in oklab, var(--case-bg) 80%, #000000 20%);
}

.hex-cell:hover {
  transform: translateY(-2px);
  border-color: var(--zeo-accent);
}

.hex-cell .cell-sym {
  font-size: 1.8rem;
  color: var(--zeo-accent);
  line-height: 1;
}

.hex-cell .cell-num {
  font-size: 0.7rem;
  color: var(--zeo-muted);
  margin-top: 2px;
}

.hex-cell .cell-name {
  font-size: 0.72rem;
  color: var(--zeo-fg);
  margin-top: 1px;
  line-height: 1.15;
}

/* 모바일 1컬럼 (King Wen 1~64) — 기본 display:none, 모바일에서 표시 */
.hex-list { display: none; }

.hex-list-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--case-line);
  border-radius: 6px;
  margin-bottom: 0.4rem;
  cursor: pointer;
  background: var(--raise);
  transition: border-color 0.15s;
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--raise) 60%, #FFFFFF 40%);
}

.hex-list-item:hover { border-color: var(--zeo-accent); }

.hex-list-item .list-sym {
  font-size: 1.6rem;
  color: var(--zeo-accent);
  line-height: 1;
  flex-shrink: 0;
  width: 2rem;
  text-align: center;
}

.hex-list-item .list-text {
  flex: 1;
  font-size: 0.92rem;
  color: var(--zeo-fg);
}

.hex-list-item .list-num {
  color: var(--zeo-muted);
  font-size: 0.82rem;
  margin-right: 0.3rem;
}

.hex-list-item .list-hanja {
  color: var(--zeo-muted);
  font-size: 0.82rem;
  margin-left: 0.5rem;
}

/* 모달 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.is-open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.7); }

.modal-content {
  position: relative;
  background: var(--raise);
  border: 1px solid var(--case-line);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.8rem 1.6rem;
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--raise) 60%, #FFFFFF 40%),
    0 6px 28px rgba(0, 0, 0, 0.4);
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--zeo-muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

.modal-close:hover { color: var(--zeo-accent); }

.modal-meta { text-align: center; margin-bottom: 1.2rem; }

.modal-meta h2 {
  margin: 0 0 0.3rem;
  font-size: 1.2rem;
  color: var(--zeo-fg);
}

.modal-meta p {
  margin: 0;
  color: var(--zeo-muted);
  font-size: 0.85rem;
}

.modal-hex-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.2rem 0;
}

.modal-hex-body .hex-symbol {
  font-size: 5rem;
  color: var(--zeo-accent);
  line-height: 1;
}

.modal-section { margin-top: 1.2rem; }

.modal-section h3 {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  color: var(--zeo-muted);
  font-weight: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--zeo-border);
  padding-bottom: 0.3rem;
}

.modal-section p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--zeo-fg);
  white-space: pre-line;
}

.yao-cards {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.yao-card {
  background: var(--inset-soft);
  border: 1px solid var(--case-line);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  box-shadow: inset 0 1px 2px color-mix(in oklab, var(--inset-soft) 70%, #000000 30%);
}

.yao-card .yao-pos {
  font-weight: bold;
  color: var(--zeo-accent);
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}

.yao-card .yao-row {
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0.15rem 0;
  color: var(--zeo-fg);
}

.yao-card .yao-label {
  display: inline-block;
  width: 3em;
  color: var(--zeo-muted);
}

@media (max-width: 600px) {
  .hex-matrix { display: none; }
  .hex-list { display: block; }
  .modal-content { width: 96%; padding: 1.4rem 1.1rem; }
  .modal-hex-body .hex-symbol { font-size: 4rem; }
  .modal-hex-body { gap: 1rem; }
}
