@import url("https://fonts.googleapis.com/css2?family=Mochiy+Pop+One&family=Noto+Sans+JP:wght@300;400;700&display=swap");

:root {
  --font-primary: "Noto Sans JP", "Helvetica Neue", Arial,
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  --font-heading: "Mochiy Pop One", sans-serif;

  --bg-color: #ffeef2;
  --text-color: #333333;
  --text-secondary-color: #6a6a6a;
  --section-bg-alt: #ffffff;
  --navbar-bg: rgba(255, 255, 255, 0.9);
  --navbar-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --dropdown-bg: #ffffff;
  --dropdown-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  --dropdown-item-hover-bg: #ffe0e6;
  --card-bg: #ffffff;
  --card-shadow: 0 7px 20px rgba(40, 50, 60, 0.05);

  --accent-color: #ff69b4;
  --accent-color-darker: #e04a99;
  --accent-color-rgb: 255, 105, 180;
  --accent-text-color: #ffffff;
  --link-color: var(--accent-color);
  --link-hover-color: var(--accent-color-darker);

  --modal-bg: rgba(0, 0, 0, 0.65);
  --modal-content-bg: #ffffff;
  --input-border-color: #ffcdd2;
  --input-focus-border-color: var(--accent-color);
  --skill-bar-bg: #f8e0e6;

  --hr-color: #ffcdd2;

  --maron-bg: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
  --maron-hacked-bg: rgba(255, 255, 255, 0.95);
  --maron-compliment-border: var(--accent-color);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: auto;
  font-size: 16px;
}
body {
  font-family: var(--font-primary);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.7;
  transition: background-color 0.2s, color 0.2s;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1300px;
  margin: 0;
}
.content-box {
  max-width: 750px;
  margin-left: auto;
  margin-right: auto;
}

.navbar {
  background-color: var(--navbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0.75rem 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: var(--navbar-shadow);
  transition: background-color 0.2s, box-shadow 0.2s, padding 0.2s;
}
.navbar.scrolled {
  padding: 0.5rem 0;
}

.navbar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.nav-logo a {
  display: flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-logo a:hover {
  color: var(--accent-color);
}
.nav-logo-icon {
  height: 38px;
  margin-right: 0.8rem;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.1));
}

.nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
}
.nav-item {
  margin-left: 1.5rem;
  position: relative;
}
.nav-link {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.6rem 0.2rem;
  transition: color 0.2s ease;
  position: relative;
  display: block;
  font-weight: 500;
}
.nav-link:hover,
.nav-link.active {
  color: var(--accent-color);
}

.nav-link.active::before {
  content: "";
  position: absolute;
  bottom: 0.2rem;
  left: 0;
  width: 100%;
  height: 2px;
  background-image: linear-gradient(
    90deg,
    var(--accent-color-darker),
    var(--accent-color)
  );
  background-color: var(--accent-color);
  border-radius: 1px;
  animation: growUnderline 0.3s ease-out;
}
@keyframes growUnderline {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  display: none;
}

.theme-toggle-switch {
  display: none;
}
.nav-item-mobile-control {
  display: none;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  color: var(--text-color);
  font-size: 0.95rem;
  font-weight: 500;
}

main > section {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 80px 20px 60px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.165, 0.84, 0.44, 1),
    transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
  position: relative;
}

main > section.active-section {
  display: flex;
}

.timeline-chapter.visible,
.polaroid.fade-in {
  opacity: 1;
  transform: translateY(0) rotate(calc(var(--rotation) * 1deg));
  transition: opacity 1s ease, transform 1s ease;
}

main > section:nth-child(even) {
  background-color: var(--section-bg-alt);
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 5vw, 3rem);
  margin-bottom: 3rem;
  color: var(--accent-color);
  font-weight: lighter;
  position: relative;
  padding-bottom: 0.8rem;
}
.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background-image: linear-gradient(
    90deg,
    var(--accent-color-darker) 0%,
    var(--accent-color) 100%
  );
  background-color: var(--accent-color);
  border-radius: 2px;
}
.section-intro {
  max-width: 700px;
  color: var(--text-secondary-color);
  font-size: 1.1rem;
}

