/* 願いごとの画面: a night sky, a crystal ball, and paper to write a wish on. One column that is as wide as a phone and
   no wider; everything pressed is at least a fingertip tall; boxes to type in have letters of 16px or more, so Safari on
   a phone does not zoom into them. */

:root {
  color-scheme: dark;
  --night: #0d0a1f;
  --night-2: #1a1338;
  --ink: #f1ecff;
  --muted: #b3a8d6;
  --faint: #7d72a3;
  --gold: #f0cf7a;
  --gold-2: #c9a24a;
  --violet: #9b7bff;
  --paper: #1c1535;
  --line: rgba(240, 207, 122, 0.22);
  --bad: #ff8f8f;
  --ok: #8fe0b0;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--night);
  color: var(--ink);
  font:
    1rem/1.7 "Hiragino Mincho ProN",
    "Yu Mincho",
    "Noto Serif CJK JP",
    "Noto Serif JP",
    serif;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 62%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 9%, #ffe9b0 50%, transparent 51%),
    radial-gradient(1px 1px at 61% 37%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 73% 78%, #cdbfff 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 55%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 7% 84%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 52% 91%, #ffe9b0 50%, transparent 51%),
    radial-gradient(1px 1px at 36% 33%, #fff 50%, transparent 51%),
    radial-gradient(60% 45% at 50% 0%, #2a1d5c 0%, transparent 70%),
    linear-gradient(180deg, var(--night-2), var(--night) 60%);
  animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle {
  from {
    opacity: 0.82;
  }
  to {
    opacity: 1;
  }
}

/* ---- the top: the motto, and who is here */

.top {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1rem 0;
}
.motto {
  display: grid;
  min-width: 0;
}
.slogan {
  font-family: "Songti SC", "PingFang SC", "Noto Serif CJK SC", "Noto Sans CJK SC", serif;
  font-size: clamp(1.05rem, 5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
}
.sub {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.2em;
}
.menu > summary {
  list-style: none;
  cursor: pointer;
  min-height: 2.75rem;
  max-width: 9rem;
  padding: 0.4rem 0.9rem;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu > summary::-webkit-details-marker {
  display: none;
}
.menu-panel {
  position: absolute;
  right: 1rem;
  top: calc(100% + 0.4rem);
  z-index: 10;
  display: grid;
  gap: 0.5rem;
  width: min(18rem, calc(100% - 2rem));
  padding: 0.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

/* ---- things to press and to type in */

button,
select,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button.primary {
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  border-color: transparent;
  color: #2a1c05;
  font-weight: 700;
}
button.stop {
  border-color: var(--bad);
  color: var(--bad);
  font-weight: 700;
}
button[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--gold);
}
button.quiet {
  border-color: transparent;
  color: var(--muted);
}
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}
label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.92rem;
  color: var(--gold);
}
label small {
  color: var(--faint);
  font-size: 0.8rem;
}
input,
textarea,
select {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  /* 16px at the least: a smaller box makes Safari on a phone zoom in and stay zoomed. */
  font-size: max(1rem, 16px);
  font-family: var(--sans);
  color: var(--ink);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
}
textarea {
  resize: vertical;
  line-height: 1.55;
}
form {
  display: grid;
  gap: 0.9rem;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.message {
  margin: 0;
  font-size: 0.92rem;
}
.message.bad {
  color: var(--bad);
}

/* ---- the page */

main,
.login {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0.5rem 1rem calc(3rem + env(safe-area-inset-bottom));
}
.sheet {
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.1rem;
}
.sheet h2,
.past h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.12em;
}
.login {
  margin-top: 1.5rem;
  display: grid;
  gap: 1rem;
  text-align: center;
}
.login form {
  text-align: left;
}
.login .lead {
  margin: 0;
  color: var(--muted);
}
.notice {
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.9rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- the fortune teller: a crystal ball that breathes, and shines with the voice */

.teller {
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  padding: 1.5rem 0 1.25rem;
  text-align: center;
}
.orb {
  --level: 0;
  position: relative;
  width: min(62vw, 15rem);
  height: min(62vw, 15rem);
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #cbbcff 0%, #7d5cf0 22%, #3a2396 55%, #150c3d 100%);
  box-shadow:
    0 0 calc(2rem + var(--level) * 4rem) calc(var(--level) * 1.2rem) rgba(155, 123, 255, 0.55),
    inset 0 -1.2rem 2.4rem rgba(0, 0, 0, 0.55),
    inset 0 0.6rem 1.6rem rgba(255, 255, 255, 0.18);
  overflow: hidden;
  animation: breathe 5s ease-in-out infinite;
  transition: box-shadow 0.12s linear;
}
.orb.small {
  width: 6.5rem;
  height: 6.5rem;
  margin: 0 auto;
}
.orb-glow,
.orb-mist,
.orb-shine {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}
.orb-glow {
  background: radial-gradient(circle at 50% 60%, rgba(240, 207, 122, calc(0.15 + var(--level) * 0.7)) 0%, transparent 55%);
}
.orb-mist {
  inset: -30%;
  background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.14), transparent 40%, rgba(200, 180, 255, 0.16), transparent 75%);
  animation: swirl 16s linear infinite;
}
.orb-shine {
  background: radial-gradient(ellipse 34% 20% at 34% 24%, rgba(255, 255, 255, 0.75), transparent 70%);
}
/* What the newest wish is doing, written inside the ball: on its way, being granted, granted. */
.orb-words {
  position: absolute;
  inset: 12%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.2rem;
  color: #fff;
  text-shadow:
    0 0 0.6rem rgba(10, 5, 40, 0.95),
    0 1px 2px rgba(10, 5, 40, 0.9);
  pointer-events: none;
}
.orb-words strong {
  font-size: clamp(1rem, 5.4vw, 1.35rem);
  letter-spacing: 0.08em;
}
.orb-words span {
  font-size: 0.82rem;
  line-height: 1.35;
  max-height: 2.7em;
  overflow: hidden;
}
.orb-words .orb-hint {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--gold);
}
.orb-words .orb-hint:empty {
  display: none;
}
body[data-wish="waiting"] .orb-mist,
body[data-wish="working"] .orb-mist {
  animation-duration: 5s;
}
body[data-wish="working"] .orb {
  animation: breathe 2.2s ease-in-out infinite;
}
body[data-wish="done"] .orb {
  background: radial-gradient(circle at 35% 30%, #fff3c9 0%, #f0cf7a 20%, #a9772a 52%, #3a2396 82%, #150c3d 100%);
  box-shadow:
    0 0 3.5rem 0.6rem rgba(240, 207, 122, 0.6),
    inset 0 -1.2rem 2.4rem rgba(0, 0, 0, 0.45),
    inset 0 0.6rem 1.6rem rgba(255, 255, 255, 0.25);
}
body[data-wish="stopped"] .orb,
body[data-wish="trouble"] .orb {
  filter: saturate(0.45) brightness(0.8);
}
/* While the teller talks, the ball is the teller's: the words step aside. */
body[data-talk="on"] .orb-words,
body[data-talk="calling"] .orb-words {
  display: none;
}
/* The ticket for the copier: white paper in front of the ball. A QR code on purple is not read. */
.ticket {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  width: min(100%, 20rem);
  padding: 1.1rem 1rem 1rem;
  border-radius: 16px;
  background: #fff;
  color: #1a1338;
  font-family: var(--sans);
  box-shadow: 0 0 3rem rgba(240, 207, 122, 0.45);
  animation: rise 0.3s ease-out;
}
.ticket p {
  margin: 0;
}
.ticket-title {
  font-weight: 700;
  letter-spacing: 0.08em;
}
.ticket img {
  width: min(62vw, 220px);
  height: auto;
  aspect-ratio: 1;
  padding: 10px;
  background: #fff;
  image-rendering: pixelated;
}
.ticket-number {
  display: grid;
  justify-items: center;
  font-size: 0.8rem;
  color: #5b5378;
}
.ticket-number strong {
  font:
    700 1.9rem/1.2 ui-monospace,
    "SF Mono",
    Menlo,
    monospace;
  letter-spacing: 0.14em;
  color: #1a1338;
  user-select: all;
}
.ticket-until {
  font-size: 0.9rem;
  font-weight: 600;
}
.ticket-how {
  font-size: 0.8rem;
  line-height: 1.55;
  color: #5b5378;
  text-align: left;
}
.ticket button {
  background: #1a1338;
  color: #fff;
  border-color: #1a1338;
}
/* With the ticket out, the ball steps back. */
body[data-ticket="on"] .orb {
  display: none;
}
label.check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  color: var(--ink);
}
label.check input {
  width: 1.4rem;
  min-height: 1.4rem;
  height: 1.4rem;
  flex: none;
  accent-color: var(--gold);
}
.gift {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
}
.gift .hint {
  flex: 1 1 100%;
  text-align: left;
}
body[data-talk="on"] .orb-mist {
  animation-duration: 6s;
}
body[data-talk="calling"] .orb {
  animation: breathe 1.2s ease-in-out infinite;
}
@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}
@keyframes swirl {
  to {
    transform: rotate(360deg);
  }
}
.status {
  margin: 0;
  min-height: 1.7em;
  color: var(--muted);
}
.said {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  min-height: 3.4em;
}
.said p {
  margin: 0;
}
.said-teller {
  font-size: 1.08rem;
}
.said-me {
  color: var(--faint);
  font-size: 0.9rem;
  font-family: var(--sans);
}
.said-me:not(:empty)::before {
  content: "あなた：";
}

/* ---- the wish, on paper */

.card {
  margin-bottom: 1.5rem;
  border-color: rgba(240, 207, 122, 0.5);
  box-shadow: 0 0 2.5rem rgba(240, 207, 122, 0.12);
  animation: rise 0.35s ease-out;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.8rem);
  }
}
.card form {
  margin-top: 0.9rem;
}

