* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  background-color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: sans-serif;
  overflow: hidden;
  font-family: "Raleway", sans-serif;
  font-size: 0.95rem;
}

.wrapper {
  background-color: #ffb1c1;
  border-radius: 40px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.7);

  position: relative;
  width: 90%;
  height: 100%;
  max-width: 1440px;
  max-height: 90vh;
  aspect-ratio: 4 / 3;

  display: block;
  padding: 0;
  gap: 0;
}

.page-wrapper {
  background-color: #ffb1c1;
  border-radius: 40px;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.7);

  position: relative;
  width: 90%;
  height: 100%;
  max-width: 1440px;
  max-height: 90vh;
  aspect-ratio: 4 / 3;

  overflow-y: auto;

  display: block;
  padding: 0;
  gap: 0;
}

.text-wrapper {
  width: 50%;
  margin: 2vw auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.8rem;
}

.text-huge {
  font-size: 3rem;
  line-height: 3rem;
  font-weight: 600;
  margin-bottom: 50px;
}
.header h1 {
  font-size: 1rem;
  line-height: 2rem;
  margin-bottom: 20px;
}

.lead {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 30px;
}

h2 {
  margin-top: 30px;
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
}

a {
  color: rgb(255, 0, 128);
}

blockquote {
  font-style: italic;
  background-color: rgba(0, 0, 0, 0.05);
  padding: 10px 15px;
  border-left: 4px solid black;
  margin: 20px 0;
}

.noise-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("https://grainy-gradients.vercel.app/noise.svg");
  opacity: 0.3;
  pointer-events: none;
  z-index: 2;
}

.floating-menu {
  position: fixed;

  z-index: 1000;
}

.menu-btn {
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 24px;
  border: none;
  border-radius: 50%;
  width: 4vw;
  height: 4vw;
  cursor: pointer;
  transition: background-color 0.2s;
  position: relative;
  z-index: 2;
}

.menu-btn:hover {
  background-color: #ffb1c1;
  color: black;
}

.menu-list {
  position: absolute;

  right: 0;
  list-style: none;
  padding: 0;
  margin: 0;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  min-width: 170px;
}

.menu-list li {
  margin: -10px;
  padding: 0;
  width: 100%;
}

.menu-list a {
  background: white;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: black;
  font-size: 14px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

.menu-list a:hover {
  background: #ffb1c1;
}

.close-button {
  position: fixed;
  top: 8vh;
  right: 6.5vw;

  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;

  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 24px;
  border: none;
  border-radius: 50%;
  width: 4vw;
  height: 4vw;
  cursor: pointer;
  transition: background-color 0.2s;

  z-index: 2;
}

.close-button:hover {
  background-color: #ffb1c1;
  color: black;
}

.lyrics-wrapper {
  position: relative;
  width: 80%;
  margin: 2vw auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 72px;
}

.panel {
  display: inline-flex;
  gap: 0.5rem;
  margin: 0;
}

.panel.lyrics {
  height: 1px;
  position: relative;
  width: 100%;
  border-radius: 12px;

  overflow: hidden;
}

.panel.lyrics::before,
.panel.lyrics::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: var(--fade-h);
  pointer-events: none;
  z-index: 3;
}

.fade {
  position: absolute;
  left: 0;
  right: 0;
  height: 200px;
  pointer-events: none;
  z-index: 3;
}
.fade-top {
  top: 0;
  background: linear-gradient(
    to bottom,
    rgba(255, 177, 193, 1),
    rgba(255, 177, 193, 0.5)
  );
}
.fade-bottom {
  bottom: 0;
  background: linear-gradient(
    to top,
    rgba(255, 177, 193, 1),
    rgba(255, 177, 193, 0.6)
  );
}

.lyrics {
  overflow: auto;
  padding: 1rem;
  padding-top: 5rem;
}

.lyrics-scroll {
  position: relative;
  z-index: 1;
  max-height: 70vh;
  overflow: auto;
  padding: 6rem 1rem 1rem;
}

.button-set {
  position: absolute;
  z-index: 30;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  margin: 0;
}

