/* ================================================================
   六爻排盘专用样式 — 作用域前缀 .ly- 避免与八字页面冲突
   ================================================================ */

/* ── CSS 变量（六爻专用） ─────────────────────── */
.ly-page {
  --ly-bg: transparent;
  --ly-surface: #FDFBF7;
  --ly-surface-soft: #FAF6EE;
  --ly-border: rgba(166, 120, 42, 0.2);
  --ly-text: #1D1C1A;
  --ly-text-soft: #3D3B38;
  --ly-text-dim: #6B6965;
  --ly-primary: #A6782A;
  --ly-primary-dark: #8c6422;
  --ly-primary-soft: rgba(166, 120, 42, 0.08);
  --ly-success: #2D6A4F;
  --ly-danger: #B23A22;
  --ly-warning: #C9A15D;
  --ly-shadow: 0 4px 15px rgba(166, 120, 42, 0.05);
  --ly-radius: 4px;
  --ly-radius-sm: 2px;
  font-family: 'Noto Serif SC', ui-serif, 'Songti SC', 'STSong', 'SimSun', serif;
}

/* ── 摇卦动画覆盖层 ─────────────────────────── */
.ly-cast-anim-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,18,8,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.5rem;
  backdrop-filter: blur(6px);
}
.ly-cast-anim-overlay.show { display: flex; }

.ly-coins-wrap {
  display: flex;
  gap: 1.2rem;
}

.ly-coin {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f5d26b, #b8860b);
  border: 3px solid #8B6914;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #3d2b0d;
  box-shadow: 0 4px 14px #1a120855, inset 0 1px 3px #fff5;
  animation: lyFlip 0.6s ease infinite alternate;
}
.ly-coin:nth-child(2) { animation-delay: 0.15s; }
.ly-coin:nth-child(3) { animation-delay: 0.3s; }

@keyframes lyFlip {
  from { transform: rotateY(0deg) translateY(0); }
  to   { transform: rotateY(180deg) translateY(-8px); }
}

.ly-cast-hint {
  font-size: 1.3rem;
  color: #f5eed8;
  letter-spacing: 0.3em;
  text-shadow: 0 2px 10px #00000055;
}

/* ── Hero ─────────────────────────────────── */
.ly-hero {
  background: linear-gradient(90deg, #FDFBF7 0%, rgba(166, 120, 42, 0.08) 100%);
  border-bottom: 1px solid rgba(166, 120, 42, 0.15);
  padding: 2rem 1rem;
  margin-bottom: 1.5rem;
}

.ly-hero-inner {
  max-width: 1120px;
  margin: 0 auto;
  text-align: center;
}

.ly-hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--ly-text);
}

.ly-hero p {
  max-width: 820px;
  margin: 0 auto 1.5rem;
  color: var(--ly-text-soft);
  font-size: 1rem;
}

.ly-hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.ly-hero-tags span {
  background: var(--ly-surface);
  color: var(--ly-text-dim);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  font-size: 0.875rem;
}

/* ── 表单卡片 ─────────────────────────────── */
.ly-page-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.ly-form-shell {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.ly-form-card {
  width: 100%;
  max-width: 760px;
}

.ly-card {
  background: var(--ly-surface);
  border: 1px solid var(--ly-border);
  border-radius: var(--ly-radius);
  box-shadow: var(--ly-shadow);
  padding: 2rem;
  margin-bottom: 1rem;
}

.ly-card-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: var(--ly-text);
  font-size: 1.125rem;
  font-weight: 700;
}

.ly-card-title .ly-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--ly-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
}

.ly-intro-text {
  margin: 0 0 1rem;
  color: var(--ly-text-soft);
  font-size: 0.95rem;
}

/* ── 选项卡 ───────────────────────────────── */
.ly-method-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.ly-tab-btn {
  appearance: none;
  border: 1px solid var(--ly-border);
  background: var(--ly-surface);
  color: var(--ly-text-soft);
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ly-tab-btn:hover {
  border-color: #e5dcb7;
  color: var(--ly-primary);
  background: #fdfdfa;
}

.ly-tab-btn.active {
  background: var(--ly-primary-soft);
  border-color: var(--ly-primary);
  color: var(--ly-primary);
  box-shadow: 0 4px 12px rgba(19, 36, 56, 0.08);
}

.ly-method-panel {
  display: none;
}

.ly-method-panel.active {
  display: block;
}

/* ── 表单控件 ─────────────────────────────── */
.ly-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.ly-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ly-form-group label,
.ly-yao-cell label {
  color: var(--ly-text-soft);
  font-size: 0.875rem;
  font-weight: 500;
}

.ly-form-group input,
.ly-form-group select,
.ly-yao-cell select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: var(--ly-radius-sm);
  padding: 0.7rem 0.85rem;
  background: var(--ly-surface);
  color: var(--ly-text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ly-form-group input:focus,
.ly-form-group select:focus,
.ly-yao-cell select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ly-checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: -0.1rem 0 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--ly-border);
  border-radius: var(--ly-radius-sm);
  background: var(--ly-surface-soft);
  color: var(--ly-text-soft);
  cursor: pointer;
}

.ly-checkbox-option input {
  width: 1rem;
  height: 1rem;
  margin: 0.15rem 0 0;
  accent-color: var(--ly-primary);
  flex: 0 0 auto;
}

