/* 生辰拨轮 · 八字时盘与命盘录入、紫微时盘同用，行为见 dial.js。
   时盘一行用 .dial__row 包住 .dial__cells--joined 与 .dial__now「回到此刻」。 */

/* 一行收窄后居中于排盘之上，与下面四柱同一中轴 */
.dial__body{ display: flex; align-items: stretch; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.dial__cells{ display: flex; align-items: stretch; justify-content: center; gap: .5rem; flex-wrap: wrap; }

/* 一格 —— 悬停其上滚轮即改，不必点开 */
.cell{
  --edge: var(--hair);
  position: relative;
  /* 「2026 年」横排一行：字与单位上下叠时格子要高一倍，一排五格占去半屏宽 */
  display: flex; align-items: baseline; gap: .3rem;
  padding: .4rem 1.35rem .4rem .7rem;
  font-family: inherit; color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 2px;
  cursor: ns-resize;
  user-select: none;
  /* 拨轮反馈随变化即起即止，淡出会让已经停下的格子仍像在变化。 */
  transition: none;
}
/* 焦点落在格中的 input 上，故取 focus-within —— 若仍写 focus-visible，
   人一点进去敲字，整格反倒退回常态，看着像是没选中 */
.cell:hover, .cell:focus-within{
  --edge: var(--zhu-edge);
  background: var(--lift);
  box-shadow: 0 8px 18px -12px rgba(90,64,30,.6);
}
/* 外框只此一道：自身描边聚焦时立时隐去，不渐变，免得点进去那一瞬内外两层 */
.cell:focus-within{ outline: 2px solid var(--zhu); outline-offset: 2px; --edge: transparent; }
.cell.is-spun{ --edge: var(--zhu); background: var(--zhu-wash); }

/* 值位可敲。褪去 input 自带的框与底，只留字，看着仍是一格纸 */
.cell__val{
  /* 按位数定宽：年四位、余皆两位，格子随之收紧 */
  width: calc(var(--len) * (1ch + .06em)); min-width: 0;
  padding: 0; margin: 0;
  font-family: inherit; color: inherit;
  font-size: 1.1rem; line-height: 1.25;
  letter-spacing: var(--ls-note);
  font-variant-numeric: tabular-nums;
  text-align: center;
  background: none; border: 0; border-radius: 0;
  cursor: text; caret-color: var(--zhu);
  appearance: none;
}
.cell__val:focus{ outline: none; }        /* 框由整格来打，见 .cell:focus-within */
.cell__val::selection{ background: var(--zhu-wash); }
.cell__cap{ line-height: 1.2; font-size: var(--t-micro); letter-spacing: var(--ls-label); color: var(--ink-3); }

/* 上下箭头 —— 只作可滚之示，鼠标点亦可 */
.cell__nudge{
  position: absolute; right: .3rem;
  width: 1rem; height: 50%;
  display: grid; place-items: center;
  border: 0; background: none; padding: 0;
  color: var(--ink-3); opacity: 0; cursor: pointer;
  transition: opacity .3s var(--ease), color .3s var(--ease);
}
.cell:hover .cell__nudge{ opacity: .6; }
/* 触屏无悬停，滚轮亦无从谈起 —— 箭头须常显，否则那里根本改不动 */
@media (hover: none){
  .cell__nudge{ opacity: .55; width: 1.4rem; }
  .cell{ padding-right: 1.9rem; cursor: default; }
}
.cell__nudge:hover{ opacity: 1; color: var(--zhu); }
.cell__nudge--up{ top: 0; }
.cell__nudge--dn{ bottom: 0; }
.cell__nudge::before{
  content: ""; width: 5px; height: 5px;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;
}
.cell__nudge--up::before{ transform: rotate(-135deg) translate(-1px,-1px); }
.cell__nudge--dn::before{ transform: rotate(45deg) translate(-1px,-1px); }

/* 时盘采用连体分格：只有一圈外框，短竖线分位，回到此刻退作旁侧素钮。
   只收束时盘（加 .dial__cells--joined），命盘录入仍沿用各自独立的输入格。 */
.dial__row{ display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; }
.dial__cells--joined{
  display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr));
  gap: 0; border: 1px solid var(--hair); border-radius: 2px;
}
.dial__cells--joined .cell{
  justify-content: center; padding: .65rem 1.1rem .65rem .55rem;
  border: 0; border-radius: 0; background: none; box-shadow: none;
}
.dial__cells--joined .cell:first-child{ border-radius: 1px 0 0 1px; }
.dial__cells--joined .cell:last-child{ border-radius: 0 1px 1px 0; }
.dial__cells--joined .cell + .cell::before{
  content: ""; position: absolute; left: 0; top: 25%; bottom: 25%;
  border-left: 1px solid var(--hair);
}
.dial__cells--joined .cell:hover, .dial__cells--joined .cell:focus-within{ background: var(--lift); }
.dial__cells--joined .cell.is-spun{ background: var(--zhu-wash); }
.dial__cells--joined .cell:focus-within{ outline-offset: -2px; }
.dial__cells--joined .cell__nudge{ right: .15rem; width: .8rem; }
.dial__now{
  padding: .35rem .1rem .35rem .25rem; font-size: var(--t-micro);
  border-color: transparent; background: none; white-space: nowrap;
}
.dial__now:hover{ color: var(--zhu); }
@media (max-width: 600px){
  .dial__row{ grid-template-columns: minmax(0, 1fr); gap: .5rem; }
  .dial__cells--joined .cell{
    flex-direction: column-reverse; align-items: center; gap: .35rem;
    padding: .55rem .7rem .55rem .15rem;
  }
  .dial__now{ justify-self: end; min-height: 2.75rem; }
}
@media (max-width: 768px){
  .dial__cells:not(.dial__cells--joined){ gap: .35rem; }
  .cell__val{ font-size: 1.1rem; }
}
@media (hover: none){
  .cell{ padding-right: 1.9rem; }
}

/* 远年之注：紧随拨轮之后，时盘一行里横跨两栏；平常 hidden 不出 */
.dial__row > .dial__note{ grid-column: 1 / -1; order: 1; }   /* order：排在「回到此刻」之后，不把它挤下一行 */
.dial__note{
  margin: .1rem 0 0; text-align: center;
  font-size: .78rem; line-height: 1.5; color: var(--ink-2);
}

/* 时盘右栏：「回到此刻」与「保存至命盘」作一组 —— 同一行、同样轻重，中隔一道细竖线；
   上下叠放时一轻一重，两颗看着不像一组。保存前一枚朱线书签，只描边不填实，免得抢了拨轮 */
.dial__row:has(> .dial__acts){ align-items: center; }
.dial__acts{ display: flex; align-items: center; }
.dial__acts .dial__now{ padding: .35rem .75rem .35rem .25rem; }
.dial__save{
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .1rem .35rem .75rem; line-height: 1.2;
  font-family: inherit; font-size: var(--t-micro); letter-spacing: var(--ls-note); white-space: nowrap;
  color: var(--ink-2); background: none; border: 0; border-left: 1px solid var(--hair); cursor: pointer;
  transition: color .25s var(--ease);
}
.dial__save svg{ width: .78rem; height: .9rem; flex: none; }
.dial__save svg path{ fill: none; stroke: var(--zhu); stroke-width: 1.3; stroke-linejoin: round; }
.dial__save:hover{ color: var(--zhu); }
.dial__save:focus-visible{ outline: 2px solid var(--zhu); outline-offset: 2px; }
@media (max-width: 600px){ .dial__acts{ justify-self: end; } }