.controls {
  position: absolute;

  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.controls button {
  font-family: "Raleway", sans-serif;
  padding: 0.5em 1em;
  border-radius: 60px;
  border: none;
  background: #333;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.controls button:hover {
  background: #444;
}

.agent-intro {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 5;
}

.agent-image-min {
  width: 60px;
  height: 60px;
  border-radius: 30px;
  object-fit: cover;
  border: 2px solid #fff;
}

.agent-intro p {
  margin: 0;
  background: #fff;
  color: #000;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
  max-width: 500px;
  min-width: 0vw;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  animation: bubble-pulse 2s ease-in-out infinite;
  will-change: opacity, transform;
}

@keyframes bubble-pulse {
  0%,
  100% {
    opacity: 1;
    transform: translateZ(0) scale(1);
  }
  50% {
    opacity: 0.85;
    transform: translateZ(0) scale(1.03);
  }
}

.agent-container {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.agent-image {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--w) * 1%);
  height: auto;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.cta-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 3;
  pointer-events: none;
}
.cta-center h1 {
  font-family: "Raleway", system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.8vw;
  line-height: 1.1;
  color: #fff;
  letter-spacing: -1px;
}
.cta-center p {
  margin-top: 0.6rem;
  font-size: 0.8vw;
  color: #ff0000;
  font-weight: 600;
  letter-spacing: -1px;
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 1000px) {
  .menu-list li {
    margin: 10px;
  }
}
@media (max-width: 768px) {
  .lyrics {
    max-height: 90vh;
  }

  .lyrics-wrapper {
    width: 100%;
  }

  .text-wrapper {
    width: 90%;
  }

  .page-wrapper {
    margin-top: 30px;
    width: 95%;
    position: relative;
  }

  .menu-list li {
    margin: 20px;
  }

  html,
  body {
    overflow: auto;
    height: auto;
  }

  .wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;

    width: 90%;
    margin-top: 30px;
    margin-bottom: 30px;
    height: auto;
    max-height: none;
    aspect-ratio: auto;

    padding: 8vw 0;
  }

  .cta-center {
    position: static;
    transform: none;
    text-align: center;
    margin: 0 auto 8vw;
    max-width: 88vw;
  }
  .cta-center h1 {
    font-size: 6vw;
    letter-spacing: -0.5px;
  }
  .cta-center p {
    font-size: 3.4vw;
  }

  .agent-container {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6vw 4vw;
    width: 90%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0;
    z-index: 3;
    pointer-events: auto;
  }

  .agent-image {
    position: static;
    width: 100%;
    height: auto;
    transform: none;
  }

  .jax {
    order: 1;
  }
  .tom {
    order: 2;
  }
  .eva {
    order: 3;
  }
  .talia {
    order: 4;
  }

  .lily {
    order: 5;
  }
  .paul {
    order: 6;
  }
  .adam {
    order: 7;
  }

  .text-huge {
    font-size: 2.2rem;
    line-height: 2.5rem;
  }

  .menu-btn {
    width: 45px;
    height: 45px;
  }

  .close-button {
    top: auto;
    right: 10px;
    width: 45px;
    height: 45px;
    z-index: 10;
  }
}

@media (max-width: 420px) {
  .agent-container {
    grid-template-columns: 1fr;
    gap: 7vw;
  }
  .cta-center h1 {
    font-size: 7vw;
  }
  .cta-center p {
    font-size: 3.6vw;
  }
}

/* === MOBILE LAYOUT NORMALIZE (patch) === */

/* 1) '가사' 전용 리스트 스타일로 스코프 축소: 전역 ul/li 오염 방지 */
ul,
li {
  /* 전역 초기화 복구 */
  list-style: initial;
  padding-left: 1.1em;
  margin: 0;
}
.text-wrapper ul {
  /* 본문 리스트: 디스크 불릿 유지 */
  list-style: disc;
}
.text-wrapper li {
  font-size: 1rem;
  line-height: 1.6;
  color: #000;
  opacity: 1;
  margin: 0.5em 0;
}
/* 가사 전용 스타일은 .lyrics 영역으로 한정 */
.panel.lyrics ul,
.lyrics-wrapper ul {
  list-style: none;
  padding-left: 0;
}
.panel.lyrics li,
.lyrics-wrapper li {
  margin: 0.6em 0;
  opacity: 0.55;
  transition: 0.25s;
  font-size: clamp(14px, 4vw, 20px);
  line-height: 1.4;
  color: #504747;
  font-weight: 400;
}
.panel.lyrics li.current,
.lyrics-wrapper li.current {
  opacity: 1;
  color: #fff;
  font-weight: 600;
  font-size: clamp(18px, 4vw, 30px);
}

.lyrics {
  min-height: 85vh;
}

/* 2) 텍스트/가사 래퍼 폭을 통일된 그리드로 */
:root {
  --page-max: 900px; /* 모바일-태블릿 공통 최대 폭 */
  --page-pad: 24px; /* 모바일 기본 내부 여백 */
  --page-pad-lg: 40px; /* 데스크톱 내부 여백 */
  --tap: 48px; /* 접근성 탭 타깃 */
}
.page-wrapper {
  margin: 2vh auto 0vh;
  width: 100%;
  padding: var(--page-pad-lg);
}
.text-wrapper,
.lyrics-wrapper {
  width: 100%;
  max-width: 68ch; /* 읽기 최적 폭 */
  margin: 0 auto;
}
.text-huge {
  margin-bottom: 1.25rem; /* 과한 하단 여백 완화 */
}

