/* 주스닥: 그림일기장. 줄 공책 위에 연필·크레파스·빨간 펜. 밤에는 불 끈 교실의 야광 공책. */
:root {
  --paper: #fffefa;
  --paper-2: #f6f9f2;
  --rule: #d6e5f2;
  --margin: #f2a7a7;
  --grid: #b9dcae;
  --cover: #ffd23f;
  --cover-2: #f4b400;
  --cover-ink: #2b2a33;
  --ink: #2b2a33;
  --ink-2: #57555f;
  --ink-3: #8a8794;
  --line: #2b2a33;
  --up: #d8301d;
  --dn: #1d5bc8;
  --fl: #6c6a75;
  --red: #d8301d;
  --stamp: #e0532a;
  --tape: rgba(255, 214, 92, 0.78);
  --tint-up: #fde4df;
  --tint-dn: #e1ebfb;
  --hatch-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M-3 9C1 6 3 3 9-3M0 16C5 11 9 6 16 0M7 18c3-4 7-8 11-11' fill='none' stroke='%23d8301d' stroke-width='2.1' stroke-linecap='round' opacity='.85'/%3E%3C/svg%3E");
  --hatch-dn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M-3 9C1 6 3 3 9-3M0 16C5 11 9 6 16 0M7 18c3-4 7-8 11-11' fill='none' stroke='%231d5bc8' stroke-width='2.1' stroke-linecap='round' opacity='.85'/%3E%3C/svg%3E");
  --fi: #2b2a33; /* 얼굴 외곽선 */
  --fe: #2b2a33; /* 눈·입 */
  --shadow: 0 1px 0 rgba(43, 42, 51, 0.08), 0 12px 28px -18px rgba(43, 42, 51, 0.35);
  --hand: "Nanum Pen Script", "Pretendard Variable", system-ui, sans-serif;
  --num: "Jua", "Pretendard Variable", system-ui, sans-serif;
  --sans: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151a33;
    --paper-2: #1a2040;
    --rule: rgba(150, 185, 255, 0.13);
    --margin: rgba(255, 140, 140, 0.32);
    --grid: rgba(150, 220, 140, 0.22);
    --cover: #232a52;
    --cover-2: #2e376a;
    --cover-ink: #fff3c4;
    --ink: #f3eedf;
    --ink-2: #c9c4d6;
    --ink-3: #9a95ad;
    --line: #f3eedf;
    --up: #ff7468;
    --dn: #74aaff;
    --fl: #aaa5b8;
    --red: #ff7468;
    --stamp: #ff8a5c;
    --tape: rgba(255, 214, 92, 0.85);
    --tint-up: rgba(255, 116, 104, 0.16);
    --tint-dn: rgba(116, 170, 255, 0.16);
    --hatch-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M-3 9C1 6 3 3 9-3M0 16C5 11 9 6 16 0M7 18c3-4 7-8 11-11' fill='none' stroke='%23ff7468' stroke-width='2.1' stroke-linecap='round'/%3E%3C/svg%3E");
    --hatch-dn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M-3 9C1 6 3 3 9-3M0 16C5 11 9 6 16 0M7 18c3-4 7-8 11-11' fill='none' stroke='%2374aaff' stroke-width='2.1' stroke-linecap='round'/%3E%3C/svg%3E");
    --fi: #fff6dc;
    --fe: #1b1e2c;
    --shadow: 0 0 0 1px rgba(255, 246, 220, 0.06), 0 18px 40px -24px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151a33;
  --paper-2: #1a2040;
  --rule: rgba(150, 185, 255, 0.13);
  --margin: rgba(255, 140, 140, 0.32);
  --grid: rgba(150, 220, 140, 0.22);
  --cover: #232a52;
  --cover-2: #2e376a;
  --cover-ink: #fff3c4;
  --ink: #f3eedf;
  --ink-2: #c9c4d6;
  --ink-3: #9a95ad;
  --line: #f3eedf;
  --up: #ff7468;
  --dn: #74aaff;
  --fl: #aaa5b8;
  --red: #ff7468;
  --stamp: #ff8a5c;
  --tape: rgba(255, 214, 92, 0.85);
  --tint-up: rgba(255, 116, 104, 0.16);
  --tint-dn: rgba(116, 170, 255, 0.16);
  --hatch-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M-3 9C1 6 3 3 9-3M0 16C5 11 9 6 16 0M7 18c3-4 7-8 11-11' fill='none' stroke='%23ff7468' stroke-width='2.1' stroke-linecap='round'/%3E%3C/svg%3E");
  --hatch-dn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14'%3E%3Cpath d='M-3 9C1 6 3 3 9-3M0 16C5 11 9 6 16 0M7 18c3-4 7-8 11-11' fill='none' stroke='%2374aaff' stroke-width='2.1' stroke-linecap='round'/%3E%3C/svg%3E");
  --fi: #fff6dc;
  --fe: #1b1e2c;
  --shadow: 0 0 0 1px rgba(255, 246, 220, 0.06), 0 18px 40px -24px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  background: var(--cover);
}
body {
  margin: 0;
  background: var(--cover);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  font-feature-settings: "ss06";
  word-break: keep-all;
  overflow-wrap: anywhere;
}
::selection {
  background: var(--tape);
  color: #2b2a33;
}
a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
:focus-visible {
  outline: 3px solid var(--dn);
  outline-offset: 3px;
  border-radius: 6px;
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 9;
  background: var(--paper);
  padding: 6px 10px;
}
.up {
  color: var(--up);
}
.dn {
  color: var(--dn);
}
.fl {
  color: var(--fl);
}