.main-button {
  background-image: linear-gradient(
    135deg,
    var(--accent-color) 0%,
    var(--accent-color-darker) 100%
  );
  background-color: var(--accent-color);
  color: var(--accent-text-color);
  padding: 15px 30px;
  font-size: 1.2em;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: background-image 0.3s ease, transform 0.2s ease,
    box-shadow 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  background-size: 200% auto;
  background-position: 0% 0%;
}
.main-button:hover {
  background-position: 100% 0%;
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}
.main-button:active {
  animation: buttonPress 0.1s ease-out forwards;
}

#opening {
  min-height: 100vh;
  background: linear-gradient(135deg, #fef0f4 0%, #ffc4d3 100%);
  color: var(--text-color);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.cat-paw-animation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  z-index: 0;
  opacity: 0.6;
}
.cat-paw-animation img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: pawMove 2s ease-in-out infinite;
}
.opening-content {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.3);
  padding: 40px 50px;
  border-radius: 20px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
  max-width: 800px;
  width: 100%;
}

#opening h1 {
  font-family: var(--font-heading);
  font-size: 3.5em;
  margin-bottom: 0.2em;
  animation: fadeInDown 0.8s ease-out;
  color: var(--accent-color);
}
#opening p {
  font-size: 1.5em;
  margin-bottom: 1.5em;
  animation: fadeInUp 0.8s ease-out 0.2s;
  animation-fill-mode: backwards;
}

#timeline {
  background-color: var(--bg-color);
}

.timeline-container {
  width: 100%;
  max-width: 900px;
  margin: 50px auto;
  position: relative;
}
.timeline-container::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background-color: var(--hr-color);
  transform: translateX(-50%);
  z-index: -10;
}

.timeline-chapter {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 80px;
  position: relative;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
}

.timeline-chapter:last-child {
  margin-bottom: 0;
}

.timeline-chapter::before {
  content: "";
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background-color: var(--bg-color);
  border: 4px solid var(--accent-color);
  border-radius: 50%;
  z-index: 2;
}

.chapter-content {
  background-color: var(--card-bg);
  padding: 40px;
  border-radius: 15px;
  text-align: center;
  width: 90%;
  max-width: 700px;
  box-shadow: var(--card-shadow);
  position: relative;
  z-index: 2;
  margin-top: 30px;

  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-chapter h3 {
  font-family: var(--font-heading);
  font-size: 2.2em;
  color: var(--accent-color);
  margin-bottom: 1em;
  position: relative;
  display: inline-block;
  font-weight: lighter;
  order: 1;
}
.timeline-chapter h3::after {
  content: "";
  display: block;
  width: 60%;
  height: 3px;
  background-color: var(--accent-color);
  margin: 10px auto 0;
  border-radius: 5px;
}

.chapter-visual {
  order: 2;
  width: 100%;
}
.chapter-visual img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  background-color: #f0f0f0;
}

.chapter-visual p {
  text-align: center;
}

.gallery-slider {
  margin: 20px 0;
  display: flex;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  justify-content: center;
  flex-direction: column;
}

.gallery-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.gallery-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background-color: #f0f0f0;
}

.hover-comment {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px;
  font-size: 0.9em;
  text-align: center;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-item:hover .hover-comment {
  opacity: 1;
  transform: translateY(0);
}

.gallery-instruction {
  font-size: 0.9em;
  color: var(--text-secondary-color);
  margin-top: 20px;
}

.timeline-navigation {
  margin-top: 40px;
}
.timeline-navigation .main-button,
.scrapbook-navigation .main-button,
.maron-navigation .main-button {
  min-width: 200px;
}

.mini-quiz {
  background-color: var(--bg-color);
  padding: 30px;
  border-radius: 15px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--hr-color);
  order: 3;
  text-align: center;
}

.mini-quiz h4 {
  font-family: var(--font-heading);
  font-size: 1.6em;
  color: var(--accent-color);
  margin-bottom: 1em;
}

#quizAnswer {
  width: calc(100% - 20px);
  padding: 12px;
  border: 2px solid var(--input-border-color);
  border-radius: 8px;
  font-size: 1.1em;
  margin-bottom: 15px;
  transition: border-color 0.3s ease, background-color 0.2s, color 0.2s;
  background-color: var(--card-bg);
  color: var(--text-color);
  font-family: inherit;
}
#quizAnswer:focus {
  outline: none;
  border-color: var(--input-focus-border-color);
  box-shadow: 0 0 0 0.2rem rgba(var(--accent-color-rgb), 0.25);
}