/* 3) 버튼(닫기/메뉴) 크기와 탭타깃을 픽셀로 일관화 */
.menu-btn,
.close-button {
  width: var(--tap);
  height: var(--tap);
  min-width: var(--tap);
  min-height: var(--tap);
  font-size: 24px;
}

/* 4) 작은 화면에서 프레임 여백 줄이기 */
@media (max-width: 768px) {
  .page-wrapper {
    padding: var(--page-pad);
    margin-top: 5vw;
    width: min(96%, var(--page-max));
  }
  .text-huge {
    font-size: 1.7rem;
    line-height: 2.1rem;
  }
}

/* 5) 드롭다운 메뉴가 화면 밖으로 밀려나지 않도록 */
.floating-menu {
  margin: 0;
  bottom: 5vh;
  right: 6.5vw;
}

.close-button {
  top: 5vh;
  right: 6.5vw;
}

.menu-list {
  bottom: calc(var(--tap) + 12px);
  right: 0;
  gap: 10px;
}
.menu-list a {
  display: block;
}

/* 6) 비평/바이오 페이지의 <ul> 내부 마크업 보정용(안전망) */
.text-wrapper ul p {
  margin: 0;
  display: list-item;
}

/* === UI refinements per Princess' feedback === */

/* Remove bullets from menus */
.menu-list,
.menu-list li {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

/* Ensure dialogue lines never show bullets even if scoped differently */
#list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
#list li {
  list-style: none;
  margin: 0.6em 0;
}

/* Make the pink frame (page border) as tall as other pages */
.page-wrapper {
  box-sizing: border-box;
  min-height: calc(
    100svh - 6vh
  ); /* 100svh minus vertical margins (4vh top, 6vh bottom) */
}

/* === Desktop width alignment & Adam controls placement === */

/* Wider pink frame on desktop to match index width, while keeping text width (68ch) */
:root {
  --page-max-desktop: 1280px;
}

@media (min-width: 1024px) {
  .page-wrapper {
    margin-top: -0.1vh;
    min-height: calc(
      100svh - 10vh
    ); /* 100svh minus vertical margins (4vh top, 6vh bottom) */
  }

  .floating-menu {
    margin: 0;
    bottom: 6vh;
    right: 7vw;
  }
  .close-button {
    top: 6vh;
    right: 7vw;
  }
}

@media (min-width: 1591px) {
  :root {
    --cx: 50vw; /* 화면 중심 X */
    --cy: 50vh; /* 화면 중심 Y */
    --offx: 670px; /* +면 오른쪽, -면 왼쪽으로 이동 */
    --offy: -41vh; /* -면 위로, +면 아래로 이동 */
  }

  .floating-menu {
    margin: 0;

    right: 1vw;
    bottom: 1vh;
  }
  .close-button {
    left: calc(var(--cx) + var(--offx));
    top: clamp(40px, calc(var(--cy) + var(--offy)), 90vh);
    transform: translate(-50%, -50%); /* 버튼 중심 정렬 유지 */
    z-index: 10;
  }
}

/* Agent pages: keep controls near bottom inside the pink frame */
.lyrics-wrapper {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.panel.lyrics {
  flex: 1 1 auto; /* occupy remaining space to push controls down */
}

/* Controls block at the bottom with breathing room */
.controls {
  margin-top: auto;
  padding-top: 12px;
  padding-bottom: calc(var(--tap) + 12px); /* avoid overlapping floating menu */
}

/* === Unify non-index page frame width & push controls lower === */

/* All .page-wrapper now same absolute max-width as index */
.page-wrapper {
  max-width: 1280px;
  width: 95%;
  margin-left: auto;
  margin-right: auto;
}

/* Controls area: push further down inside pink frame */
.controls {
  margin-top: auto;
  padding-top: 16px;
  padding-bottom: calc(var(--tap) * 2); /* more breathing space at bottom */
}

/* === Final overrides: match index width; push controls further down === */

/* 1) Match index's pink frame absolute width across non-index pages */
.page-wrapper {
  width: 90%;
  max-width: 1440px;
}

/* 2) Adam: controls anchored towards bottom inside the pink frame */
.lyrics-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.panel.lyrics {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

/* Let the scrolling area occupy available space */
.panel.lyrics .lyrics-scroll {
  flex: 1 1 auto;
  max-height: none; /* let flexbox handle height */
  overflow: auto;
}

/* Controls: no absolute positioning; sit at the bottom */
.controls {
  position: static;
  margin-top: auto;
  align-self: center;
  padding-top: 12px;
  padding-bottom: calc(var(--tap) + 24px);
}