/* ---- wishes sent: how far each has come, and what came back */

.past {
  margin-top: 0.5rem;
}
.wishes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.8rem;
}
.empty {
  margin: 0;
  color: var(--faint);
  font-size: 0.92rem;
}
.wish {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}
.wish > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  gap: 0.25rem;
  min-height: 2.75rem;
  padding: 0.75rem 0.9rem;
}
.wish > summary::-webkit-details-marker {
  display: none;
}
.wish-title {
  font-weight: 700;
}
.wish-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: center;
  color: var(--faint);
  font-size: 0.82rem;
  font-family: var(--sans);
}
.badge {
  padding: 0.05rem 0.6rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: var(--muted);
}
.badge.waiting,
.badge.working {
  color: var(--violet);
}
.badge.working {
  animation: pulse 1.6s ease-in-out infinite;
}
.badge.done {
  color: var(--ok);
}
.badge.ask {
  color: var(--gold);
}
.badge.stopped,
.badge.trouble {
  color: var(--bad);
}
@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}
.wish-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0 0.9rem 0.9rem;
}
.parts {
  margin: 0;
  display: grid;
  gap: 0.15rem;
  font-size: 0.88rem;
  font-family: var(--sans);
}
.parts dt {
  color: var(--gold);
  font-size: 0.8rem;
}
.parts dd {
  margin: 0 0 0.3rem;
  color: var(--muted);
  white-space: pre-wrap;
}
.question {
  display: grid;
  gap: 0.6rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.question p {
  margin: 0;
  white-space: pre-wrap;
}
.question .actions {
  justify-content: flex-start;
}
.oracle {
  padding: 0.9rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.7;
  overflow-x: auto;
}
.oracle > :first-child {
  margin-top: 0;
}
.oracle > :last-child {
  margin-bottom: 0;
}
.oracle h1,
.oracle h2,
.oracle h3 {
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0;
}
.oracle a {
  color: var(--violet);
}
.oracle pre,
.oracle code {
  font-family: ui-monospace, "Noto Sans Mono CJK JP", monospace;
  font-size: 0.85rem;
}
.oracle pre {
  overflow-x: auto;
  padding: 0.6rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
}
.oracle table {
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}
.oracle th,
.oracle td {
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.25rem 0.5rem;
}
.files {
  display: grid;
  gap: 0.4rem;
}
.files a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.9rem;
}

/* ---- over the page */

.veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  grid-template-columns: minmax(0, 1fr);
  padding: 0.75rem;
  background: rgba(5, 3, 15, 0.7);
}
.dialog {
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  max-height: calc(100dvh - 1.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
}
.dialog form {
  margin-top: 0.9rem;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  width: max-content;
  max-width: calc(100% - 2rem);
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  background: var(--ink);
  color: var(--night);
  font-family: var(--sans);
  font-size: 0.92rem;
  /* Says its piece without taking the presses meant for what is under it. */
  pointer-events: none;
}
.toast.bad {
  background: var(--bad);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
  }
}


/* ==== An iPhone in one hand ============================================================================================
   The first screen is the crystal and nothing else: the motto above, the ball in the middle with what it has to say,
   and what can be pressed along the bottom, under the thumb. What was wished before is below, a scroll away. The notch
   and the home bar are stayed clear of, and added to the home screen the page opens without Safari around it. */

html {
  background: var(--night);
  /* No rubber-banding into white, and no pull-to-refresh in the middle of a wish. */
  overscroll-behavior-y: none;
}
body {
  --bar: calc(4.6rem + env(safe-area-inset-bottom));
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
button,
summary,
.orb,
label.check {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.top {
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 0;
  max-width: 34rem;
}
main,
.login {
  max-width: 34rem;
  padding: 0 1rem calc(var(--bar) + 1.5rem);
}

/* ---- the first screen: as tall as the phone, the ball in its middle */

.teller {
  /* What is left of the screen under the motto and above the bar. */
  min-height: calc(100vh - 4.4rem - env(safe-area-inset-top) - var(--bar));
  min-height: calc(100dvh - 4.4rem - env(safe-area-inset-top) - var(--bar));
  align-content: center;
  gap: 0.75rem;
  padding: 0.5rem 0 0.75rem;
}
.notice {
  margin: 0.5rem 0 0;
  font-size: 0.84rem;
  line-height: 1.5;
}
/* Never taller than the screen can spare: a short phone, or one held sideways, gets a smaller ball. */
.orb {
  width: min(64vw, 16rem, 36vh);
  height: min(64vw, 16rem, 36vh);
  width: min(64vw, 16rem, 36dvh);
  height: min(64vw, 16rem, 36dvh);
}
.orb.small {
  width: 6.5rem;
  height: 6.5rem;
}
.orb-words strong {
  font-size: clamp(0.95rem, 5vw, 1.3rem);
}
.status {
  min-height: 0;
  font-size: 0.98rem;
  line-height: 1.55;
  text-wrap: balance;
}
.said {
  min-height: 0;
}
.said-teller {
  font-size: 1.05rem;
  line-height: 1.6;
  /* The teller's last few lines, not a wall of them. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}
.said:has(p:not(:empty)) {
  min-height: 2.4em;
}

/* ---- along the bottom, under the thumb */

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem calc(0.75rem + env(safe-area-inset-right)) calc(0.7rem + env(safe-area-inset-bottom)) calc(0.75rem + env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(13, 10, 31, 0), rgba(13, 10, 31, 0.92) 32%);
}
.bar button {
  flex: 1 1 0;
  max-width: 14rem;
  min-height: 3.1rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.98rem;
  line-height: 1.25;
  background: rgba(28, 21, 53, 0.92);
}
.bar button.primary {
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
}
.bar button.quiet {
  border-color: var(--line);
  color: var(--ink);
}
/* While a wish is being written by hand, or the copier's ticket is out, the bar is out of the way. */
body[data-card="on"] .bar,
body[data-ticket="on"] .bar,
body[data-auth="out"] .bar,
body[data-auth="checking"] .bar {
  display: none;
}
.toast {
  bottom: calc(var(--bar) + 0.5rem);
}

/* ---- what the granted wish offers: full-width, one under the other */

.gift {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  max-width: 22rem;
}
.gift button {
  width: 100%;
  min-height: 3rem;
}
.gift .hint {
  font-size: 0.8rem;
  line-height: 1.55;
}

/* ---- the copier's ticket: all of it on one screen, the code as large as the phone allows */

.ticket {
  width: min(100%, 21rem);
  gap: 0.4rem;
  padding: 0.9rem 0.9rem 0.8rem;
}
.ticket img {
  width: min(66vw, 240px, 34vh);
  width: min(66vw, 240px, 34dvh);
  padding: 8px;
}
.ticket-number strong {
  font-size: clamp(1.6rem, 9vw, 2.1rem);
}
.ticket-how {
  font-size: 0.76rem;
}
.ticket button {
  width: 100%;
  min-height: 3rem;
}
body[data-ticket="on"] .teller {
  align-content: start;
}
body[data-ticket="on"] .notice,
body[data-ticket="on"] .gift,
body[data-ticket="on"] .said {
  display: none;
}

/* ---- the wish card and what was wished before */

.card {
  margin: 0 0 1rem;
  padding: 1.1rem 1rem;
  scroll-margin-top: calc(0.75rem + env(safe-area-inset-top));
}
.card .actions button,
.dialog .actions button,
.login button {
  flex: 1 1 100%;
  min-height: 3rem;
}
.past {
  margin-top: 0;
  padding-top: 0.5rem;
  scroll-margin-top: calc(0.75rem + env(safe-area-inset-top));
}
.past h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}
.past h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.wish > summary {
  padding: 0.85rem 0.9rem;
}
.wish > summary::after {
  content: "⌄";
  position: absolute;
  right: 0.9rem;
  top: 0.7rem;
  color: var(--faint);
  transition: transform 0.15s;
}
.wish > summary {
  position: relative;
  padding-right: 2.2rem;
}
.wish[open] > summary::after {
  transform: rotate(180deg);
}
.question input {
  min-height: 3rem;
}
.dialog {
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
}
.veil {
  align-items: end;
  padding: 0;
}
.veil .dialog {
  max-width: 34rem;
  border-radius: 18px 18px 0 0;
  max-height: calc(100dvh - 2rem - env(safe-area-inset-top));
}
.menu-panel {
  top: calc(100% + 0.4rem);
}
.menu-panel button {
  min-height: 3rem;
  text-align: left;
}

/* Held sideways there is little height: the ball and its words sit side by side with nothing wasted above. */
@media (orientation: landscape) and (max-height: 480px) {
  .top {
    padding-top: calc(0.4rem + env(safe-area-inset-top));
  }
  .sub {
    display: none;
  }
  .teller {
    min-height: 0;
    padding-top: 0.25rem;
  }
  .orb {
    width: min(40vh, 12rem);
    height: min(40vh, 12rem);
    width: min(40dvh, 12rem);
    height: min(40dvh, 12rem);
  }
}
/* On a wide screen the page stays a phone's width, in the middle. */
@media (min-width: 700px) {
  .bar {
    left: 50%;
    right: auto;
    width: 34rem;
    transform: translateX(-50%);
    background: none;
  }
}

/* ---- the admin's screen: the people who may wish */

.menu-link {
  display: flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  -webkit-tap-highlight-color: transparent;
}
.admin {
  max-width: 34rem;
  margin: 0 auto;
  padding: 0.75rem 1rem calc(2rem + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
  font-family: var(--sans);
}
.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.admin h2,
.admin h3 {
  margin: 0;
  color: var(--gold);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", serif;
  letter-spacing: 0.08em;
}
.admin h2 {
  font-size: 1.15rem;
}
.admin h3 {
  font-size: 1rem;
}
.admin h3 small {
  color: var(--faint);
  letter-spacing: 0;
  font-size: 0.8rem;
}
.with-button {
  display: flex;
  gap: 0.5rem;
}
.with-button input {
  flex: 1 1 0;
}
.with-button button {
  flex: none;
  border-radius: 10px;
}
.admin form button.primary {
  min-height: 3rem;
}
.handover {
  display: grid;
  gap: 0.6rem;
  border-color: rgba(143, 224, 176, 0.5);
}
.handover p {
  margin: 0;
}
.handover code {
  display: block;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  font:
    1rem/1.6 ui-monospace,
    Menlo,
    monospace;
  white-space: pre-wrap;
  user-select: all;
  -webkit-user-select: all;
}
.users {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
}
.user {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}
.user-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.6rem;
}
.user-name {
  font-weight: 700;
  font-size: 1.05rem;
}
.user-meta {
  color: var(--faint);
  font-size: 0.8rem;
  line-height: 1.5;
}
.user-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
}
.user-actions select {
  grid-column: 1 / -1;
}
.user-actions button {
  border-radius: 10px;
  padding: 0.5rem;
  font-size: 0.92rem;
}
.user-actions button.danger {
  border-color: var(--bad);
  color: var(--bad);
}
.reset {
  display: grid;
  gap: 0.5rem;
}
/* On the admin's screen there is no ball and no bar. */
body[data-view="admin"] .bar {
  display: none;
}