#revealAnswerBtn {
  background-image: linear-gradient(
    135deg,
    var(--accent-color) 0%,
    var(--accent-color-darker) 100%
  );
  color: var(--accent-text-color);
  padding: 12px 25px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 1.1em;
  transition: background-position 0.3s ease, transform 0.2s ease,
    box-shadow 0.2s ease;
  background-size: 200% auto;
  background-position: 0% 0%;
}
#revealAnswerBtn:hover {
  background-position: 100% 0%;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(var(--accent-color-rgb), 0.2);
}
#revealAnswerBtn:active {
  animation: buttonPress 0.1s ease-out forwards;
}

#quizResult {
  margin-top: 25px;
  background-color: var(--section-bg-alt);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--hr-color);
}

.quiz-reveal-text {
  font-size: 1.3em;
  font-weight: bold;
  color: var(--accent-color);
}
.quiz-reveal-text.pulsing {
  animation: pulse 1.5s infinite alternate;
}

#scrapbook {
  background-color: var(--bg-color);
}

.scrapbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  width: 90%;
  max-width: 1000px;
  margin: 0 auto;
}

.polaroid {
  background-color: var(--card-bg);
  border: 5px solid #f0f0f0;
  padding: 15px 15px 30px 15px;
  box-shadow: var(--card-shadow);
  transform: rotate(calc(var(--rotation) * 1deg));
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.2s;
  cursor: pointer;
  border-radius: 5px;
  opacity: 0;
  transform: translateY(20px) rotate(calc(var(--rotation) * 1deg));
}

.polaroid:hover {
  transform: translateY(-5px) scale(1.03) rotate(calc(var(--rotation) * 1deg));
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-color: var(--accent-color);
  z-index: 10;
}

.polaroid img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  margin-bottom: 15px;
  border: 1px solid var(--hr-color);
  background-color: #f0f0f0;
}

.polaroid .caption {
  font-size: 1em;
  color: var(--text-secondary-color);
  text-align: left;
}

.stickers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.sticker {
  position: absolute;
  font-size: 2em;
  opacity: 0;
  transform: scale(0.5);
}

.scrapbook-navigation {
  margin-top: 50px;
}

#maron-surprise {
  background: var(--maron-bg);
  color: var(--text-color);
  overflow: hidden;
  position: relative;

  align-items: center;
}

.maron-content {
  background-color: var(--maron-hacked-bg);
  padding: 50px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 2;

  display: flex;
  flex-direction: column;
  align-items: center;
}

