:root {
  --ink: #2b1738;
  --muted: #76677d;
  --cream: #fffaf2;
  --paper: rgba(255, 252, 247, 0.82);
  --purple: #7d4c9b;
  --purple-dark: #4a2860;
  --coral: #e97767;
  --gold: #d6a448;
  --green: #4a8c72;
  --line: rgba(74, 40, 96, 0.14);
  --shadow: 0 22px 55px rgba(61, 31, 78, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(86, 55, 128, 0.35), transparent 30rem),
    radial-gradient(circle at 95% 55%, rgba(233, 119, 103, 0.18), transparent 34rem),
    linear-gradient(180deg, #10091c 0%, #21172c 42%, #f8f0e7 100%);
  font-family: "DM Sans", sans-serif;
}

.ambient {
  position: fixed;
  z-index: -2;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  filter: blur(1px);
  opacity: 0.55;
  pointer-events: none;
}

.ambient-one {
  top: -10rem;
  right: -8rem;
  background: #d8c1e7;
}

.ambient-two {
  bottom: -12rem;
  left: -9rem;
  background: #f2c3b5;
}

.grain {
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: 0.16;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
}

.page-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 70px 0 32px;
}

.countdown-screen {
  display: grid;
  min-height: 100vh;
  padding: 32px 18px;
  place-items: center;
}

.countdown-card {
  width: min(820px, 100%);
  padding: clamp(34px, 7vw, 76px);
  border: 1px solid rgba(74, 40, 96, 0.14);
  border-radius: 34px;
  background:
    radial-gradient(circle at 12% 12%, rgba(233, 119, 103, 0.18), transparent 28%),
    radial-gradient(circle at 90% 80%, rgba(125, 76, 155, 0.14), transparent 32%),
    rgba(255, 250, 242, 0.96);
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise 0.8s ease-out both;
}

.countdown-kicker {
  margin: 0;
  color: var(--coral);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.countdown-copy {
  max-width: 560px;
  margin: 0 auto 30px;
  color: var(--muted);
  line-height: 1.7;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.countdown-grid div {
  padding: 18px 10px;
  border: 1px solid rgba(74, 40, 96, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
}

.countdown-grid strong {
  display: block;
  color: var(--purple-dark);
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 1;
}

.countdown-grid span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero {
  max-width: 760px;
  margin: 0 auto 55px;
  text-align: center;
  animation: rise 0.8s ease-out both;
}

.mouse-hero {
  display: block;
  width: min(280px, 72vw);
  margin: 26px auto 18px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 32px;
  box-shadow: 0 24px 60px rgba(8, 5, 18, 0.45);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border: 1px solid rgba(125, 76, 155, 0.22);
  border-radius: 999px;
  color: #f6c775;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 5px rgba(233, 119, 103, 0.13);
}

h1,
h2 {
  font-family: "Fraunces", Georgia, serif;
}

h1 {
  margin: 24px 0 18px;
  font-size: clamp(3rem, 7vw, 5.75rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero h1 {
  color: white;
}

.countdown-card h1 {
  color: var(--ink);
}

.countdown-card h1 em {
  color: #3b224d;
}

h1 em {
  color: #f6c775;
  font-weight: 600;
}

.intro {
  max-width: 620px;
  margin: 0 auto;
  color: rgba(255,255,255,0.78);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.7;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  margin-top: 36px;
  color: rgba(255,255,255,0.7);
  font-size: 0.86rem;
}

.progress-copy strong {
  color: #f6c775;
}

.progress-track {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(74, 40, 96, 0.08);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.58);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--purple));
  transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stage-panel {
  max-width: 760px;
  margin: 0 auto 34px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 250, 242, 0.7);
  box-shadow: 0 12px 34px rgba(61, 31, 78, 0.08);
  text-align: center;
}

.stage-panel h2 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 5vw, 2.6rem);
}

.stage-panel p:last-of-type {
  max-width: 560px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.65;
}

.mini-countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin-top: 18px;
}

