/* Geomancy Reading */
.tagline {
  max-width: 900px;
}
.stage {
  flex: 1 1 520px;
  max-width: 760px;
}
.side {
  position: sticky;
  top: 70px;
}
.panel h3.mt {
  margin-top: 18px;
}
.ctl input[type="text"],
.ctl select {
  margin-top: 4px;
}
.progress {
  margin: 14px 0 6px;
  font-size: 0.9em;
  opacity: 0.85;
  min-height: 1.4em;
}
#cast-panel.cast-done .btns,
#cast-panel.cast-done #method-chips,
#cast-panel.cast-done .tray-wrap,
#cast-panel.cast-done #tray-note {
  display: none;
}

/* the tray of sand */
.tray-wrap {
  border-radius: 10px;
  padding: 10px 14px;
  margin: 4px 0 8px;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.25), transparent 40%),
    repeating-radial-gradient(circle at 70% 60%, rgba(120, 90, 50, 0.08) 0 2px, transparent 2px 5px),
    linear-gradient(160deg, #e3cd9e, #cdb07a);
  box-shadow: inset 0 2px 8px rgba(80, 55, 20, 0.45);
}
.tray {
  display: flex;
  align-items: center;
  gap: 4%;
  height: 64px;
  padding: 0 4px;
}
.mark {
  position: relative;
  display: block;
  width: 4px;
  height: var(--h, 80%);
  border-radius: 3px;
  background: #6b4a24;
  box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.45);
  transform: rotate(var(--tilt, 0deg));
  animation: mark-in 0.15s ease-out;
}
@keyframes mark-in {
  from {
    height: 0;
    opacity: 0;
  }
}
.mark.struck {
  opacity: 0.35;
}
.mark.struck::after {
  content: "";
  position: absolute;
  left: -9px;
  top: 45%;
  width: 22px;
  height: 2px;
  background: #3d2810;
  transform: rotate(-35deg);
}
.mark.left {
  background: #c0392b;
  box-shadow: 0 0 8px rgba(192, 57, 43, 0.8);
}

/* figures */
.fig {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 6px 4px 6px;
  min-width: 64px;
  border-radius: 10px;
  border: 2px solid transparent;
  border-bottom-color: var(--tone);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.fig:hover,
.fig:focus {
  background-color: var(--card-bg);
  color: inherit;
}
.fig.sel {
  border-color: #ffa500;
}
.tone-good {
  --tone: #66bb6a;
}
.tone-bad {
  --tone: #ef5350;
}
.tone-neutral {
  --tone: #90a4ae;
}
.tone-mixed {
  --tone: #ffb74d;
}
.pts {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 2px 0;
}
.pts .row {
  display: flex;
  justify-content: center;
  gap: 10px;
  height: 10px;
}
.pt {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--card-strong);
}
.pt.ghost {
  background: transparent;
  border: 1px dashed currentColor;
  opacity: 0.35;
  box-sizing: border-box;
}
.fig.small .pts {
  gap: 3px;
}
.fig.small .pts .row {
  gap: 7px;
  height: 7px;
}
.fig.small .pt {
  width: 7px;
  height: 7px;
}
.fig.big .pts {
  gap: 8px;
}
.fig.big .pts .row {
  gap: 16px;
  height: 15px;
}
.fig.big .pt {
  width: 15px;
  height: 15px;
}
.fig-label {
  font-size: 0.65em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
  white-space: nowrap;
}
.fig-name {
  font-size: 0.8em;
  font-weight: bold;
  color: var(--card-strong);
  white-space: nowrap;
}
.fig-sub {
  font-size: 0.7em;
  opacity: 0.75;
  white-space: nowrap;
}
.fig.big {
  min-width: 100px;
}
.fig.big .fig-name {
  font-size: 1em;
}

/* the four Mothers while casting */
.mothers {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}
.mother {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
  padding: 8px 6px;
  border: 2px dashed var(--card-border);
  border-radius: 10px;
}
.mother.done {
  border-style: solid;
}
.mother .row.cur .pt.ghost {
  opacity: 0.9;
  border-color: #ffa500;
  border-style: solid;
}

