:root {
  --cb-yellow: #ffd23f;
  --cb-cream: #fff3c4;
  --cb-brown: #43281a;
  --round: "Jua", "Pretendard Variable", sans-serif;
  --body: "Pretendard Variable", system-ui, sans-serif;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --title: clamp(24px, 2.8vw, 50px); /* 홈 타일 제목 크기와 같게 — 확대 전환이 이어지도록 */
}
* { box-sizing: border-box; }
body { margin: 0; background: #fffaf0; color: var(--cb-brown); font-family: var(--body); -webkit-font-smoothing: antialiased; }
img { display: block; }

.home {
  position: fixed; right: 26px; top: 26px; z-index: 20;
  width: 84px; height: 84px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--cb-yellow);
  box-shadow: 0 10px 24px -12px rgba(67, 40, 26, 0.5);
  transition: transform 0.35s var(--spring);
}
.home:hover { transform: scale(1.08) rotate(-4deg); }
.home img { width: 70px; height: auto; }

/* 홈에서 확대된 타일의 마지막 모양(16px 여백, 둥근 모서리, 캐릭터 색)과 같다 */
.panel {
  position: relative;
  margin: 16px;
  min-height: calc(100vh - 32px);
  border-radius: 16px;
  background: var(--bg);
  color: var(--on);
  padding: 22px 28px 48px;
  overflow: hidden;
  isolation: isolate;
}
.is-etc .panel { min-height: auto; }
.flowers { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.flowers img { position: absolute; width: clamp(36px, 5vw, 76px); height: auto; translate: -50% -50%; opacity: 0.9; animation: bob 4.5s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(8deg); } }

.head__name {
  margin: 0;
  font-family: var(--round); font-weight: 400;
  font-size: calc(var(--title) * 2.6);
  line-height: 1.05;
}
.head__tag { margin: 12px 0 0 6px; font-size: clamp(15px, 1.3vw, 19px); font-weight: 700; opacity: 0.9; }
.head__tag span { display: inline-block; margin-right: 10px; padding: 3px 10px; border-radius: 999px; background: var(--on); color: var(--deep); font-size: 0.8em; letter-spacing: 0.06em; }

.body {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(24px, 4vw, 64px); align-items: center;
  margin-top: clamp(24px, 5vh, 56px);
  padding: 0 clamp(0px, 2vw, 32px);
}
.is-etc .body { display: block; }