/* ---- the ticket again: on the shortest phone, and on one held sideways, the code, the number and the way to put it
   away are all on the screen at once. The ticket says what to do itself, so the line above it steps aside. */
body[data-ticket="on"] .status {
  display: none;
}
body[data-ticket="on"] .teller {
  padding-top: 0.25rem;
}
.ticket img {
  width: min(60vw, 240px, 30vh);
  width: min(60vw, 240px, 30dvh);
}
@media (max-height: 620px) {
  .ticket {
    gap: 0.25rem;
    padding: 0.6rem 0.8rem;
  }
  .ticket-how {
    line-height: 1.4;
  }
  .ticket button {
    min-height: 2.75rem;
  }
}
@media (orientation: landscape) and (max-height: 480px) {
  .ticket {
    width: min(100%, 34rem);
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 1rem;
    align-items: center;
    justify-items: start;
    text-align: left;
  }
  .ticket img {
    grid-row: 1 / span 5;
    width: min(52vh, 220px);
    width: min(52dvh, 220px);
  }
  .ticket-number {
    justify-items: start;
  }
  .ticket-how {
    display: none;
  }
}

/* ---- last fittings for the phone */

/* The motto on one line beside the name, even on the narrowest phone. */
.slogan {
  font-size: clamp(0.92rem, 4.5vw, 1.35rem);
  white-space: nowrap;
}
.menu > summary {
  max-width: 7rem;
  padding: 0.4rem 0.75rem;
}
/* What a granted wish offers: the two things to do side by side, putting it away as a quiet line under them. */
.gift {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  max-width: 24rem;
}
.gift button {
  padding: 0.5rem 0.4rem;
  font-size: 0.95rem;
}
.gift #gift-close {
  grid-column: 1 / -1;
  min-height: 2.75rem;
  background: none;
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}
.gift:has(#gift-pdf[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}
/* News comes in at the top, where it covers nothing that is pressed. */
.toast {
  top: calc(4.6rem + env(safe-area-inset-top));
  bottom: auto;
}
.gift button {
  white-space: nowrap;
  font-size: clamp(0.82rem, 3.9vw, 0.95rem);
}
.user.stopped {
  opacity: 0.7;
}
.user-actions button.wide {
  grid-column: 1 / -1;
}
.wish-print-row {
  display: grid;
  gap: 0.4rem;
}
.wish-print-row button {
  min-height: 3rem;
  width: 100%;
}
.ticket-wish {
  font-size: 0.85rem;
  color: #5b5378;
  text-align: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.ticket-wish:empty {
  display: none;
}
.ticket .ticket-again {
  background: none;
  border-color: transparent;
  color: #5b5378;
  min-height: 2.75rem;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}
@media (orientation: landscape) and (max-height: 480px) {
  .ticket .ticket-again {
    display: none;
  }
}

/* ---- in a wish from the list: what was asked, and what came back, told apart at a glance.
   The asking is a card of paper with a gold edge and its own tab; the answer follows under a green tab. */
.asked {
  display: grid;
  gap: 0.6rem;
  padding: 0.85rem 0.9rem 0.7rem;
  border: 1px solid rgba(240, 207, 122, 0.55);
  border-left-width: 4px;
  border-radius: 4px 12px 12px 4px;
  background: linear-gradient(180deg, rgba(240, 207, 122, 0.1), rgba(240, 207, 122, 0.03));
}
.asked-head,
.answered-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
}
.asked-tab,
.answered-tab {
  padding: 0.1rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.asked-tab {
  background: var(--gold);
  color: #2a1c05;
}
.answered-tab {
  background: rgba(143, 224, 176, 0.16);
  border: 1px solid var(--ok);
  color: var(--ok);
}
.wish:has(.badge.stopped) .answered-tab,
.wish:has(.badge.trouble) .answered-tab {
  background: rgba(255, 143, 143, 0.14);
  border-color: var(--bad);
  color: var(--bad);
}
.asked-when {
  color: var(--faint);
  font-size: 0.78rem;
  font-family: var(--sans);
}
.asked .parts {
  gap: 0.1rem;
}
.asked .parts dd {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.6;
}
.answered-head {
  margin-top: 0.3rem;
}
.oracle {
  border-left: 4px solid rgba(143, 224, 176, 0.55);
  border-radius: 4px 12px 12px 4px;
}

/* ==== The East's own signs round the crystal ===========================================================================
   A geomancer's compass (羅盤) holds the ball: the eight trigrams in the Earlier Heaven order on the outer ring, the
   twelve earthly branches on the inner one, turning against each other as slowly as the sky. Inside the ball a 太極
   turns in the mist. The Northern Dipper (北斗七星) hangs in the sky above. The ring takes the colour of the phase at
   work (五行): water while waiting, wood while the stars are asked, fire while the wish is given its form, gold when it
   is granted, and then a vermilion seal (朱印) is set on it. */

.compass {
  --ring: 196, 176, 255;
  position: relative;
  display: grid;
  place-items: center;
  width: min(84vw, 21rem, 44vh);
  width: min(84vw, 21rem, 44dvh);
  aspect-ratio: 1;
}
.compass .orb {
  width: 66%;
  height: 66%;
}
.compass-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 0 0.35rem rgba(var(--ring), 0.35));
}
.ring-outer,
.ring-inner {
  transform-origin: 0 0;
  will-change: transform;
}
.ring-outer {
  animation: turn 240s linear infinite;
}
.ring-inner {
  animation: turn 180s linear infinite reverse;
}
@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}
.ring-line {
  fill: none;
  stroke: rgba(var(--ring), 0.5);
  stroke-width: 0.7;
}
.ring-line.thin {
  stroke: rgba(var(--ring), 0.28);
  stroke-width: 0.45;
}
.trigram rect {
  fill: rgba(var(--ring), 0.78);
  transition: fill 0.6s;
}
.branch {
  fill: rgba(var(--ring), 0.6);
  font:
    600 7.2px "Hiragino Mincho ProN",
    "Yu Mincho",
    "Songti SC",
    "Noto Serif CJK JP",
    serif;
}

