/* Six-yao result texts that open the hexagram overlay, and the overlay itself:
   a right panel on desktop, a bottom sheet on phones. */
.liuyao-text-button {
  appearance: none;
  display: block;
  /* The text keeps the column width; the shaded area reaches 8 past each side through
     two shadows, which (unlike negative margins) never widen the page. */
  width: 100%;
  margin: 0;
  padding: calc(6 * var(--u)) 0;
  border: 0;
  border-radius: calc(6 * var(--u));
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
}
.liuyao-text-button:hover, .liuyao-text-button.is-selected {
  background: var(--color-pressed);
  box-shadow: calc(-8 * var(--u)) 0 0 var(--color-pressed), calc(8 * var(--u)) 0 0 var(--color-pressed);
}
.divination-page .liuyao-text-button:focus-visible { outline: 1px solid var(--color-ink); outline-offset: 0; }

.hex-sheet-overlay {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: var(--color-sheet-overlay);
  opacity: 0;
  transition: opacity var(--motion-sheet) ease;
}
.hex-sheet {
  position: fixed;
  z-index: 41;
  top: var(--sheet-top);
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: var(--sheet-width);
  border-left: 1px solid var(--color-line);
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  background: var(--color-paper);
  box-shadow: var(--shadow-sheet);
  color: var(--color-ink);
  transform: translateX(100%);
  transition: transform var(--motion-sheet) ease;
  /* Smaller reading sizes inside the panel (prototype Result board). */
  --h1-size: var(--sheet-title-size);
  --hex-table-top: calc(28 * var(--u));
  --hex-text-top: calc(44 * var(--u));
  --hex-line-size: var(--sheet-line-size);
  --hex-judgment-size: var(--sheet-judgment-size);
  --hex-body-size: var(--sheet-body-size);
  --hex-lines-gap: calc(52 * var(--u));
  --hex-line-gap: calc(36 * var(--u));
}
.hex-sheet:focus { outline: none; }
.hex-sheet-open .hex-sheet-overlay { opacity: 1; }
.hex-sheet-open .hex-sheet { transform: none; }
.hex-sheet.is-dragging { transition: none; }
.hex-sheet-overlay[hidden], .hex-sheet[hidden] { display: none; }

.hex-sheet-grab { flex: none; border-bottom: 1px solid var(--color-line-soft); touch-action: none; }
.hex-sheet-handle { display: none; }
.hex-sheet-head { display: flex; flex-wrap: wrap; align-items: center; gap: calc(12 * var(--u)); padding: var(--sheet-head-pad); }
.hex-sheet-switch { display: flex; gap: calc(2 * var(--u)); margin-right: auto; padding: calc(4 * var(--u)); border-radius: var(--radius-round); background: var(--color-pressed); }
.hex-sheet-switch[hidden] { display: none; }
.has-single .hex-sheet-full.is-top { margin-left: auto; }
.hex-sheet-switch button {
  appearance: none;
  height: calc(36 * var(--u));
  padding: 0 calc(16 * var(--u));
  border: 0;
  border-radius: calc(18 * var(--u));
  background: none;
  color: var(--color-secondary);
  font: inherit;
  font-size: var(--size-aux);
  cursor: pointer;
}
/* Touch screens: the 36-high switch buttons get an invisible 44-high hit area. */
@media (any-pointer: coarse) {
  .hex-sheet-switch button { position: relative; }
  .hex-sheet-switch button::after { content: ""; position: absolute; inset: 0; top: 50%; bottom: auto; height: max(100%, var(--touch-target)); transform: translateY(-50%); }
}
.hex-sheet-switch button[aria-pressed="true"] { background: var(--color-ink); color: var(--color-paper); }
.hex-sheet-full { display: flex; align-items: center; min-height: var(--hit-size); color: var(--color-secondary); font-size: var(--size-aux); text-decoration: none; }
.hex-sheet-full:hover { color: var(--color-ink); }
.hex-sheet-full.is-bottom { display: none; }
.hex-sheet-close {
  appearance: none;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--hit-size);
  height: var(--hit-size);
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  background: none;
  color: var(--color-ink);
  cursor: pointer;
}
.hex-sheet-close:hover { background: var(--color-pressed); }
.hex-sheet :is(button, a):focus-visible { outline: 1px solid var(--color-ink); outline-offset: -3px; }
.hex-sheet-body { flex: 1 1 auto; min-height: 0; padding: var(--sheet-pad); overflow-y: auto; overscroll-behavior: contain; overflow-wrap: anywhere; }
.hex-sheet-body > :last-child { margin-bottom: calc(24 * var(--u)); }
.hex-sheet-message { margin: 0; color: var(--color-secondary); font-size: var(--size-aux); }

@media (width <= 64em) {
  .hex-sheet { left: 0; border-left: 0; transform: translateY(100%); }
  .hex-sheet-handle { display: block; width: calc(40 * var(--u)); height: calc(4 * var(--u)); margin: calc(8 * var(--u)) auto 0; border-radius: calc(2 * var(--u)); background: var(--color-handle); }
  .hex-sheet-head { gap: calc(4 * var(--u)); }
  .hex-sheet-full.is-top { display: none; }
  .hex-sheet-full.is-bottom {
    display: flex;
    flex: none;
    justify-content: center;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--color-line-soft);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hex-sheet, .hex-sheet-overlay { transition: none; }
}
