/* ============================================================
   큐피스트 하트 보드 · 테마 (heyduck 커스터마이징)
   - 실제 fun.js 가 생성하는 DOM 클래스명에 맞춰 작성됨
   - 색/타이포/헤더만 Cupist 코럴 아이덴티티로 교체
   ============================================================ */

:root {
  --ground: #FBF6F4;
  --header: #1C1417;
  --header-soft: #2A1F23;
  --accent: #FF4D6D;
  --accent-deep: #E63958;
  --good: #3FBE86;
  --bad: #E08DAC;
  --rank: #C0897B;
  --card: #FFFFFF;
  --ink: #241A1E;
  --muted: #93818A;
  --line: #EFE6E3;
  --shadow: 0 7px 20px rgba(70, 30, 40, 0.08), 0 2px 6px rgba(70, 30, 40, 0.06);
  --sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
}

/* ---- compact reset ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
img { display: block; }
ol, ul { list-style: none; }

html { box-sizing: border-box; }
body {
  line-height: 1.4;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 80% -10%, #FFE7EC 0%, rgba(255, 231, 236, 0) 60%),
    var(--ground);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* =====================  HEADER  ===================== */
#header {
  height: 66px;
  background: linear-gradient(180deg, var(--header) 0%, var(--header-soft) 100%);
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

#logo {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
}
.logo__mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: 0 3px 10px rgba(230, 57, 88, 0.45);
}
.logo__text {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.logo__accent { color: var(--accent); }

#filter { display: flex; align-items: center; }
#filter p { display: inline-flex; align-items: center; gap: 16px; }

.nav-link {
  color: #C9B3BA;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--accent); }

/* ---- To/From (받은/보낸) 스위치 ---- */
.c-switch {
  --switch-height: 36px;
  --switch-handle-size: calc(var(--switch-height) - 6px);
  display: inline-block;
  position: relative;
  min-width: 116px;
  height: var(--switch-height);
  border: 1px solid #37292e;
  background: #14100f;
  color: #fff;
  border-radius: var(--switch-height);
  cursor: pointer;
  overflow: hidden;
}
.c-switch__input { position: absolute; opacity: 0; }
.c-switch__values { display: flex; height: 100%; }
.c-switch__value {
  display: flex;
  align-items: center;
  padding: 0 20px;
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: #8b7d83;
  transition: opacity 0.3s, color 0.3s;
}
.c-switch__value--true { justify-content: flex-start; }
.c-switch__value--false { justify-content: flex-end; }
.c-switch__values::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translate(0, -50%);
  width: calc(50% - 3px);
  height: var(--switch-handle-size);
  border-radius: var(--switch-handle-size);
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  transition: left 0.3s, transform 0.3s;
}
.c-switch__input:checked + .c-switch__values::after {
  left: calc(100% - 3px);
  transform: translate(-100%, -50%);
}
.c-switch__input:not(:checked) + .c-switch__values .c-switch__value--true { opacity: 0; }
.c-switch__input:checked + .c-switch__values .c-switch__value--false { opacity: 0; }

/* =====================  DATE FILTER  ===================== */
.date-filter {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}
.date-filter__button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: #6b5c62;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: 0.15s;
}
.date-filter__button:hover { border-color: #e3b8bf; }
.date-filter__button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.date-filter__button.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

#month-picker-wrapper { display: flex; justify-content: center; }
.month-picker { margin: 26px 0; }

/* =====================  SCOREBOARD  ===================== */
.scoreboard {
  max-width: 720px;
  margin: auto;
  padding: 12px 0 40px;
  justify-content: center;
}
@media (min-width: 1440px) {
  .scoreboard {
    max-width: 1440px;
    max-height: 95vh;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    padding-bottom: 10px;
    overflow-x: auto;
  }
}
@media (min-width: 2160px) {
  .scoreboard { max-width: 2160px; }
}

.scoreboard__user {
  max-width: 700px;
  margin: 12px auto 0;
  background: var(--card);
  border-radius: 14px;
  border: 1px solid rgba(230, 57, 88, 0.06);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  /* 등장 애니메이션 (fun.js 가 .display / .displayed 토글) */
  opacity: 0;
  transform: translate3d(0, -20px, 0) rotateX(45deg);
  transform-style: preserve-3d;
  transition: 0.3s transform cubic-bezier(0.68, -0.55, 0.265, 1.55), 0.3s opacity;
}
.scoreboard__user.display {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotateX(0);
}
.scoreboard__user.displayed {
  transition: 1s transform cubic-bezier(0.68, -0.55, 0.265, 1.55), 0.3s opacity;
}

.scoreboard__user__row {
  display: flex;
  align-items: center;
  max-width: 700px;
  max-height: 55px;
  padding: 15px 0;
}
.scoreboard__user__row > div { flex: 1; padding: 0 20px; }
.scoreboard__user__row > div:first-child { flex-grow: 0; padding-right: 0; }
.scoreboard__user__row > div:nth-child(2) { flex-grow: 0; padding-right: 0; }
.scoreboard__user__row > div:last-child { flex-grow: 0; text-align: right; padding-left: 0; }
.scoreboard__user__summary { cursor: pointer; }

.displayname { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }

.avatar { border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35); }

/* ---- scores ---- */
.score {
  display: inline-block;
  font-weight: 800;
  color: var(--accent);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}
.score.mini { font-size: 17px; }
.score.good { color: var(--good); }
.score.bad { color: var(--bad); }
.position {
  color: var(--rank);
  font-size: 15px;
  font-weight: 800;
}
.level {
  display: inline-block;
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
  margin-left: 8px;
}

/* ---- expandable stats ---- */
.scoreboard__user__stats {
  display: flex;
  flex-wrap: wrap;
  height: 0;              /* fun.js 가 펼칠 때 height 를 인라인으로 설정 */
  overflow: hidden;
  transition: 0.3s height cubic-bezier(0.68, -0.55, 0.265, 1.55);
  border-top: 1px dashed var(--line);
}
.scoreboard__user__stats__info,
.scoreboard__user__stats__today {
  width: 700px;
  display: flex;
  border-bottom: 1px dashed var(--line);
}
.scoreboard__user__stats__column {
  flex: 1;
  padding: 20px;
  border-right: 1px dashed var(--line);
}
.scoreboard__user__stats__title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  height: 30px;
  margin: -20px -20px 12px;
  padding: 9px 0 0 20px;
  background: rgba(255, 231, 236, 0.35);
  border-bottom: 1px dashed var(--line);
}
.scoreboard__user__stats__list > li {
  display: flex;
  align-items: center;
  margin-top: 10px;
}
.scoreboard__user__stats__list img {
  flex-shrink: 0;
  margin-right: 10px;
}
.scoreboard__user__stats__list strong {
  flex: 1;
  font-weight: normal;
  color: var(--ink);
}

/* =====================  RESPONSIVE HEADER  ===================== */
@media (max-width: 720px) {
  #header { height: auto; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  #filter { width: 100%; }
  .scoreboard { max-width: 720px; padding-top: 10px; }
}

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