/* The 太極 in the ball: more felt than seen, turning the other way from the mist. */
.orb-taiji {
  position: absolute;
  inset: 14%;
  width: 72%;
  height: 72%;
  opacity: 0.13;
  pointer-events: none;
  animation: turn 48s linear infinite reverse;
  transform-origin: 50% 50%;
}
.orb-taiji path,
.orb-taiji circle {
  fill: #fff;
}
.orb-taiji .taiji-eye {
  fill: #150c3d;
}
/* With words in the ball, the 太極 fades so that they can be read. */
body:not([data-wish="none"]) .orb-taiji {
  opacity: 0.07;
}

/* The phase at work (五行) colours the ring. */
body[data-wish="waiting"] .compass {
  --ring: 132, 180, 255; /* 水 */
}
body[data-stage="research"] .compass {
  --ring: 126, 224, 176; /* 木 */
}
body[data-stage="compose"][data-wish="working"] .compass {
  --ring: 255, 150, 120; /* 火 */
}
body[data-wish="done"] .compass {
  --ring: 240, 207, 122; /* 金 */
}
body[data-wish="stopped"] .compass,
body[data-wish="trouble"] .compass {
  --ring: 150, 140, 170;
}
/* While the stars are asked or the wish is given its form, the trigrams light one after another round the ring. */
body[data-stage="research"] .trigram rect,
body[data-stage="compose"][data-wish="working"] .trigram rect,
body[data-talk="calling"] .trigram rect {
  animation: kindle 3.2s ease-in-out infinite;
}
.trigram[data-index="1"] rect { animation-delay: 0.4s !important; }
.trigram[data-index="2"] rect { animation-delay: 0.8s !important; }
.trigram[data-index="3"] rect { animation-delay: 1.2s !important; }
.trigram[data-index="4"] rect { animation-delay: 1.6s !important; }
.trigram[data-index="5"] rect { animation-delay: 2s !important; }
.trigram[data-index="6"] rect { animation-delay: 2.4s !important; }
.trigram[data-index="7"] rect { animation-delay: 2.8s !important; }
@keyframes kindle {
  0%,
  100% {
    fill: rgba(var(--ring), 0.35);
  }
  12% {
    fill: #fff;
  }
  30% {
    fill: rgba(var(--ring), 0.85);
  }
}
/* While the teller and the person talk, the sky turns faster. */
body[data-talk="on"] .ring-outer {
  animation-duration: 60s;
}
body[data-talk="on"] .ring-inner {
  animation-duration: 45s;
}

