:root {
  --deep: #1c1917;
  --light: #faf7f2;
  --clay: #c2410c;
  --teal: #0d9488;
  --stone: #78716c;
  --gold: #d97706;
  --moss: #365314;
  --warm-border: #8b7355;
  --soft-stone: #a8a29e;
  --body: #44403c;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; overflow: hidden; }

body {
  background: var(--deep);
  color: var(--body);
  font-family: "DM Sans", Inter, system-ui, sans-serif;
}

.quest-grid {
  width: 100vw;
  height: 100vh;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 6px;
  grid-template-areas:
    "hero hero hero brand sphere thread"
    "hero hero hero plates shard thread"
    "roots roots kintsugi kintsugi timer thread"
    "roots roots converge converge timer thread";
  background: var(--deep);
}

.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--warm-border);
  border-radius: 2px;
  background: var(--light);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: pointer;
}

.hero { grid-area: hero; }
.brand { grid-area: brand; }
.sphere { grid-area: sphere; }
.thread { grid-area: thread; }
.plates { grid-area: plates; }
.shard { grid-area: shard; }
.timer { grid-area: timer; }
.roots { grid-area: roots; }
.kintsugi { grid-area: kintsugi; }
.converge { grid-area: converge; }

.reveal, .cover {
  position: absolute;
  inset: 0;
  padding: clamp(16px, 2.2vw, 34px);
}

.reveal {
  background: var(--light);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 1;
}

.cover {
  z-index: 3;
  transition: transform 600ms var(--ease), filter 600ms var(--ease);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  color: var(--light);
  isolation: isolate;
}

.cell.revealed .cover, .cell:hover .cover { filter: saturate(1.1); }
.cell[data-reveal="up"].revealed .cover, .cell[data-reveal="up"]:hover .cover { transform: translateY(-105%); }
.cell[data-reveal="down"].revealed .cover, .cell[data-reveal="down"]:hover .cover { transform: translateY(105%); }
.cell[data-reveal="left"].revealed .cover, .cell[data-reveal="left"]:hover .cover { transform: translateX(-105%); }
.cell[data-reveal="right"].revealed .cover, .cell[data-reveal="right"]:hover .cover { transform: translateX(105%); }

.cell.invite { animation: inviteGlow 1050ms var(--ease) 1; }

@keyframes inviteGlow {
  0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-color: var(--warm-border); }
  45% { box-shadow: 0 0 24px rgba(217, 119, 6, 0.3); border-color: var(--gold); }
}

h1, h2 {
  font-family: "Barlow Condensed", Impact, sans-serif;
  margin: 0;
  color: var(--deep);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 0.92;
  position: relative;
  z-index: 2;
}

h1 { font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 800; }
h2 { font-size: clamp(1.85rem, 3.6vw, 3.2rem); font-weight: 800; }
p {
  margin: 14px 0 0;
  max-width: 44ch;
  font-size: clamp(0.875rem, 1.5vw, 1.05rem);
  line-height: 1.65;
  color: var(--body);
  position: relative;
  z-index: 2;
}

.meta {
  font-family: "Overpass Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--soft-stone);
  position: relative;
  z-index: 4;
  margin-bottom: 12px;
}

.vertical { writing-mode: vertical-rl; text-orientation: mixed; margin: 0 auto; }

.dark-reveal, .timer-reveal, .thread-reveal { background: var(--deep); color: var(--light); }
.dark-reveal h2, .timer-reveal h2, .timer-read { color: var(--light); }
.dark-reveal p, .timer-reveal p, .thread-reveal p { color: var(--light); }

