@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;600&family=Lora:wght@500;600&display=swap");

:root {
  --paper: #f5e2b6;
  --paper-deep: #e9d19a;
  --paper-shadow: #d7c28f;
  --ink: #5f5b57;
  --ink-button: #77726e;
  --ink-soft: rgba(95, 91, 87, 0.35);
  --border-soft: rgba(95, 91, 87, 0.45);
  --accent: #8f3a2f;
  --accent-soft: rgba(143, 58, 47, 0.18);
  --accent-fill: rgba(143, 58, 47, 0.28);
  --bg-default-swatch: #edd9aa;
  --bg-sepia-swatch: #d5b48e;
  --bg-paper-swatch: #f5f1e9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Cormorant Garamond", "Garamond", "Times New Roman", serif;
  background: var(--paper);
}

body[data-background="sepia"] {
  --paper: #e6d0aa;
  --paper-deep: #d4b18a;
  --paper-shadow: #c4a27b;
}

body[data-background="paper"] {
  --paper: #f6f3ec;
  --paper-deep: #ebe5da;
  --paper-shadow: #ddd3c5;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 32px 20px 80px;
  position: relative;
}

.layout {
  width: min(960px, 92vw);
  display: grid;
  gap: 36px;
  align-items: center;
}

.illustration {
  width: min(440px, 92vw);
  padding: 12px 4px;
  display: grid;
  gap: 16px;
  place-items: center;
  transition: transform 1.2s ease;
}

.picture {
  width: min(320px, 70vw);
  aspect-ratio: 1 / 1;
  display: block;
  object-fit: contain;
  transition: transform 2.4s ease, filter 2.4s ease;
}

.illustration.solved .picture {
  filter: drop-shadow(0 10px 20px rgba(143, 58, 47, 0.2));
}

.caption {
  margin: 0;
  min-height: 1.6em;
  font-size: clamp(1.75rem, 1.2vw + 1.25rem, 2.5rem);
  opacity: 0;
  transition: opacity 2.6s ease 0s;
}

.illustration.solved .caption {
  opacity: 1;
  transition-delay: 1s;
}

.caption .hit {
  color: var(--accent);
  font-weight: 600;
}

.choices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  width: min(520px, 92vw);
}

.choices button {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: transparent;
  -webkit-text-stroke: 2px;
  -webkit-text-stroke-color: var(--ink-button);
  font-family: "Lora", "Cormorant Garamond", serif;
  font-size: clamp(3.4rem, 5.3vw + 1.2rem, 5.4rem);
  padding: 20px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition:
    transform 2s ease,
    opacity 2s ease,
    border-color 2s ease,
    color 2s ease,
    -webkit-text-stroke 2s ease,
    -webkit-text-stroke-color 2s ease,
    box-shadow 2s ease;
  box-shadow: none;
}

.choices button:hover {
  transform: translateY(-2px);
}

.choices button.correct {
  color: var(--accent);
  -webkit-text-stroke-color: transparent;
  box-shadow: none;
}

.choices button.faded {
  opacity: 0;
  transform: none;
  pointer-events: none;
}

.controls {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  align-items: flex-end;
  z-index: 2;
}

.control-button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: "Lora", "Cormorant Garamond", serif;
  font-size: 1.05rem;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: color 1.6s ease;
  line-height: 1;
}

.control-button:hover {
  color: var(--ink);
}

.menu-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--ink);
  display: grid;
  place-items: center;
}

.menu-toggle svg {
  width: 22px;
  height: 22px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.options-menu {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  background-color: var(--paper);
  background-image: none;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.controls.is-open .options-menu {
  opacity: 1;
  transform: translateY(-8px) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.sound-toggle {
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sound-toggle svg {
  width: 22px;
  height: 22px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.sound-toggle .sound-off-icon {
  display: none;
}

.sound-toggle.is-off .sound-on-icon {
  display: none;
}

.sound-toggle.is-off .sound-off-icon {
  display: block;
}

.mode-toggle {
  width: 44px;
  text-align: center;
}

.background-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--bg-default-swatch);
  transition: transform 1.2s ease;
}

.background-toggle:hover {
  transform: translateY(-1px);
}

.background-toggle[data-mode="sepia"] {
  background: var(--bg-sepia-swatch);
}

.background-toggle[data-mode="paper"] {
  background: var(--bg-paper-swatch);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(320px, 1fr) minmax(260px, 1fr);
    align-items: center;
  }

  .caption {
    font-size: clamp(2.25rem, 1.6vw + 1.5rem, 3.25rem);
  }

  .choices {
    grid-template-columns: 1fr;
    width: min(380px, 40vw);
  }

  .choices button {
    max-width: 300px;
    justify-self: start;
    font-size: clamp(4.4rem, 6.5vw + 1.2rem, 7rem);
  }

  .choices button:nth-child(2) {
    margin-left: clamp(60px, 12%, 120px);
  }

  .choices button:nth-child(3) {
    margin-left: clamp(120px, 24%, 240px);
  }
}

@media (max-width: 600px) {
  .layout {
    gap: 18px;
  }

  .illustration {
    gap: 10px;
  }

  .choices {
    gap: 8px;
  }

  .choices button {
    padding: 14px 10px;
  }

  .caption {
    font-size: clamp(2.4rem, 2.6vw + 1.75rem, 3.4rem);
  }

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

@media (max-width: 420px) {
  .layout {
    gap: 12px;
  }

  .illustration {
    gap: 8px;
  }
}
