:root {
  color-scheme: light;
  --paper: #f7f4ee;
  --ink: #151411;
  --blue: #2110ee;
  --lime: #c0ff16;
  --card-paper: #fff4dd;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: #e9e5dc;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, p { margin: 0; }
[hidden] { display: none !important; }

.oracle {
  width: min(100%, 460px);
  min-height: 100vh;
  min-height: 100svh;
  margin-inline: auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(26px, env(safe-area-inset-bottom));
  background: var(--paper);
}

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 7px 16px;
  padding-top: 12px;
  border-top: 3px solid var(--ink);
}

h1 {
  font-size: clamp(37px, 12.25vw, 58px);
  font-weight: 900;
  line-height: .91;
  letter-spacing: -.075em;
}

.stamp {
  display: grid;
  flex: none;
  place-items: center;
  width: 39px;
  height: 39px;
  margin-top: 5px;
  background: var(--lime);
}

.stamp svg { width: 27px; }

.stage {
  display: grid;
  place-items: center;
  height: min(130vw, 59svh, 515px);
  min-height: 300px;
  padding: clamp(20px, 5.2vw, 30px) 16px;
  background: radial-gradient(circle, #f8efff9c .65px, transparent 1px) center / 14px 14px, var(--blue);
  perspective: 1000px;
}

.card {
  position: relative;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 628 / 1108;
  transform-style: preserve-3d;
}

.card__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card__back {
  display: grid;
  place-items: center;
  color: var(--card-paper);
  background:
    radial-gradient(circle, #fff2 .45px, transparent .8px) 0 0 / 4px 4px,
    radial-gradient(circle, #13007380 .55px, transparent .9px) 1px 1px / 3px 3px,
    #2815df;
  border: 5px solid currentColor;
  border-radius: 8px;
  box-shadow: 6px 7px 0 #100b40;
}

.card__back::before {
  position: absolute;
  inset: 5px;
  border: 2px solid currentColor;
  border-radius: 2px;
  content: "";
}

.card__back svg { width: 49%; }

.registration {
  position: absolute;
  width: 16px;
  height: 16px;
  background:
    linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat;
}

.registration:nth-child(1) { top: 16px; left: 16px; }
.registration:nth-child(2) { top: 16px; right: 16px; }
.registration:nth-child(3) { bottom: 16px; left: 16px; }
.registration:nth-child(4) { bottom: 16px; right: 16px; }

.card__front {
  display: grid;
  place-items: center;
  transform: rotateY(180deg);
}

.card__front img {
  display: block;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 7px;
  filter: drop-shadow(6px 7px 0 #100b40);
}

.oracle.is-revealed .card { transform: rotateY(180deg); }
.oracle.is-animated .card { transition: transform 580ms cubic-bezier(.2,.63,.25,1); }
.oracle.is-animated #result { animation: appear 420ms 160ms both; }

@keyframes appear {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.reading { margin-top: 22px; }

.draw {
  display: flex;
  width: 100%;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border: 0;
  border-radius: 0;
  background: var(--lime);
  color: var(--ink);
  font: 820 clamp(19px, 6.5vw, 28px) / 1.1 system-ui, -apple-system, sans-serif;
  letter-spacing: -.045em;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.draw svg { width: 24px; flex: none; }
.draw:active { background: #aaf000; }
.draw:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.draw:disabled { cursor: progress; opacity: .8; }

.prediction {
  padding-inline: 7px;
  font-size: clamp(19px, 5.6vw, 25px);
  font-weight: 770;
  line-height: 1.14;
  letter-spacing: -.035em;
  text-wrap: pretty;
}

#result:focus { outline: none; }

.note {
  margin: 14px 7px 0;
  color: #423f39;
  font-size: 15px;
  line-height: 1.4;
}

.error { color: #8d2523; }

@media (prefers-reduced-motion: reduce) {
  .oracle.is-animated .card { transition: none; }
  .oracle.is-animated #result { animation: none; }
}