/* The seal (朱印): set on a wish that has been granted. */
.seal {
  position: absolute;
  right: 9%;
  bottom: 9%;
  display: none;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 2px solid #e2533d;
  border-radius: 5px;
  background: rgba(226, 83, 61, 0.14);
  color: #f0745d;
  font:
    700 1.5rem/1 "Hiragino Mincho ProN",
    "Yu Mincho",
    "Songti SC",
    serif;
  transform: rotate(-9deg);
  box-shadow: inset 0 0 0 2px rgba(13, 10, 31, 0.6);
  pointer-events: none;
}
body[data-wish="done"] .seal {
  display: grid;
  animation: press 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
@keyframes press {
  from {
    opacity: 0;
    transform: rotate(-9deg) scale(1.9);
  }
}
body[data-ticket="on"] .compass {
  display: none;
}

/* The Northern Dipper, high in the sky and faint. */
.dipper {
  position: fixed;
  top: calc(3.2rem + env(safe-area-inset-top));
  right: max(0.5rem, calc(50% - 17rem));
  z-index: -1;
  width: min(46vw, 12rem);
  opacity: 0.5;
  pointer-events: none;
}
.dipper polyline {
  fill: none;
  stroke: rgba(196, 176, 255, 0.22);
  stroke-width: 0.6;
}
.dipper circle {
  fill: #fff7dd;
  animation: twinkle 5s ease-in-out infinite alternate;
}
.dipper circle:nth-of-type(2n) {
  animation-delay: 1.7s;
}
.dipper circle:nth-of-type(3n) {
  animation-delay: 3.1s;
}

@media (orientation: landscape) and (max-height: 480px) {
  .compass {
    width: min(48vh, 13rem);
    width: min(48dvh, 13rem);
  }
  .seal {
    width: 2rem;
    height: 2rem;
    font-size: 1.1rem;
  }
}

/* The night sky and the Dipper are painted behind the page: the page itself must not paint over them. */
body {
  background: transparent;
}
.orb-words strong {
  font-size: clamp(0.85rem, 4.3vw, 1.2rem);
  letter-spacing: 0.04em;
  text-wrap: balance;
}
.orb-words span {
  text-wrap: balance;
}

/* What can be wished for, said beside the motto: looking things up, and making documents. Kept on the motto's line,
   in closer letters, so that the narrowest phone still shows it whole. */
.sub {
  white-space: nowrap;
  letter-spacing: 0.14em;
  font-size: clamp(0.72rem, 3.5vw, 0.85rem);
}
.sub .scope {
  letter-spacing: 0.02em;
  color: var(--gold);
  opacity: 0.85;
}
@media (orientation: landscape) and (max-height: 480px) {
  .sub {
    display: block;
  }
}

/* ---- the top again: the motto in two tongues, each with a line that says what is done for you.
   The name sits beside the first line; the lines under it have the whole width, so the longest fits the narrowest phone. */
.top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.6rem;
}
.motto {
  display: contents;
}
.slogan {
  grid-column: 1;
  grid-row: 1;
}
.menu {
  grid-column: 2;
  grid-row: 1;
}
.says,
.sub {
  grid-column: 1 / -1;
}
.says {
  color: var(--muted);
  font-size: clamp(0.68rem, 3.35vw, 0.82rem);
  line-height: 1.45;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.says[lang="zh-CN"] {
  font-family: "Songti SC", "PingFang SC", "Noto Serif CJK SC", "Noto Sans CJK SC", serif;
}
.sub {
  margin-top: 0.35rem;
  color: var(--gold);
  font-size: clamp(0.92rem, 4.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.menu-panel {
  top: calc(env(safe-area-inset-top) + 3.6rem);
}
/* The top is taller now: the first screen under it is that much shorter. */
.teller {
  min-height: calc(100vh - 7.6rem - env(safe-area-inset-top) - var(--bar));
  min-height: calc(100dvh - 7.6rem - env(safe-area-inset-top) - var(--bar));
}
.compass {
  width: min(84vw, 21rem, 40vh);
  width: min(84vw, 21rem, 40dvh);
}
.toast {
  top: calc(7.6rem + env(safe-area-inset-top));
}
@media (orientation: landscape) and (max-height: 480px) {
  .says {
    display: none;
  }
  .sub {
    display: none;
  }
}

/* ---- the language to talk in */
.lang {
  display: flex;
  gap: 0.4rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.lang button {
  min-height: 2.75rem;
  min-width: 4.6rem;
  padding: 0.3rem 0.8rem;
  border: none;
  background: none;
  color: var(--muted);
  font-family: system-ui, "Hiragino Sans", "PingFang SC", sans-serif;
  font-size: 0.92rem;
}
.lang button[aria-checked="true"] {
  background: rgba(240, 207, 122, 0.18);
  color: var(--gold);
  font-weight: 700;
}
.lang button:disabled {
  opacity: 1;
}
.lang button:disabled:not([aria-checked="true"]) {
  opacity: 0.35;
}
/* Not while a wish's gift or the copier's ticket has the floor, and not for someone who may not wish. */
body[data-ticket="on"] .lang,
body[data-wish="done"] .lang {
  display: none;
}

/* The Northern Dipper, brought forward: larger, its seven stars bright with a halo, the line between them plain to see. */
.dipper {
  top: calc(6.6rem + env(safe-area-inset-top));
  right: max(0.25rem, calc(50% - 17.5rem));
  width: min(58vw, 15rem);
  opacity: 1;
  overflow: visible;
}
.dipper polyline {
  stroke: rgba(214, 200, 255, 0.5);
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dipper circle {
  fill: #fff8e1;
  stroke: rgba(240, 207, 122, 0.55);
  stroke-width: 1.4;
  filter: drop-shadow(0 0 3px #fff3c4) drop-shadow(0 0 7px rgba(240, 207, 122, 0.85));
  animation: glimmer 4.5s ease-in-out infinite alternate;
}
@keyframes glimmer {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 1;
  }
}

/* The language choice sits in the sky's upper left, across from the Dipper, and takes no room from the ball. */
.teller {
  position: relative;
}
.lang {
  position: absolute;
  top: 0.15rem;
  left: 0;
  z-index: 2;
  gap: 0.1rem;
  padding: 0.15rem;
  background: rgba(13, 10, 31, 0.55);
}
.lang button {
  min-width: 0;
  padding: 0.3rem 0.7rem;
  font-size: 0.86rem;
}
/* The ball keeps clear of it on a short phone. */
@media (orientation: portrait) {
  .teller {
    padding-top: 3.1rem;
  }
}

/* ---- the motto in the language chosen to talk in: its two lines, and only its own */
.top [data-for] {
  display: none;
}
html[data-spoken="zh"] .top [data-for="zh"],
html[data-spoken="ja"] .top [data-for="ja"],
html[data-spoken="en"] .top [data-for="en"],
html:not([data-spoken]) .top [data-for="ja"] {
  display: block;
}
.slogan[lang="ja"] {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", serif;
  letter-spacing: 0.1em;
}
/* The English one is longer than the name beside it leaves room for on a narrow phone: it may take two lines. */
.slogan[lang="en"] {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.95rem, 4.4vw, 1.3rem);
  letter-spacing: 0.01em;
  line-height: 1.25;
  white-space: normal;
  text-wrap: balance;
}
.says[lang="en"] {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  white-space: normal;
}
/* Two lines at the top again: the first screen gets its height back. */
.teller {
  min-height: calc(100vh - 5.6rem - env(safe-area-inset-top) - var(--bar));
  min-height: calc(100dvh - 5.6rem - env(safe-area-inset-top) - var(--bar));
}
.compass {
  width: min(84vw, 21rem, 42vh);
  width: min(84vw, 21rem, 42dvh);
}
.toast {
  top: calc(5.4rem + env(safe-area-inset-top));
}
.dipper {
  top: calc(4.6rem + env(safe-area-inset-top));
}
@media (orientation: landscape) and (max-height: 480px) {
  html[data-spoken] .top .says[data-for] {
    display: none;
  }
  .compass {
    width: min(48vh, 13rem);
    width: min(48dvh, 13rem);
  }
}
/* Clear of the language choice on its left. */
.dipper {
  width: min(44vw, 13rem);
  right: max(0.4rem, calc(50% - 16.5rem));
  top: calc(5.2rem + env(safe-area-inset-top));
}

/* The motto's two lines sit close together: the first rests on the bottom of its row (the row is as tall as the name
   beside it), so that only a line's own spacing parts it from the second. */
.top {
  align-items: end;
  row-gap: 0.1rem;
}
.top .slogan {
  align-self: end;
  line-height: 1.25;
}
.top .menu {
  align-self: center;
}
.top .says {
  line-height: 1.35;
}

/* A little air between the motto's second line and the language choice under it. */
.lang {
  top: 0.75rem;
}
@media (orientation: portrait) {
  .teller {
    padding-top: 3.7rem;
  }
}
/* …and a little more of it. */
.lang {
  top: 1.4rem;
}
@media (orientation: portrait) {
  .teller {
    padding-top: 4.4rem;
  }
}
@media (orientation: landscape) and (max-height: 480px) {
  .lang {
    top: 0.15rem;
  }
}
.bar button:disabled {
  opacity: 0.45;
}
.voices {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0.7rem 0.8rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
}
.voices legend {
  padding: 0 0.3rem;
  font-size: 0.92rem;
  color: var(--gold);
}
.voices legend small {
  color: var(--faint);
  font-size: 0.8rem;
}
.voices label {
  grid-template-columns: 4.5rem minmax(0, 1fr);
  align-items: center;
  color: var(--ink);
}

/* ==== The door: the screen before signing in ============================================================================
   One column in the middle of the screen, from the top: the crystal in its ring, a line of welcome, the card with the
   name and the password, and the choice of language. Evenly spaced, clear of the motto above, with nothing left over
   under the button. */
.login {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: center;
  gap: 1.1rem;
  max-width: 24rem;
  margin: 0 auto;
  min-height: calc(100vh - 5.6rem - env(safe-area-inset-top));
  min-height: calc(100dvh - 5.6rem - env(safe-area-inset-top));
  padding: 1.25rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
  text-align: center;
}
.login-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: min(42vw, 9.5rem, 24vh);
  width: min(42vw, 9.5rem, 24dvh);
  aspect-ratio: 1;
}
.login-orb .orb.small {
  width: 70%;
  height: 70%;
  margin: 0;
}
.login-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  animation: turn 200s linear infinite;
}
.login-ring circle {
  fill: none;
  stroke: rgba(196, 176, 255, 0.4);
  stroke-width: 0.8;
}
.login-ring circle + circle {
  stroke: rgba(240, 207, 122, 0.45);
  stroke-dasharray: 1.5 9.5;
  stroke-width: 2.2;
}
.login .lead {
  margin: 0;
  max-width: 20rem;
  font-size: 0.98rem;
  line-height: 1.6;
  text-wrap: balance;
}
.login form.sheet {
  width: 100%;
  gap: 1rem;
  padding: 1.4rem 1.2rem 1.3rem;
  text-align: left;
}
.login form.sheet button.primary {
  margin-top: 0.3rem;
  min-height: 3rem;
}
.login .lang {
  position: static;
  background: none;
}
/* The Dipper keeps to the open sky beside the crystal, not behind the card. */
body[data-auth="out"] .dipper,
body[data-auth="checking"] .dipper {
  width: min(34vw, 10rem);
  opacity: 0.8;
}
@media (orientation: landscape) and (max-height: 480px) {
  .login {
    min-height: 0;
    gap: 0.6rem;
    padding-top: 0.5rem;
  }
  .login-orb {
    display: none;
  }
}
.login {
  padding-bottom: calc(0.9rem + env(safe-area-inset-bottom));
}
/* A short phone: everything a little closer and the crystal smaller, so that the door is on one screen. */
@media (max-height: 720px) and (orientation: portrait) {
  .login {
    gap: 0.75rem;
    padding-top: 0.6rem;
  }
  .login-orb {
    width: min(34vw, 7.5rem, 19vh);
    width: min(34vw, 7.5rem, 19dvh);
  }
  .login form.sheet {
    gap: 0.75rem;
    padding: 1.05rem 1.05rem 1rem;
  }
}
@media (max-height: 600px) and (orientation: portrait) {
  .login {
    gap: 0.55rem;
    padding-top: 0.3rem;
  }
  .login-orb {
    width: min(26vw, 5.2rem, 14vh);
    width: min(26vw, 5.2rem, 14dvh);
  }
  .login .lead {
    font-size: 0.86rem;
    line-height: 1.45;
  }
  .login form.sheet {
    gap: 0.55rem;
    padding: 0.85rem 0.95rem;
  }
  .login form.sheet label {
    gap: 0.15rem;
  }
}
.login .lead-more {
  display: block;
  margin-top: 0.15rem;
  color: var(--faint);
  font-size: 0.9em;
}
.login .lang button {
  flex: none;
  min-height: 2.75rem;
  white-space: nowrap;
}
/* The names of the languages are never broken over two lines, wherever the choice is shown. */
.lang button {
  flex: none;
  white-space: nowrap;
}

/* ---- signing up, at the door */
.login .switch {
  flex: none;
  min-height: 2.75rem;
  padding: 0.3rem 0.6rem;
  border: none;
  background: none;
  color: var(--gold);
  font-size: 0.92rem;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 0.3em;
  text-wrap: balance;
}
.message.good {
  color: var(--ok);
}
.user.waiting {
  border-color: rgba(240, 207, 122, 0.55);
  background: rgba(240, 207, 122, 0.06);
}
/* Someone is waiting to be let in: a small light on the admin's name. */
.menu > summary.has-news::after {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 0.4rem;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0.4rem var(--gold);
}
/* Signing up has one more box to fill in: on a phone the crystal steps aside for it. */
@media (max-height: 760px) and (orientation: portrait) {
  .login[data-mode="signup"] .login-orb {
    display: none;
  }
}
/* With the line for signing up under the card, the door is a little taller: the crystal gives up the room. */
@media (max-height: 720px) and (orientation: portrait) {
  .login {
    gap: 0.6rem;
  }
  .login-orb {
    width: min(30vw, 6.2rem, 14vh);
    width: min(30vw, 6.2rem, 14dvh);
  }
  .login .switch {
    font-size: 0.86rem;
    line-height: 1.4;
  }
}
@media (max-height: 600px) and (orientation: portrait) {
  .login {
    gap: 0.4rem;
  }
  .login-orb {
    width: min(20vw, 3.6rem, 9vh);
    width: min(20vw, 3.6rem, 9dvh);
  }
  .login .switch {
    font-size: 0.82rem;
  }
}
/* The code from the mail: six digits, large and spaced, as they are read off. */
input.code {
  font:
    700 1.5rem/1.2 ui-monospace,
    "SF Mono",
    Menlo,
    monospace;
  letter-spacing: 0.4em;
  text-align: center;
}
.login form.sheet button.quiet {
  min-height: 2.75rem;
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

/* ---- the form the wish comes back in: a document, or slides */
.field {
  display: grid;
  gap: 0.35rem;
}
.field-name {
  font-size: 0.92rem;
  color: var(--gold);
}
.choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
}
.choice button {
  min-height: 3rem;
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--muted);
}
.choice button[aria-checked="true"] {
  border-color: var(--gold);
  background: rgba(240, 207, 122, 0.14);
  color: var(--gold);
  font-weight: 700;
}
/* With slides there are three things to take: the two files side by side, the copier under them. */
.gift:has(#gift-pptx:not([hidden])) #gift-print {
  grid-column: 1 / -1;
}

/* The seal in the language chosen: 叶 (granted) in Japanese, 成 (心想事成: it has come to be) in Chinese, and
   WISH GRANTED in English. Cut bold, as a seal is. */
.seal {
  font-weight: 900;
  border-width: 3px;
  -webkit-text-stroke: 0.6px currentColor;
}
.seal [data-for] {
  display: none;
}
html[data-spoken="ja"] .seal [data-for="ja"],
html[data-spoken="zh"] .seal [data-for="zh"],
html[data-spoken="en"] .seal [data-for="en"],
html:not([data-spoken]) .seal [data-for="ja"] {
  display: block;
}
.seal [lang="zh-CN"] {
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Hiragino Mincho ProN", serif;
}
/* The English one is two short words: a wider seal, in small capitals. */
html[data-spoken="en"] .seal {
  width: auto;
  height: auto;
  padding: 0.3rem 0.45rem;
  font:
    900 0.62rem/1.15 Georgia,
    "Times New Roman",
    serif;
  letter-spacing: 0.09em;
  text-align: center;
  -webkit-text-stroke: 0.3px currentColor;
}
/* The seal's ground is solid: what turns behind it must not show through its letters. */
.seal {
  background: #2b0f14;
  box-shadow:
    inset 0 0 0 2px rgba(226, 83, 61, 0.35),
    0 0 0.6rem rgba(0, 0, 0, 0.6);
}

/* ==== The ball as glass ================================================================================================
   A crystal ball is clear: it is seen by what it does to light. So the ball is drawn as light on and through a sphere of
   glass, in layers from the back to the front:
     the body     dark and clear in the middle, where one looks into it, and brightening to a thin bright edge (glass
                  seen at a glancing angle mirrors the sky)
     the depth    the world behind it, small and upside down, as a glass ball shows it, with the light it gathers
                  pooling at the bottom
     the mist, the sparks and the 太極 drifting inside
     the shine    the lamp's reflection, upper left: a soft patch, a hard point beside it, and the window's long curve;
                  and, low on the far side, the paler light that has gone through the ball and come out
     the rim      one fine line of light round the edge
   The tint of the glass (--glass) follows the wish: violet, and gold once it is granted. */
.orb {
  --glass: 138, 108, 255;
  --glass-deep: 26, 14, 78;
  --lit: 226, 216, 255;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 54%, rgba(var(--lit), 0.16) 74%, rgba(var(--lit), 0.5) 91%, rgba(255, 255, 255, 0.85) 97.5%, rgba(var(--lit), 0.25) 100%),
    radial-gradient(ellipse 70% 46% at 50% 108%, rgba(var(--lit), 0.55) 0%, rgba(var(--glass), 0.32) 38%, transparent 70%),
    radial-gradient(circle at 42% 36%, rgba(var(--glass), 0.62) 0%, rgba(var(--glass), 0.3) 30%, rgba(var(--glass-deep), 0.82) 62%, rgba(8, 4, 30, 0.94) 100%);
  box-shadow:
    0 0 calc(1.6rem + var(--level) * 4rem) calc(0.1rem + var(--level) * 1.2rem) rgba(var(--glass), 0.5),
    0 0 0.35rem rgba(var(--lit), 0.55),
    inset 0 0 0.9rem rgba(var(--lit), 0.3),
    inset 0 -1.4rem 2.2rem rgba(6, 3, 24, 0.6),
    inset 0 1.1rem 1.8rem rgba(255, 255, 255, 0.1);
}
.orb-depth,
.orb-sparks,
.orb-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}
/* What is behind the ball, seen through it: turned over and drawn small, the sky's stars low and the ground's glow high. */
.orb-depth {
  inset: 7%;
  transform: rotate(180deg) scale(0.92);
  opacity: 0.85;
  background:
    radial-gradient(1.5px 1.5px at 22% 30%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 61% 22%, #fff 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 74% 44%, #ffe9b0 50%, transparent 52%),
    radial-gradient(1px 1px at 38% 16%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 48% 38%, #dcd0ff 50%, transparent 52%),
    radial-gradient(ellipse 80% 34% at 50% 6%, rgba(var(--lit), 0.3), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 96%, rgba(var(--glass), 0.38), transparent 70%);
  filter: blur(0.3px);
}
/* The mist is thinner in glass than it was in the lamp. */
.orb-mist {
  opacity: 0.55;
  mix-blend-mode: screen;
}
/* Flecks inside the glass, catching the light by turns. */
.orb-sparks {
  inset: 12%;
  background:
    radial-gradient(2px 2px at 30% 62%, #fff 45%, transparent 55%),
    radial-gradient(1.5px 1.5px at 66% 58%, #fff 45%, transparent 55%),
    radial-gradient(2px 2px at 54% 28%, #fff3c9 45%, transparent 55%),
    radial-gradient(1.5px 1.5px at 76% 36%, #fff 45%, transparent 55%),
    radial-gradient(1.5px 1.5px at 40% 78%, #e6dcff 45%, transparent 55%);
  animation:
    glint 4.2s ease-in-out infinite alternate,
    turn 70s linear infinite;
}
@keyframes glint {
  0% {
    opacity: 0.15;
  }
  45% {
    opacity: 0.9;
  }
  100% {
    opacity: 0.35;
  }
}
.orb-shine {
  background:
    radial-gradient(ellipse 27% 16% at 32% 21%, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.55) 38%, rgba(255, 255, 255, 0.12) 68%, transparent 80%),
    radial-gradient(circle 2.6% at 23% 35%, #fff 0%, rgba(255, 255, 255, 0.8) 55%, transparent 100%),
    radial-gradient(ellipse 34% 9% at 64% 86%, rgba(var(--lit), 0.5) 0%, rgba(var(--lit), 0.16) 55%, transparent 78%),
    radial-gradient(ellipse 9% 20% at 86% 52%, rgba(255, 255, 255, 0.2), transparent 75%);
}
/* The window's long curve, across the upper left, and its faint echo on the far side. */
.orb-shine::before,
.orb-shine::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.orb-shine::before {
  inset: 7% 12% 34% 9%;
  border-top: 2px solid rgba(255, 255, 255, 0.5);
  transform: rotate(-24deg);
  filter: blur(0.6px);
}
.orb-shine::after {
  inset: 38% 8% 6% 14%;
  border-bottom: 1.5px solid rgba(var(--lit), 0.35);
  transform: rotate(-24deg);
  filter: blur(0.8px);
}
.orb-rim {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    inset 0 0 0.5rem 1px rgba(var(--lit), 0.28);
}
.orb-glow {
  background: radial-gradient(circle at 50% 58%, rgba(var(--lit), calc(0.1 + var(--level) * 0.75)) 0%, rgba(var(--glass), calc(var(--level) * 0.35)) 34%, transparent 58%);
}
/* The words inside are read against the clear, dark middle of the glass. */
.orb-words {
  z-index: 2;
}
.orb-taiji {
  opacity: 0.1;
}
body:not([data-wish="none"]) .orb-taiji {
  opacity: 0.05;
}
body:not([data-wish="none"]) .orb-depth,
body:not([data-wish="none"]) .orb-sparks {
  opacity: 0.35;
}
/* Granted: the glass fills with gold light. */
body[data-wish="done"] .orb {
  --glass: 240, 196, 96;
  --glass-deep: 92, 58, 12;
  --lit: 255, 238, 190;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 54%, rgba(var(--lit), 0.2) 74%, rgba(var(--lit), 0.6) 91%, rgba(255, 255, 255, 0.9) 97.5%, rgba(var(--lit), 0.3) 100%),
    radial-gradient(ellipse 70% 46% at 50% 108%, rgba(var(--lit), 0.7) 0%, rgba(var(--glass), 0.4) 38%, transparent 70%),
    radial-gradient(circle at 42% 36%, rgba(255, 226, 150, 0.85) 0%, rgba(var(--glass), 0.62) 30%, rgba(var(--glass-deep), 0.86) 66%, rgba(40, 22, 6, 0.95) 100%);
  box-shadow:
    0 0 3.2rem 0.5rem rgba(var(--glass), 0.55),
    0 0 0.35rem rgba(var(--lit), 0.7),
    inset 0 0 0.9rem rgba(var(--lit), 0.4),
    inset 0 -1.4rem 2.2rem rgba(40, 20, 4, 0.5),
    inset 0 1.1rem 1.8rem rgba(255, 255, 255, 0.14);
}
/* The small one at the door. */
.orb.small .orb-shine::before,
.orb.small .orb-shine::after {
  border-width: 1px;
}

/* The glass, tuned: the lamp's reflection (its hard point was written in a way browsers refuse, which lost the whole
   layer), a clearer and brighter body, and the 太極 no more than a breath inside it. */
.orb {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 50%, rgba(var(--lit), 0.14) 70%, rgba(var(--lit), 0.46) 89%, rgba(255, 255, 255, 0.9) 97%, rgba(var(--lit), 0.3) 100%),
    radial-gradient(ellipse 78% 50% at 52% 104%, rgba(255, 255, 255, 0.5) 0%, rgba(var(--lit), 0.4) 22%, rgba(var(--glass), 0.3) 48%, transparent 74%),
    radial-gradient(circle at 40% 34%, rgba(var(--lit), 0.5) 0%, rgba(var(--glass), 0.55) 24%, rgba(var(--glass), 0.26) 46%, rgba(var(--glass-deep), 0.8) 72%, rgba(10, 5, 36, 0.92) 100%);
}
.orb-shine {
  background:
    radial-gradient(ellipse 26% 15% at 31% 20%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.6) 36%, rgba(255, 255, 255, 0.14) 66%, transparent 80%),
    radial-gradient(ellipse 3% 3% at 22% 35%, #fff 0%, rgba(255, 255, 255, 0.85) 50%, transparent 100%),
    radial-gradient(ellipse 5% 3% at 40% 13%, rgba(255, 255, 255, 0.7) 0%, transparent 100%),
    radial-gradient(ellipse 36% 10% at 62% 87%, rgba(255, 255, 255, 0.55) 0%, rgba(var(--lit), 0.2) 55%, transparent 80%),
    radial-gradient(ellipse 8% 22% at 87% 50%, rgba(255, 255, 255, 0.22), transparent 75%);
}
.orb-shine::before {
  border-top-color: rgba(255, 255, 255, 0.38);
}
.orb-taiji {
  opacity: 0.045;
  filter: blur(1.2px);
}
body:not([data-wish="none"]) .orb-taiji {
  opacity: 0.025;
}
.orb-depth {
  opacity: 0.7;
}
/* Granted: brighter at the heart, as if the light were inside the glass. */
body[data-wish="done"] .orb {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 50%, rgba(var(--lit), 0.2) 70%, rgba(var(--lit), 0.6) 89%, rgba(255, 255, 255, 0.92) 97%, rgba(var(--lit), 0.3) 100%),
    radial-gradient(ellipse 78% 50% at 52% 104%, rgba(255, 255, 255, 0.6) 0%, rgba(var(--lit), 0.5) 22%, rgba(var(--glass), 0.36) 48%, transparent 74%),
    radial-gradient(circle at 44% 38%, rgba(255, 244, 205, 0.9) 0%, rgba(255, 214, 120, 0.78) 22%, rgba(var(--glass), 0.6) 44%, rgba(150, 100, 28, 0.86) 70%, rgba(58, 34, 8, 0.95) 100%);
}

/* ---- while the copier's ticket is being made: the same white paper, with the steps and the time it has taken */
.wait {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  width: min(100%, 21rem);
  padding: 1rem 1rem 0.9rem;
  border-radius: 16px;
  background: #fff;
  color: #1a1338;
  font-family: var(--sans);
  box-shadow: 0 0 3rem rgba(240, 207, 122, 0.45);
  animation: rise 0.3s ease-out;
}
.wait[hidden] {
  display: none;
}
.wait p {
  margin: 0;
}
.wait-title {
  font-weight: 700;
  letter-spacing: 0.08em;
}
.wait-ring {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  margin: 0.2rem 0;
  border-radius: 50%;
  border: 4px solid #e6e1f2;
  border-top-color: #6b4fd8;
  animation: wait-turn 1.1s linear infinite;
}
.wait-ring span {
  font-size: 1.6rem;
  animation: wait-turn 1.1s linear infinite reverse;
}
@keyframes wait-turn {
  to {
    transform: rotate(360deg);
  }
}
.wait-steps {
  display: grid;
  gap: 0.3rem;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: 0.9rem;
}
.wait-steps li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  color: #8d86a6;
}
.wait-steps li::before {
  content: "";
  flex: none;
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid #cfc8e2;
  font-size: 0.8rem;
  line-height: 1;
}
.wait-steps li[data-state="done"] {
  color: #1a1338;
}
.wait-steps li[data-state="done"]::before {
  content: "✓";
  border-color: #2e9e6b;
  background: #2e9e6b;
  color: #fff;
}
.wait-steps li[data-state="now"] {
  background: #f1edfb;
  color: #1a1338;
  font-weight: 700;
}
.wait-steps li[data-state="now"]::before {
  border-color: #6b4fd8;
  border-right-color: transparent;
  animation: wait-turn 0.8s linear infinite;
}
.wait-time {
  font-size: 0.9rem;
  font-weight: 600;
}
.wait-time strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.wait-note {
  font-size: 0.82rem;
  color: #8a5a00;
}
.wait-how {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #5b5378;
}
@media (prefers-reduced-motion: reduce) {
  .wait-ring,
  .wait-ring span,
  .wait-steps li[data-state="now"]::before {
    animation: none;
  }
}

/* ---- paying: the price on the wish card, the payment's line in what was wished before, the admin's prices */
.card-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.6rem;
  margin: 0.2rem 0 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(240, 207, 122, 0.45);
  border-radius: 12px;
  background: rgba(240, 207, 122, 0.08);
}
.card-price[hidden] {
  display: none;
}
.card-price strong {
  font-size: 1.25rem;
  color: #f0cf7a;
}
.card-price small {
  flex: 1 1 100%;
  opacity: 0.8;
  line-height: 1.5;
}
.paid {
  margin: 0.2rem 0 0.6rem;
  font-size: 0.88rem;
  opacity: 0.9;
}
.paid strong {
  color: #f0cf7a;
}
.paid-failed strong,
.paid-failed {
  color: #ffb4a8;
}
.prices[hidden] {
  display: none;
}
.prices input {
  width: 7.5rem;
  text-align: right;
}

/* ---- how to pay, chosen on the wish card */
.card-price {
  display: grid;
  gap: 0.45rem;
}
.card-price p {
  margin: 0;
}
.card-price .choice button {
  min-height: 2.9rem;
}
.paypay-mark {
  font-family: system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.card-price .choice [aria-checked="true"] .paypay-mark {
  color: #ff5b5b;
}

/* When the wisher was born, on the card, and the four pillars read from it. */
.card-birth {
  margin: 0.2rem 0 0.8rem;
  padding: 0.7rem 0.8rem 0.8rem;
  border: 1px solid rgba(214, 178, 110, 0.35);
  border-radius: 12px;
  background: rgba(214, 178, 110, 0.06);
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}
.card-birth[hidden] {
  display: none;
}
/* Floated, the legend sits inside the frame instead of cutting across its top edge. */
.card-birth legend {
  float: left;
  width: 100%;
  padding: 0;
}
.card-birth legend small {
  display: block;
}
.birth-date {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
}
.card-birth label {
  margin: 0;
  min-width: 0;
}
.card-birth input[type="number"],
.card-birth input[type="time"] {
  width: 100%;
  min-width: 0;
}
.card-birth p {
  margin: 0;
}
.birth-result strong {
  letter-spacing: 0.06em;
  color: var(--gold);
}
.birth-message {
  color: var(--muted);
  font-size: 0.85rem;
}
.card-birth > button {
  justify-self: start;
}

.card-focus {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.card-focus[hidden] {
  display: none;
}
.card-focus select {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.16));
  background: rgba(10, 8, 24, 0.6);
  color: inherit;
  font: inherit;
}

/* 奇門遁甲: the board of this hour, under the crystal. Nine palaces on the 洛書 square. */
.moment {
  width: min(100%, 24rem);
  margin: 0.6rem auto 0.2rem;
  text-align: center;
}
.moment[hidden] {
  display: none;
}
.moment h2 {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  color: var(--gold);
}
.moment-head {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.moment small {
  display: block;
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
}
.nine {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid rgba(240, 207, 122, 0.55);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(10, 8, 24, 0.55);
}
.gong {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.05rem 0.2rem;
  padding: 0.35rem 0.4rem 0.3rem;
  border: 0.5px solid rgba(240, 207, 122, 0.28);
  font-size: 0.72rem;
  line-height: 1.35;
  min-width: 0;
}
.gong .spirit {
  text-align: left;
  color: #b9a7e8;
}
.gong .star {
  text-align: right;
  color: #8fc6ff;
}
.gong .door {
  grid-column: 1 / -1;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  color: var(--gold);
}
.gong .stems {
  grid-column: 1 / -1;
  letter-spacing: 0.1em;
}
.gong .seat {
  grid-column: 1 / -1;
  font-style: normal;
  font-size: 0.62rem;
  color: var(--muted);
}
.gong.centre {
  background: rgba(240, 207, 122, 0.07);
}
.gong.centre .door {
  color: var(--muted);
  font-weight: 400;
}
.gong.lead {
  box-shadow: inset 0 0 0 1.5px rgba(240, 207, 122, 0.75);
}

/* 紫微斗数の命盤: twelve palaces round a four-by-four square, the person in the middle. */
.ziwei[hidden] {
  display: none;
}
.twelve {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(4.6rem, auto));
  margin-top: 0.3rem;
  border: 1px solid rgba(240, 207, 122, 0.55);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(10, 8, 24, 0.55);
}
.palace {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.25rem 0.25rem 0.2rem;
  border: 0.5px solid rgba(240, 207, 122, 0.28);
  font-size: 0.6rem;
  line-height: 1.3;
  min-width: 0;
  overflow: hidden;
}
.palace .stars {
  font-size: 0.72rem;
  color: #f3e3b0;
}
.palace .marks {
  font-style: normal;
  color: #ff9c8a;
}
.palace .minor,
.palace .ages {
  color: var(--muted);
}
.palace .name {
  margin-top: auto;
  color: var(--gold);
  font-size: 0.68rem;
}
.palace .at {
  font-style: normal;
  color: #b9a7e8;
}
.palace.soul {
  background: rgba(240, 207, 122, 0.12);
}
.palace.now {
  box-shadow: inset 0 0 0 1.5px rgba(143, 198, 255, 0.7);
}
.twelve .middle {
  grid-area: 2 / 2 / 4 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.3rem;
  font-size: 0.68rem;
  text-align: center;
  color: var(--muted);
}
.twelve .middle b {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--gold);
}

/* The choice of language is the first thing on the teller's stage, at its left, in the flow of the page: the compass
   comes under it and the two cannot meet, however much stands below the crystal. (It used to be laid over the stage's
   top corner, with room kept for it by padding, which a taller stage outgrew.) */
body .teller .lang {
  position: static;
  order: -1;
  justify-self: start;
  margin-bottom: 0.2rem;
}
body .teller {
  padding-top: 0.4rem;
}

/* The bar's buttons keep their words on one line. Each is as wide as its words need (and shares what room is left);
   when the bar is too narrow for them all, app.js makes the letters a little smaller (--bar-size) until they fit. */
.bar button {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  font-size: var(--bar-size, 0.98rem);
  white-space: nowrap;
}

/* The bar is a solid band: what scrolls under it (the boards, the wishes) does not show through its buttons. A thin
   line and a short fade above it mark where the page goes under. */
.bar {
  background: var(--night);
  border-top: 1px solid rgba(240, 207, 122, 0.22);
  box-shadow: 0 -0.9rem 1.1rem -0.2rem var(--night);
}
.bar button {
  background: #1c1535;
}

/* ---- Letters for each language.
   The page's own letters used to be the Japanese ones whatever the language. In Chinese that left an iPhone to patch
   each simplified character the Japanese face lacks with one from another face, so a line came out in two hands; and
   where one face did hold them all (Noto), they were drawn in their Japanese shapes. Each language now has its own
   serif (for reading) and sans (for buttons and fields), chosen by the language of the page. */
:root {
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", "Noto Serif JP", serif;
  --sans: system-ui, "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", sans-serif;
  /* The boards are written in Chinese characters in every language, many in their older forms (門, 驚, 輔). */
  --han: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", "Songti TC", "Noto Serif CJK TC", serif;
}
html:lang(zh) {
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --han: "Songti SC", "STSong", "Noto Serif CJK SC", "Songti TC", "Noto Serif CJK TC", serif;
}
html:lang(en) {
  /* Latin first; the Chinese characters that still appear (names, the boards) fall to the faces after it. */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Noto Serif", "Liberation Serif", "Times New Roman", "Hiragino Mincho ProN", "Noto Serif CJK JP", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Noto Sans CJK JP", sans-serif;
}
body {
  font-family: var(--serif);
}
.nine,
.twelve,
.moment-head,
#wish-birth-pillars {
  font-family: var(--han);
}
/* Figures in a column line up: ages on the chart, the price, the seconds that pass. */
.palace .ages,
.twelve .middle,
#card-amount,
#wait-seconds {
  font-variant-numeric: tabular-nums;
}
/* Long lines of Japanese and Chinese break between phrases where the browser can tell them, not mid-word. */
html:lang(ja) .status,
html:lang(ja) .hint,
html:lang(ja) .says {
  word-break: auto-phrase;
}
/* Each name on the language switch is in its own language, whatever the page's: 中文 in Chinese shapes. */
.lang button[lang="zh-CN"] {
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
}