.ly-checkbox-option span {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ly-checkbox-option strong {
  color: var(--ly-text);
  font-size: 0.9rem;
}

.ly-checkbox-option small {
  color: var(--ly-text-dim);
  line-height: 1.45;
}

.ly-yao-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ly-yao-cell {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── 提交按钮 ─────────────────────────────── */
.ly-btn-cast {
  width: 100%;
  border: none;
  border-radius: 10px;
  background: var(--ly-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 18px rgba(19, 36, 56, 0.15);
}

.ly-btn-cast:hover {
  background: var(--ly-primary-dark);
  transform: translateY(-1px);
}

.ly-btn-cast:active {
  transform: translateY(0) scale(0.99);
}

.ly-btn-cast:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ── 保存栏 ───────────────────────────────── */
.ly-save-bar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--ly-radius);
}

.ly-save-bar.show {
  display: flex;
  flex-wrap: wrap;
}

.ly-save-bar input {
  flex: 1;
  min-width: 180px;
  border: 1px solid #d1d5db;
  border-radius: var(--ly-radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  outline: none;
}

.ly-save-bar input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ly-btn-save {
  border: none;
  border-radius: 8px;
  background: var(--ly-success);
  color: #fff;
  padding: 0.55rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.ly-btn-save:hover {
  background: #047857;
}

.ly-btn-save:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ── 结果区 ───────────────────────────────── */
.ly-result-area {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.ly-result-area.show {
  display: flex;
}

.ly-view-switch {
  display: flex;
  justify-content: flex-end;
}

.ly-btn-view-toggle {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--ly-primary-dark);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.ly-btn-view-toggle:hover {
  background: #dbeafe;
}

.ly-result-section {
  border-radius: var(--ly-radius);
  border: 1px solid var(--ly-border);
  box-shadow: var(--ly-shadow);
  padding: 0.9rem;
}

.ly-result-section-blue { background: #eff6ff; }
.ly-result-section-amber { background: #fffbeb; }
.ly-result-section-purple { background: #faf5ff; }

.ly-result-section-title {
  margin: 0 0 0.75rem;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ly-text);
}

.ly-result-panel-grid {
  display: grid;
  grid-template-columns: 1.8fr 0.8fr;
  gap: 0.75rem;
}

.ly-result-panel {
  background: var(--ly-surface);
  border: 1px solid var(--ly-border);
  border-radius: 10px;
  padding: 0.9rem;
}

.ly-result-panel-wide {
  min-width: 0;
}

.ly-panel-heading {
  margin-bottom: 0.65rem;
  color: var(--ly-text-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.ly-panel-heading-spaced {
  margin-top: 0.1rem;
}

/* ── 基础信息条 ──────────────────────────── */
.ly-mini-info-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ly-mini-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--ly-border);
  background: var(--ly-surface-soft);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.ly-mini-label {
  color: var(--ly-text-dim);
  font-size: 0.75rem;
}

.ly-mini-value {
  color: var(--ly-text);
  font-size: 0.9rem;
  font-weight: 600;
}

.ly-gua-info-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ly-info-chip {
  background: var(--ly-surface-soft);
  border: 1px solid var(--ly-border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ly-info-chip-wide {
  grid-column: span 2;
}

.ly-record-note {
  grid-column: 1 / -1;
  flex-basis: 100%;
  min-width: 0;
}

.ly-record-note .ly-value {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.ly-info-chip .ly-label {
  font-size: 0.6875rem;
  color: var(--ly-text-dim);
}

.ly-info-chip .ly-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ly-text);
}

.ly-info-chip.ly-highlight .ly-value {
  color: var(--ly-danger);
}

.ly-info-chip.ly-jade .ly-value {
  color: var(--ly-success);
}

.ly-info-chip.ly-purple .ly-value {
  color: #7c3aed;
}

.ly-info-chip.ly-orange .ly-value {
  color: var(--ly-warning);
}

.ly-divider {
  height: 1px;
  background: var(--ly-border);
  margin: 1rem 0;
}

/* ── 卦名区 ──────────────────────────────── */
.ly-gua-title-block {
  text-align: center;
  margin-bottom: 1.1rem;
}

.ly-gua-name-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.ly-gua-name-card {
  min-width: 180px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--ly-border);
  border-radius: 10px;
  background: var(--ly-surface-soft);
}

.ly-gua-name-label {
  margin-bottom: 0.3rem;
  text-align: center;
  color: var(--ly-text-dim);
  font-size: 0.75rem;
  font-weight: 600;
}

.ly-gua-name-main,
.ly-gua-name-variant {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ly-text);
  text-align: center;
}

.ly-gua-name-variant {
  color: var(--ly-text-soft);
}

.ly-gua-gong-name {
  margin-top: 0.25rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--ly-text-dim);
}

.ly-gua-arrow {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ly-primary);
  align-self: center;
}

.ly-gua-badge-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.ly-badge {
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 600;
}

.ly-badge-red { background: #dbeafe; color: var(--ly-primary); border: 1px solid #bfdbfe; }
.ly-badge-gold { background: #eff6ff; color: var(--ly-primary-dark); border: 1px solid #dbeafe; }

/* ── 六爻表格 ─────────────────────────────── */
.ly-table-wrap {
  overflow-x: auto;
}

/* 完整模式：主表横向滚动区（手机端触感优化在 @media 中补充） */
.ly-table-wrap:not(.ly-table-wrap-compact) {
  -webkit-overflow-scrolling: touch;
}

.ly-compact-panel {
  display: none;
}

.ly-compact-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.ly-compact-info:not(.ly-compact-info-aux) > .ly-compact-info-item.ly-compact-info-time {
  flex-basis: 100%;
}

.ly-compact-info-aux {
  margin-top: 0;
  align-items: center;
}

.ly-compact-info-heading {
  flex-basis: 100%;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--ly-text-dim);
  margin-bottom: 0.1rem;
}

.ly-compact-info-item {
  border: 1px solid var(--ly-border);
  border-radius: 6px;
  background: var(--ly-surface-soft);
  padding: 0.25rem 0.45rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
}

.ly-compact-info-item .ly-label {
  font-size: 0.6875rem;
  color: var(--ly-text-dim);
}

.ly-compact-info-item .ly-label::after {
  content: '\FF1A';
}

.ly-compact-info-item .ly-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ly-text);
}

.ly-compact-gua-cell {
  font-weight: 600;
  white-space: nowrap;
}

/* 简化视图动爻释义区块 */
.ly-compact-yaoci-block {
  margin-top: 1rem;
  padding: 0 0.5rem;
}

.ly-compact-yaoci-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ly-primary, #0f766e);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ly-compact-yaoci-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 12px;
  background-color: var(--ly-primary, #0f766e);
  border-radius: 2px;
}

.ly-compact-yaoci-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ly-compact-yaoci-item-inline {
  background: #fdfbf7;
  border: 1px solid #f1e7d8;
  border-radius: var(--ly-radius, 4px);
  padding: 0.35rem 0.6rem;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ly-text-main, #1f2937);
  word-break: break-all;
  white-space: normal;
}

.ly-yc-title {
  font-weight: 600;
  color: #854d0e;
  margin-right: 0.2rem;
  white-space: nowrap;
  display: inline-block;
}

.ly-yc-badge-inline {
  font-size: 0.62rem;
  padding: 0.05rem 0.2rem;
  border-radius: 2px;
  font-weight: 600;
  margin-left: 0.4rem;
  margin-right: 0.15rem;
  line-height: 1.2;
  display: inline-block;
}

.ly-badge-yc {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}

.ly-badge-xc {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.ly-yc-val {
  color: var(--ly-text-main, #1f2937);
}

.ly-table-compact {
  min-width: 420px;
  table-layout: auto;
}

.ly-table-compact th:nth-child(1) { width: 52px; }
.ly-table-compact th:nth-child(3) { width: 40px; }

.ly-table-compact td,
.ly-table-compact th {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.ly-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.8125rem;
}

.ly-table th {
  background: #f9fafb;
  color: var(--ly-text-soft);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--ly-border);
  border-right: 1px solid #f1f5f9;
  white-space: nowrap;
}

.ly-table th:nth-child(1) { width: 60px; }
.ly-table th:nth-child(2) { width: 56px; }
.ly-table th:nth-child(4) { width: 118px; }
.ly-table th:nth-child(5) { width: 42px; }
.ly-table th:nth-child(7) { width: 118px; }

.ly-table td {
  padding: 0.5rem 0.45rem;
  border-bottom: 1px solid #eef2f7;
  border-right: 1px solid #f8fafc;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ly-table th:last-child,
.ly-table td:last-child { border-right: none; }

.ly-th-short { display: none; }

.ly-table td:nth-child(3),
.ly-table td:nth-child(6),
.ly-table th:nth-child(3),
.ly-table th:nth-child(6) {
  text-align: center;
}

.ly-table tr:hover td { background: #fafcff; }
.ly-table tr.ly-is-changed > td { background: #eff6ff; }

.ly-col-center,
.ly-yao-label-cell,
.ly-col-dong,
.ly-table td.ly-col-yao-line,
.ly-liushen-cell { text-align: center; }

/* 爻位列允许换行（"上爻" + 世/应徽标各占一行） */
.ly-yao-label-cell {
  white-space: normal;
  overflow: visible;
  line-height: 1.4;
}

.ly-table td.ly-col-yao-line {
  font-size: 0.95rem;
  letter-spacing: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.ly-yang-line { color: var(--ly-text); display: inline-block; }
.ly-yin-line { color: var(--ly-text-soft); display: inline-block; }
.ly-line-changed, .ly-changed-mark { color: var(--ly-danger); font-weight: 700; }
.ly-no-change { color: transparent; }

.ly-relative-cell { font-weight: 600; }
.ly-relative-官鬼 { color: var(--ly-danger); }
.ly-relative-妻财 { color: var(--ly-warning); }
.ly-relative-子孙 { color: var(--ly-success); }
.ly-relative-父母 { color: #7c3aed; }
.ly-relative-兄弟 { color: var(--ly-primary); }

.ly-liushen-青龙 { color: var(--ly-success); font-weight: 600; }
.ly-liushen-朱雀 { color: var(--ly-danger); font-weight: 600; }
.ly-liushen-勾陈 { color: var(--ly-warning); font-weight: 600; }
.ly-liushen-腾蛇 { color: #6b7280; font-weight: 600; }
.ly-liushen-白虎 { color: #4b5563; font-weight: 600; }
.ly-liushen-玄武 { color: var(--ly-primary); font-weight: 600; }

.ly-gua-text-wrap {
  display: inline-block;
  text-align: left;
}

.ly-gua-main {
  position: relative;
  display: inline-block;
}

/* 世/应徽标：display:block，放在爻位列的第二行 */
.ly-shi-tag, .ly-ying-tag {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.3;
  vertical-align: middle;
  white-space: nowrap;
}
.ly-shi-tag { background: var(--ly-danger); }
.ly-ying-tag { background: var(--ly-success); }

.ly-fushen-text {
  display: block;
  margin-top: 0.2rem;
  color: var(--ly-text-dim);
  font-size: 0.6875rem;
}

.ly-wuxing-金 { color: #6b7280; }
.ly-wuxing-木 { color: var(--ly-success); }
.ly-wuxing-水 { color: var(--ly-primary); }
.ly-wuxing-火 { color: var(--ly-danger); }
.ly-wuxing-土 { color: var(--ly-warning); }

.ly-variant-still { color: var(--ly-text-dim); }
.ly-variant-active { color: var(--ly-text); font-weight: 500; }

/* ── 神煞 ─────────────────────────────────── */
.ly-shensha-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ly-shensha-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--ly-border);
  border-radius: 999px;
  background: var(--ly-surface-soft);
  font-size: 0.8125rem;
}

.ly-ss-name { color: var(--ly-text-dim); font-size: 0.75rem; }
.ly-ss-zhi { color: var(--ly-primary); font-weight: 600; }

/* ── 报数明细 ─────────────────────────────── */
.ly-number-detail {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--ly-radius);
  color: var(--ly-text-soft);
  line-height: 1.65;
  font-size: 0.875rem;
}

.ly-number-detail strong { color: var(--ly-primary-dark); }

/* ── 错误框 ───────────────────────────────── */
.ly-error-box {
  display: none;
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--ly-radius-sm);
  color: var(--ly-danger);
  font-size: 0.95rem;
}
.ly-error-box.show { display: block; }

/* ── SEO 区 ───────────────────────────────── */
.ly-seo-section {
  margin-top: 2rem;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.ly-seo-card {
  background: var(--ly-surface);
  border: 1px solid var(--ly-border);
  border-radius: var(--ly-radius);
  box-shadow: var(--ly-shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.ly-seo-card h3 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: var(--ly-text);
}

.ly-seo-card p,
.ly-seo-card li { color: var(--ly-text-soft); }

.ly-seo-card ul { margin: 0; padding-left: 1.25rem; }

/* ── 响应式 ───────────────────────────────── */
@media (max-width: 768px) {
  /* ── Hero 区紧凑 ── */
  .ly-hero {
    padding: 1.25rem 0.75rem;
    margin-bottom: 0.75rem;
  }

  .ly-hero h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .ly-hero p {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
  }

  .ly-hero-tags {
    gap: 0.4rem;
  }

  .ly-hero-tags span {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }

  /* ── 页面容器 ── */
  .ly-page-wrap {
    padding: 0 0.5rem 1rem;
  }

  .ly-form-shell {
    margin-bottom: 1rem;
  }

  /* ── 表单卡片 ── */
  .ly-card {
    padding: 0.85rem;
    border-radius: 10px;
    margin-bottom: 0.65rem;
  }

  .ly-card-title {
    margin-bottom: 0.65rem;
    font-size: 1rem;
    gap: 0.5rem;
  }

  .ly-card-title .ly-icon {
    width: 28px;
    height: 28px;
    font-size: 0.78rem;
  }

  /* ── 选项卡 ── */
  .ly-method-tabs {
    gap: 0.4rem;
    margin-bottom: 0.85rem;
  }

  .ly-tab-btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
  }

  .ly-intro-text {
    font-size: 0.82rem;
    margin-bottom: 0.65rem;
  }

  /* ── 表单控件 ── */
  .ly-form-row {
    gap: 0.65rem;
    margin-bottom: 0.65rem;
  }

  .ly-form-group {
    gap: 0.35rem;
  }

  .ly-form-group label,
  .ly-yao-cell label {
    font-size: 0.8rem;
  }

  .ly-form-group input,
  .ly-form-group select,
  .ly-yao-cell select {
    padding: 0.55rem 0.7rem;
    font-size: 0.88rem;
  }

  .ly-yao-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.65rem;
  }

  .ly-btn-cast {
    padding: 0.75rem 0.85rem;
    font-size: 0.9rem;
    border-radius: 8px;
  }

  /* ── 保存栏 ── */
  .ly-save-bar {
    padding: 0.55rem 0.75rem;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
  }

  /* ── 结果区通用 ── */
  .ly-result-panel-grid { grid-template-columns: 1fr; }

  /* 基础信息：多列紧凑，标签与值同一行节省高度 */
  .ly-result-section-blue .ly-gua-info-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.6rem;
  }

  .ly-result-section-blue .ly-info-chip-wide {
    grid-column: span 2;
  }

  .ly-result-section-blue .ly-info-chip {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    padding: 0.38rem 0.55rem;
    min-height: 0;
  }

  .ly-result-section-blue .ly-info-chip .ly-label {
    flex-shrink: 0;
    font-size: 0.68rem;
  }

  .ly-result-section-blue .ly-info-chip .ly-value {
    font-size: 0.78rem;
    text-align: right;
    min-width: 0;
    word-break: break-all;
    line-height: 1.25;
  }

  /* 辅助信息：床帐 / 香闺 同一行两格 */
  .ly-result-section-blue .ly-mini-info-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .ly-result-section-blue .ly-mini-info-item {
    padding: 0.45rem 0.55rem;
  }

  .ly-result-section-blue .ly-panel-heading {
    margin-bottom: 0.45rem;
    font-size: 0.85rem;
  }

  /* 较宽手机：月建·日辰·空亡·卦身 一行四格 */
  @media (min-width: 400px) {
    .ly-result-section-blue .ly-gua-info-bar {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .ly-result-section-blue .ly-info-chip-wide {
      grid-column: span 4;
    }
  }

  /* 调整卦名大小 */
  .ly-gua-name-main,
  .ly-gua-name-variant { font-size: 1.3rem; }
  .ly-gua-arrow { font-size: 1.3rem; }
  .ly-gua-name-card { min-width: 130px; padding: 0.6rem; }

  .ly-view-switch { justify-content: center; }

  /* ── 完整模式：六爻主表手机端（一屏宽，无需横滑）── */
  .ly-result-area:not(.ly-compact-mode) .ly-table-wrap-full {
    margin: 0;
    padding: 0;
    overflow-x: visible;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
    font-size: 0.68rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-th-long { display: none; }
  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-th-short { display: inline; }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full th {
    padding: 0.35rem 0.1rem;
    font-size: 0.62rem;
    white-space: normal;
    line-height: 1.25;
    word-break: break-all;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full td {
    padding: 0.32rem 0.1rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.3;
    word-break: break-all;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full th:nth-child(1) { width: 9%; }
  .ly-result-area:not(.ly-compact-mode) .ly-table-full th:nth-child(2) { width: 9%; }
  .ly-result-area:not(.ly-compact-mode) .ly-table-full th:nth-child(3) { width: 24%; }
  .ly-result-area:not(.ly-compact-mode) .ly-table-full th:nth-child(4) { width: 11%; }
  .ly-result-area:not(.ly-compact-mode) .ly-table-full th:nth-child(5) { width: 6%; }
  .ly-result-area:not(.ly-compact-mode) .ly-table-full th:nth-child(6) { width: 24%; }
  .ly-result-area:not(.ly-compact-mode) .ly-table-full th:nth-child(7) { width: 11%; }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full td.ly-col-yao-line {
    font-size: 0.58rem;
    letter-spacing: -1px;
    padding-left: 0.05rem;
    padding-right: 0.05rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-yang-line,
  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-yin-line {
    font-size: 0.52rem;
    letter-spacing: -1.5px;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-shi-tag,
  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-ying-tag {
    font-size: 0.55rem;
    padding: 0 0.15rem;
    margin-top: 0.1rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-fushen-text {
    font-size: 0.58rem;
    line-height: 1.25;
    margin-top: 0.15rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-gua-text-wrap {
    line-height: 1.25;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-number-detail {
    font-size: 0.8125rem;
    padding: 0.65rem 0.75rem;
    line-height: 1.55;
    word-break: break-word;
  }

  .ly-btn-view-toggle {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }

  .ly-result-section {
    padding: 0.75rem;
  }

  .ly-gc-header {
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
  }

  .ly-gc-symbol {
    font-size: 2.25rem;
  }

  /* ── SEO 区紧凑 ── */
  .ly-seo-section {
    margin-top: 1rem;
  }

  .ly-seo-card {
    padding: 0.85rem;
    margin-bottom: 0.65rem;
  }

  .ly-seo-card h3 {
    font-size: 1rem;
    margin-bottom: 0.65rem;
  }

  .ly-seo-card p,
  .ly-seo-card li {
    font-size: 0.85rem;
  }

  /* ── 错误框 ── */
  .ly-error-box {
    padding: 0.75rem 0.85rem;
    font-size: 0.85rem;
  }
}

/* ── 爻象视觉统一 ──
   使用 CSS 几何线段代替字体符号，避免不同设备上长度、粗细和缺口偏移。 */
.ly-yao-symbol {
  --ly-yao-width: 4.75rem;
  --ly-yao-thickness: 0.44rem;
  --ly-yao-gap: 0.62rem;
  display: inline-flex;
  width: var(--ly-yao-width);
  height: var(--ly-yao-thickness);
  align-items: stretch;
  justify-content: center;
  gap: var(--ly-yao-gap);
  color: #23211e;
  vertical-align: middle;
  flex: 0 0 auto;
}

.ly-yao-segment {
  display: block;
  height: 100%;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.ly-yao-yang .ly-yao-segment {
  width: 100%;
}

.ly-yao-yin .ly-yao-segment {
  width: calc((100% - var(--ly-yao-gap)) / 2);
}

.ly-yao-symbol.ly-line-changed {
  color: var(--ly-danger);
}

.ly-table td.ly-col-yao-line {
  line-height: 1;
}

.ly-table-full th:nth-child(4),
.ly-table-full th:nth-child(7) {
  width: 104px;
}

.ly-table tbody tr {
  height: 3rem;
}

.ly-table tr.ly-is-changed > td {
  background: rgba(178, 58, 34, 0.055);
}

.ly-table tr.ly-is-changed > td:first-child {
  box-shadow: inset 3px 0 0 rgba(178, 58, 34, 0.55);
}

.ly-table th {
  background: #f8f3e9;
  border-bottom-color: rgba(166, 120, 42, 0.24);
}

.ly-table-compact .ly-yao-symbol {
  --ly-yao-width: 3.25rem;
  --ly-yao-thickness: 0.38rem;
  --ly-yao-gap: 0.48rem;
  margin-inline: 0.18rem;
}

@media (max-width: 768px) {
  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-yao-symbol {
    --ly-yao-width: 4.25rem;
    --ly-yao-thickness: 0.42rem;
    --ly-yao-gap: 0.54rem;
  }

  .ly-result-area.ly-compact-mode .ly-table-compact .ly-yao-symbol {
    --ly-yao-width: 3rem;
    --ly-yao-thickness: 0.375rem;
    --ly-yao-gap: 0.42rem;
    margin-inline: 0.12rem;
  }

  .ly-table tbody tr {
    height: 2.7rem;
  }
}

@media (max-width: 520px) {
  .ly-page-wrap { padding-left: 0.65rem; padding-right: 0.65rem; }
  .ly-card { padding: 0.75rem; }
  .ly-method-tabs { flex-direction: column; }
  .ly-tab-btn { width: 100%; }
  .ly-form-row { grid-template-columns: 1fr; }

  /* 勿再把基础信息压成单列；与 768 策略一致 */
  .ly-result-section-blue .ly-gua-info-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .ly-result-section-blue .ly-info-chip-wide {
    grid-column: span 2;
  }

  @media (min-width: 400px) {
    .ly-result-section-blue .ly-gua-info-bar {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .ly-result-section-blue .ly-info-chip-wide {
      grid-column: span 4;
    }
  }

  .ly-yao-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  
  /* 进一步缩小卦名 */
  .ly-gua-name-main,
  .ly-gua-name-variant { font-size: 1.15rem; }
  .ly-gua-arrow { font-size: 1.15rem; }
  .ly-gua-name-card { min-width: 110px; padding: 0.5rem; }
  
  .ly-result-area:not(.ly-compact-mode) .ly-table-full {
    font-size: 0.64rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full th {
    font-size: 0.58rem;
    padding: 0.28rem 0.06rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full td {
    padding: 0.26rem 0.06rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full td.ly-col-yao-line {
    font-size: 0.54rem;
    letter-spacing: -1.2px;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-yang-line,
  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-yin-line {
    font-size: 0.48rem;
    letter-spacing: -1.8px;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-number-detail {
    font-size: 0.78rem;
    padding: 0.55rem 0.65rem;
  }

  .ly-table-compact {
    min-width: 100%;
    font-size: 0.78rem;
  }

  .ly-table-compact th {
    font-size: 0.68rem;
  }

  .ly-compact-gua-cell {
    font-size: 0.78rem;
  }

  .ly-compact-yaoci-item-inline {
    font-size: 0.68rem;
    padding: 0.3rem 0.5rem;
  }
  .ly-yc-badge-inline {
    font-size: 0.58rem;
    margin-left: 0.25rem;
    margin-right: 0.15rem;
  }

  .ly-result-area.ly-compact-mode .ly-result-section-blue,
  .ly-result-area.ly-compact-mode .ly-result-section-purple,
  .ly-result-area.ly-compact-mode .ly-number-detail {
    display: none;
  }

  .ly-result-area.ly-compact-mode .ly-divider,
  .ly-result-area.ly-compact-mode .ly-panel-heading-spaced,
  .ly-result-area.ly-compact-mode .ly-table-wrap:not(.ly-table-wrap-compact) {
    display: none;
  }

  .ly-result-area.ly-compact-mode .ly-compact-panel {
    display: block;
  }

  .ly-result-area.ly-compact-mode .ly-gua-name-wrap {
    gap: 0.5rem;
  }

  .ly-result-area.ly-compact-mode .ly-gua-name-card {
    min-width: 95px;
    padding: 0.45rem;
  }

  .ly-result-area.ly-compact-mode .ly-gua-name-main,
  .ly-result-area.ly-compact-mode .ly-gua-name-variant {
    font-size: 0.78rem;
    font-weight: 600;
  }

  .ly-result-area.ly-compact-mode .ly-gua-arrow {
    font-size: 0.78rem;
  }

  .ly-result-area.ly-compact-mode .ly-gua-name-label,
  .ly-result-area.ly-compact-mode .ly-gua-gong-name,
  .ly-result-area.ly-compact-mode .ly-compact-info-item .ly-label,
  .ly-result-area.ly-compact-mode .ly-compact-info-item .ly-value,
  .ly-result-area.ly-compact-mode .ly-compact-gua-cell,
  .ly-result-area.ly-compact-mode .ly-table-compact td,
  .ly-result-area.ly-compact-mode .ly-table-compact th {
    font-size: 0.78rem;
  }
}

/* ================================================================
   卦典解读区块样式
   ================================================================ */

.ly-result-section-teal { background: #f0fdf4; }

/* ── 卦头条 ─────────────────────────────────── */
.ly-gc-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #fcd34d;
  border-radius: 10px;
}

.ly-gc-symbol {
  font-size: 2.8rem;
  line-height: 1;
  color: #92400e;
  flex-shrink: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.ly-gc-title-wrap {
  flex: 1;
  min-width: 0;
}

.ly-gc-gua-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: #78350f;
  margin-bottom: 0.3rem;
}

.ly-gc-gua-ci {
  font-size: 0.9rem;
  color: #92400e;
  line-height: 1.65;
  word-break: break-all;
}

/* ── 内容区块 ─────────────────────────────── */
.ly-gc-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ly-gc-block {
  border: 1px solid #d1fae5;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.ly-gc-block-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  background: #ecfdf5;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #065f46;
  border-bottom: 1px solid #d1fae5;
}

.ly-gc-collapsible-label {
  cursor: pointer;
  user-select: none;
}

.ly-gc-collapsible-label:hover {
  background: #d1fae5;
}

.ly-gc-toggle-icon {
  font-size: 0.75rem;
  color: #059669;
  transition: transform 0.2s ease;
}

/* ── 大象辞 ─────────────────────────────────── */
.ly-gc-da-xiang {
  padding: 0.75rem 1rem 0.75rem 1.25rem;
  font-size: 0.9375rem;
  color: #1f2937;
  line-height: 1.75;
  border-left: 3px solid #34d399;
  margin: 0.75rem 0.75rem;
  background: #f9fafb;
  border-radius: 0 6px 6px 0;
}

/* ── 彖辞折叠区 ─────────────────────────────── */
.ly-gc-collapsible {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.ly-gc-collapsible.collapsed {
  max-height: 0;
}

.ly-gc-text {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #374151;
  line-height: 1.85;
  word-break: break-all;
}

/* ── 爻辞表格 ─────────────────────────────── */
.ly-gc-yao-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.ly-gc-yao-table th {
  background: #f9fafb;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.ly-gc-yao-table th:first-child { width: 80px; }

.ly-gc-yao-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
  color: #374151;
  line-height: 1.6;
  word-break: break-all;
}

.ly-gc-yao-table tr:last-child td { border-bottom: none; }

.ly-gc-yao-table tr:hover td { background: #f9fafb; }

.ly-gc-yao-table tr.ly-gc-yao-changed td {
  background: #fff7ed;
}

.ly-gc-yao-table tr.ly-gc-yao-changed:hover td {
  background: #fed7aa;
}

.ly-gc-yao-pos {
  white-space: nowrap;
  font-weight: 600;
  color: #4b5563;
}

.ly-gc-yao-text {
  color: #1f2937;
}

.ly-gc-xiao-xiang {
  color: #6b7280;
  font-size: 0.8rem;
}

.ly-gc-dong-tag {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.1rem 0.3rem;
  background: #dc2626;
  color: #fff;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  vertical-align: middle;
  line-height: 1.4;
}

@media (max-width: 520px) {
  .ly-gc-header { gap: 0.75rem; padding: 0.75rem; }
  .ly-gc-symbol { font-size: 2rem; }
  .ly-gc-gua-name { font-size: 1.1rem; }
  .ly-gc-gua-ci { font-size: 0.8rem; }
  .ly-gc-yao-table th:first-child { width: 56px; }
  .ly-gc-yao-table th, .ly-gc-yao-table td { padding: 0.4rem 0.5rem; }
  .ly-gc-xiao-xiang { font-size: 0.75rem; }
}

/* ================================================================
   简化表格专用样式
   ================================================================ */

.ly-table.ly-table-compact {
  table-layout: auto;
  min-width: 480px;
}

.ly-table.ly-table-compact th,
.ly-table.ly-table-compact td {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.ly-table.ly-table-compact th:nth-child(1),
.ly-table.ly-table-compact td:nth-child(1) { width: 48px; }
.ly-table.ly-table-compact th:nth-child(3),
.ly-table.ly-table-compact td:nth-child(3) { width: 32px; }

@media (max-width: 520px) {
  .ly-table.ly-table-compact {
    min-width: 100%;
    font-size: 0.72rem;
  }

  .ly-table.ly-table-compact th,
  .ly-table.ly-table-compact td {
    padding: 0.3rem 0.15rem;
  }
}

/* ================================================================
   极简模式增量样式（不影响完整模式；完整模式 CSS 保持 git 原版）
   ================================================================ */

.ly-compact-yaoci-moving {
  background: #fff7ed;
  border-color: #fed7aa;
}

@media (max-width: 768px) {
  .ly-page.ly-minimal-active .ly-hero,
  .ly-page.ly-minimal-active .ly-seo-section,
  .ly-page.ly-minimal-active #ly-cast-section {
    display: none;
  }

  .ly-page.ly-minimal-active .ly-page-wrap {
    padding-top: 0.25rem;
    padding-bottom: 0.5rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode {
    gap: 0.35rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-result-section-teal,
  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-save-bar {
    display: none !important;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-compact-info-time {
    flex-basis: 100%;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-compact-info-time .ly-value {
    word-break: break-all;
    line-height: 1.25;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-result-section-amber {
    padding: 0.45rem 0.35rem;
    background: #fffdf8;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-result-section-title {
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-result-panel {
    padding: 0.45rem 0.35rem;
    border-radius: 8px;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-gua-title-block {
    margin-bottom: 0.35rem;
  }

  /* 卦名摘要改为两行横排，避免两张纵向卡片抢占首屏高度。 */
  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-gua-name-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.35rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-gua-name-card {
    min-width: 0;
    padding: 0.35rem 0.45rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 0.35rem;
    row-gap: 0.18rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-gua-name-label,
  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-gua-gong-name {
    margin: 0;
    text-align: left;
    white-space: nowrap;
    font-size: 0.68rem;
    line-height: 1.2;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-gua-name-main,
  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-gua-name-variant {
    text-align: left;
    font-size: 0.88rem;
    line-height: 1.2;
    white-space: nowrap;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-gua-badge-row {
    justify-content: flex-start;
    margin-top: 0;
    gap: 0.2rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-gua-badge-row:empty {
    display: none;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-gua-badge-row .ly-badge {
    padding: 0.08rem 0.35rem;
    font-size: 0.62rem;
    line-height: 1.25;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-compact-info {
    margin-bottom: 0.35rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-compact-yaoci-block {
    margin-top: 0.45rem;
    padding: 0;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-compact-yaoci-title {
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-compact-yaoci-list {
    gap: 0.35rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-compact-yaoci-item-inline {
    font-size: 0.78rem;
    line-height: 1.55;
    padding: 0.38rem 0.5rem;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-yc-title {
    font-size: 0.78rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-yc-badge-inline {
    font-size: 0.66rem;
    margin-left: 0.15rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-table-compact th {
    font-size: 0.72rem;
    padding: 0.3rem 0.1rem;
    white-space: normal;
    line-height: 1.25;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-table-compact {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-table-compact th:nth-child(1) { width: 15%; }
  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-table-compact th:nth-child(2) { width: 37%; }
  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-table-compact th:nth-child(3) { width: 8%; }
  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-table-compact th:nth-child(4) { width: 40%; }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-table-compact td {
    font-size: 0.82rem;
    padding: 0.32rem 0.1rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-compact-gua-cell {
    font-size: 0.82rem;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-table-compact .ly-yang-line,
  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-table-compact .ly-yin-line {
    font-size: 0.75rem;
    letter-spacing: -0.04em;
  }

  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-shi-tag,
  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-ying-tag {
    font-size: 0.55rem;
    padding: 0 0.2rem;
    margin-left: 0.1rem;
  }
}

@media (max-width: 520px) {
  .ly-page.ly-minimal-active .ly-result-area.ly-compact-mode .ly-compact-yaoci-item-inline {
    font-size: 0.76rem;
    padding: 0.35rem 0.45rem;
  }
}

/* 手机完整模式：保留七列信息密度，以横向滑动换取正常可读字号。 */
@media (max-width: 768px) {
  .ly-result-area:not(.ly-compact-mode) .ly-gua-name-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.35rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-gua-name-card {
    min-width: 0;
    padding: 0.4rem 0.5rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 0.4rem;
    row-gap: 0.2rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-gua-name-label,
  .ly-result-area:not(.ly-compact-mode) .ly-gua-gong-name {
    margin: 0;
    text-align: left;
    white-space: nowrap;
    font-size: 0.72rem;
    line-height: 1.25;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-gua-name-main,
  .ly-result-area:not(.ly-compact-mode) .ly-gua-name-variant {
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.25;
    white-space: nowrap;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-gua-badge-row {
    justify-content: flex-start;
    margin-top: 0;
    gap: 0.2rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-gua-badge-row:empty {
    display: none;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-gua-badge-row .ly-badge {
    padding: 0.1rem 0.38rem;
    font-size: 0.65rem;
    line-height: 1.25;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-panel-heading-spaced::after {
    content: "（左右滑动查看）";
    margin-left: 0.25rem;
    color: var(--ly-text-dim);
    font-size: 0.7rem;
    font-weight: 400;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-wrap-full {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full {
    width: 610px;
    min-width: 610px;
    table-layout: fixed;
    font-size: 0.8rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full th {
    padding: 0.38rem 0.2rem;
    font-size: 0.72rem;
    line-height: 1.3;
    word-break: normal;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full td {
    padding: 0.38rem 0.2rem;
    font-size: 0.8rem;
    line-height: 1.4;
    word-break: normal;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full td.ly-col-yao-line,
  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-yang-line,
  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-yin-line {
    font-size: 0.75rem;
    letter-spacing: -0.04em;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-shi-tag,
  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-ying-tag {
    padding: 0.05rem 0.25rem;
    font-size: 0.62rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table-full .ly-fushen-text {
    font-size: 0.7rem;
    line-height: 1.35;
  }
}

/* 桌面/平板结果：手机端仍使用原有完整与极简布局。 */
@media (min-width: 769px) {
  .ly-result-area {
    gap: 0.75rem;
  }

  .ly-result-area > *,
  .ly-result-panel-grid > * {
    min-width: 0;
  }

  .ly-result-section {
    padding: 0.75rem;
  }

  .ly-result-section-title {
    text-align: left;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
  }

  .ly-result-panel {
    padding: 0.75rem;
  }

  .ly-result-panel-grid {
    grid-template-columns: minmax(0, 1fr) 180px;
  }

  .ly-gua-info-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
    margin-bottom: 0;
  }

  .ly-info-chip,
  .ly-mini-info-item {
    padding: 0.4rem 0.6rem;
  }

  .ly-info-chip {
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.15rem 0.5rem;
  }

  .ly-info-chip .ly-value {
    overflow-wrap: anywhere;
  }

  .ly-gua-title-block {
    margin-bottom: 0.65rem;
  }

  .ly-gua-name-wrap {
    gap: 0.75rem;
    align-items: stretch;
  }

  .ly-gua-name-card {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.65rem;
    min-width: 0;
    padding: 0.5rem 0.75rem;
  }

  .ly-gua-name-main,
  .ly-gua-name-variant {
    font-size: 1.3rem;
  }

  .ly-gua-name-label,
  .ly-gua-gong-name,
  .ly-gua-badge-row {
    margin: 0;
  }

  .ly-gua-badge-row:empty {
    display: none;
  }

  .ly-result-area .ly-divider {
    margin: 0.65rem 0;
  }

  .ly-number-detail {
    margin-bottom: 0;
    padding: 0.6rem 0.8rem;
  }

  .ly-table-full {
    min-width: 640px;
  }

  .ly-table-full .ly-yao-symbol {
    --ly-yao-width: 3.5rem;
  }

  .ly-table-full th:nth-child(4),
  .ly-table-full th:nth-child(7) {
    width: 80px;
  }

  .ly-table-full .ly-th-long { display: none; }
  .ly-table-full .ly-th-short { display: inline; }
}

/* 宽屏将神煞与主盘并排，阅读区限制宽度，避免大屏过度拉伸。 */
@media (min-width: 1100px) {
  .ly-result-area.show {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    align-items: start;
  }

  .ly-result-area > * {
    grid-column: 1 / -1;
  }

  .ly-result-area > .ly-result-section-amber {
    grid-column: 1;
  }

  .ly-result-area > .ly-result-section-purple {
    grid-column: 2;
  }

  .ly-result-section-purple .ly-shensha-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .ly-result-section-purple .ly-shensha-item {
    justify-content: space-between;
    padding: 0.3rem 0.4rem;
    gap: 0.2rem;
    border-radius: 6px;
  }

  .ly-result-section-purple .ly-shensha-item:first-child {
    grid-column: 1 / -1;
  }
}
