:root {
  color-scheme: light;
  --bg: #fffdf5;
  --bg-soft: #eaf7dc;
  --card: #ffffff;
  --card-strong: #d8efc3;
  --text: #1b331c;
  --muted: #53724a;
  --pink: #ff6fae;
  --red: #ef3f58;
  --peach: #ffe3b5;
  --green: #5da73a;
  --green-dark: #2f6b2b;
  --green-soft: #ccebb2;
  --shadow: 8px 8px 0 #b6d99b;
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  min-height: 100%;
  min-height: -webkit-fill-available;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  background:
    linear-gradient(90deg, rgba(93, 167, 58, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(93, 167, 58, 0.08) 1px, transparent 1px),
    var(--bg);
  background-size: 18px 18px;
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(#5da73a, #5da73a) 28px 96px / 6px 18px no-repeat,
    linear-gradient(#ff9cc6, #ff9cc6) 22px 90px / 18px 6px no-repeat,
    linear-gradient(#ff9cc6, #ff9cc6) 28px 84px / 6px 18px no-repeat,
    linear-gradient(#ffd74a, #ffd74a) 28px 90px / 6px 6px no-repeat,
    linear-gradient(#5da73a, #5da73a) calc(100% - 46px) 210px / 6px 18px no-repeat,
    linear-gradient(#ff9cc6, #ff9cc6) calc(100% - 52px) 204px / 18px 6px no-repeat,
    linear-gradient(#ff9cc6, #ff9cc6) calc(100% - 46px) 198px / 6px 18px no-repeat,
    linear-gradient(#ffd74a, #ffd74a) calc(100% - 46px) 204px / 6px 6px no-repeat,
    linear-gradient(#5da73a, #5da73a) 50% 74% / 6px 18px no-repeat,
    linear-gradient(#ff9cc6, #ff9cc6) calc(50% - 6px) calc(74% - 6px) / 18px 6px no-repeat,
    linear-gradient(#ff9cc6, #ff9cc6) 50% calc(74% - 12px) / 6px 18px no-repeat,
    linear-gradient(#ffd74a, #ffd74a) 50% calc(74% - 6px) / 6px 6px no-repeat;
}

body.is-locked {
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

main {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 28px 18px 56px;
}

section {
  margin: 0 0 42px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 11ch;
  font-size: clamp(3.1rem, 18vw, 6.2rem);
  line-height: 0.86;
  letter-spacing: -0.08em;
}

.hero-title {
  font-size: clamp(2.6rem, 15vw, 5.2rem);
}

h2 {
  font-size: clamp(2rem, 9vw, 4.2rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

p {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.music-gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background:
    linear-gradient(90deg, rgba(47, 107, 43, 0.1) 1px, transparent 1px),
    linear-gradient(180deg, rgba(47, 107, 43, 0.1) 1px, transparent 1px),
    #fffdf5;
  background-size: 18px 18px;
  overflow: hidden;
  transition: transform 900ms cubic-bezier(0.75, 0, 0.2, 1), opacity 700ms ease;
}

.music-gate::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(86vw, 56svh, 34rem);
  height: min(86vw, 56svh, 34rem);
  background: rgba(93, 167, 58, 0.16);
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 18px rgba(93, 167, 58, 0.08),
    0 0 0 36px rgba(93, 167, 58, 0.04);
}

.music-gate.is-hidden {
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
}

.music-card {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  padding: 28px;
  border: 4px solid var(--green-dark);
  border-radius: 0;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}

.music-card p {
  margin-bottom: 22px;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1.25;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 4px solid var(--green-dark);
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms steps(2, end), filter 120ms steps(2, end), background 120ms steps(2, end);
}

.primary-button {
  width: 100%;
  padding: 0 24px;
  background: var(--green);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 5px 5px 0 var(--green-dark);
}

.secondary-button {
  padding: 0 18px;
  background: var(--green-soft);
  color: var(--text);
  font-weight: 700;
  box-shadow: 4px 4px 0 var(--green-dark);
}

.secondary-button.is-hidden {
  display: none;
}

.primary-button:active,
.secondary-button:active {
  transform: scale(0.97);
  filter: brightness(0.98);
}

.hero {
  min-height: 95svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 18px;
  padding: 28px 0 38px;
}

.eyebrow {
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
}

.hero-text {
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.15rem;
}

.photo-story,
.angelica-scene,
.final-section,
.quote-card,
.arrival-section,
.chess-section,
.game-section {
  border: 4px solid var(--green-dark);
  border-radius: 0;
  background: var(--card);
  box-shadow: var(--shadow);
}

.photo-story,
.angelica-scene,
.arrival-section,
.chess-section,
.game-section,
.final-section {
  padding: 16px;
}

.photo-frame {
  position: relative;
  min-height: 230px;
  overflow: hidden;
  border: 4px solid var(--green-dark);
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(93, 167, 58, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(93, 167, 58, 0.12) 1px, transparent 1px),
    var(--bg-soft);
  background-size: 14px 14px;
}

.photo-frame-tall {
  min-height: 340px;
}

.story-copy {
  display: grid;
  gap: 12px;
  padding: 22px 4px 4px;
}

.text-story .story-copy {
  padding: 12px 4px 4px;
}

.quote-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 28px;
}

.quote-card p {
  color: var(--text);
  font-size: clamp(1.45rem, 8vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.flower-card {
  background:
    linear-gradient(#5da73a, #5da73a) 22px 26px / 6px 18px no-repeat,
    linear-gradient(#ff9cc6, #ff9cc6) 16px 20px / 18px 6px no-repeat,
    linear-gradient(#ff9cc6, #ff9cc6) 22px 14px / 6px 18px no-repeat,
    linear-gradient(#ffd74a, #ffd74a) 22px 20px / 6px 6px no-repeat,
    var(--card);
}

.softness-card {
  padding-bottom: 82px;
}

.pixel-heart-button {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 64px;
  height: 56px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform-origin: center;
  animation: pixelHeartBeat 780ms steps(2, end) infinite;
}

.pixel-heart-button span {
  position: absolute;
  display: block;
  left: 8px;
  top: 4px;
  width: 8px;
  height: 8px;
  background: var(--red);
  box-shadow:
    8px 0 0 var(--red),
    32px 0 0 var(--red),
    40px 0 0 var(--red),
    -8px 8px 0 var(--red),
    0 8px 0 var(--red),
    8px 8px 0 var(--red),
    16px 8px 0 var(--red),
    24px 8px 0 var(--red),
    32px 8px 0 var(--red),
    40px 8px 0 var(--red),
    48px 8px 0 var(--red),
    -8px 16px 0 var(--red),
    0 16px 0 var(--red),
    8px 16px 0 var(--red),
    16px 16px 0 var(--red),
    24px 16px 0 var(--red),
    32px 16px 0 var(--red),
    40px 16px 0 var(--red),
    48px 16px 0 var(--red),
    0 24px 0 var(--red),
    8px 24px 0 var(--red),
    16px 24px 0 var(--red),
    24px 24px 0 var(--red),
    32px 24px 0 var(--red),
    40px 24px 0 var(--red),
    8px 32px 0 var(--red),
    16px 32px 0 var(--red),
    24px 32px 0 var(--red),
    32px 32px 0 var(--red),
    16px 40px 0 var(--red),
    24px 40px 0 var(--red),
    24px 48px 0 var(--red);
}

.pixel-heart-button:active {
  transform: scale(0.92);
}

.gallery {
  display: grid;
  gap: 14px;
}

.gallery .photo-frame:nth-child(2) {
  min-height: 300px;
}

.travel-gallery .photo-frame:nth-child(2) {
  min-height: 230px;
}

.captioned-photo span {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  display: block;
  padding: 10px;
  border: 3px solid var(--green-dark);
  background: rgba(255, 253, 245, 0.92);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.25;
}

.blurred-photo img {
  filter: blur(38px);
  transform: scale(1.16);
}

.blurred-photo span {
  color: transparent;
}

.blurred-photo span::before {
  content: "⠿⠗⠁⠝⠙⠕⠍ ⠎⠑⠉⠗⠑⠞ ⠉⠕⠞⠊⠅";
  color: var(--text);
}

.blurred-photo.is-visible img {
  filter: none;
  transform: none;
}

.blurred-photo.is-visible span {
  color: var(--text);
}

.blurred-photo.is-visible span::before {
  content: none;
}

.photo-reveal-button {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  min-height: 52px;
  padding: 0 20px;
  border: 4px solid var(--green-dark);
  background: var(--green);
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  box-shadow: 5px 5px 0 var(--green-dark);
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.blurred-photo.is-visible .photo-reveal-button {
  display: none;
}

.angelica-scene {
  display: grid;
  gap: 20px;
}

.text-only-scene {
  display: block;
}

.text-only-scene div {
  display: grid;
  gap: 14px;
}

.angelica-character {
  position: relative;
  min-height: 260px;
  border-radius: 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(93, 167, 58, 0.14) 1px, transparent 1px),
    linear-gradient(180deg, rgba(93, 167, 58, 0.14) 1px, transparent 1px),
    #f3ffe9;
  background-size: 16px 16px;
}

.angelica-character span {
  position: absolute;
  left: 50%;
  bottom: 36px;
  width: 86px;
  height: 140px;
  border-radius: 0;
  background: #ff9cc6;
  transform: translateX(-50%);
  animation: floatAngelica 2.8s ease-in-out infinite;
}

.angelica-character span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -54px;
  width: 72px;
  height: 72px;
  border-radius: 0;
  background: #ffd0bc;
  transform: translateX(-50%);
  box-shadow: 0 -8px 0 14px #3a1728;
}

.angelica-character span::after {
  content: "♡";
  position: absolute;
  left: 50%;
  top: -84px;
  color: white;
  font-size: 2.4rem;
  transform: translateX(-50%);
}

.game-section {
  display: grid;
  gap: 14px;
}

.chess-section {
  display: grid;
  gap: 14px;
}

.game-description {
  color: var(--muted);
}

.game-shell {
  position: relative;
  overflow: hidden;
  border: 4px solid var(--green-dark);
  border-radius: 0;
  background: #f3ffe9;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  image-rendering: pixelated;
}

.chess-shell canvas {
  image-rendering: pixelated;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 20px;
  background: rgba(255, 253, 245, 0.78);
  text-align: center;
  transition: opacity 220ms ease;
}

.game-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.game-overlay strong {
  font-size: 1.5rem;
}

.game-overlay span {
  color: var(--muted);
}

.game-stats {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.game-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.game-controls [data-start-game] {
  grid-column: 1 / -1;
}

.arrival-section {
  display: grid;
  gap: 16px;
}

.arrival-form {
  display: grid;
  gap: 12px;
}

.arrival-form label {
  display: grid;
  gap: 7px;
  color: var(--green-dark);
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
}

.arrival-form select {
  width: 100%;
  min-height: 52px;
  padding: 0 12px;
  border: 4px solid var(--green-dark);
  border-radius: 0;
  background: #fffdf5;
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.arrival-button {
  margin-top: 4px;
}

.arrival-button.is-disabled {
  opacity: 0.48;
  pointer-events: none;
  filter: grayscale(0.6);
}

.final-section {
  display: grid;
  gap: 16px;
  min-height: 70svh;
  align-content: center;
}

.traffic-light {
  justify-self: center;
  display: grid;
  gap: 14px;
  width: 104px;
  padding: 18px;
  border: 5px solid var(--green-dark);
  border-radius: 0;
  background: #243527;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.12),
    5px 5px 0 #b6d99b;
}

.traffic-light span {
  display: block;
  width: 58px;
  height: 58px;
  border-radius: 0;
  background: #241920;
  box-shadow: inset 0 6px 12px rgba(0, 0, 0, 0.42);
}

.traffic-light span:nth-child(1) {
  background: #ff405f;
  box-shadow:
    0 0 30px rgba(255, 59, 95, 0.78),
    inset 0 6px 12px rgba(255, 255, 255, 0.28);
}

.traffic-light span:nth-child(2) {
  background: #4a351a;
}

.traffic-light span:nth-child(3) {
  background: #19401f;
}

.telegram-button {
  margin-top: 10px;
}

.instruction-section {
  padding: 14px;
  border: 3px solid var(--green-dark);
  background: var(--card);
  box-shadow: 4px 4px 0 #b6d99b;
}

.instruction-section p {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.35;
}

.certificate-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(47, 107, 43, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

.certificate-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.certificate-card {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(100%, 430px);
  padding: 30px 22px;
  border: 6px double var(--green-dark);
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(93, 167, 58, 0.1) 1px, transparent 1px),
    linear-gradient(180deg, rgba(93, 167, 58, 0.1) 1px, transparent 1px),
    #fffdf5;
  background-size: 16px 16px;
  color: var(--text);
  text-align: center;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

.certificate-card::before,
.certificate-card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(120, 73, 23, 0.34);
  pointer-events: none;
}

.certificate-card::after {
  inset: 18px;
}

.certificate-card h2 {
  color: var(--green-dark);
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(2rem, 10vw, 3.4rem);
  letter-spacing: -0.04em;
}

.certificate-card p {
  color: var(--muted);
}

.certificate-kicker {
  color: var(--green-dark);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.certificate-seal {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border: 4px solid #b01839;
  border-radius: 0;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.24), transparent 38%),
    #d11d45;
  color: #fff2f5;
  font-size: 3.2rem;
  box-shadow:
    0 0 0 8px rgba(176, 24, 57, 0.14),
    inset 0 0 0 3px rgba(255, 255, 255, 0.28);
}

.certificate-card .primary-button {
  position: relative;
  z-index: 1;
  margin-top: 8px;
}

.reveal {
  opacity: 0;
  transform: translateY(34px) scale(0.98);
  transition: opacity 750ms ease, transform 750ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@keyframes floatAngelica {
  0%,
  100% {
    transform: translate(-50%, 0);
  }

  50% {
    transform: translate(-50%, -12px);
  }
}

@keyframes pixelHeartBeat {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.18);
  }
}

@media (min-width: 680px) {
  main {
    padding-inline: 28px;
  }

  .photo-story,
  .angelica-scene {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }

  .text-story {
    grid-template-columns: 1fr;
  }

  .story-copy {
    padding: 18px;
  }

}