.mini-countdown span {
  display: grid;
  gap: 3px;
  padding: 11px 8px;
  border: 1px solid rgba(74, 40, 96, 0.12);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255,255,255,0.5);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mini-countdown strong {
  color: var(--purple-dark);
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.3rem, 5vw, 2rem);
  line-height: 1;
}

.code-form {
  max-width: 560px;
  margin: 20px auto 0;
  text-align: left;
}

.code-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--purple-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.code-form > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.code-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(74, 40, 96, 0.18);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255,255,255,0.72);
  font: inherit;
  font-weight: 700;
  padding: 0 14px;
}

.code-form input:focus {
  border-color: var(--purple);
  outline: 3px solid rgba(125, 76, 155, 0.15);
}

.code-form .primary-button {
  width: auto;
  margin: 0;
}

#code-feedback {
  min-height: 1.4em;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

#code-feedback[data-type="ok"] {
  color: var(--green);
}

#code-feedback[data-type="error"] {
  color: var(--coral);
}

.clue-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.clue-card {
  position: relative;
  min-height: 365px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(61, 31, 78, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  animation: rise 0.7s ease-out both;
}

.clue-card:nth-child(2) { animation-delay: 0.08s; }
.clue-card:nth-child(3) { animation-delay: 0.16s; }
.clue-card:nth-child(4) { animation-delay: 0.24s; }

.clue-card::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: 0;
  background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(223, 207, 235, 0.58));
  transition: opacity 0.4s ease;
}

.clue-card.unlocked {
  border-color: rgba(125, 76, 155, 0.36);
  box-shadow: var(--shadow);
  transform: translateY(-5px);
}

.clue-card.unlocked::before {
  opacity: 1;
}

.card-number,
.card-icon,
.card-copy,
.card-status {
  position: relative;
  z-index: 1;
}