.maron-message {
  font-family: var(--font-heading);
  font-size: 2.5em;
  color: var(--accent-color);
  margin-bottom: 1em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.maron-character {
  width: 150px;
  height: 150px;
  margin: 0 auto 20px;
  cursor: pointer;
  position: relative;
  animation: maronFloat 4s ease-in-out infinite;
  background-color: #f0f0f0;
  border-radius: 50%;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.maron-character.maron-bounce {
  animation: maronBounce 0.6s ease-out;
}

.maron-character img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.maron-instruction {
  font-size: 1.1em;
  color: var(--text-secondary-color);
  margin-bottom: 30px;
}

.maron-compliment-bubble {
  background-color: var(--card-bg);
  border: 3px solid var(--maron-compliment-border);
  padding: 15px 25px;
  border-radius: 25px;
  font-size: 1.3em;
  font-weight: bold;
  color: var(--accent-color);
  display: inline-block;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}
.maron-compliment-bubble.hidden {
  opacity: 0;
  pointer-events: none;
}
.maron-compliment-bubble.visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.maron-navigation {
  margin-top: 50px;
}

.maron-game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background-color: var(--card-bg);
  padding: 40px;
  border-radius: 15px;
  box-shadow: var(--card-shadow);
  width: 90%;
  max-width: 800px;
  margin-top: 40px;
  position: relative;
  overflow: hidden;
}

.game-area-wrapper {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 400px;
  border: 2px solid var(--accent-color);
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(to bottom, #d6f2ff, #aedce8);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);

  display: block;
}

.game-area {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  overflow: hidden;

  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 5px;
  padding: 5px;

  transform: translateX(0);
}
.game-area.shake {
  animation: shakeBoard 0.3s ease-in-out;
}

.grid-cell {
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 3em;
  transition: background-color 0.2s ease, transform 0.1s ease,
    box-shadow 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  color: var(--accent-color);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.grid-cell:hover {
  background-color: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.grid-cell.revealed {
  cursor: default;
  background-color: var(--card-bg);
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
  transform: none;
}

.grid-cell.shrimp-found {
  background-color: #e6ffe6;
}

.grid-cell.maron-hit {
  background-color: #ffe6e6;
}

.grid-cell .content-image,
.grid-cell .content-emoji {
  width: 80%;
  height: 80%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.grid-cell.revealed .content-image,
.grid-cell.revealed .content-emoji {
  opacity: 1;
  transform: scale(1);
}

.score-display,
.timer-display {
  position: absolute;
  top: 10px;
  font-family: var(--font-heading);
  font-size: 1.2em;
  color: var(--accent-color-darker);
  background-color: rgba(255, 255, 255, 0.8);
  padding: 5px 10px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  z-index: 15;
}
.score-display {
  left: 10px;
}
.timer-display {
  right: 10px;
}

.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(var(--accent-color-rgb), 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--accent-text-color);
  font-family: var(--font-heading);
  gap: 20px;
  z-index: 20;
}
.game-overlay h3 {
  font-size: 2.5em;
  margin-bottom: 0;
}
.game-overlay p {
  font-size: 1.5em;
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

#final-message {
  background-color: var(--bg-color);
}

.final-message-content {
  max-width: 800px;
}

.envelope-container {
  perspective: 1000px;
  width: 600px;
  min-height: 400px;
  margin: 50px auto;
  position: relative;
  transition: min-height 0.8s ease-in-out;
}

.envelope-front {
  background-color: #f7e0e7;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  position: absolute;
  backface-visibility: hidden;
  transition: transform 0.8s ease-in-out, background-color 0.5s ease;
  top: 0;
  left: 0;
  overflow: hidden;
  border: 1px solid #e6d3db;
}

.envelope-front > p {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-heading);
  font-size: 2em;
  font-weight: bold;
  color: var(--accent-color-darker);
  z-index: 2;
  text-shadow: none;
  white-space: nowrap;
}

.envelope-front img {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 100px;
  height: auto;
  padding: 0;
  border-radius: 0;
  background-color: transparent;
}

#unfoldLetterBtn {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  --button-base-transform: translateX(-50%);
  z-index: 2;

  background-image: linear-gradient(
    135deg,
    var(--accent-color) 0%,
    var(--accent-color-darker) 100%
  );
  color: var(--accent-text-color);
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 1.1em;
}

.envelope-front::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%;
  background-color: #fce8ee;
  border-radius: 15px;

  clip-path: polygon(0 0, 100% 0, 100% 40%, 50% 60%, 0 40%);
  transform-origin: top;
  z-index: 1;
  transition: transform 0.8s ease-in-out, opacity 0.5s ease,
    background-color 0.5s ease;
  border-bottom: 1px solid #e6d3db;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.envelope-container.unfolded .envelope-front::before {
  transform: rotateX(180deg);
  opacity: 0;
  z-index: 0;
}

.envelope-front::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30%;
  background-color: #f7e0e7;
  border-radius: 15px;

  clip-path: polygon(0 100%, 100% 100%, 50% 0);
  transform-origin: bottom;
  z-index: 0;
  transition: transform 0.8s ease-in-out, opacity 0.5s ease;
  border-top: 1px solid #e6d3db;
}

.envelope-back {
  background-color: var(--card-bg);
  width: 100%;

  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
  position: absolute;
  backface-visibility: hidden;
  transform: rotateY(180deg);
  transition: transform 0.8s ease-in-out, background-color 0.5s ease;
  text-align: left;

  overflow-y: visible;
  color: var(--text-color);
  top: 0;
  left: 0;
  right: 0;
}

.envelope-container.unfolded .envelope-front {
  transform: rotateY(-180deg);
}

.envelope-container.unfolded .envelope-back {
  transform: rotateY(0deg);
}

.envelope-back:after {
  position: absolute;
  content: "";
  bottom: -80px;
  height: 80px;
  width: 1px;
}

.letter-paper {
  background-color: #fffaf0;
  padding: 40px;
  border-radius: 10px;

  line-height: 1.8;
  white-space: pre-wrap;
  color: #555;
  font-size: 1.15em;
}

