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

/* ── CSS 变量（六爻专用） ─────────────────────── */
.ly-page {
  --ly-bg: #f3f4f6;
  --ly-surface: #ffffff;
  --ly-surface-soft: #f9fafb;
  --ly-border: #e5e7eb;
  --ly-text: #1f2937;
  --ly-text-soft: #4b5563;
  --ly-text-dim: #6b7280;
  --ly-primary: #2563eb;
  --ly-primary-dark: #1d4ed8;
  --ly-primary-soft: #dbeafe;
  --ly-success: #059669;
  --ly-danger: #dc2626;
  --ly-warning: #d97706;
  --ly-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --ly-radius: 12px;
  --ly-radius-sm: 8px;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-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, #eff6ff 0%, #faf5ff 100%);
  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-form-card-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.ly-form-card-header h2 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ly-text);
}

.ly-form-card-header p {
  margin: 0;
  color: var(--ly-text-dim);
}

.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: #bfdbfe;
  color: var(--ly-primary);
  background: #f8fbff;
}

.ly-tab-btn.active {
  background: var(--ly-primary);
  border-color: var(--ly-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

.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-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(37, 99, 235, 0.2);
}

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

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

.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);
  margin-bottom: 1rem;
}

.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-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: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ly-compact-info-item {
  border: 1px solid var(--ly-border);
  border-radius: 8px;
  background: var(--ly-surface-soft);
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

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

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

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

.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-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) {
  .ly-result-panel-grid { grid-template-columns: 1fr; }
  .ly-hero { padding: 1.5rem 1rem; }
  .ly-card { padding: 1.25rem; }
  .ly-form-card-header h2 { font-size: 1.5rem; }
  .ly-yao-grid { grid-template-columns: repeat(3, minmax(0, 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:not(.ly-table-wrap-compact) {
    margin: 0 -0.25rem;
    padding: 0 0.25rem 0.45rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scroll-padding: 0.25rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) {
    min-width: 640px;
    font-size: 0.78rem;
    border-collapse: separate;
    border-spacing: 0;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) th {
    padding: 0.45rem 0.3rem;
    font-size: 0.72rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) td {
    padding: 0.42rem 0.28rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) th:nth-child(1) { width: 52px; }
  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) th:nth-child(2) { width: 48px; }
  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) th:nth-child(4),
  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) th:nth-child(7) { width: 100px; }
  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) th:nth-child(5) { width: 36px; }

  /* 横滑时固定「六神」列，便于对照 */
  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) th:first-child,
  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #f9fafb;
    box-shadow: 4px 0 10px rgba(15, 23, 42, 0.06);
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) tbody td:first-child {
    background: #fff;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) tr.ly-is-changed > td:first-child {
    background: #eff6ff;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) thead th:first-child {
    z-index: 3;
  }

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

  .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;
  }
}

@media (max-width: 520px) {
  .ly-page-wrap, .ly-hero { padding-left: 0.75rem; padding-right: 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; }
  
  /* 完整模式主表：超小屏继续横滑，略收紧（不再压成 min-width:100% 以免七列错乱） */
  .ly-result-area:not(.ly-compact-mode) .ly-table-wrap:not(.ly-table-wrap-compact) {
    margin: 0 -0.45rem;
    padding: 0 0.45rem 0.45rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) {
    min-width: 600px;
    font-size: 0.7rem;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) th {
    font-size: 0.64rem;
    padding: 0.28rem 0.12rem;
    white-space: nowrap;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) td {
    padding: 0.28rem 0.12rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) td:nth-child(3),
  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) td:nth-child(6) {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: 6.5rem;
    line-height: 1.25;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) td.ly-yao-label-cell {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .ly-result-area:not(.ly-compact-mode) .ly-table:not(.ly-table-compact) td.ly-col-yao-line {
    font-size: 0.72rem;
    letter-spacing: -0.6px;
    overflow: visible;
    text-overflow: clip;
  }

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

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

  .ly-compact-info {
    grid-template-columns: 1fr;
  }

  .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-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-result-section-teal,
  .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;
  }
}