/* ── 표지 ── */
.cover {
  background: var(--cover);
  color: var(--cover-ink);
  position: relative;
}
:root[data-theme="dark"] .cover,
:root:not([data-theme="light"]) .cover {
  background-image: radial-gradient(1.2px 1.2px at 12% 30%, #fff6dc 50%, transparent 51%), radial-gradient(1px 1px at 38% 70%, #fff6dc 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 66% 24%, #fff6dc 50%, transparent 51%), radial-gradient(1px 1px at 88% 62%, #fff6dc 50%, transparent 51%);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .cover {
    background-image: none;
  }
}
:root[data-theme="light"] .cover {
  background-image: none;
}
.cover .in {
  max-width: 920px;
  margin: 0 auto;
  padding: 14px 16px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo {
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.logo .lt {
  font: 400 52px/1 var(--hand);
  letter-spacing: -0.02em;
}
.logo .ls {
  font: 400 22px/1.2 var(--hand);
  opacity: 0.85;
}
.night {
  appearance: none;
  border: 2.5px solid var(--cover-ink);
  background: transparent;
  color: var(--cover-ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
.night svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.night .moon {
  display: none;
  fill: currentColor;
}
.night .moon .st {
  fill: currentColor;
  stroke: none;
}
:root[data-theme="dark"] .night .sun {
  display: none;
}
:root[data-theme="dark"] .night .moon {
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .night .sun {
    display: none;
  }
  :root:not([data-theme="light"]) .night .moon {
    display: block;
  }
}
.night:hover {
  background: rgba(43, 42, 51, 0.08);
}

/* 메뉴: 표지에 붙인 이름표 띠 */
.tabs {
  max-width: 920px;
  margin: 0 auto;
  padding: 6px 12px 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tabs a {
  flex: none;
  text-decoration: none;
  font: 400 26px/1 var(--hand);
  padding: 10px 14px 9px;
  border-radius: 12px 12px 0 0;
  color: var(--cover-ink);
  position: relative;
}
.tabs a:hover {
  background: rgba(255, 255, 255, 0.35);
}
.tabs a[aria-current="page"] {
  background: var(--paper);
  color: var(--ink);
}

/* ── 공책 종이 ── */
.paper {
  background-color: var(--paper);
  background-image: linear-gradient(var(--rule) 1.5px, transparent 1.5px);
  background-size: 100% 32px;
  background-position: 0 14px;
  max-width: 920px;
  margin: 0 auto;
  padding: 8px 16px 48px;
  min-height: 60vh;
  position: relative;
}
@media (min-width: 760px) {
  .paper {
    border-radius: 0 0 6px 6px;
    box-shadow: var(--shadow);
    padding: 20px 56px 64px 72px;
  }
  .paper::before {
    content: "";
    position: absolute;
    left: 48px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--margin);
  }
}
.tape {
  display: inline-block;
  margin: 10px 0 4px;
  background: var(--tape);
  color: #2b2a33;
  font: 400 22px/1.35 var(--hand);
  padding: 6px 14px;
  transform: rotate(-1.2deg);
  clip-path: polygon(0 4%, 3% 0, 97% 2%, 100% 0, 99% 96%, 96% 100%, 3% 98%, 0 100%);
}
.sheet {
  max-width: 760px;
  margin: 0 auto;
}

/* 손글씨 제목 */
.hand {
  font: 400 39px/1.15 var(--hand);
  letter-spacing: -0.01em;
  margin: 44px 0 14px;
  text-wrap: balance;
}
h1.hand {
  font-size: 50px;
  margin-top: 22px;
}
h1.hand.sm {
  font-size: 38px;
  margin: 4px 0 6px;
}
.intro {
  font-size: 16px;
  color: var(--ink-2);
  max-width: 62ch;
  margin: 0 0 18px;
}
.cap {
  font-size: 13.5px;
  color: var(--ink-3);
  margin: 10px 2px 0;
  max-width: 64ch;
}
.empty-note,
.empty {
  font: 400 25px/1.4 var(--hand);
  color: var(--ink-3);
}

/* ── 일기 머리줄(날짜·날씨·쪽) ── */
.dhead {
  display: grid;
  grid-template-columns: 1fr auto;
  border: 2.5px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  margin: 14px 0 0;
}
.dhead > div {
  padding: 8px 12px 10px;
  position: relative;
}
.dhead > div + div {
  border-left: 2.5px solid var(--line);
}
.dhead .lab {
  font: 400 18px/1 var(--hand);
  color: var(--ink-3);
  display: block;
  margin-bottom: 2px;
}
.dh-date p {
  margin: 0;
  font: 400 22px/1.2 var(--num);
}
.dh-date p small {
  display: block;
  font: 400 13px/1.3 var(--sans);
  color: var(--ink-3);
}
.stamp-date {
  display: inline-block;
  margin-top: 6px;
  font: 400 18px/1 var(--hand);
  color: var(--stamp);
  border: 2px solid var(--stamp);
  border-radius: 6px;
  padding: 4px 7px 3px;
  transform: rotate(-2deg);
  white-space: nowrap;
}
.dh-page {
  display: none;
}
.wxbox {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wxbox p {
  margin: 0;
  display: flex;
  flex-direction: column;
  font: 400 14px/1.3 var(--sans);
  color: var(--ink-2);
}
.wxbox b {
  font: 400 20px/1.1 var(--num);
  color: var(--ink);
}
.wxbox em {
  font: normal 400 16px var(--num);
  color: var(--ink);
}
.wx {
  width: 52px;
  height: 52px;
  flex: none;
}
.wx .sunc {
  fill: #ffcf33;
  stroke: var(--line);
  stroke-width: 2.6;
}
.wx .ray,
.wx .rn {
  stroke: #f2a900;
  stroke-width: 3.4;
  stroke-linecap: round;
  fill: none;
}
.wx .rn {
  stroke: #5ab0f0;
}
.wx .cl {
  fill: #e8eef6;
  stroke: var(--line);
  stroke-width: 2.6;
  stroke-linejoin: round;
}
@media (min-width: 620px) {
  .dhead {
    grid-template-columns: 1fr auto auto;
  }
  .dh-page {
    display: block;
    min-width: 72px;
    text-align: center;
  }
  .dh-page p {
    margin: 2px 0 0;
    font: 400 30px/1 var(--num);
  }
}

/* ── 그림 칸 ── */
.frame {
  border: 2.5px solid var(--line);
  border-top: 0;
  border-radius: 0 0 4px 4px;
  background: var(--paper);
  padding: 14px 12px 14px;
}
.lead {
  position: relative;
}
.season {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}
.season b {
  font-weight: 700;
  color: var(--ink);
}
.lead h1 {
  font: 400 36px/1.2 var(--hand);
  margin: 6px 0 0;
}
.lead h1 a {
  text-decoration: none;
  box-shadow: inset 0 -0.38em 0 var(--tape);
}
.big {
  margin: 0;
  position: relative;
  display: inline-block;
  font: 400 clamp(64px, 19vw, 112px) / 1 var(--num);
  letter-spacing: -0.02em;
  padding: 6px 14px 4px 4px;
}
.big .num {
  position: relative;
  z-index: 1;
}
.redcircle {
  position: absolute;
  inset: -10px -18px -6px -16px;
  width: calc(100% + 34px);
  height: calc(100% + 16px);
  fill: none;
  stroke: var(--red);
  stroke-width: 3.2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  stroke-dasharray: 900;
  stroke-dashoffset: 0;
  animation: draw 0.9s 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}
@keyframes draw {
  from {
    stroke-dashoffset: 900;
  }
}
.redpen {
  margin: 4px 0 0;
  font: 400 27px/1.3 var(--hand);
  color: var(--red);
  transform: rotate(-1deg);
  transform-origin: left;
}

/* 막대 무대 */
.stage {
  position: relative;
  height: clamp(300px, 72vw, 380px);
  margin: 18px 0 0;
}
.stage .zero,
.stage .gline {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid var(--ink-3);
  z-index: 0;
}
.stage .zero span,
.stage .gline span {
  position: absolute;
  left: 0;
  top: 4px;
  font: 400 20px/1 var(--hand);
  color: var(--ink-3);
  background: var(--paper);
  padding: 2px 4px;
}
.stage .gline {
  border-top: 2.5px dashed var(--ink-2);
  z-index: 2;
}
.stage .gline span {
  left: auto;
  right: 0;
  top: -26px;
  color: var(--ink-2);
}
.stage .cols {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--n, 9), minmax(0, 1fr));
}
.col {
  position: relative;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}
.col .bar {
  position: absolute;
  left: 50%;
  width: min(60%, 24px);
  transform: translateX(-50%);
  border: 2px solid var(--line);
  transform-origin: bottom;
  animation: grow 0.9s calc(var(--i) * 55ms) cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.col.up .bar {
  background: var(--hatch-up), var(--tint-up);
  border-radius: 6px 6px 0 0;
  border-bottom: 0;
}
.col.dn .bar {
  background: var(--hatch-dn), var(--tint-dn);
  border-radius: 0 0 6px 6px;
  border-top: 0;
  transform-origin: top;
}
@keyframes grow {
  from {
    transform: translateX(-50%) scaleY(0.02);
  }
}
.col .who {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 3;
  animation: pop 0.6s calc(var(--i) * 55ms + 0.35s) cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.col.dn .who {
  transform: translate(-50%, 0);
}
@keyframes pop {
  from {
    opacity: 0;
    translate: 0 8px;
  }
}
.col .f {
  width: clamp(36px, 10.4vw, 64px);
  height: clamp(36px, 10.4vw, 64px);
  display: block;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.col:hover .f,
.col:focus-visible .f {
  transform: translateY(-4px) rotate(-4deg) scale(1.08);
}
.col .v {
  font: 400 clamp(12.5px, 3.4vw, 18px) / 1 var(--num);
  white-space: nowrap;
  margin: 2px 0;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.col .nm {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  font: 400 clamp(16px, 4.3vw, 21px) / 1 var(--hand);
  white-space: nowrap;
  color: var(--ink-2);
}
.col.best .f {
  width: clamp(48px, 13.5vw, 80px);
  height: clamp(48px, 13.5vw, 80px);
}
.col.best .v {
  color: var(--up);
}
.stage .plot {
  position: absolute;
  inset: 0 0 24px 0;
}
.col .nm {
  bottom: -22px !important;
}

/* ── 오늘의 두 주인공 ── */
.heroes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 26px 0 0;
}
@media (min-width: 620px) {
  .heroes {
    grid-template-columns: 1fr 1fr;
  }
}
.hero,
.scene {
  display: block;
  text-decoration: none;
  border: 2.5px solid var(--line);
  border-radius: 18px 22px 16px 20px;
  background: var(--paper);
  padding: 12px 14px 14px;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero:hover,
.scene:hover {
  transform: rotate(-0.6deg) translateY(-2px);
}
.hero h3,
.scene h3 {
  margin: 0 0 4px;
  font: 400 27px/1.2 var(--hand);
}
.h-best h3 {
  color: var(--up);
}
.h-worst h3 {
  color: var(--dn);
}
.hb {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hb > div {
  display: flex;
  flex-direction: column;
}
.hn {
  font: 400 24px/1.1 var(--num);
}
.hv {
  font: 400 40px/1.05 var(--num);
}
.sd {
  font: 400 16px/1.3 var(--sans);
  color: var(--ink-2);
}
.f.big {
  width: 92px;
  height: 92px;
  flex: none;
}
.f.mid {
  width: 60px;
  height: 60px;
  flex: none;
}
.bubble {
  position: relative;
  margin: 10px 0 0;
  background: var(--paper-2);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px;
  font: 400 25px/1.35 var(--hand);
}
.bubble::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 34px;
  width: 14px;
  height: 14px;
  background: var(--paper-2);
  border-left: 2px solid var(--line);
  border-top: 2px solid var(--line);
  transform: rotate(45deg);
}

/* ── 성적표 ── */
.board {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: r;
}
.row {
  padding: 12px 0 12px;
  border-bottom: 2px dashed var(--rule);
}
.row:first-child {
  border-top: 2.5px solid var(--line);
}
.rk {
  display: grid;
  grid-template-columns: 30px 52px 1fr auto;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}
.rank {
  font: 400 22px/1 var(--num);
  text-align: center;
  color: var(--ink-2);
}
.rank.r1 {
  color: var(--red);
  position: relative;
}
.rank.r1::after {
  content: "";
  position: absolute;
  inset: -7px -6px;
  border: 2.5px solid var(--red);
  border-radius: 50% 46% 52% 48%;
  transform: rotate(-8deg);
}
.rk .f {
  width: 52px;
  height: 52px;
}
.nm b {
  display: block;
  font: 400 21px/1.1 var(--num);
}
.nm small {
  font-size: 13px;
  color: var(--ink-3);
}
.ret {
  font: 400 30px/1 var(--num);
  text-align: right;
  white-space: nowrap;
}
a.rk:hover .nm b {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}
.marks {
  margin: 6px 0 0 38px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  font-size: 14px;
  color: var(--ink-2);
}
.gm {
  font: 400 22px/1.3 var(--hand);
}
.gm.up,
.gm.dn,
.gm.fl {
  color: var(--red);
}
.gm.dn {
  color: var(--dn);
}
.gm.base {
  color: var(--ink-3);
}
.td {
  font-variant-numeric: tabular-nums;
}
.tr {
  color: var(--ink-3);
}
.line {
  margin: 6px 0 0 38px;
  font: 400 25px/1.4 var(--hand);
  color: var(--ink);
}
.line .mood {
  display: inline-block;
  font: 400 12.5px/1 var(--num);
  border: 1.5px solid currentColor;
  color: var(--ink-3);
  border-radius: 99px;
  padding: 3px 7px 2px;
  margin-right: 6px;
  vertical-align: 3px;
}
.row.boss .rk {
  color: var(--ink-3);
}
.f.ghost {
  opacity: 0.4;
  filter: grayscale(1);
}
@media (min-width: 620px) {
  .rk {
    grid-template-columns: 40px 60px 1fr auto;
    gap: 12px;
  }
  .rk .f {
    width: 60px;
    height: 60px;
  }
  .ret {
    font-size: 38px;
  }
  .marks,
  .line {
    margin-left: 52px;
  }
}
.more {
  margin: 22px 0 0;
  text-align: center;
}
.pill {
  display: inline-block;
  appearance: none;
  border: 2.5px solid var(--line);
  background: var(--cover);
  color: #2b2a33;
  font: 400 26px/1 var(--hand);
  padding: 12px 20px 11px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
:root[data-theme="dark"] .pill {
  background: #ffd23f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill {
    background: #ffd23f;
  }
}
.pill:hover {
  transform: translateY(-2px) rotate(-1deg);
}

/* ── 친구들 ── */
.friends {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.fcard {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  grid-template-areas: "f n r" "f i i" "f k k";
  gap: 0 10px;
  text-decoration: none;
  border: 2.5px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  background: var(--paper);
  height: 100%;
}
.fcard .f {
  grid-area: f;
  width: 76px;
  height: 76px;
}
.fn {
  grid-area: n;
}
.fn b {
  font: 400 22px/1.2 var(--num);
}
.fn small {
  display: block;
  color: var(--ink-3);
  font-size: 13px;
}
.fi {
  grid-area: i;
  font: 400 22px/1.3 var(--hand);
  color: var(--ink-2);
}
.fcard .ret {
  grid-area: r;
  font-size: 22px;
}
.fr {
  grid-area: k;
  font-size: 13px;
  color: var(--ink-3);
}
.kind {
  display: inline-block;
  font: 400 12px/1 var(--num);
  padding: 3px 7px 2px;
  border-radius: 6px;
  border: 1.5px solid currentColor;
  vertical-align: 3px;
}
.k-rule {
  color: #2f8a4c;
}
.k-ai {
  color: #8a4fd0;
}
.k-base {
  color: var(--ink-3);
}
.k-boss {
  color: #c98a1a;
}
:root[data-theme="dark"] .k-rule {
  color: #7fd39a;
}
:root[data-theme="dark"] .k-ai {
  color: #c9a6ff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .k-rule {
    color: #7fd39a;
  }
  :root:not([data-theme="light"]) .k-ai {
    color: #c9a6ff;
  }
}

/* ── 동물 방 ── */
.profile {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-top: 16px;
}
.pf-face {
  position: relative;
  justify-self: start;
}
.f.huge {
  width: 168px;
  height: 168px;
  display: block;
}
.moodtag {
  position: absolute;
  right: -10px;
  bottom: 8px;
  background: var(--tape);
  color: #2b2a33;
  font: 400 21px/1 var(--hand);
  padding: 6px 10px;
  transform: rotate(4deg);
}
.moodtag b {
  font-size: 19px;
}
.pf-kind {
  margin: 0;
  font-size: 15px;
  color: var(--ink-2);
}
.room h1.hand {
  margin: 2px 0 2px;
  font-size: 62px;
}
.pf-intro {
  margin: 0 0 4px;
  font: 400 27px/1.3 var(--hand);
}
@media (min-width: 620px) {
  .profile {
    grid-template-columns: 210px 1fr;
    align-items: center;
    gap: 22px;
  }
  .f.huge {
    width: 210px;
    height: 210px;
  }
}
.facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin: 22px 0 0;
  border: 2.5px solid var(--line);
  border-radius: 4px;
}
.facts div {
  padding: 8px 12px;
  border-bottom: 1.5px solid var(--rule);
}
.facts div:nth-child(odd) {
  border-right: 1.5px solid var(--rule);
}
.facts dt {
  font: 400 20px/1.2 var(--hand);
  color: var(--ink-3);
}
.facts dd {
  margin: 2px 0 0;
  font: 400 21px/1.2 var(--num);
}
@media (min-width: 620px) {
  .facts {
    grid-template-columns: repeat(4, 1fr);
  }
  .facts div {
    border-right: 1.5px solid var(--rule);
  }
}

/* 곡선 */
.curve {
  margin: 0;
  position: relative;
  border: 2.5px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  padding: 10px 6px 8px;
}
.curve svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.curve .g {
  stroke: var(--rule);
  stroke-width: 1;
}
.curve .g0 {
  stroke: var(--ink-3);
  stroke-width: 1;
}
.curve .tk {
  font: 10px var(--sans);
  fill: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.curve .me {
  fill: none;
  stroke: var(--me);
  stroke-width: 2.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.curve .other,
.mini .other {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.6;
  stroke-dasharray: 4 4;
}
.curve .dot {
  stroke: var(--paper);
  stroke-width: 2;
}
.curve .dot.buy {
  fill: var(--me);
}
.curve .dot.sell {
  fill: var(--paper);
  stroke: var(--me);
  stroke-width: 2.2;
}
.curve .dot.both {
  fill: var(--me);
  stroke: var(--paper);
  stroke-width: 2;
  stroke-dasharray: 2 2;
}
.curve .end {
  fill: var(--me);
  stroke: var(--paper);
  stroke-width: 2;
}
.curve .lab {
  font: 400 12px var(--num);
  fill: var(--ink);
}
.curve .lab.mute {
  fill: var(--ink-2);
}
.curve .xl {
  stroke: var(--ink-3);
  stroke-width: 1;
}
.curve .hit {
  cursor: crosshair;
}
:root[data-theme="dark"] .curve .me,
:root[data-theme="dark"] .mini .me {
  stroke: color-mix(in oklab, var(--me) 55%, white);
}
:root[data-theme="dark"] .curve .dot.buy,
:root[data-theme="dark"] .curve .end {
  fill: color-mix(in oklab, var(--me) 55%, white);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .curve .me,
  :root:not([data-theme="light"]) .mini .me {
    stroke: color-mix(in oklab, var(--me) 55%, white);
  }
  :root:not([data-theme="light"]) .curve .dot.buy,
  :root:not([data-theme="light"]) .curve .end {
    fill: color-mix(in oklab, var(--me) 55%, white);
  }
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 13.5px;
  color: var(--ink-2);
  padding: 6px 6px 0;
}
.legend .k {
  display: inline-block;
  width: 18px;
  height: 0;
  vertical-align: middle;
  margin-right: 5px;
  border-top: 2.5px solid var(--me);
}
.legend .k.other {
  border-top: 2px dashed var(--ink-2);
}
.legend .k.buy,
.legend .k.sell {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2.2px solid var(--me);
  background: var(--me);
}
.legend .k.sell {
  background: transparent;
}
.legend .mute {
  color: var(--ink-3);
}
.tip,
.ztip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.35);
  min-width: 140px;
  font-variant-numeric: tabular-nums;
}
.tip b,
.ztip b {
  font: 400 15px var(--num);
}
.note {
  margin: 22px 0 0;
  padding: 12px 16px 14px;
  border: 2.5px solid var(--red);
  border-radius: 6px 18px 8px 16px;
  color: var(--red);
  transform: rotate(-0.5deg);
}
.note h3 {
  margin: 0 0 4px;
  font: 400 26px/1.2 var(--hand);
}
.note p {
  margin: 0;
  font: 400 25px/1.45 var(--hand);
}

/* 기분 달력 */
.moodsum {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 12px;
}
.moodsum span {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}
.moodsum b {
  font: 400 22px var(--hand);
}
.moodsum i {
  font: normal 400 16px var(--num);
  color: var(--ink-2);
}
.f.sm {
  width: 38px;
  height: 38px;
  flex: none;
}
.f.xs {
  width: 28px;
  height: 28px;
  flex: none;
  vertical-align: middle;
}
.cals {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.cal h4 {
  margin: 0 0 4px;
  font: 400 20px var(--num);
}
.wk,
.cg {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}
.wk span {
  text-align: center;
  font: 400 18px var(--hand);
  color: var(--ink-3);
}
.cg .c {
  aspect-ratio: 1;
  border: 1.5px solid var(--rule);
  border-radius: 6px;
  position: relative;
  display: grid;
  place-items: center;
  text-decoration: none;
  background: var(--paper);
}
.cg a.c:hover {
  border-color: var(--line);
}
.cg .c i {
  position: absolute;
  left: 3px;
  top: 1px;
  font: normal 400 10.5px var(--num);
  color: var(--ink-3);
}
.cg .c .cf {
  width: 78%;
  height: 78%;
}
.cg .c.x {
  background: transparent;
  border-style: dashed;
}

/* 타임라인 */
.tl {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tl li {
  padding: 14px 0;
  border-bottom: 2px dashed var(--rule);
}
.tl li.later {
  display: none;
}
.tl.all li.later {
  display: block;
}
.tl-d {
  font: 400 17px var(--num);
  text-decoration: none;
}
.tl-b {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.tl-m {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}

/* 원고지 칸 일기 본문 */
.ms {
  margin: 6px 0 0;
  font: 400 27px/34px var(--hand);
  background-image: linear-gradient(90deg, var(--grid) 1.5px, transparent 1.5px), linear-gradient(var(--grid) 1.5px, transparent 1.5px);
  background-size: 34px 34px;
  background-position: -1px -1px;
  padding: 0 4px 2px 8px;
  border: 1.5px solid var(--grid);
  letter-spacing: 0.02em;
}

/* 표 */
.rec {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.rec th {
  font: 400 21px var(--hand);
  color: var(--ink-3);
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2.5px solid var(--line);
}
.rec td {
  padding: 9px 8px;
  border-bottom: 1.5px dashed var(--rule);
  font: 400 17px var(--num);
}
.rec td small {
  color: var(--ink-3);
  font: 400 12px var(--sans);
}
.rec .tn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rec.wide td {
  font-size: 19px;
}
@media (max-width: 480px) {
  .rec.wide th:last-child,
  .rec.wide td:last-child {
    display: none;
  }
}
.pn {
  display: flex;
  justify-content: space-between;
  margin: 30px 0 0;
  font: 400 18px var(--num);
}
.pn a {
  text-decoration: none;
  padding: 8px 4px;
}
.pn a:hover {
  text-decoration: underline;
}
.pn.top {
  margin: 10px 0 12px;
}

/* 일기 한 쪽 */
.entries {
  display: grid;
  gap: 22px;
  margin-top: 24px;
}
.entry header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.eh {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.eh b {
  display: block;
  font: 400 23px/1.1 var(--num);
}
.eh small {
  color: var(--ink-3);
  font-size: 13px;
}
.ev {
  margin: 0;
  text-align: right;
  font: 400 30px/1 var(--num);
}
.ev small {
  display: block;
  font: 400 14px/1.4 var(--sans);
  color: var(--ink-2);
}
.em {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ink-2);
}
.em b {
  font: 400 22px var(--hand);
  color: var(--ink);
}
.fb {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}
.dindex {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0 18px;
}
.dindex a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  text-decoration: none;
  border-bottom: 2px dashed var(--rule);
}
.di-d {
  font: 400 18px/1.1 var(--num);
  min-width: 70px;
}
.di-d small {
  display: block;
  font: 400 17px var(--hand);
  color: var(--ink-3);
}
.di-t {
  font-size: 14.5px;
}
.di-t b {
  font: 400 16px var(--num);
}
.di-t em {
  font: normal 400 17px var(--hand);
  color: var(--dn);
  margin-left: 6px;
}

/* 시즌관 */
.minis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.mcell {
  display: block;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 6px 8px 4px;
  text-decoration: none;
  background: var(--paper);
}
.mh {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}
.mh b {
  font: 400 15px var(--num);
  flex: 1;
}
.mh i {
  font: normal 400 15px var(--num);
}
.mini {
  width: 100%;
  height: auto;
  display: block;
}
.mini .me {
  fill: none;
  stroke: var(--me);
  stroke-width: 2;
  stroke-linejoin: round;
}
.mini .g0 {
  stroke: var(--rule);
  stroke-width: 1.5;
}
.mini .end {
  fill: var(--me);
}
.scenes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.past {
  margin: 0 0 22px;
}
.past h3 {
  font: 400 22px var(--num);
  margin: 0;
}
.past h3 small {
  font: 400 14px var(--sans);
  color: var(--ink-3);
}

/* 규칙 */
.rl {
  padding-left: 0;
  list-style: none;
  counter-reset: n;
}
.rl li {
  counter-increment: n;
  position: relative;
  padding: 10px 0 10px 46px;
  border-bottom: 2px dashed var(--rule);
}
.rl li::before {
  content: counter(n);
  position: absolute;
  left: 4px;
  top: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--red);
  color: var(--red);
  font: 400 17px/26px var(--num);
  text-align: center;
}
.rl h2 {
  margin: 0;
  font: 400 30px/1.3 var(--hand);
}
.rl p {
  margin: 2px 0 0;
  color: var(--ink-2);
  max-width: 62ch;
}
.castl {
  list-style: none;
  padding: 0;
  margin: 0;
}
.castl li {
  display: grid;
  grid-template-columns: 38px auto 1fr;
  grid-template-areas: "f n k" "f s s";
  align-items: center;
  gap: 0 8px;
  padding: 8px 0;
  border-bottom: 1.5px dashed var(--rule);
}
.castl .f {
  grid-area: f;
}
.castl b {
  font: 400 19px var(--num);
}
.castl .kind {
  justify-self: start;
}
.castl span:last-child {
  grid-area: s;
  font-size: 14px;
  color: var(--ink-2);
}
.nf {
  text-align: center;
  padding-top: 30px;
}
.nf .f.huge {
  margin: 0 auto;
}

/* 꼬리 표지 */
.back {
  background: var(--cover);
  color: var(--cover-ink);
}
.back .in {
  max-width: 920px;
  margin: 0 auto;
  padding: 26px 16px 40px;
}
.back p {
  margin: 0 0 6px;
}
.back .fl {
  font: 400 25px/1.4 var(--hand);
  color: var(--cover-ink);
}
.back .fs {
  font-size: 14px;
}

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

/* 1등 얼굴: 그림 칸 모서리를 넘을 만큼 크게 */
.lead-face {
  position: absolute;
  right: -6px;
  top: -6px;
  transform: rotate(6deg);
  z-index: 2;
}
.lead-face .f {
  width: clamp(92px, 26vw, 250px);
  height: clamp(92px, 26vw, 250px);
  display: block;
  animation: pop 0.7s 0.2s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
@media (min-width: 760px) {
  .lead-face {
    right: 10px;
    top: -14px;
  }
}
.stage {
  margin-top: 40px;
}
.c-d {
  display: none;
}
@media (min-width: 700px) {
  .c-m {
    display: none;
  }
  .c-d {
    display: block;
  }
}
.curve .tk {
  font-size: 11px;
}
.curve .lab {
  font-size: 12.5px;
}
.rec td,
.rec th {
  white-space: nowrap;
}
@media (max-width: 480px) {
  .rec td {
    font-size: 15px;
    padding: 8px 4px;
  }
  .rec th {
    padding: 6px 4px;
  }
}

.mv {
  display: block;
  font: normal 400 11px/1 var(--num);
  margin-top: 3px;
}
.st {
  font: 400 20px/1.2 var(--hand);
  color: var(--ink);
  background: var(--tape);
  padding: 0 6px;
  color: #2b2a33;
}
.stage {
  height: clamp(270px, 66vw, 380px);
}
.stage.small {
  height: clamp(220px, 50vw, 300px);
}
@media (max-width: 619px) {
  .profile {
    grid-template-columns: 116px 1fr;
    align-items: center;
    gap: 12px;
  }
  .f.huge {
    width: 116px;
    height: 116px;
  }
  .room h1.hand {
    font-size: 48px;
  }
  .moodtag {
    right: -4px;
    bottom: -6px;
    font-size: 17px;
  }
  .pf-txt .big {
    font-size: clamp(52px, 15vw, 72px);
  }
  .facts dd {
    font-size: 19px;
  }
}
.pf-txt .big {
  white-space: nowrap;
}
@media (max-width: 619px) {
  .pf-txt .big {
    font-size: clamp(42px, 12vw, 60px);
  }
}

/* 테이프로 붙인 사진 */
.polaroid {
  position: relative;
  margin: 18px auto 8px;
  max-width: 340px;
  background: #fffdf7;
  padding: 10px 10px 8px;
  border: 1.5px solid rgba(43, 42, 51, 0.12);
  box-shadow: 0 2px 2px rgba(43, 42, 51, 0.06), 0 14px 24px -14px rgba(43, 42, 51, 0.45);
  transform: rotate(-2.2deg);
}
.polaroid.tilt-r {
  transform: rotate(1.8deg);
}
.polaroid::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 92px;
  height: 26px;
  background: var(--tape);
  transform: translateX(-50%) rotate(-3deg);
  clip-path: polygon(0 8%, 4% 0, 96% 4%, 100% 0, 98% 92%, 94% 100%, 4% 96%, 0 100%);
}
.polaroid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.polaroid figcaption {
  font: 400 23px/1.3 var(--hand);
  color: #2b2a33;
  margin: 8px 2px 2px;
}
.polaroid .credit {
  display: block;
  font-size: 11px;
  color: #8a8794;
  margin: 0 2px;
}
.polaroid .credit a {
  color: inherit;
}
.photo-row {
  margin-top: 34px;
}
.photo-note {
  text-align: center;
}
.photo-note > p:first-child {
  font: 400 24px/1.4 var(--hand);
  margin: 14px auto 0;
  max-width: 30ch;
}
.photo-note .more {
  margin-top: 14px;
}
@media (min-width: 700px) {
  .photo-row {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 36px;
    align-items: center;
  }
  .photo-row .polaroid {
    margin: 0;
  }
  .photo-note {
    text-align: left;
  }
  .photo-note > p:first-child {
    margin: 0;
  }
  .photo-note .more {
    text-align: left;
  }
  .rules .polaroid {
    float: right;
    width: 300px;
    margin: -8px 0 16px 28px;
  }
}
:root[data-theme="dark"] .polaroid {
  background: #ece7da;
}
:root[data-theme="dark"] .polaroid img {
  filter: brightness(0.82) saturate(0.9);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .polaroid {
    background: #ece7da;
  }
  :root:not([data-theme="light"]) .polaroid img {
    filter: brightness(0.82) saturate(0.9);
  }
}

/* 로고 */
:root {
  --logo-line: #d8301d;
}
:root[data-theme="dark"] {
  --logo-line: #ff7468;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --logo-line: #ff7468;
  }
}
.logo {
  align-items: center;
  column-gap: 6px;
}
.logo .mark {
  width: 58px;
  height: 58px;
  flex: none;
  margin: -6px -2px -8px -6px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.logo:hover .mark {
  transform: rotate(-6deg) translateY(-2px);
}
.logo .ls {
  flex-basis: auto;
}
@media (max-width: 420px) {
  .logo .mark {
    width: 50px;
    height: 50px;
  }
  .logo .ls {
    display: none;
  }
}
:root {
  --tint-up-solid: var(--tint-up);
  --tint-dn-solid: var(--tint-dn);
}
.logo .mark {
  width: 54px;
  height: 54px;
  margin: -4px 0 -6px -4px;
}