/* 프로필 액자 — 원본 상세 패널처럼 흰 테두리 + 이름표 */
.profile {
  position: relative; margin: 0 auto; width: min(100%, 540px);
  border: 10px solid #fff; border-radius: 26px;
  background: #fff;
  box-shadow: 0 24px 40px -24px rgba(0, 0, 0, 0.55);
  transform: rotate(-2.5deg);
  animation: pop 0.8s var(--spring) 0.15s both;
}
.profile__img { width: 100%; height: auto; border-radius: 16px; }
.profile__label {
  position: absolute; left: 50%; bottom: -22px; translate: -50% 0;
  padding: 8px 26px 6px; border-radius: 999px;
  background: var(--deep); color: #fff;
  font-family: var(--round); font-size: clamp(20px, 1.8vw, 28px);
  white-space: nowrap;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
}
.profile--cutout { aspect-ratio: 4 / 3.4; background: linear-gradient(#bfe7ff, #fff3c4 70%); overflow: visible; }
.profile--cutout::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 22%; border-radius: 0 0 16px 16px; background: #8ed16a; }
.profile__cloud { position: absolute; width: 34%; height: auto; opacity: 0.95; }
.profile__cloud--1 { left: 6%; top: 10%; }
.profile__cloud--2 { right: 4%; top: 22%; width: 40%; }
.profile__cut { position: absolute; left: 50%; bottom: 8%; z-index: 1; height: 82%; width: auto; translate: -50% 0; }
@keyframes pop { from { opacity: 0; transform: rotate(-8deg) scale(0.85); } to { opacity: 1; transform: rotate(-2.5deg) scale(1); } }

/* 줄 노트 — 원본의 노트 박스 + 테이프·스티커 */
.note {
  position: relative;
  padding: 34px 34px 30px;
  border-radius: 18px;
  background-color: #fff;
  background-image: repeating-linear-gradient(to bottom, transparent 0 35px, #cfe3ff 35px 36px);
  background-position: 0 70px;
  color: var(--cb-brown);
  line-height: 36px;
  box-shadow: 0 20px 40px -26px rgba(0, 0, 0, 0.6);
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both;
}
.note__tape { position: absolute; left: 22px; top: -18px; width: 70px; height: auto; transform: rotate(-12deg); opacity: 0.85; }
.note__dot { position: absolute; right: -16px; top: 40px; width: 40px; height: auto; }
.note__blob { position: absolute; left: -14px; bottom: 28px; width: 38px; height: auto; }
.note__title { margin: 0 0 6px; font-family: var(--round); font-weight: 400; font-size: 26px; line-height: 36px; color: var(--deep); }
.note p { margin: 0; font-size: 17px; }
.traits { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; padding: 0; list-style: none; }
.traits li { padding: 0 14px; border-radius: 999px; background: var(--bg); color: var(--on); font-family: var(--round); font-size: 16px; line-height: 32px; }
.facts { margin: 8px 0 0; }
.facts div { display: flex; gap: 14px; }
.facts dt { flex: 0 0 auto; min-width: 84px; font-weight: 700; color: var(--deep); }
.facts dd { margin: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* ETC */
.etc__lead { margin: 0 0 22px; font-size: clamp(16px, 1.4vw, 20px); line-height: 1.6; }
.chips { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.chip { border: 0; padding: 8px 18px 6px; border-radius: 999px; background: rgba(255, 243, 196, 0.16); color: var(--on); font: 400 17px var(--round); cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.chip.is-on { background: var(--cb-yellow); color: var(--cb-brown); }
.friends { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.friend {
  width: 100%; border: 0; padding: 12px 12px 16px; border-radius: 20px;
  background: var(--cb-cream); color: var(--cb-brown); cursor: pointer; text-align: left;
  font: inherit;
  transition: transform 0.4s var(--spring), box-shadow 0.3s;
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.friends li:nth-child(n) .friend { animation-delay: calc(var(--i, 0) * 60ms); }
.friend:hover, .friend:focus-visible { transform: translateY(-6px) rotate(-1.5deg); box-shadow: 0 18px 28px -18px rgba(0, 0, 0, 0.6); outline: none; }
.friend img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; }
.friend__name { display: block; margin-top: 10px; font-family: var(--round); font-size: 24px; }
.friend__tag { display: block; font-size: 13px; font-weight: 600; opacity: 0.7; }

.sheet { border: 0; padding: 0; border-radius: 28px; background: var(--bg); color: var(--on); width: min(920px, calc(100vw - 32px)); overflow: visible; }
.sheet::backdrop { background: rgba(43, 25, 15, 0.55); backdrop-filter: blur(3px); }
.sheet[open] { animation: pop-in 0.45s var(--spring); }
@keyframes pop-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
.sheet__inner { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: center; padding: 40px; }
.sheet__close { position: absolute; right: -12px; top: -12px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--cb-yellow); color: var(--cb-brown); font-size: 18px; cursor: pointer; }

/* 다른 친구들 */
.others { padding: 40px 16px 24px; }
.others__title { margin: 0 0 18px 12px; font-family: var(--round); font-weight: 400; font-size: clamp(22px, 2vw, 30px); }
.others__list { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.mini {
  position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 14px;
  background: var(--bg); color: var(--on); text-decoration: none;
  transition: background-color 0.3s, transform 0.4s var(--spring);
}
.mini:hover { background: var(--deep); transform: translateY(-6px); }
.mini[aria-current="page"] { outline: 3px solid var(--cb-brown); outline-offset: 3px; }
.mini__name { position: absolute; left: 12px; top: 10px; font-family: var(--round); font-size: clamp(16px, 1.6vw, 24px); z-index: 1; }
.mini__img { position: absolute; right: 10%; bottom: 10%; width: 62%; aspect-ratio: 1; object-fit: cover; border: 4px solid #fff; border-radius: 12px; transform: rotate(-5deg); }
.mini__img.is-cut { object-fit: contain; border: 0; border-radius: 0; height: 74%; width: auto; aspect-ratio: auto; right: 8%; bottom: -4%; transform: none; }
.foot { padding: 12px 28px 36px; font-size: 13px; opacity: 0.6; }

@media (max-width: 991px) {
  .panel { padding: 20px 20px 40px; min-height: auto; }
  .head__name { font-size: clamp(48px, 15vw, 88px); padding-right: 84px; }
  .home { width: 64px; height: 64px; right: 24px; top: 24px; }
  .home img { width: 54px; }
  .body { grid-template-columns: 1fr; gap: 48px; padding: 0; }
  .note { padding: 30px 22px 24px; }
  .sheet__inner { grid-template-columns: 1fr; padding: 28px 22px; gap: 40px; }
  .others__list { grid-template-columns: repeat(4, 1fr); }
}