.cover-stone { background: radial-gradient(circle at 28% 25%, #78716c 0 11%, transparent 12%), linear-gradient(135deg, #1c1917, #44403c 46%, #365314); }
.cover-clay { background: linear-gradient(160deg, #c2410c, #8b7355 70%, #1c1917); font-family: "Barlow Condensed"; font-size: 3rem; line-height: .85; letter-spacing: .12em; }
.cover-water { background: radial-gradient(circle at 50% 70%, rgba(13,148,136,.7), transparent 32%), linear-gradient(45deg, #faf7f2, #a8a29e); color: var(--deep); }
.cover-moss { background: linear-gradient(90deg, #365314, #1c1917), radial-gradient(circle, #0d9488 0 2px, transparent 3px); background-size: auto, 18px 18px; animation: mossCreep 30s ease-in-out infinite alternate; }
.cover-ceramic { background: repeating-linear-gradient(165deg, #faf7f2 0 12px, #a8a29e 13px 14px), linear-gradient(#8b7355, #faf7f2); color: var(--deep); }
.cover-copper { background: radial-gradient(circle at 70% 30%, #d97706, transparent 22%), linear-gradient(135deg, #8b7355, #c2410c 52%, #1c1917); }
.cover-dark { background: #1c1917; font-family: "Barlow Condensed"; font-size: clamp(2rem, 4vw, 4rem); line-height: .82; color: #d97706; }
.cover-roots { background: linear-gradient(130deg, #faf7f2, #78716c), radial-gradient(circle at 20% 90%, #365314 0 20%, transparent 21%); color: var(--deep); }
.cover-gold { background: linear-gradient(110deg, #44403c 0 48%, #d97706 49% 51%, #faf7f2 52%); color: var(--deep); }
.cover-teal { background: linear-gradient(140deg, #0d9488, #365314 70%, #1c1917); }

@keyframes mossCreep { from { background-size: auto, 18px 18px; } to { background-size: auto, 22px 22px; } }

.hero-reveal {
  background: radial-gradient(circle at 78% 22%, rgba(13,148,136,.18), transparent 28%), radial-gradient(circle at 20% 90%, rgba(194,65,12,.2), transparent 30%), var(--light);
}

.stone-arch {
  position: absolute;
  border: 28px solid #44403c;
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  opacity: .88;
  filter: contrast(1.2);
  animation: stoneTurn 120s linear infinite alternate;
}
.stone-arch::after {
  content: "";
  position: absolute;
  inset: -30px;
  background: radial-gradient(circle at 15% 40%, #365314 0 5%, transparent 6%), radial-gradient(circle at 74% 8%, #365314 0 4%, transparent 5%);
  mix-blend-mode: multiply;
}
.arch-one { width: 42%; height: 56%; right: 6%; top: 12%; transform: rotate(-12deg); }
.arch-two { width: 31%; height: 41%; right: 30%; top: 24%; border-color: #78716c; animation-duration: 90s; }
@keyframes stoneTurn { to { transform: rotateY(.5deg) rotate(-9deg) translateY(-6px); } }

.crack-map, .roots-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.crack-map path, .roots-svg path { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 720; stroke-dashoffset: 720; animation: drawCrack 2.8s var(--ease) forwards; opacity: .72; }
@keyframes drawCrack { to { stroke-dashoffset: 0; } }

.clay-sphere {
  width: min(150px, 54%); aspect-ratio: 1;
  border-radius: 50%;
  margin: auto auto 16px;
  background: radial-gradient(circle at 35% 28%, #d97706, #c2410c 38%, #8b7355 70%);
  box-shadow: inset -18px -22px 0 rgba(28,25,23,.18), 0 18px 0 rgba(13,148,136,.22);
  animation: floatObj 10s ease-in-out infinite alternate;
}
.sphere-reveal { background: linear-gradient(to top, rgba(13,148,136,.25) 0 28%, #faf7f2 29%); }
@keyframes floatObj { to { transform: translateY(-10px) rotate(2deg); } }

.plate-stack { position: relative; height: 145px; margin-bottom: 12px; }
.plate-stack i { position: absolute; left: 8%; right: 8%; height: 20px; border-radius: 50%; background: #faf7f2; border: 1px solid #78716c; box-shadow: 0 7px 0 rgba(217,119,6,.32); animation: floatObj 8s ease-in-out infinite alternate; }
.plate-stack i:nth-child(1){ top: 14px; } .plate-stack i:nth-child(2){ top: 48px; animation-delay: -1s; } .plate-stack i:nth-child(3){ top: 82px; animation-delay: -2s; } .plate-stack i:nth-child(4){ top: 116px; animation-delay: -3s; }

.shards { position: absolute; inset: 8%; }
.shards i { position: absolute; width: 54px; height: 62px; background: #8b7355; clip-path: polygon(48% 0,100% 36%,78% 100%,18% 82%,0 22%); animation: shardSpin 28s linear infinite; }
.shards i:nth-child(1){ left: 10%; top: 18%; background:#c2410c; }.shards i:nth-child(2){ right: 16%; top: 12%; background:#44403c; animation-duration:34s; }.shards i:nth-child(3){ left: 44%; top: 40%; background:#d97706; animation-duration:31s; }.shards i:nth-child(4){ left: 20%; bottom: 8%; background:#78716c; animation-duration:39s; }.shards i:nth-child(5){ right: 10%; bottom: 18%; background:#0d9488; animation-duration:29s; }
@keyframes shardSpin { to { transform: rotate(360deg) translateY(-8px); } }

.thread-reveal { align-items: center; justify-content: center; padding: 8px; }
.thread-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.path { fill: none; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 95 26; animation: threadRun 8s linear infinite; opacity: .92; }
.path-a, .path-c { stroke: var(--clay); }
.path-b, .path-d { stroke: var(--teal); }
.path-b { animation-duration: 11s; }.path-c { animation-duration: 13s; }.path-d { animation-duration: 17s; }
@keyframes threadRun { to { stroke-dashoffset: -600; } }
.pulse-point { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 0 rgba(217,119,6,.5); opacity: 0; transform: translate(-50%, -50%); }
.pulse-point.active { animation: radialPulse 800ms var(--ease); }
@keyframes radialPulse { 0% { opacity: 1; box-shadow: 0 0 0 0 rgba(217,119,6,.55); } 100% { opacity: 0; box-shadow: 0 0 0 34px rgba(217,119,6,0); } }

.timer-read { font-family: "Overpass Mono", monospace; font-size: clamp(2rem, 5vw, 4.8rem); letter-spacing: -.06em; margin: 10px 0; }
.roots-reveal { background: radial-gradient(circle at 88% 84%, rgba(54,83,20,.28), transparent 30%), #faf7f2; }
.roots-svg path { stroke: var(--moss); animation-duration: 3.6s; }
.kintsugi-reveal { background: linear-gradient(90deg, #faf7f2 0 48%, rgba(217,119,6,.22) 49% 51%, #faf7f2 52%); }
.converge-reveal { background: var(--teal); }
.converge-reveal h2, .converge-reveal p { color: var(--light); }

.dust-field { position: fixed; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.dust { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: var(--gold); opacity: .45; animation: dustDrift var(--drift, 24s) linear infinite; }
@keyframes dustDrift { from { transform: translate3d(0, 105vh, 0); opacity: 0; } 20% { opacity: .5; } to { transform: translate3d(var(--wind, 40px), -8vh, 0); opacity: 0; } }

@media (max-width: 980px) {
  html, body { overflow: auto; }
  .quest-grid { min-height: 100vh; height: auto; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(7, minmax(180px, 1fr)); grid-template-areas: "hero hero thread" "hero hero thread" "brand sphere thread" "plates shard thread" "roots roots timer" "kintsugi kintsugi timer" "converge converge converge"; }
}

@media (max-width: 640px) {
  .quest-grid { display: flex; flex-direction: column; height: auto; min-height: 100vh; }
  .cell { min-height: 220px; }
  .hero { min-height: 460px; }
  .thread { min-height: 520px; }
  html, body { overflow: auto; }
}