.letter-hint {
  margin-top: 20px;
  font-size: 0.9em;
  color: var(--text-secondary-color);
}

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: var(--modal-bg);
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}
.modal.active {
  display: flex;
  opacity: 1;
}
.modal-content {
  background-color: var(--modal-content-bg);
  margin: auto;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  position: relative;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
  opacity: 0;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal.active .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.modal-scrollable-area {
  overflow-y: auto;
  flex-grow: 1;
  padding: 30px;
}
.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--section-bg-alt);
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 10;
  cursor: pointer;
  color: var(--text-secondary-color);
  transition: color 0.2s, transform 0.2s, background-color 0.2s;
}
.modal-close:hover,
.modal-close:focus-visible {
  color: var(--accent-color);
  transform: scale(1.05);
  outline: none;
}
.modal-close:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}
.modal-close svg {
  width: 20px;
  height: 20px;
}
.modal-content h2 {
  margin-top: 0;
  font-family: var(--font-heading);
  color: var(--accent-color);
  margin-bottom: 1.5rem;
  font-size: 2rem;
  font-weight: 600;
}
.modal-image-main {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  max-height: 696.5px;
  object-fit: contain;
  margin: 0 auto 1.5rem;
  border: 1px solid var(--hr-color);
  background-color: #f0f0f0;
}

.modal-image-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 12px;
  margin-bottom: 1.5rem;
  justify-content: center;
}
.modal-image-gallery img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.25s, border-color 0.25s, transform 0.2s;
  border: 3px solid transparent;
  flex-shrink: 0;
  background-color: #f0f0f0;
}
.modal-image-gallery img:hover {
  opacity: 1;
  transform: scale(1.05);
}
.modal-image-gallery img.active {
  opacity: 1;
  border-color: var(--accent-color);
}
.modal-description {
  margin-bottom: 2rem;
  font-size: 1.05rem;
  text-align: left;
  line-height: 1.8;
}
.modal-description p {
  margin-bottom: 1rem;
}

.modal-nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-50%);
  padding: 0 10px;
  pointer-events: none;
}

.modal-nav-buttons button {
  pointer-events: all;
  background-color: rgba(var(--accent-color-rgb), 0.7);
  color: var(--accent-text-color);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.8em;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s, transform 0.2s;
}

.modal-nav-buttons button:hover {
  background-color: var(--accent-color);
  transform: scale(1.1);
}
.modal-nav-buttons button:active {
  transform: scale(0.95);
}

footer {
  padding: 2rem 0;
  background-color: var(--section-bg-alt);
  color: var(--text-secondary-color);
  font-size: 0.9rem;
  border-top: 1px solid var(--hr-color);
  margin-top: 4rem;
}
footer p {
  text-align: center;
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 5px;
  margin-left: 0.5rem;
}
.hamburger span {
  height: 3px;
  width: 25px;
  background-color: var(--text-color);
  margin-bottom: 5px;
  border-radius: 3px;
  transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.hamburger span:last-child {
  margin-bottom: 0;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

.konami-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--accent-color);
  color: var(--accent-text-color);
  padding: 30px 50px;
  border-radius: 20px;
  font-family: var(--font-heading);
  font-size: 2.5em;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  animation: fadeInOut 3s forwards;
  display: none;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--accent-color);
  color: var(--accent-text-color);
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
  font-size: 0.95rem;
  text-align: center;
  min-width: 250px;
  max-width: 90%;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  visibility: visible;
  transition-delay: 0s;
}
.toast.error {
  background-color: #dc3545;
  color: white;
}
.toast.info {
  background-color: #17a2b8;
  color: white;
}

@media (max-width: 992px) {
  .nav-controls {
    gap: 0.8rem;
  }
  .nav-item {
    margin-left: 1.2rem;
  }
}

