:root {
  color-scheme: dark;
  --ink: #17120f;
  --paper: #f3ead8;
  --feather: #e8cc91;
  --ash: #40342b;
  --line: rgba(232, 204, 145, .28);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
}

body {
  min-height: 100svh;
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.oracle-stage {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(18px, 3.2vh, 34px) clamp(16px, 4vw, 46px) clamp(18px, 3vh, 36px);
}

.oracle-stage::before,
.oracle-stage::after {
  position: absolute;
  z-index: -1;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(242, 219, 161, .62);
  box-shadow: 9vw 14vh rgba(242, 219, 161, .24), 21vw 71vh rgba(242, 219, 161, .38), 37vw 21vh rgba(242, 219, 161, .23), 54vw 79vh rgba(242, 219, 161, .34), 72vw 28vh rgba(242, 219, 161, .21), 88vw 61vh rgba(242, 219, 161, .32);
  content: "";
}

.oracle-stage::before { top: 8vh; left: 6vw; }
.oracle-stage::after { right: 12vw; bottom: 14vh; opacity: .65; }

.oracle-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 760px);
  margin: 0 auto;
}

.oracle-site-badge,
.oracle-section-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid rgba(244, 207, 134, .25);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(42, 22, 34, .78), rgba(75, 31, 56, .42));
  box-shadow: 0 8px 20px rgba(0, 0, 0, .22), 0 0 0 1px rgba(244, 207, 134, .08) inset;
  color: #f8ead8;
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
}

.oracle-site-badge:hover,
.oracle-site-badge:focus-visible {
  color: #f8ead8;
  text-decoration: none;
}

.oracle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.45vw, 16px);
  width: min(88vw, 660px);
  height: min(76svh, 620px);
  min-height: 292px;
  margin: auto;
}

.oracle-tile {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(243, 234, 216, .035);
  color: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .018), 0 12px 30px rgba(0, 0, 0, .12);
  font: inherit;
  pointer-events: none;
  transition: border-color .35s ease, background-color .35s ease, box-shadow .35s ease, transform .22s cubic-bezier(.22, 1, .36, 1);
}

.oracle-tile::after {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(232, 204, 145, .06);
  border-radius: 4px;
  content: "";
}

.oracle-word {
  position: relative;
  z-index: 1;
  max-width: calc(100% - 22px);
  overflow-wrap: anywhere;
  color: rgba(243, 234, 216, .94);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(16px, 3.15vw, 28px);
  font-style: italic;
  line-height: 1.08;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .52);
}

.oracle-tile--awakened {
  border-color: rgba(238, 207, 137, .78);
  background: rgba(232, 204, 145, .1);
  box-shadow: inset 0 0 22px rgba(232, 204, 145, .1), 0 0 22px rgba(232, 204, 145, .12);
  transform: translateY(2px) scale(.985);
}

.oracle-tile--awakened .oracle-word { animation: oracle-word-arrival .65s cubic-bezier(.22, 1, .36, 1) both; }

.oracle-raven {
  position: absolute;
  z-index: 4;
  width: 60px;
  height: 94px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: none;
  transition: left var(--oracle-flight-duration, 900ms) cubic-bezier(.35, .02, .22, 1), top var(--oracle-flight-duration, 900ms) cubic-bezier(.35, .02, .22, 1), opacity .7s cubic-bezier(.22, 1, .36, 1);
  will-change: left, top, opacity;
}

.oracle-raven--visible { opacity: 1; }

.oracle-raven__body {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: scaleX(var(--oracle-raven-dir, -1));
  transform-origin: 50% 80%;
}

.oracle-raven__sprite {
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 56px;
  height: 90px;
  clip-path: inset(0 4px 0 4px);
  filter: drop-shadow(0 4px 7px rgba(0, 0, 0, .48));
  object-fit: contain;
  object-position: center bottom;
  transform: translateX(-50%);
  user-select: none;
}

.oracle-raven__shadow {
  position: absolute;
  bottom: 12px;
  left: 50%;
  width: 24px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .32);
  filter: blur(2px);
  opacity: .68;
  transform: translateX(-50%);
}

.oracle-raven--flying .oracle-raven__body { animation: oracle-flight-body var(--oracle-flight-duration, 900ms) ease-in-out 1; }
.oracle-raven--flying .oracle-raven__shadow { opacity: .12; transform: translateX(-50%) scale(.6); }
.oracle-raven--flying,
.oracle-raven--flap,
.oracle-raven--flying .oracle-raven__body,
.oracle-raven--flap .oracle-raven__body { overflow: visible; }
.oracle-raven--flying .oracle-raven__sprite,
.oracle-raven--flap .oracle-raven__sprite { clip-path: none; }
.oracle-raven--look .oracle-raven__sprite { animation: oracle-look .9s ease-in-out 1; }
.oracle-raven--peck .oracle-raven__sprite { animation: oracle-peck .86s ease-in-out 1; }
.oracle-raven--preen .oracle-raven__sprite { animation: oracle-preen 1.08s ease-in-out 1; }
.oracle-raven--flap .oracle-raven__body { animation: oracle-idle-flap .72s ease-in-out 1; }

@keyframes oracle-word-arrival {
  0% { opacity: 0; transform: translateY(6px) scale(.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes oracle-flight-body {
  0%, 100% { transform: scaleX(var(--oracle-raven-dir, -1)) translateY(0); }
  46% { transform: scaleX(var(--oracle-raven-dir, -1)) translateY(-8px); }
  74% { transform: scaleX(var(--oracle-raven-dir, -1)) translateY(-3px); }
}

@keyframes oracle-look {
  0%, 100% { transform: translateX(-50%); }
  32% { transform: translateX(-54%) rotate(-1deg); }
  68% { transform: translateX(-46%) rotate(1deg); }
}

@keyframes oracle-peck {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  48% { transform: translateX(-50%) translateY(4px) rotate(2deg); }
}

@keyframes oracle-preen {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  35% { transform: translateX(-52%) rotate(-2deg); }
  68% { transform: translateX(-48%) translateY(1px) rotate(2deg); }
}

@keyframes oracle-idle-flap {
  0%, 100% { transform: scaleX(var(--oracle-raven-dir, -1)) translateY(0); }
  40% { transform: scaleX(var(--oracle-raven-dir, -1)) translateY(-7px) rotate(2deg); }
  72% { transform: scaleX(var(--oracle-raven-dir, -1)) translateY(-2px) rotate(-1deg); }
}

@media (max-width: 620px) {
  .oracle-stage { padding-top: 18px; }
  .oracle-topbar { width: 100%; }
  .oracle-grid { width: min(92vw, 520px); height: min(73svh, 540px); min-height: 250px; }
  .oracle-raven { width: 52px; height: 82px; }
  .oracle-raven__sprite { width: 48px; height: 78px; }
}

@media (max-height: 620px) {
  .oracle-grid { height: min(76svh, 430px); min-height: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  .oracle-raven,
  .oracle-raven__body,
  .oracle-raven__sprite,
  .oracle-tile,
  .oracle-word {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