/* shield chart */
#chart-view {
  margin: 10px 0 16px;
}
.shield {
  overflow-x: auto;
  padding: 14px 10px 30px;
  border: 3px solid var(--card-border);
  background-color: var(--card-bg);
  border-radius: 12px 12px 50% 50% / 12px 12px 22% 22%;
}
.sh-row.r8 {
  display: grid;
  grid-template-columns: repeat(8, minmax(64px, 1fr));
  gap: 4px;
  margin-bottom: 10px;
  min-width: 540px;
}
.sh-row .cell {
  display: flex;
  justify-content: center;
}
.cell.span2 {
  grid-column: span 2;
}
.cell.span4 {
  grid-column: span 4;
}
.sh-judge {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 24px;
  min-width: 540px;
}
.cell.reconciler {
  opacity: 0.85;
}
.anim .cell,
.anim .house {
  animation: fig-in 0.5s ease-out both;
}
.anim .sh-row:nth-child(2) .cell {
  animation-delay: 0.35s;
}
.anim .sh-row:nth-child(3) .cell {
  animation-delay: 0.7s;
}
.anim .sh-judge .cell {
  animation-delay: 1.05s;
}
@keyframes fig-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* house chart */
.house-chart {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, auto);
  gap: 4px;
  max-width: 560px;
}
.house {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 4px 6px;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  background-color: var(--card-bg);
}
.house.querent {
  border-color: #64b5f6;
}
.house.quesited {
  border-color: #ffa500;
}
.h-num {
  position: absolute;
  top: 3px;
  left: 7px;
  font-weight: bold;
  font-size: 0.8em;
}
.h-name {
  position: absolute;
  top: 4px;
  right: 7px;
  font-size: 0.6em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}
.house .fig {
  min-width: 0;
}
.house-center {
  grid-row: 2 / 4;
  grid-column: 2 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 6px;
}
.hc-q {
  margin: 0;
  font-style: italic;
  font-size: 0.85em;
  opacity: 0.9;
}
.hc-figs {
  display: flex;
  gap: 4px;
}

/* reading */
.reading {
  max-width: 680px;
}
.reading h4 {
  margin: 22px 0 6px;
  font-size: 0.8em;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.75;
}
.reading p {
  margin: 0 0 8px;
  line-height: 1.55;
}
.reading strong {
  font-weight: bold;
}
.rd-q {
  font-style: italic;
  font-size: 1.1em;
}
.rd-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px;
  border: 3px solid var(--card-border);
  border-radius: 12px;
  background-color: var(--card-bg);
}
.verdict {
  font-size: 1.35em;
  font-weight: bold;
  color: var(--tone);
  margin-bottom: 4px;
}
.warn {
  border-left: 4px solid #ef5350;
  padding: 8px 12px;
  margin: 0 0 12px;
  background-color: var(--card-bg);
  border-radius: 6px;
}
.perf {
  border-left: 4px solid #66bb6a;
  padding: 6px 12px;
}
.perf-denial {
  border-left-color: #ef5350;
}

/* figure detail */
.fd-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}
.fd-name {
  font-size: 1.3em;
  font-weight: bold;
  color: var(--card-strong);
}
.fd-en {
  opacity: 0.85;
}
.fd-tone {
  color: var(--tone);
  font-size: 0.85em;
  margin-top: 2px;
}
.fig-detail p {
  line-height: 1.5;
  font-size: 0.95em;
}
.fd-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  font-size: 0.85em;
  margin: 0;
}
.fd-facts dt {
  opacity: 0.7;
}
.fd-facts dd {
  margin: 0;
}

h3.section {
  margin: 34px 0 12px;
}
.all-figures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  max-width: 980px;
}
.all-figures .fig {
  border-color: var(--card-border);
  border-bottom-color: var(--tone);
  background-color: var(--card-bg);
  padding: 10px 4px;
}
.all-figures .fig.sel {
  border-color: #ffa500;
}

html[data-theme="evol-blue"] .tone-good,
html[data-theme="evol-blue"] .tone-bad,
html[data-theme="evol-blue"] .tone-neutral,
html[data-theme="evol-blue"] .tone-mixed {
  --tone: white;
}

@media only screen and (max-width: 900px) {
  .side {
    position: static;
  }
}
@media only screen and (max-width: 520px) {
  .house {
    padding-top: 22px;
  }
  .h-name {
    display: none;
  }
  .fig {
    min-width: 0;
  }
}

/* labels in the crowded rows wrap instead of overlapping */
.sh-row .fig-label {
  white-space: normal;
  text-align: center;
  line-height: 1.15;
}
.house-chart {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.house .fig-name {
  white-space: normal;
  text-align: center;
  line-height: 1.15;
}
@media only screen and (max-width: 520px) {
  .house .fig-name {
    font-size: 0.68em;
  }
  .hc-figs .fig:not(:nth-child(2)) {
    display: none;
  }
}