/* While the copier's ticket (or its waiting card) has the floor, the board of the hour steps aside: the ticket and its
   QR code are to be seen whole on one screen. */
body[data-ticket="on"] .moment {
  display: none;
}

/* The middle palace has no spirit: a faint dash in its place. */
.gong .spirit.none {
  opacity: 0.4;
}

/* ---- The words being spoken, as lines under the compass: above the board, where they are seen while talking.
   The teller's line shows its newest part: as more is said than four lines hold, the earliest lines go up and out of
   sight (it used to keep the first four and hide what was being said now). */
.teller .said {
  width: min(100%, 26rem);
  margin: 0 auto;
  text-align: center;
}
.teller .said:not(:has(p:not(:empty))) {
  display: none;
}
.said-teller {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  -webkit-line-clamp: unset;
  /* Exactly four lines high, with no padding above or below: what is cut off is cut between lines, never through one.
     The frame and its ground are drawn outside the box (outline and shadow), so they take no part in the cutting. */
  line-height: 1.6;
  max-height: calc(1.6em * 4);
  overflow: hidden;
  padding: 0 0.3rem;
  margin: 0.6rem 0.6rem;
  border-radius: 4px;
  background: rgba(13, 10, 31, 0.6);
  box-shadow: 0 0 0 0.6rem rgba(13, 10, 31, 0.6);
  outline: 1px solid rgba(240, 207, 122, 0.3);
  outline-offset: 0.6rem;
  color: var(--ink);
  text-align: left;
}
.said-teller:empty {
  display: none;
}
.said-me {
  text-align: left;
  padding: 0.4rem 0.9rem 0;
}
html:lang(zh) .said-me:not(:empty)::before {
  content: "你：";
}
html:lang(en) .said-me:not(:empty)::before {
  content: "You: ";
}
