/* 仅用于合盘、梅花、奇门、六爻表单；首页、账户与阅读器不接入。 */
:root {
  --core-canvas: #eeedec;
  --core-paper: #faf9f6;
  --core-ink: #18181a;
  --core-muted: #6b6a68;
  --core-accent: #9a463f;
}

/* 普通字段共用纸面、字号与交互；数字起卦和摇卦器保留仪式布局。 */
:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form,
body.tool-page-he #invite-overlay {
  --core-field-border: #aaa7a2;
  --core-field-radius: 8px;
}

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="button"]):not([type="submit"]), select, textarea),
body.tool-page-he #invite-overlay :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: none;
  min-height: var(--core-field-height, 48px);
  padding: 11px var(--core-field-padding-end, 13px) 11px 13px;
  border: 1px solid var(--core-field-border);
  border-radius: var(--core-field-radius);
  background-color: var(--core-field-paper, var(--core-paper));
  color: var(--core-field-ink, var(--core-ink));
  font: 400 16px/1.5 var(--sans);
  box-shadow: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form select,
body.tool-page-he #invite-overlay select { --core-field-padding-end: 36px; }

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form textarea {
  --core-field-height: 108px;
  resize: vertical;
}

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form
  :is(input, textarea)::placeholder { color: var(--core-muted); opacity: 1; }

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form
  :is(input, select, textarea):focus-visible,
body.tool-page-he #invite-overlay :is(input, select, textarea):focus-visible {
  --core-field-border: var(--core-accent);
  outline: 2px solid var(--core-accent);
  outline-offset: 3px;
}

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form
  :is(input, select, textarea):disabled {
  --core-field-paper: var(--core-canvas);
  --core-field-ink: var(--core-muted);
  cursor: not-allowed;
}

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form label {
  color: var(--core-ink);
  gap: 8px;
}

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form .submit-button {
  min-height: 48px;
  padding: 13px 26px;
  border: 1px solid var(--core-ink);
  border-radius: 6px;
  background: var(--core-ink);
  color: var(--core-paper);
  font: 600 15px/1.4 var(--sans);
  letter-spacing: .04em;
}

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form .submit-button:hover:not(:disabled) {
  border-color: var(--core-accent);
  background: var(--core-accent);
}

/* 这是报数器，不使用普通字段的字号。 */
#gua-form.core-form .gua-nums :is(#gua-n1, #gua-n2) {
  min-height: 56px;
  font-family: var(--display);
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
}

@media (max-width: 700px) {
  #gua-form.core-form .gua-nums :is(#gua-n1, #gua-n2) { font-size: 24px; }
  :is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form .submit-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .core-form :is(input, select, textarea) { transition: none; }
}

/* ——— 10-22 收小（用户：按钮、输入框、胶囊都偏大偏重）———
   向首页看齐：平、方角、细线；主按钮＝首页那条近黑长条。只改尺寸与描边，不动版式结构；
   字号保持 16px（iOS 上小于 16 点进输入框会自动放大页面）。 */
:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form,
body.tool-page-he #invite-overlay {
  --core-field-border: #cfcbc4;
  --core-field-radius: 3px;
  --core-field-height: 44px;
}

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="button"]):not([type="submit"]), select, textarea),
body.tool-page-he #invite-overlay :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
  padding-top: 9px;
  padding-bottom: 9px;
}

/* 所问：两行高，不要右下角拖拽柄（写长了照样会滚动） */
:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form textarea {
  --core-field-height: 76px;
  resize: none;
}

:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form
  :is(input, select, textarea):focus-visible,
body.tool-page-he #invite-overlay :is(input, select, textarea):focus-visible {
  outline-width: 1px;
  outline-offset: 2px;
}

/* 梅花报数：仍比正文大一档，但不再是 63px 高、26 号字的大框 */
#gua-form.core-form .gua-nums :is(#gua-n1, #gua-n2) {
  min-height: 48px;
  font-size: 20px;
}

/* 起卦方式／合盘「我来填写・邀请对方填写」：一组细线分段，选中的那段填黑（同首页选占问方法） */
#gua-form.core-form .tool-cast-method {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0;
  margin: 18px 0 8px;
  border: 1px solid var(--core-ink);
  border-radius: 3px;
  overflow: hidden;
}
#gua-form.core-form .tool-cast-method button,
body.tool-page-he .he-mode-switch button {
  min-height: 36px;
  padding: 6px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--core-ink);
  font: 400 14px/1.5 var(--sans);
  letter-spacing: .04em;
}
#gua-form.core-form .tool-cast-method button + button { border-left: 1px solid var(--core-ink); }
#gua-form.core-form .tool-cast-method button[aria-pressed="true"],
body.tool-page-he .he-mode-switch button[aria-pressed="true"] {
  background: var(--core-ink);
  color: var(--core-paper);
}
body.tool-page-he .he-mode-switch button { border: 1px solid var(--core-ink); }
body.tool-page-he .he-mode-switch button + button { border-left: 0; }
body.tool-page-he .he-mode-switch button:first-of-type { border-radius: 3px 0 0 3px; }
body.tool-page-he .he-mode-switch button:last-of-type { border-radius: 0 3px 3px 0; }

/* 奇门「使用当前时间」：时间框旁边的小按钮，不再是一整行 */
#qimen-form.core-form .qm-when { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
#qimen-form.core-form .qm-when label { flex: 1 1 240px; min-width: 0; }
#qimen-form.core-form .qm-now {
  flex: none;
  width: auto;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--core-field-border);
  border-radius: 3px;
  background: transparent;
  color: var(--core-ink);
  font: 400 14px/1.4 var(--sans);
}

/* 主按钮：首页那条近黑长条——方角、字距拉开、右侧箭头 */
:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form .submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  min-width: 240px;
  min-height: 52px;
  padding: 14px 18px 14px 22px;
  border: 0;
  border-radius: 0;
  background: var(--core-ink);
  color: var(--core-paper);
  font: 500 14px/1.4 var(--sans);
  letter-spacing: .13em;
}
:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form .submit-button::after {
  content: "→";
  font: 400 18px/1 var(--display);
  letter-spacing: 0;
}
:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form .submit-button:disabled::after { content: none; }
:is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form .submit-button:hover:not(:disabled) {
  background: var(--core-accent);
}

/* 换一种问事方式：细线行，不再是两张大卡片 */
.tool-page .divination-switch-options { gap: 0; }
.tool-page .divination-switch-options > a {
  padding: 13px 0;
  border: 0;
  border-top: 1px solid var(--border-soft, rgba(24, 24, 26, .12));
  border-radius: 0;
  background: transparent;
}
.tool-page .divination-switch-options > a:last-child { border-bottom: 1px solid var(--border-soft, rgba(24, 24, 26, .12)); }
.tool-page .divination-switch-options > a:hover { background: transparent; }
.tool-page .divination-switch-options > a:hover b { color: var(--core-accent); }
.tool-page .divination-switch-options b { font-size: 16px; }

/* 电脑上单栏的三张表单收进版心，不再让所问框横贯一千多像素（合盘是两栏，不收） */
@media (min-width: 901px) {
  :is(#gua-form, #qimen-form, #liuyao-form).core-form > * { max-width: 720px; }
}

@media (max-width: 700px) {
  #gua-form.core-form .gua-nums :is(#gua-n1, #gua-n2) { font-size: 20px; }
  :is(#syn-form, #gua-form, #qimen-form, #liuyao-form).core-form .submit-button { width: 100%; min-width: 0; }
  #gua-form.core-form .tool-cast-method { display: flex; }
  #gua-form.core-form .tool-cast-method button { flex: 1 1 0; }
}