.card-number {
  color: rgba(74, 40, 96, 0.42);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.card-icon {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 36px auto 28px;
  place-items: center;
  border: 1px dashed rgba(74, 40, 96, 0.3);
  border-radius: 50%;
  color: rgba(74, 40, 96, 0.48);
  background: rgba(255, 255, 255, 0.38);
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.55rem;
  transition: all 0.5s ease;
}

.unlocked .card-icon {
  border-style: solid;
  border-color: rgba(125, 76, 155, 0.2);
  color: white;
  background: linear-gradient(145deg, var(--coral), var(--purple));
  box-shadow: 0 12px 25px rgba(125, 76, 155, 0.23);
  transform: rotate(360deg);
}

.card-kicker {
  margin: 0 0 7px;
  color: var(--coral);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card-copy h2 {
  margin: 0 0 10px;
  font-size: 1.52rem;
}

.card-copy > p:not(.card-kicker) {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.unlocked-copy {
  display: none;
}

.unlocked .locked-copy {
  display: none;
}

.unlocked .unlocked-copy {
  display: block;
}

.unlocked-copy > span:first-child {
  display: block;
}

.next-hint-label {
  display: block;
  margin-top: 13px;
  color: var(--coral);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-copy .next-hint {
  display: block;
  margin-top: 4px;
  color: var(--purple-dark);
  font-weight: 600;
}

.card-status {
  position: absolute;
  right: 22px;
  bottom: 20px;
  left: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b9acbb;
}

.unlocked .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(74, 140, 114, 0.12);
}

.unlocked .status-text {
  color: var(--green);
}

.final-lock {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 720px;
  margin: 55px auto 0;
  padding: 25px 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 250, 242, 0.56);
}

.final-lock h2 {
  margin: 0 0 5px;
  font-size: 1.4rem;
}

.final-lock p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.lock-symbol {
  position: relative;
  flex: 0 0 58px;
  height: 64px;
}

.lock-shackle {
  position: absolute;
  top: 1px;
  left: 13px;
  width: 32px;
  height: 32px;
  border: 5px solid rgba(74, 40, 96, 0.35);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
}

.lock-body {
  position: absolute;
  bottom: 0;
  display: grid;
  width: 58px;
  height: 43px;
  place-items: center;
  border-radius: 12px;
  color: rgba(74, 40, 96, 0.64);
  background: #e7dce6;
}

.reveal {
  position: relative;
  margin-top: 55px;
  padding: clamp(44px, 8vw, 80px) 24px;
  overflow: hidden;
  border-radius: 32px;
  color: white;
  background:
    radial-gradient(circle at 10% 10%, rgba(233, 119, 103, 0.78), transparent 28%),
    radial-gradient(circle at 90% 100%, rgba(214, 164, 72, 0.4), transparent 31%),
    #4a2860;
  box-shadow: 0 30px 70px rgba(61, 31, 78, 0.25);
  text-align: center;
  animation: reveal-in 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.reveal-content {
  position: relative;
  z-index: 2;
  max-width: 700px;
  margin: 0 auto;
}

.reveal-kicker {
  margin: 0 0 15px;
  color: #f6c775;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.reveal h2 {
  margin: 0 0 18px;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  line-height: 1.03;
}

#surprise-text {
  max-width: 580px;
  margin: 0 auto 30px;
  color: rgba(255,255,255,0.8);
  line-height: 1.7;
}

.surprise-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 25px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 20px;
  background: rgba(255,255,255,0.09);
  backdrop-filter: blur(10px);
}

.surprise-label {
  color: #f6c775;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.surprise-box strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.surprise-box span:last-child {
  color: rgba(255,255,255,0.7);
}

.signature {
  margin: 30px 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.05rem;
  font-style: italic;
}

.gift-lock,
.gift-reveal {
  margin-top: 28px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 22px;
  background: rgba(255,255,255,0.09);
  text-align: center;
}

.gift-lock h3,
.gift-reveal h2 {
  margin: 0 0 10px;
  color: white;
  font-family: "Fraunces", Georgia, serif;
}

.gift-lock p:last-child {
  margin: 0;
  color: rgba(255,255,255,0.76);
  line-height: 1.6;
}

.friend-messages {
  margin-top: 38px;
  text-align: left;
}

.friend-kicker {
  margin: 0 0 8px;
  color: #f6c775;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.friend-messages h3 {
  margin: 0 0 22px;
  color: white;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.8rem, 6vw, 3rem);
  line-height: 1.05;
  text-align: center;
}

.friend-list {
  display: grid;
  gap: 14px;
}

.friend-card {
  display: grid;
  grid-template-columns: 122px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 22px;
  background: rgba(255,255,255,0.09);
  backdrop-filter: blur(10px);
}

.friend-link-card {
  color: inherit;
  text-decoration: none;
  transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}

.friend-link-card:hover {
  border-color: rgba(246, 199, 117, 0.5);
  background: rgba(255,255,255,0.13);
  transform: translateY(-2px);
}

.friend-link-card.viewed {
  border-color: rgba(74, 140, 114, 0.46);
}

.friend-link-card.viewed .friend-action {
  color: white;
  background: var(--green);
}

.friend-card.without-gallery {
  grid-template-columns: 1fr;
}

.friend-gallery {
  display: grid;
  gap: 7px;
}

.friend-photo {
  position: relative;
  display: grid;
  overflow: hidden;
  place-items: center;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(246, 199, 117, 0.42), rgba(233, 119, 103, 0.38));
  cursor: pointer;
  padding: 0;
}

.featured-photo {
  width: 122px;
  height: 122px;
  box-shadow: 0 18px 36px rgba(43, 23, 56, 0.22);
}

.friend-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.thumb-photo,
.more-photos {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
}

