:root {
  color-scheme: light;
  --accent: #ec4899;
  --ink: #5b1237;
  --ink-soft: #8f3a67;
  --line: #ffd9e9;
  --card: #fffafc;
  --blush: #fff0f7;
  --petal: #ffe1ee;
  --title-font: "Jua", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }

html {
  overflow-y: scroll;
  background: #ffe4f0;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans KR", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, #fff3f9 0, transparent 34%),
    radial-gradient(circle at 88% 2%, #ffc6df 0, transparent 38%),
    radial-gradient(circle at 80% 72%, #ffd3e6 0, transparent 40%),
    linear-gradient(180deg, #ffe4f0, #ffeef6);
  background-attachment: fixed;
}

a { color: inherit; }

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- 머리말 ---- */
.hero {
  position: relative;
  padding: 44px 8px 26px;
  text-align: center;
}

.hero[hidden] { display: none; }

.hero h1 {
  margin: 0;
  font-family: var(--title-font);
  font-size: clamp(2.1rem, 7vw, 3.2rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #d4186f;
  outline: none;
}

.hero-group h1 { color: color-mix(in srgb, var(--accent) 62%, #6d0f43); }

.hero-sub {
  margin: 10px 0 0;
  font-weight: 500;
  color: var(--ink-soft);
}

.hero-hint {
  display: inline-block;
  margin: 14px 0 0;
  padding: 6px 16px;
  border-radius: 999px;
  background: #fff;
  color: #c2185b;
  font-size: 0.875rem;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.16);
}

.back {
  display: inline-block;
  margin-bottom: 14px;
  padding: 7px 16px;
  border-radius: 999px;
  background: #fff;
  color: #c2185b;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.18);
  transition: transform 0.15s ease, background 0.15s ease;
}

.back:hover { background: var(--blush); transform: translateX(-2px); }

/* ---- 단체 사진 ---- */
.gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.group-card {
  display: block;
  flex: 0 0 calc((100% - 36px) / 4);
  overflow: hidden;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 6px 18px rgba(219, 39, 119, 0.14);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.group-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(219, 39, 119, 0.24);
}

.group-card:focus-visible {
  outline: 3px solid #e11d74;
  outline-offset: 2px;
}

.group-card img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--petal);
}

.group-card span {
  display: block;
  padding: 7px 8px;
  font-family: var(--title-font);
  font-size: 1rem;
}

.group-banner {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 18px;
  border-radius: 20px;
  background: var(--petal);
  box-shadow: 0 12px 28px rgba(219, 39, 119, 0.18);
}

/* ---- 표 ---- */
.board {
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 18px 44px rgba(219, 39, 119, 0.14);
  overflow: clip;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 14px 12px;
  background: linear-gradient(180deg, #ff8ec2, #f968ad);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(160, 20, 90, 0.45);
}

.members thead th:first-child { padding-left: 20px; }

.members tbody tr {
  cursor: pointer;
  background: var(--card);
  border-top: 1px solid var(--line);
  transition: background 0.15s ease;
}

.members tbody tr:hover { background: var(--petal); }

.members tbody td {
  padding: 8px 12px;
  vertical-align: middle;
  font-size: 0.95rem;
}

.c-photo { width: 84px; padding-left: 20px !important; }

.avatar {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--petal);
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #ffc1dc;
  transition: transform 0.2s ease;
}

tr:hover .avatar { transform: scale(1.08) rotate(-3deg); }

.avatar-empty {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffb3d4, #ff7fb8);
  color: #fff;
  font-family: var(--title-font);
  font-size: 1.35rem;
  text-shadow: 0 1px 2px rgba(160, 20, 90, 0.5);
}

.row-link {
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}

.row-link:focus-visible,
.back:focus-visible,
.footer a:focus-visible {
  outline: 3px solid #e11d74;
  outline-offset: 2px;
  border-radius: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px 3px 8px;
  border-radius: 999px;
  background: var(--blush);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

.chip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.c-birth { white-space: nowrap; font-variant-numeric: tabular-nums; }
.age { color: #c2185b; font-weight: 700; }
.c-height { white-space: nowrap; font-variant-numeric: tabular-nums; }
.unknown { color: var(--ink-soft); font-size: 0.85rem; }

.c-nation { white-space: nowrap; }

.flag {
  display: inline-block;
  width: 32px;
  height: 24px;
  margin-right: 6px;
  border-radius: 4px;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(91, 18, 55, 0.14);
}

/* 그룹 보기: 사진을 크게 */
body:not([data-active=""]) .members tbody tr { cursor: default; }
body:not([data-active=""]) .avatar { width: 84px; height: 84px; }
body:not([data-active=""]) .c-photo { width: 116px; }
body:not([data-active=""]) .members tbody td { padding-top: 12px; padding-bottom: 12px; }
body:not([data-active=""]) .row-link { font-size: 1.2rem; cursor: default; }

/* 하트 */
.heart {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  font-size: 18px;
  line-height: 1;
  color: #f472b6;
}

/* 사진 출처 */
.credits th { position: static; }
.credits td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

/* ---- 꼬리말 ---- */
.footer {
  padding: 26px 8px 40px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.footer p { margin: 4px 0; }

/* ---- 모바일: 표 한 줄을 카드 한 장으로 ---- */
@media (max-width: 680px) {
  .hero { padding: 30px 4px 20px; }

  .board { border-radius: 20px; }

  /* 표가 너무 밀리지 않도록 모바일에서는 옆으로 넘겨 본다 */
  .gallery {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 10px;
    margin: 18px -16px 0;
    padding: 2px 16px 12px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding-left: 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .gallery::-webkit-scrollbar { display: none; }

  .group-card { flex: 0 0 62%; scroll-snap-align: start; }
  .group-banner { border-radius: 16px; margin-top: 14px; }

  .members thead,
  .credits thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .members tbody tr {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    grid-template-areas:
      "photo name   chip"
      "photo birth  birth"
      "photo detail detail";
    align-items: center;
    column-gap: 12px;
    row-gap: 1px;
    padding: 12px 14px;
  }

  .members tbody tr[hidden] { display: none; }

  .members tbody td {
    padding: 0 !important;
    font-size: 0.875rem;
  }

  .c-photo { grid-area: photo; width: auto; }
  .avatar { width: 60px; height: 60px; margin-left: 4px; }
  .c-name { grid-area: name; }
  .c-group { grid-area: chip; justify-self: end; }
  .c-birth { grid-area: birth; }

  /* 키와 국적은 같은 줄에 */
  .members tbody .c-height { grid-area: detail; justify-self: start; }
  .members tbody .c-nation { grid-area: detail; padding-left: 68px !important; color: var(--ink-soft); }

  .chip { font-size: 0.75rem; }
  .flag { width: 24px; height: 18px; margin-right: 4px; border-radius: 3px; }

  body:not([data-active=""]) .avatar { width: 64px; height: 64px; }
  body:not([data-active=""]) .c-photo { width: auto; }

  .credits tr { display: block; padding: 12px 14px; border-top: 1px solid var(--line); }
  .credits td { display: block; padding: 1px 0; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