@media (max-width: 830px) {
  .nav-controls {
    display: block;
  }

  .nav-controls > .theme-toggle-switch {
    display: none;
  }

  .gallery-slider {
    margin-top: 0;
  }

  .mini-quiz {
    margin-top: 35px;
  }

  .nav-menu.active .nav-item-mobile-control {
    display: none;
  }

  .nav-menu.active > li:last-child.nav-item-mobile-control {
    border-bottom: none;
  }

  .nav-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--navbar-bg);
    padding: 0.5rem 0;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--hr-color);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.35s ease-out;
  }
  .nav-menu.active {
    display: flex;
    opacity: 1;
    max-height: calc(100vh - 70px);
  }
  .nav-item {
    margin: 0;
    width: 100%;
  }
  .nav-link {
    padding: 1rem 1.8rem;
    text-align: left;
    width: 100%;
    border-bottom: 1px solid var(--hr-color);
  }

  .nav-menu.active > li:last-child > .nav-link {
    border-bottom: none;
  }

  .timeline-chapter h3 .chapter-subtitle {
    display: block;
    font-size: 0.8em;
    margin-top: 0.2em;
  }

  .mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 999;
  }
  .mobile-menu-overlay.active {
    display: block;
  }

  .nav-link.active::before {
    display: none;
  }

  .hamburger {
    display: flex;
  }
  .section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
  }
  main > section {
    padding-top: 100px;
  }

  .timeline-container::before {
    display: none;
  }
  .timeline-chapter {
    justify-content: center;
    align-items: center;
    margin-bottom: 50px;
  }
  .timeline-chapter::before {
    display: none;
  }
  .chapter-content {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 500px;
    padding: 25px 20px;

    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: left;
  }

  .timeline-chapter h3 {
    order: 2;
    text-align: center;
    font-size: clamp(1.8em, 5vw, 2.2em);
    margin-bottom: 1em;
  }
  .timeline-chapter h3::after {
    margin: 10px auto 0;
  }

  .chapter-visual {
    order: 1;
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
  }

  .chapter-visual p {
    text-align: center;
  }

  .growth-text {
    order: 3;
    width: 100%;
    text-align: center;
  }

  .mini-quiz {
    order: 4;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .konami-popup {
    font-size: 1.8em;
    padding: 20px 30px;
  }

  .cat-paw-animation {
    width: 150px;
    height: 150px;
  }
  .opening-content {
    padding: 30px;
  }
  #opening h1 {
    font-size: 2.8em;
  }
  #opening p {
    font-size: 1.2em;
  }
  .main-button {
    padding: 12px 25px;
    font-size: 1em;
  }

  .scrapbook-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .polaroid {
    padding: 10px 10px 20px 10px;
  }
  .polaroid img {
    height: 180px;
  }
  .polaroid .caption {
    font-size: 0.9em;
  }

  .maron-content {
    padding: 30px;
  }
  .maron-message {
    font-size: 2em;
  }
  .maron-character {
    width: 120px;
    height: 120px;
  }
  .maron-compliment-bubble {
    padding: 10px 15px;
    font-size: 1.1em;
  }

  .maron-game-container {
    padding: 20px;
    margin-top: 20px;
  }
  .game-area-wrapper {
    height: 300px;
    max-width: 300px;
  }

  .score-display,
  .timer-display {
    font-size: 1em;
    padding: 3px 8px;
  }
  .game-overlay h3 {
    font-size: 1.8em;
  }
  .game-overlay p {
    font-size: 1.1em;
  }
  #playMaronGameBtn,
  #startGameBtn {
    padding: 10px 20px;
    font-size: 0.9em;
  }

  .mini-quiz {
    padding: 15px;
  }

  .mini-quiz h4 {
    font-size: clamp(1.2em, 4.5vw, 1.6em);
  }

  #quizAnswer {
    width: 100%;
    padding: 10px;
    font-size: clamp(0.9em, 3.5vw, 1.1em);
  }

  #revealAnswerBtn {
    padding: 10px 20px;
    font-size: 1em;
  }

  #quizResult {
    padding: 15px;
  }

  .quiz-reveal-text {
    font-size: clamp(1em, 4vw, 1.3em);
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .envelope-container {
    width: 100%;
    height: 150px;
  }
  .envelope-front {
    height: 80%;
    padding: 20px;
    font-size: 1.2em;
  }
  .envelope-front p {
    font-size: 1.8em;
  }
  .envelope-front img {
    width: 60px;
  }
  #unfoldLetterBtn {
    padding: 8px 15px;
    font-size: 1em;
    white-space: nowrap;
  }
  .envelope-back {
    padding: 20px;
  }
  .letter-paper {
    padding: 15px;
    font-size: 0.9em;
  }
}