.more-photos {
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  background: rgba(43, 23, 56, 0.46);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.friend-photo::before {
  content: attr(data-initial);
  color: white;
  font-family: "Fraunces", Georgia, serif;
  font-size: 2.2rem;
}

.friend-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-photo.photo-missing img {
  display: none;
}

.friend-photo:focus-visible,
.more-photos:focus-visible,
.gallery-close:focus-visible,
.gallery-nav:focus-visible {
  outline: 3px solid #f6c775;
  outline-offset: 3px;
}

.friend-role {
  color: #f6c775;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.friend-content h4 {
  margin: 4px 0 6px;
  color: white;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
}

.friend-content p {
  margin: 0 0 12px;
  color: rgba(255,255,255,0.76);
  font-size: 0.9rem;
  line-height: 1.55;
}

.friend-video {
  display: block;
  width: 100%;
  max-height: 420px;
  margin: 12px 0;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 16px;
  background: rgba(0,0,0,0.18);
}

.friend-content audio {
  width: 100%;
  height: 36px;
}

.media-badge,
.friend-action {
  display: inline-flex;
  width: fit-content;
  margin: 3px 8px 0 0;
  padding: 6px 9px;
  border-radius: 999px;
  color: rgba(255,255,255,0.82);
  background: rgba(255,255,255,0.12);
  font-size: 0.72rem;
  font-weight: 700;
}

.friend-action {
  color: var(--purple-dark);
  background: #f6c775;
}

.friend-page-shell {
  width: min(880px, calc(100% - 28px));
  margin: 0 auto;
  padding: 32px 0 42px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 30px;
  color: var(--purple-dark);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.friend-page-hero {
  margin-bottom: 22px;
  text-align: center;
}

.friend-page-hero h1 {
  margin: 10px 0 8px;
}

.friend-page-hero p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.friend-detail-card {
  padding: clamp(18px, 5vw, 32px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 250, 242, 0.78);
  box-shadow: var(--shadow);
}

.friend-detail-card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.friend-detail-video {
  display: block;
  width: 100%;
  max-height: 78vh;
  margin: 0 0 18px;
  border-radius: 20px;
  background: rgba(0,0,0,0.2);
}

#friend-page-audio audio {
  width: 100%;
}

.friend-detail-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.friend-detail-photo {
  position: relative;
  overflow: hidden;
  min-height: 180px;
  border: 0;
  border-radius: 22px;
  background: rgba(74, 40, 96, 0.12);
  cursor: pointer;
  padding: 0;
}

.friend-detail-photo:first-child {
  grid-column: 1 / -1;
  min-height: 320px;
}

.friend-detail-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.confetti {
  position: absolute;
  inset: 0;
  opacity: 0.8;
  background-image:
    radial-gradient(circle, #f6c775 2px, transparent 3px),
    radial-gradient(circle, #ef9d90 2px, transparent 3px),
    radial-gradient(circle, #ffffff 1.5px, transparent 2.5px);
  background-position: 0 0, 40px 60px, 80px 20px;
  background-size: 110px 110px, 130px 130px, 90px 90px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

footer {
  padding: 45px 0 5px;
  color: rgba(74, 40, 96, 0.55);
  font-family: "Fraunces", Georgia, serif;
  font-size: 0.85rem;
  text-align: center;
}

.unlock-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 38px;
  border: 0;
  border-radius: 28px;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 30px 90px rgba(43, 23, 56, 0.35);
  text-align: center;
}

.unlock-dialog::backdrop {
  background: rgba(43, 23, 56, 0.62);
  backdrop-filter: blur(6px);
}

.unlock-dialog[open] {
  animation: dialog-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dialog-close {
  position: absolute;
  top: 15px;
  right: 17px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 1.6rem;
  cursor: pointer;
}

.dialog-burst {
  display: grid;
  width: 65px;
  height: 65px;
  margin: 0 auto 22px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, var(--coral), var(--purple));
  font-size: 1.6rem;
  box-shadow: 0 12px 30px rgba(125, 76, 155, 0.24);
}

.dialog-kicker {
  color: var(--coral);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.unlock-dialog h2 {
  margin: 8px 0 12px;
  font-size: 2rem;
}

.unlock-dialog #dialog-text {
  color: var(--muted);
  line-height: 1.6;
}

.unlock-dialog #dialog-text > span:first-child {
  display: block;
}

.dialog-hint-label {
  display: block;
  margin-top: 20px;
  color: var(--coral);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dialog-hint {
  display: block;
  margin-top: 6px;
  padding: 13px 15px;
  border: 1px solid rgba(125, 76, 155, 0.16);
  border-radius: 12px;
  color: var(--purple-dark);
  background: rgba(125, 76, 155, 0.07);
  font-weight: 600;
}

.primary-button {
  width: 100%;
  margin-top: 14px;
  padding: 14px 20px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: var(--purple-dark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 20px;
  bottom: 20px;
  max-width: calc(100% - 40px);
  padding: 13px 18px;
  border-radius: 12px;
  color: white;
  background: var(--purple-dark);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: all 0.3s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-dialog {
  width: min(980px, calc(100% - 22px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 0;
  overflow: hidden;
  border-radius: 24px;
  color: white;
  background: rgba(21, 11, 30, 0.96);
  box-shadow: 0 30px 90px rgba(0,0,0,0.45);
}

.gallery-dialog::backdrop {
  background: rgba(13, 8, 19, 0.78);
  backdrop-filter: blur(8px);
}

.gallery-dialog figure {
  display: grid;
  min-height: min(86vh, 820px);
  margin: 0;
  grid-template-rows: 1fr auto;
}

.gallery-dialog img {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
  background: rgba(0,0,0,0.18);
}

.gallery-dialog figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  color: rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.06);
}

.gallery-dialog figcaption strong {
  color: white;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.15rem;
}

.gallery-close,
.gallery-nav {
  position: absolute;
  z-index: 2;
  border: 0;
  color: white;
  background: rgba(43, 23, 56, 0.62);
  cursor: pointer;
}

.gallery-close {
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.8rem;
  line-height: 1;
}

.gallery-nav {
  top: 50%;
  width: 44px;
  height: 58px;
  border-radius: 16px;
  font-size: 2.5rem;
  transform: translateY(-50%);
}

.gallery-prev {
  left: 12px;
}

.gallery-next {
  right: 12px;
}

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

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(30px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 900px) {
  .clue-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .clue-card {
    min-height: 335px;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 24px, 1120px);
    padding-top: 40px;
  }

  .hero {
    margin-bottom: 35px;
  }

  h1 {
    font-size: 3.2rem;
  }

  .progress-copy {
    align-items: flex-end;
    gap: 20px;
    text-align: right;
  }

  .countdown-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mini-countdown {
    grid-template-columns: repeat(2, 1fr);
  }

  .code-form > div {
    grid-template-columns: 1fr;
  }

  .code-form .primary-button {
    width: 100%;
  }

  .clue-grid {
    grid-template-columns: 1fr;
  }

  .clue-card {
    min-height: 290px;
  }

  .card-icon {
    margin: 25px auto 20px;
  }

  .final-lock {
    align-items: flex-start;
    gap: 18px;
    padding: 22px;
  }

  .unlock-dialog {
    padding: 34px 24px 26px;
  }

  .friend-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
    border-radius: 18px;
  }

  .friend-gallery {
    grid-template-columns: 1fr;
  }

  .featured-photo {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    border-radius: 16px;
  }

  .friend-photo::before {
    font-size: 1.7rem;
  }

  .friend-content h4 {
    font-size: 1.1rem;
  }

  .friend-content p {
    font-size: 0.84rem;
  }

  .gallery-dialog {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .gallery-dialog figure {
    min-height: 100vh;
  }

  .gallery-dialog img {
    max-height: calc(100vh - 72px);
  }

  .gallery-dialog figcaption {
    padding: 13px 14px;
  }

  .gallery-nav {
    width: 38px;
    height: 52px;
    font-size: 2rem;
  }

  .friend-detail-gallery {
    grid-template-columns: 1fr;
  }

  .friend-detail-photo,
  .friend-detail-photo:first-child {
    min-height: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
