/* 우리가족 — 다이어리 디자인 (라이트 전용)
   모바일(<700): 종이가 화면을 채우고 아래에 탭
   태블릿(700~1099): 왼쪽 인덱스 탭 + 스프링 노트
   PC(1100~): 책상 위에 펼친 다이어리 */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--desk);
  background-image: radial-gradient(rgba(110, 80, 40, .08) 1px, transparent 1.3px);
  background-size: 13px 13px;
  color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-family: var(--font-hand); font-size: 1.9rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-family: var(--font-hand); font-size: 1.4rem; font-weight: 700; }
h3 { font-size: .95rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.small { font-size: .85rem; }

/* 달력 색상 범례 */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; font-size: .85rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.checks .allfam { background: var(--surface-2); font-weight: 600; }

/* 이모티콘 꾸미기 */
.evicon { margin-right: 4px; font-size: 1.1em; }
.emojis { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; max-height: 136px; overflow: auto; }
.emo { width: 40px; height: 40px; font-size: 1.3rem; line-height: 1; border: 1.5px solid transparent; background: var(--surface-2); border-radius: 8px; padding: 0; }
.emo:hover, .emo:focus-visible { border-color: var(--line-strong); background: var(--hl); }
.cal .pip.emoji { width: auto; height: auto; background: none !important; font-size: .85rem; line-height: 1; }

/* 버튼 · 입력 — 문구류 느낌 */
.btn {
  font-family: var(--font);
  border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 8px;
  padding: 8px 14px; min-height: 40px; box-shadow: 0 2px 0 rgba(120, 90, 50, .18);
  transition: transform .06s, box-shadow .06s;
}
.btn:hover { background: color-mix(in srgb, var(--surface) 65%, #fff); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.primary { background: var(--accent); border-color: #245a4b; color: var(--accent-ink); font-weight: 600; box-shadow: 0 2px 0 #245a4b; }
.btn.primary:hover { background: #2a6857; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.icon { padding: 0; width: 40px; font-size: 1.1rem; display: inline-flex; align-items: center; justify-content: center; }
/* 기본 아이콘(icons.js): 선 굵기·모서리를 통일한 SVG. 색은 글자색을 따른다 */
svg.i { width: 1.2em; height: 1.2em; flex: none; vertical-align: -.25em; filter: drop-shadow(0 1px 0 rgba(74, 53, 36, .18)); }
.btn svg.i { margin-right: 2px; }
.btn.icon svg.i { width: 1.5em; height: 1.5em; margin: 0; vertical-align: middle; }
.badge svg.i { width: .95em; height: .95em; vertical-align: -.12em; }
nav#nav a .ic svg.i { width: 1.6rem; height: 1.6rem; margin: 0; vertical-align: top; }
.thumbbox .x { display: flex; align-items: center; justify-content: center; padding: 0; }
.thumbbox .x svg.i { width: 14px; height: 14px; margin: 0; filter: none; }
.btn[disabled] { opacity: .55; cursor: default; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-sm);
  padding: 9px 11px; min-height: 40px;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
input[type=color] { width: 44px; height: 40px; padding: 2px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
input[type=file] { width: 100%; padding: 8px 0; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.row.fit > * { flex: none; }
.spacer { flex: 1 !important; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

/* 로그인 */
#login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card {
  position: relative; width: min(390px, 100%); background: var(--paper); border-radius: 6px; padding: 34px 26px 26px 38px;
  box-shadow: 0 1px 0 #fff inset, 4px 4px 0 -1px #f0e8d4, 8px 8px 0 -2px #e4dac3, 0 24px 40px -18px rgba(60, 40, 10, .5);
  background-image: linear-gradient(to right, transparent 22px, rgba(217, 105, 74, .35) 22px 23.5px, transparent 23.5px);
}
.login-card::before, .card.taped::before {
  content: ""; position: absolute; top: -10px; left: 50%; width: 76px; height: 20px; margin-left: -38px;
  background: rgba(255, 226, 150, .75); transform: rotate(-2deg); box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
}
.login-card h1 { margin-bottom: 4px; font-size: 2.3rem; }
.err { color: var(--danger); font-size: .9rem; min-height: 1.3em; margin: 4px 0 10px; }

/* ── 레이아웃 ───────────────────────────────────────────── */
/* 모바일: 종이가 화면 전체, 아래에 인덱스 탭 */
#app { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
main#main {
  position: relative; min-height: 100dvh; padding: 20px 16px 28px calc(var(--m) + 14px);
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, transparent var(--m), rgba(217, 105, 74, .38) var(--m), rgba(217, 105, 74, .38) calc(var(--m) + 1.5px), transparent calc(var(--m) + 1.5px)),
    repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
  background-position: 0 0, 0 14px;
}
.head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.head h1 { flex: 1; }
.brand { display: none; }

nav#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: #f7f0df; border-top: 1.5px solid var(--line-strong); padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -8px 16px -12px rgba(80, 55, 20, .5);
}
nav#nav a {
  position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  height: var(--nav-h); color: var(--muted); text-decoration: none; font-size: .68rem; white-space: nowrap;
}
nav#nav a .ic { font-size: 1.25rem; line-height: 1; }
nav#nav a.on { color: var(--ink); font-weight: 700; background: var(--tab-soft, transparent); }
nav#nav a.on::before { content: ""; position: absolute; top: 0; left: 14%; right: 14%; height: 4px; border-radius: 0 0 4px 4px; background: var(--tab, var(--accent)); }
nav#nav a[data-v=home] { --tab: var(--tab-home); --tab-soft: var(--tab-home-soft); }
nav#nav a[data-v=cal] { --tab: var(--tab-cal); --tab-soft: var(--tab-cal-soft); }
nav#nav a[data-v=meals] { --tab: var(--tab-meals); --tab-soft: var(--tab-meals-soft); }
nav#nav a[data-v=shop] { --tab: var(--tab-shop); --tab-soft: var(--tab-shop-soft); }
nav#nav a[data-v=diary] { --tab: var(--tab-diary); --tab-soft: var(--tab-diary-soft); }
nav#nav a[data-v=photos] { --tab: var(--tab-room); --tab-soft: var(--tab-room-soft); }
nav#nav a[data-v=kids] { --tab: var(--tab-kids); --tab-soft: var(--tab-kids-soft); }
@media (max-width: 420px) { nav#nav a { font-size: .62rem; } }          /* 탭이 8개라 좁은 폰에서는 글자를 조금 줄인다 */
nav#nav a[data-v=more] { --tab: var(--tab-more); --tab-soft: var(--tab-more-soft); }

/* 태블릿 이상: 왼쪽 인덱스 탭 + 스프링 노트 */
@media (min-width: 700px) {
  #app {
    display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); column-gap: 30px;
    max-width: 1380px; margin: 0 auto; padding: 24px 22px 28px 14px;
  }
  nav#nav {
    position: sticky; top: 24px; align-self: start; flex-direction: column; gap: 10px;
    background: transparent; border: 0; box-shadow: none; padding: 0;
  }
  nav#nav a {
    flex: none; height: 72px; border-radius: 16px 6px 6px 16px; color: var(--ink); font-size: .78rem;
    background: var(--tab-soft); box-shadow: 0 2px 0 rgba(90, 65, 30, .2), 0 6px 10px -8px rgba(90, 65, 30, .5);
    transition: transform .15s, background .15s;
  }
  nav#nav a:hover { transform: translateX(4px); }
  nav#nav a.on { background: var(--tab); transform: translateX(10px); }
  nav#nav a.on::before { display: none; }

  main#main {
    min-height: calc(100dvh - 52px); padding: 28px 38px 36px calc(var(--m) + 20px); border-radius: 4px 14px 14px 4px;
    box-shadow: 0 1px 0 #fff inset, 4px 4px 0 -1px #f2ead7, 8px 8px 0 -2px #e6dcc6, 0 22px 44px -20px rgba(60, 40, 10, .55);
  }
  /* 스프링 */
  main#main::before {
    content: ""; position: absolute; z-index: 3; left: -20px; top: 18px; bottom: 18px; width: 40px; pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='27' cy='20' r='6' fill='%23cbbd9f'/%3E%3Ccircle cx='27' cy='20' r='6' fill='none' stroke='%23b3a483' stroke-width='1'/%3E%3Crect x='3' y='16.5' width='31' height='7' rx='3.5' fill='%238f8a80'/%3E%3Crect x='4' y='17.2' width='29' height='2.6' rx='1.3' fill='%23d9d5cc'/%3E%3C/svg%3E") repeat-y 0 0 / 40px 40px;
  }
  /* 책갈피 */
  main#main::after {
    content: ""; position: absolute; top: 0; right: 10px; width: 18px; height: 52px; background: var(--coral);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  }
  .head h1, .cal-head h1 { font-size: 2.1rem; }
}

/* PC: 이름이 보이는 넓은 탭 */
@media (min-width: 1100px) {
  #app { padding-top: 28px; }
  .brand { display: block; font-family: var(--font-hand); font-weight: 700; font-size: 2.1rem; padding: 0 4px 12px; line-height: 1; }
  nav#nav a { flex-direction: row; justify-content: flex-start; gap: 12px; height: 54px; padding: 0 16px; font-size: 1rem; }
  nav#nav a .ic { font-size: 1.35rem; }
  main#main { padding-right: 50px; }
}

/* ── 카드(메모지) ───────────────────────────────────────── */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h2 { margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1.5px dashed var(--line-strong); display: flex; align-items: center; gap: 8px; }
.card.today { background: var(--hl); border-color: var(--accent); }
.grid2 { display: grid; gap: 22px 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
.grid2 > .card { margin-bottom: 0; }
/* 마스킹 테이프 */
.grid2 > .card::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 66px; height: 18px; margin-left: -33px; z-index: 1;
  background: rgba(255, 226, 150, .75); transform: rotate(-2deg); box-shadow: 0 1px 1px rgba(0, 0, 0, .08); pointer-events: none;
}
.grid2 > .card:nth-child(4n+2)::before { background: rgba(247, 183, 205, .7); transform: rotate(1.5deg); }
.grid2 > .card:nth-child(4n+3)::before { background: rgba(176, 226, 205, .75); transform: rotate(-1deg); }
.grid2 > .card:nth-child(4n+4)::before { background: rgba(176, 205, 240, .75); transform: rotate(2deg); }
.empty { color: var(--muted); font-size: .92rem; padding: 6px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tag { display: inline-block; font-size: .72rem; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.badge { font-size: .7rem; padding: 1px 8px; border-radius: 4px; border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--accent); margin-left: 6px; white-space: nowrap; }

/* 목록 항목 */
.item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; overflow-wrap: anywhere; }
.item .s { font-size: .85rem; color: var(--muted); }
.item.click, .item .grow.click { cursor: pointer; }
.bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.linkrow { color: inherit; text-decoration: none; }
.ic.big { font-size: 1.5rem; width: 34px; text-align: center; flex: none; }

/* D-day */
.dday { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; }
.dday b { font-family: var(--font-hand); font-size: 1.6rem; min-width: 76px; color: var(--coral); }

/* ── 캘린더(월간 스프레드) ──────────────────────────────── */
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.cal-head h1 { flex: 1; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1.5px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.cal .wd { text-align: center; font-family: var(--font-hand); font-size: 1.1rem; padding: 3px 0; background: var(--surface-2); border-bottom: 1px solid var(--line-strong); }
.cal .wd:first-child, .cal .d.sun .n { color: var(--danger); }
.cal .wd:nth-child(7), .cal .d.sat .n { color: #4a78c2; }
.cal .d { min-height: 62px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 4px; cursor: pointer; overflow: hidden; background: var(--surface); text-align: left; border-radius: 0; border-right: 0; border-bottom: 0; }
.cal .d:nth-child(7n + 8) { border-left: 0; }
.cal .d.other { opacity: .45; }
.cal .d.sel { background: var(--hl); }
.cal .d .n { font-family: var(--font-hand); font-size: 1.15rem; line-height: 1.2; }
.cal .d.today .n { display: inline-grid; place-items: center; min-width: 27px; height: 27px; border: 2px solid var(--coral); border-radius: 50%; color: var(--coral); font-weight: 700; transform: rotate(-4deg); }
.cal .chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.cal .chip { display: none; font-size: .72rem; border-radius: 3px; padding: 1px 5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cal .pip { width: 7px; height: 7px; border-radius: 50%; }
.daylist { margin-top: 16px; }
@media (min-width: 700px) {
  .cal .d { min-height: 96px; }
  .cal .chip { display: block; width: 100%; }
  .cal .pip { display: none; }
  .cal .chips { flex-direction: column; flex-wrap: nowrap; }
}
@media (min-width: 1100px) { .cal .d { min-height: 112px; } }

/* ── 식단 ───────────────────────────────────────────────── */
/* 하루 카드: 칸마다 윗줄에 '끼니 이름 ··· 칼로리', 아랫줄에 메뉴(줄 전체 폭), 그 밑에 사진. 빈 칸은 한 줄로 작게. */
.week { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.meal-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.meal-day.today { background: var(--hl); border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.meal-day h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-family: var(--font-hand); font-size: 1.25rem; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1.5px dashed var(--line-strong); }
.meal-day h3 .kcal-day { margin: 0 0 0 auto; }
.slotwrap { border-top: 1px solid var(--line); }
.slotwrap:first-of-type { border-top: 0; }
.slot { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "lab kc" "val val"; align-items: baseline; gap: 3px 10px; width: 100%; text-align: left; border: 0; background: transparent; border-top: 1px solid var(--line); padding: 9px 2px; min-height: 42px; }
.slot:first-of-type { border-top: 0; }
.slot .lab { grid-area: lab; color: var(--muted); font-size: .82rem; font-weight: 700; letter-spacing: .02em; width: auto; }
.slot .kc { grid-area: kc; white-space: nowrap; }
.slot .val { grid-area: val; min-width: 0; overflow-wrap: anywhere; line-height: 1.45; }
.slot .val.none { color: var(--muted); opacity: .75; }
.slot.empty { grid-template-columns: 3.4em minmax(0, 1fr); grid-template-areas: "lab val"; align-items: center; min-height: 36px; padding: 5px 2px; }
.slot.empty .val { opacity: .5; }
@media (min-width: 700px) { .week { grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); } }
@media (min-width: 1700px) { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; } .meal-day { padding: 10px 11px; } }
/* 부모 홈: 아이들 오늘 */
.grid2 > .card.wide { grid-column: 1 / -1; }
.kidgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.kidbox { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 12px; }
.kname { font-family: var(--font-hand); font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.kl { display: flex; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.kl:first-of-type { border-top: 0; }
.kl .ki { flex: none; width: 1.5em; text-align: center; }
.kl.hot { background: linear-gradient(transparent 55%, var(--hl) 55%); }
.kl.tmr { background: rgba(120, 150, 210, .12); border-radius: 8px; padding: 6px 8px; margin: 4px 0; }

/* 식단: 집 식단 / 먹은 기록 */
.tabs.mealmode { overflow: visible; }
.mealmode .tab small { display: block; font-size: .7rem; font-weight: 400; color: var(--muted); }
.slot .val.skip { color: var(--muted); text-decoration: line-through; }
.slot[disabled] { cursor: default; }
.famchip { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 8px 10px; }
.mylog { border-top: 1px solid var(--line); padding: 8px 2px 0; margin-top: 6px; }
.mylog .small { padding: 1px 0; }
.mylogrow { display: flex; align-items: center; gap: 8px; }

/* 캘린더 위 D-day */
.ddaybar { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; margin-bottom: 4px; }
.ddchip { flex: none; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; text-align: left; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); padding: 6px 12px; min-width: 130px; }
.ddchip b { grid-row: 1 / 3; font-family: var(--font-hand); font-size: 1.35rem; color: var(--coral); }
.ddchip span { font-weight: 600; overflow-wrap: anywhere; }
.ddchip small { color: var(--muted); font-size: .72rem; }

/* 먹은 사진 */
.slotwrap { border-top: 1px solid var(--line); }
.slotwrap:first-of-type { border-top: 0; }
.slotwrap .slot { border-top: 0; }
.mealthumb { display: block; width: 100%; max-width: 220px; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); margin: 2px 0 10px; cursor: zoom-in; }
.mealthumb.sm { width: 44px; height: 44px; margin: 0; flex: none; }

.logphoto { margin-bottom: 12px; display: flex; align-items: flex-end; gap: 10px; }
.logphoto:empty { display: none; }
.mealpic { max-width: 180px; max-height: 140px; border-radius: var(--radius-sm); object-fit: cover; }
.meal-day { scroll-margin-top: 8px; }

/* 칼로리 */
.kcal-day { margin-left: 8px; font-family: var(--font); font-size: .75rem; font-weight: 400; color: var(--coral); white-space: nowrap; }
.slot .kc { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.kcal-hint { margin: -6px 0 12px; line-height: 1.5; }
.kcal-hint b { color: var(--coral); }
@media (min-width: 1280px) { .slot .kc { margin-top: -2px; } }

/* 학교 급식 */
.schoolmeal { border-top: 1px solid var(--line); padding: 8px 2px; font-size: .9rem; }
.schoolmeal summary { cursor: pointer; color: var(--muted); }
.schoolmeal div { margin-top: 6px; overflow-wrap: anywhere; }

/* 장보기 · 체크 */
.check { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.done .t { text-decoration: line-through; color: var(--muted); }

/* ── 다이어리: 줄 노트 + 폴라로이드 ───────────────────────── */
.entry { border-top: 1.5px dashed var(--line-strong); padding: 14px 0; }
.entry:first-child { border-top: 0; }
.entry .who { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.entry .who > span:not(.dot):not(.badge):not(.spacer) { font-family: var(--font-hand); font-size: 1.3rem; color: var(--ink); }
.entry .body {
  font-family: var(--font-hand); font-size: 1.25rem; line-height: 28px; white-space: pre-wrap; overflow-wrap: anywhere;
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, #e6dcc4 27px 28px);
}
.thumbs { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0 6px; }
.thumb {
  width: 104px; height: 112px; object-fit: cover; display: block; cursor: zoom-in; background: #fff;
  border: 6px solid #fff; border-bottom-width: 20px; border-radius: 2px;
  box-shadow: 0 2px 3px rgba(60, 40, 10, .3), 0 8px 14px -8px rgba(60, 40, 10, .5); transform: rotate(-2deg); transition: transform .15s;
}
.thumbs > :nth-child(even) .thumb, .thumbs > .thumb:nth-child(even) { transform: rotate(1.8deg); }
.thumbs > .thumb:nth-child(3n) { transform: rotate(-.8deg); }
.thumb:hover { transform: rotate(0) scale(1.05); }
.thumbbox { position: relative; }
.thumbbox .thumb { cursor: default; }
.thumbbox .x { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); font-size: .8rem; line-height: 1; z-index: 1; }
dialog#lightbox { width: auto; max-width: 96vw; margin: auto; padding: 0; border-radius: 4px; background: transparent; box-shadow: none; }
dialog#lightbox img { display: block; max-width: 96vw; max-height: 90dvh; border: 10px solid #fff; border-bottom-width: 30px; border-radius: 2px; cursor: zoom-out; }
dialog#lightbox::backdrop { background: rgba(35, 25, 10, .7); }

/* ── 모달: 모바일은 아래에서 올라오는 시트 ───────────────── */
dialog {
  border: 0; border-radius: 12px; padding: 0; width: min(500px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px rgba(40, 25, 5, .45);
}
dialog::backdrop { background: rgba(60, 40, 15, .45); }
dialog form {
  padding: 20px 20px 18px 34px; overflow: auto; max-height: calc(100dvh - 24px);
  background-image: linear-gradient(to right, transparent 20px, rgba(217, 105, 74, .35) 20px 21.5px, transparent 21.5px);
}
dialog h2 { margin-bottom: 14px; font-size: 1.6rem; }
@media (max-width: 599px) {
  dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92dvh; }
  dialog form { max-height: 92dvh; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}
.actions { display: flex; gap: 8px; margin-top: 8px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1.5px solid var(--line-strong); border-radius: 99px; cursor: pointer; background: var(--surface); }
.checks input { accent-color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 99px; font-size: .9rem; z-index: 50; max-width: calc(100vw - 32px); }
@media (min-width: 700px) { .toast { bottom: 24px; } }

/* ── 아이 화면: 구성원 · 폴더 탭 · 진행 막대 ─────────────── */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 6px 14px; min-height: 38px; }
.pill.on { background: var(--hl); border-color: #d6bf4a; font-weight: 700; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1.5px solid var(--line-strong); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; border: 1.5px solid transparent; border-bottom: 0; background: var(--surface-2); padding: 9px 10px; min-height: 42px; white-space: nowrap; color: var(--muted); border-radius: 9px 9px 0 0; }
.tab.on { background: var(--paper); border-color: var(--line-strong); color: var(--ink); font-weight: 700; position: relative; top: 1.5px; }
.progress { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: repeating-linear-gradient(45deg, var(--accent) 0 8px, #3b8a75 8px 16px); border-radius: 99px; }
.big { font-family: var(--font-hand); font-size: 1.9rem; font-weight: 700; }
.pos { color: var(--pos); }
.neg { color: var(--danger); }
.schres { max-height: 220px; overflow: auto; margin-bottom: 8px; }
.schopt { width: 100%; text-align: left; background: transparent; border: 0; border-top: 1px solid var(--line); color: inherit; }
.schopt.on { background: var(--accent-soft); }
.schopt.on::after { content: "✓"; color: var(--accent); font-weight: 700; font-size: 1.1rem; }

/* ── 연간 회고 ──────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; text-align: center; }
.stat b { display: block; font-family: var(--font-hand); font-size: 2rem; color: var(--coral); line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar-col i { display: block; width: 100%; min-height: 2px; background: var(--accent); border-radius: 3px 3px 0 0; }
.bar-col span { font-size: .7rem; color: var(--muted); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── PC 큰 화면: 화면을 더 넓게 쓴다 ─────────────────────── */
@media (min-width: 1500px) {
  #app { max-width: 1760px; }
  main#main { padding-left: calc(var(--m) + 34px); padding-right: 64px; }
  .calbody { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
  .calbody .daylist { position: sticky; top: 24px; margin-top: 0; }
}
@media (min-width: 1900px) { #app { max-width: 2060px; } .calbody { grid-template-columns: minmax(0, 1fr) 420px; } }

/* ── 내 방 (싸이월드식 미니홈피) ───────────────────────── */
.roomtabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.roomtabs .chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 99px; background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--ink); text-decoration: none; font-size: .92rem; }
.roomtabs .chip.on { background: var(--hl); font-weight: 700; box-shadow: 0 2px 0 var(--line-strong); }
/* 미니홈은 맨 위가 방(무대), 바로 아래가 일촌평. 프로필·메뉴(방명록 등)는 옆(넓은 화면)이나 그 아래(좁은 화면)에 온다. 모든 덩어리 사이는 같은 간격. */
.roomwrap { display: grid; gap: 16px; grid-template-areas: "stage" "ilchon" "side"; grid-template-columns: minmax(0, 1fr); align-items: start; }
.rstage { grid-area: stage; min-width: 0; }
.rilchon { grid-area: ilchon; min-width: 0; }
.rside { grid-area: side; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.rside > .card, .rstage .card, .rilchon { margin-bottom: 0; }
.rstage > * + * { margin-top: 16px; }
@media (min-width: 900px) {
  .roomwrap { grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr); grid-template-areas: "stage side" "ilchon side"; grid-template-rows: auto 1fr; }
}
.rilchon .ilchon { margin: 0; padding: 0; border: 0; }
.rgreet { margin: -4px 0 10px; }
.rmenu h2 { font-size: 1.1rem; }
.menurow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 4px; border: 0; border-top: 1px dashed var(--line-strong); background: transparent; color: inherit; text-align: left; text-decoration: none; font-size: 1rem; }
.menurow:first-of-type { border-top: 0; }
.menurow:hover { background: var(--hl); }
.menurow .mi { flex: none; font-size: 1.15rem; width: 1.6em; text-align: center; }
.menurow .grow { flex: 1; min-width: 0; }
.menurow .chev { color: var(--muted); flex: none; }
.rmenu .menulabel { margin: 10px 0 6px; padding-top: 10px; border-top: 1.5px dashed var(--line-strong); }
.rmenu .roomtabs { margin-bottom: 0; }
.rwho { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ravatar { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--font-hand); font-size: 1.7rem; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line-strong), 0 4px 8px -4px rgba(0, 0, 0, .4); flex: none; }
.rname { font-family: var(--font-hand); font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.rmood { margin-right: 6px; }
.rintro { margin-top: 2px; }
.rmoods { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.emo.on { border-color: var(--accent); background: var(--hl); }

/* 방 무대: 폭에 비례해 커지고(cqw), 스티커는 % 좌표로 놓인다 */
.stage { position: relative; container-type: inline-size; aspect-ratio: 16 / 10; width: 100%; overflow: hidden; border-radius: 12px; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line-strong), 0 14px 26px -16px rgba(60, 40, 10, .6); user-select: none; -webkit-user-select: none; }
.stage.editing { box-shadow: 0 0 0 2px var(--accent), 0 14px 26px -16px rgba(60, 40, 10, .6); cursor: crosshair; }
.stage.pat-dots { background-image: radial-gradient(rgba(74, 53, 36, .16) 1.6px, transparent 1.7px); background-size: 20px 20px; }
.stage.pat-grid { background-image: linear-gradient(rgba(74, 53, 36, .1) 1px, transparent 1px), linear-gradient(90deg, rgba(74, 53, 36, .1) 1px, transparent 1px); background-size: 24px 24px; }
.stage.pat-stripe { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .55) 0 14px, transparent 14px 28px); }
.stage.pat-check { background-image: conic-gradient(rgba(255, 255, 255, .5) 25%, transparent 0 50%, rgba(255, 255, 255, .5) 0 75%, transparent 0); background-size: 40px 40px; }
.stage.pat-hearts { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36'%3E%3Cpath d='M18 27C10 21 9 17 9 14.5a4.2 4.2 0 0 1 9-1.4 4.2 4.2 0 0 1 9 1.4C27 17 26 21 18 27z' fill='%23ff6b8a' fill-opacity='.22'/%3E%3C/svg%3E"); background-size: 36px 36px; }
.stage-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); font-family: var(--font-hand); font-size: 1.3rem; pointer-events: none; }
.ritem { position: absolute; font-size: calc(var(--s, 60) * .1cqw); line-height: 1; white-space: nowrap; filter: drop-shadow(0 2px 2px rgba(60, 40, 10, .25)); }
.ritem.note { font-family: var(--font-hand); font-size: calc(var(--s, 55) * .04cqw + .5rem); line-height: 1.25; padding: .45em .8em; border-radius: 3px; color: var(--ink); white-space: normal; max-width: 40cqw; box-shadow: 0 3px 6px -2px rgba(60, 40, 10, .4); }
.ritem.note::before { content: ""; position: absolute; top: -.55em; left: 50%; width: 3.2em; height: 1em; transform: translateX(-50%) rotate(-3deg); background: rgba(255, 255, 255, .6); border: 1px dashed rgba(74, 53, 36, .25); }
.stage.editing .ritem { cursor: grab; touch-action: none; }
.stage.editing .ritem:active { cursor: grabbing; }
.ritem.sel { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: 6px; }
.rtools { margin-top: 14px; }
.rpal { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0; align-items: center; }
.rsel { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }
.rsel b { margin-right: 4px; }
.rbg { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { display: inline-block; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line-strong); padding: 0; cursor: pointer; }
.swatch.on, input:checked + .swatch { box-shadow: 0 0 0 2.5px var(--accent); }
.rbg select { width: auto; min-height: 34px; padding: 4px 8px; }
.gitem { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px dashed var(--line-strong); }
.gitem .dot { margin-top: 7px; flex: none; }
.gb { overflow-wrap: anywhere; }
.gform { margin-bottom: 8px; }
.gbbody { min-width: 0; }

/* 모아 사진첩 · 방에 붙이는 폴라로이드 사진 */
.ralbum { margin-top: 14px; }
.albumgrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.albumgrid .ph { padding: 0; border: 0; background: #fff; border-radius: 3px; box-shadow: 0 0 0 5px #fff, 0 3px 8px -2px rgba(60, 40, 10, .5); aspect-ratio: 1; overflow: hidden; cursor: pointer; margin: 5px; }
.albumgrid .ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.albumgrid .ph:hover img { transform: scale(1.06); }
.ritem.photo { font-size: inherit; width: calc(var(--s, 60) * .25cqw); background: #fff; padding: .6cqw .6cqw 2.4cqw; border-radius: 2px; box-shadow: 0 4px 10px -3px rgba(60, 40, 10, .55); }
.ritem.photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; pointer-events: none; background: #eee; }

/* 가구 · 캐릭터(미니미) · 방 장면 */
.ritem.prop { width: calc(var(--s, 60) * .3cqw); font-size: inherit; }
.ritem.avatar { width: calc(var(--s, 60) * .15cqw * var(--k, 1)); font-size: inherit; }
.ritem svg { display: block; width: 100%; height: auto; overflow: visible; pointer-events: none; }
.stage:not(.editing) .ritem.avatar svg { transform-origin: 50% 100%; }
.stage:not(.editing) .ritem.avatar.mo-idle svg { animation: mmbob 2.4s ease-in-out infinite; }
.stage:not(.editing) .ritem.avatar.mo-jump svg { animation: mmjump 1s ease-in-out infinite; }
.stage:not(.editing) .ritem.avatar.mo-dance svg { animation: mmdance .7s ease-in-out infinite alternate; }
.stage:not(.editing) .ritem.avatar.mo-walk svg { animation: mmwalk 9s linear infinite; }
.stage:not(.editing) .ritem.avatar.mo-walk { animation: mmstep .5s ease-in-out infinite; }
/* 움직임 더하기: 인사 · 빙글빙글 · 달리기 · 둥실 · 졸기 · 뒤뚱 · 기지개 · 수줍음 · 랜덤 */
.stage:not(.editing) .ritem.avatar.mo-wave svg { animation: mmwave 2.6s ease-in-out infinite; }
.stage:not(.editing) .ritem.avatar.mo-spin svg { animation: mmspin 3.6s ease-in-out infinite; }
.stage:not(.editing) .ritem.avatar.mo-run svg { animation: mmwalk 4.5s linear infinite; }
.stage:not(.editing) .ritem.avatar.mo-run { animation: mmhop .26s ease-in-out infinite; }
.stage:not(.editing) .ritem.avatar.mo-float svg { animation: mmfloat2 3.6s ease-in-out infinite; }
.stage:not(.editing) .ritem.avatar.mo-sleep svg { animation: mmnod 3.4s ease-in-out infinite; }
.stage:not(.editing):not(.mini) .ritem.avatar.mo-sleep::after { content: "💤"; position: absolute; right: -14%; top: 4%; font-size: 3cqw; line-height: 1; animation: mmzzz 2.8s ease-out infinite; }
.stage:not(.editing) .ritem.avatar.mo-waddle svg { animation: mmwaddle .7s ease-in-out infinite alternate; }
.stage:not(.editing) .ritem.avatar.mo-stretch svg { animation: mmstretch 3.4s ease-in-out infinite; }
.stage:not(.editing) .ritem.avatar.mo-shy svg { animation: mmshy 4s ease-in-out infinite; }
.stage:not(.editing) .ritem.avatar.mo-mix svg { animation: mmmix 18s linear infinite; }
@keyframes mmwave { 0%, 52%, 100% { transform: rotate(0) translateY(0); } 6%, 22%, 38% { transform: rotate(-9deg) translateY(-2%); } 14%, 30%, 46% { transform: rotate(9deg) translateY(-2%); } }
@keyframes mmspin { 0%, 48% { transform: perspective(500px) rotateY(0) translateY(0); } 60% { transform: perspective(500px) rotateY(180deg) translateY(-9%); } 72%, 100% { transform: perspective(500px) rotateY(360deg) translateY(0); } }
@keyframes mmhop { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5%; } }
@keyframes mmfloat2 { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-11%) rotate(2deg); } }
@keyframes mmnod { 0%, 38%, 100% { transform: rotate(0) translateY(0); } 52% { transform: rotate(8deg) translateY(1.5%); } 60% { transform: rotate(2deg) translateY(0); } 70% { transform: rotate(10deg) translateY(2%); } 86% { transform: rotate(0) translateY(0); } }
@keyframes mmzzz { 0% { opacity: 0; translate: 0 0; scale: .6; } 25% { opacity: 1; } 100% { opacity: 0; translate: 45% -100%; scale: 1.2; } }
@keyframes mmwaddle { from { transform: rotate(-6deg) translateX(-3%); } to { transform: rotate(6deg) translateX(3%); } }
@keyframes mmstretch { 0%, 100% { transform: scale(1, 1); } 25%, 50% { transform: scale(.95, 1.1); } 65% { transform: scale(1.05, .93); } 80% { transform: scale(1, 1); } }
@keyframes mmshy { 0%, 100% { transform: rotate(0) translateX(0) scale(1, 1); } 25% { transform: rotate(-6deg) translateX(-3%) scale(.97, 1.02); } 50% { transform: rotate(5deg) translateX(2%) scale(.95, .97); } 75% { transform: rotate(-3deg) translateX(-1%) scale(.98, 1); } }
@keyframes mmmix {
  0% { transform: translate(0, 0) rotate(0) scale(1, 1); }
  5% { transform: translate(0, -3%) rotate(1.5deg) scale(1, 1); }
  10% { transform: translate(0, 0) rotate(-1.5deg) scale(1, 1); }
  15% { transform: translate(0, -16%) rotate(0) scale(.97, 1.04); }
  19% { transform: translate(0, 0) rotate(0) scale(1.04, .94); }
  23% { transform: translate(0, -16%) rotate(0) scale(.97, 1.04); }
  27% { transform: translate(0, 0) rotate(0) scale(1.04, .94); }
  30% { transform: translate(0, 0) rotate(0) scale(1, 1); }
  34% { transform: translate(-2%, 0) rotate(-8deg) scale(1, 1); }
  38% { transform: translate(2%, 0) rotate(8deg) scale(1, 1); }
  42% { transform: translate(-2%, 0) rotate(-8deg) scale(1, 1); }
  46% { transform: translate(0, 0) rotate(0) scale(1, 1); }
  60% { transform: translate(80%, 0) rotate(0) scale(1, 1); }
  61% { transform: translate(80%, 0) rotate(0) scale(-1, 1); }
  76% { transform: translate(-80%, 0) rotate(0) scale(-1, 1); }
  77% { transform: translate(-80%, 0) rotate(0) scale(1, 1); }
  90% { transform: translate(0, 0) rotate(0) scale(1, 1); }
  95% { transform: translate(0, -9%) rotate(0) scale(.96, 1.08); }
  100% { transform: translate(0, 0) rotate(0) scale(1, 1); }
}
@keyframes mmjump { 0%, 100% { transform: translateY(0) scale(1.04, .94); } 35% { transform: translateY(-16%) scale(.97, 1.04); } 70% { transform: translateY(0) scale(1.04, .94); } }
@keyframes mmdance { from { transform: rotate(-8deg) translateY(0); } to { transform: rotate(8deg) translateY(-4%); } }
@keyframes mmwalk { 0% { transform: translateX(-90%) scaleX(1); } 48% { transform: translateX(90%) scaleX(1); } 50% { transform: translateX(90%) scaleX(-1); } 98% { transform: translateX(-90%) scaleX(-1); } 100% { transform: translateX(-90%) scaleX(1); } }
@keyframes mmstep { 0%, 100% { translate: 0 0; } 50% { translate: 0 -2.5%; } }
@keyframes mmbob { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-3%) rotate(1.5deg); } }
@media (prefers-reduced-motion: reduce) { .stage:not(.editing) .ritem.avatar, .stage:not(.editing) .ritem.avatar svg { animation: none !important; } }
.stage[class*="pat-room"] { background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .35) 0 14px, transparent 14px 28px); }
.stage[class*="pat-room"]::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34%; border-top: 3px solid rgba(74, 53, 36, .45); box-shadow: inset 0 8px 10px -8px rgba(60, 40, 10, .45); }
.stage.pat-room-wood::before { background: repeating-linear-gradient(90deg, #e2b073 0 56px, #c98f5a 56px 58px); }
.stage.pat-room-tile::before { background: conic-gradient(#fff 25%, #cfe8ff 0 50%, #fff 0 75%, #cfe8ff 0) 0 0 / 52px 52px; }
.stage.pat-room-carpet::before { background: radial-gradient(rgba(255, 255, 255, .4) 1.6px, transparent 2.2px) 0 0 / 14px 14px, #f2a0b8; }
img.ravatar { object-fit: cover; background: #fff; }
.rtabs { display: flex; gap: 6px; margin: 10px 0; }
.rtabs .btn.on { background: var(--hl); border-color: var(--accent); font-weight: 700; }
.propgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin: 10px 0; }
.propbtn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 10px; font-size: .72rem; color: var(--ink); cursor: pointer; }
.propbtn:hover { background: var(--hl); }
.propbtn svg { width: 54px; height: 54px; }
.mepanel { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 14px; margin: 10px 0; align-items: start; }
.mepreview { background: var(--surface-2); border-radius: 12px; padding: 8px; }
.mepreview svg { width: 100%; height: auto; display: block; overflow: visible; }
.mectl { display: grid; gap: 8px; }
@media (max-width: 480px) { .mepanel { grid-template-columns: 1fr; } .mepreview { max-width: 120px; } }
.cropwrap { position: relative; width: 240px; height: 240px; margin: 10px auto; overflow: hidden; border-radius: 6px; background: #f3ead7; }
.cropwrap canvas { display: block; touch-action: none; cursor: grab; }
.cropwrap::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px dashed var(--accent); box-shadow: 0 0 0 300px rgba(255, 253, 246, .72); pointer-events: none; }
.albumgrid.small { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
.albumscroll { max-height: 236px; overflow: auto; border: 1.5px solid var(--line-strong); border-radius: 8px; padding: 6px; background: var(--surface-2); margin-top: 6px; }
.albumgrid .ph.on { outline: 3px solid var(--accent); outline-offset: 1px; }
.mepreview { max-width: 120px; }
.ritem.gif { width: calc(var(--s, 60) * .2cqw); font-size: inherit; }
.ritem.gif img { display: block; width: 100%; height: auto; pointer-events: none; }
.gifgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 8px 0; }
.gifcell { position: relative; }
.gifbtn { width: 100%; aspect-ratio: 1; padding: 4px; border: 1.5px solid var(--line-strong); border-radius: 10px; cursor: pointer;
  background: conic-gradient(#fff 25%, #eee6d4 0 50%, #fff 0 75%, #eee6d4 0) 0 0 / 14px 14px; }
.gifbtn img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gifbtn:hover { border-color: var(--accent); }
.gifx { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); padding: 0; display: flex; align-items: center; justify-content: center; }
.gifx svg.i { width: 11px; height: 11px; margin: 0; filter: none; }
.gifgrid.found .gifcell { cursor: pointer; display: block; }
.gifgrid.found .gifcell input { position: absolute; top: 4px; left: 4px; z-index: 1; width: 18px; height: 18px; accent-color: var(--accent); }
.gifgrid.found .gifcell input:not(:checked) + .gifbtn { opacity: .45; }
.gifgrid.found .gifbtn { display: block; cursor: pointer; }

/* 방 날씨(분위기) · 기분 말풍선 · 작은 방(서명) · 미니룸샵 */
/* 방 날씨: 화면 전체를 덮는 필터가 아니라 하늘(해·달·구름·별)과 알갱이(비·눈)를 따로 그린다. 캐릭터 뒤(.wxback)와 앞(.wxfront) 두 겹. */
.wxfx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.wxfront { z-index: 6; }
.wxfx i { position: absolute; display: block; }
.wxdim, .wxwarm, .wxdusk, .wxvignette { inset: 0; }
@keyframes wxtw { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes wxspin { to { transform: rotate(360deg); } }
@keyframes wxpulse { from { opacity: .75; transform: scale(.96); } to { opacity: 1; transform: scale(1.06); } }
/* 구름(맑음·비·눈 공용) */
.wxcloud { top: var(--y); left: 0; width: var(--w); height: calc(var(--w) * .26); border-radius: 99px; background: #fff; opacity: var(--op); filter: drop-shadow(0 .5cqw .6cqw rgba(90, 110, 150, .2)); animation: wxdrift var(--dur) linear var(--del) infinite; }
.wxcloud::before, .wxcloud::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.wxcloud::before { width: 38%; height: 130%; left: 14%; top: -55%; }
.wxcloud::after { width: 48%; height: 170%; left: 40%; top: -80%; }
.wxcloud.dark { background: #aeb8c8; }
@keyframes wxdrift { from { transform: translateX(-32cqw); } to { transform: translateX(108cqw); } }
/* 맑음 */
.wxwarm { background: linear-gradient(200deg, rgba(255, 233, 160, .42), rgba(255, 244, 205, .12) 45%, transparent 70%); }
.wxsunglow { right: -4cqw; top: -7cqw; width: 34cqw; height: 34cqw; border-radius: 50%; background: radial-gradient(circle, rgba(255, 230, 130, .75), rgba(255, 230, 130, .2) 45%, transparent 70%); animation: wxpulse 5s ease-in-out infinite alternate; }
.wxsunrays { right: -10cqw; top: -13cqw; width: 46cqw; height: 46cqw; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 235, 150, .34) 0 7deg, transparent 7deg 22deg); -webkit-mask: radial-gradient(circle, #000 22%, transparent 68%); mask: radial-gradient(circle, #000 22%, transparent 68%); animation: wxspin 80s linear infinite; }
.wxsundisc { right: 5cqw; top: 3cqw; width: 8.5cqw; height: 8.5cqw; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff7c2, #ffd84a 70%); box-shadow: 0 0 2.5cqw .6cqw rgba(255, 214, 80, .7); }
.wxbeam { top: -10cqw; left: var(--x); width: 7cqw; height: 90cqw; background: linear-gradient(180deg, rgba(255, 246, 200, .32), transparent 85%); transform: rotate(var(--a)); transform-origin: 50% 0; animation: wxshimmer 7s ease-in-out var(--del) infinite alternate; }
@keyframes wxshimmer { from { opacity: .35; } to { opacity: 1; } }
.wxsparkle { left: 0; width: var(--sz); height: var(--sz); background: #fff6b0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: wxtw var(--dur) ease-in-out var(--del) infinite; }
/* 비 */
.wxrainy .wxdim { background: linear-gradient(180deg, rgba(78, 96, 130, .46), rgba(104, 124, 158, .2) 60%, rgba(104, 124, 158, .12)); }
.wxdrop { top: -8cqw; width: max(1.6px, .26cqw); height: var(--len); border-radius: 2px; background: linear-gradient(180deg, rgba(120, 165, 225, 0), rgba(86, 138, 214, .95) 55%, rgba(60, 110, 200, 1)); opacity: var(--op); transform: rotate(10deg); animation: wxfall var(--dur) linear var(--del) infinite; }
@keyframes wxfall { from { translate: 0 0; } to { translate: -12cqw 74cqw; } }
.wxripple { width: 4cqw; height: 1.1cqw; border: max(1.5px, .2cqw) solid rgba(90, 140, 215, .8); border-radius: 50%; opacity: 0; animation: wxrip 1.6s ease-out var(--del) infinite; }
@keyframes wxrip { 0% { transform: scale(.2); opacity: .85; } 100% { transform: scale(1.1); opacity: 0; } }
/* 눈 */
.wxsnowy .wxdim { background: linear-gradient(180deg, rgba(150, 178, 222, .46), rgba(190, 210, 238, .22) 55%, rgba(200, 218, 242, .08)); }
.wxflake { top: -4cqw; width: var(--sz); height: var(--sz); opacity: var(--op); animation: wxsnowfall var(--dur) linear var(--del) infinite; }
.wxflake::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 38% 34%, #fff 45%, #e4efff 100%); box-shadow: 0 0 0 max(1px, .14cqw) rgba(120, 156, 214, .65), 0 .2cqw .6cqw rgba(90, 125, 190, .35); animation: wxsway var(--swd) ease-in-out var(--del) infinite alternate; }
@keyframes wxsnowfall { from { translate: 0 0; } to { translate: 0 68cqw; } }
@keyframes wxsway { from { transform: translateX(calc(var(--sw) * -1)); } to { transform: translateX(var(--sw)); } }
.wxsnowpile { left: -3%; right: -3%; bottom: -.4cqw; height: 4.2cqw; background: radial-gradient(ellipse 15cqw 3.4cqw at 8% 100%, #fff 96%, transparent 100%), radial-gradient(ellipse 18cqw 3cqw at 30% 100%, #fff 96%, transparent 100%), radial-gradient(ellipse 14cqw 3.6cqw at 52% 100%, #fff 96%, transparent 100%), radial-gradient(ellipse 19cqw 3.1cqw at 74% 100%, #fff 96%, transparent 100%), radial-gradient(ellipse 15cqw 3.5cqw at 96% 100%, #fff 96%, transparent 100%); filter: drop-shadow(0 -.2cqw .5cqw rgba(130, 160, 205, .4)); }
/* 밤 */
.wxdusk { background: linear-gradient(180deg, rgba(12, 18, 64, .7), rgba(28, 38, 92, .42) 60%, rgba(40, 52, 110, .28)); }
.wxmoon { right: 9cqw; top: 5cqw; width: 8cqw; height: 8cqw; border-radius: 50%; box-shadow: inset -2.2cqw .5cqw 0 0 #fff4c4, 0 0 4cqw 1cqw rgba(255, 240, 170, .35); transform: rotate(-12deg); }
.wxstar { width: var(--sz); height: var(--sz); border-radius: 50%; background: #fff; box-shadow: 0 0 calc(var(--sz) * 2) rgba(255, 255, 255, .8); animation: wxtw var(--dur) ease-in-out var(--del) infinite; }
.wxstar.big { border-radius: 0; background: #fff8d0; box-shadow: none; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.wxshoot { left: 20%; top: 8%; width: 9cqw; height: max(1px, .14cqw); background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff); transform: rotate(28deg); opacity: 0; animation: wxshoot 11s ease-in 3s infinite; }
@keyframes wxshoot { 0% { translate: 0 0; opacity: 0; } 2% { opacity: 1; } 8% { translate: 26cqw 12cqw; opacity: 0; } 100% { translate: 26cqw 12cqw; opacity: 0; } }
.wxvignette { background: radial-gradient(ellipse at 50% 55%, transparent 55%, rgba(8, 12, 50, .3)); }
.wxfly { width: .9cqw; height: .9cqw; border-radius: 50%; background: #fff7a8; box-shadow: 0 0 1.4cqw .5cqw rgba(255, 240, 120, .7); animation: wxfly var(--dur) ease-in-out var(--del) infinite alternate; }
@keyframes wxfly { 0% { translate: 0 0; opacity: .15; } 50% { opacity: 1; } 100% { translate: var(--dx) var(--dy); opacity: .2; } }
/* 홈 위젯판 */
.homeboard { margin-top: 22px; }
.homeboard .head { margin-bottom: 10px; }
.boardtitle { font-family: var(--font-hand); font-size: 1.5rem; }
.wglist { display: grid; gap: 2px; margin-top: 8px; }
.wgrow { display: flex; align-items: center; gap: 6px; padding: 6px 2px; border-bottom: 1px dotted var(--line-strong); }
.wgrow label { flex: 1; display: flex; align-items: center; gap: 8px; }
.newsitem { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line-strong); color: inherit; text-decoration: none; }
.newsitem:first-of-type { border-top: 0; }
.newsitem img, .newsitem .nophoto { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; font-size: 1.4rem; }
.newstext { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* 사진 탭: 소식 */
.phototabs { margin-bottom: 12px; overflow: visible; }
.composer, #feed { max-width: 640px; margin-left: auto; margin-right: auto; }
.composer { margin-bottom: 16px; }
.composer textarea { width: 100%; resize: vertical; min-height: 56px; }
.pcthumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.pcthumbs:empty { display: none; }
.pct { position: relative; width: 72px; height: 72px; }
.pct img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.pct button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); font-size: .7rem; line-height: 1; padding: 0; }
.pcedit { position: absolute; left: -6px; bottom: -6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: .8rem; line-height: 1; padding: 0; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
/* 사진 꾸미기 창 */
.pe { display: grid; gap: 6px; min-width: 0; }
.pestage { display: grid; justify-items: center; gap: 6px; padding: 8px; border-radius: 12px; background: var(--surface-2); }
.pecanvas { display: block; max-width: 100%; max-height: 52dvh; width: auto; height: auto; border-radius: 6px; touch-action: none; cursor: grab; background: #ddd; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .5); }
.pecanvas.framed { padding: 4% 4% 12%; background: #fff; box-sizing: content-box; }
.pegroup { padding: 8px 0; border-top: 1px dashed var(--line-strong); }
.pegroup h3 { font-size: .9rem; margin-bottom: 6px; color: var(--muted); }
.pelooks { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.peemojis { display: flex; flex-wrap: wrap; gap: 4px; max-height: 132px; overflow-y: auto; }
.petext { margin-bottom: 8px; }
.peframe { display: inline-flex; align-items: center; gap: 8px; }
.pcrow { align-items: center; flex-wrap: wrap; gap: 8px; }
.pcrow > .btn, .pcrow > label { flex: none; white-space: nowrap; width: auto; }     /* .row 의 '모두 같은 폭으로 줄이기' 규칙 때문에 글자가 잘리던 것을 막는다 */
.pcrow > .spacer { flex: 1; min-width: 0; }
.pcfile { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.post { padding: 12px; }
.posthead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.postphotos { display: grid; gap: 4px; border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.postphotos.n1 { grid-template-columns: 1fr; }
.postphotos.n2 { grid-template-columns: 1fr 1fr; }
.postphotos.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.postphotos.n3 .pph:first-child { grid-row: 1 / 3; }
.postphotos.n4 { grid-template-columns: 1fr 1fr; }
.pph { position: relative; padding: 0; border: 0; background: var(--surface-2); cursor: zoom-in; aspect-ratio: 1; overflow: hidden; }
.postphotos.n1 .pph { aspect-ratio: 4 / 3; }
.pph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pmore { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .45); color: #fff; font-size: 1.4rem; font-weight: 700; }
.postbody { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; margin-bottom: 6px; }
.postact { display: flex; gap: 8px; }
.heart { border: 0; background: transparent; font-size: 1.05rem; color: var(--muted); padding: 4px 6px; border-radius: 99px; }
.heart.on { color: #e0527f; }
.comments { margin-top: 4px; }
.cmitem { padding: 4px 0; line-height: 1.45; overflow-wrap: anywhere; }
.cmitem .cmtext { white-space: pre-wrap; }
.cmform { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.cmform input { flex: 1; min-width: 0; }
.cmform .btn { flex: none; white-space: nowrap; }
.pickbar { position: sticky; bottom: calc(var(--nav-h) + 8px); z-index: 4; display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 12px; box-shadow: 0 6px 16px -6px rgba(60, 40, 10, .5); }
.albumx.pick .ph.used::after { content: "✓ 선택"; }
@media (min-width: 700px) { .pickbar { bottom: 12px; } }
/* 사진첩: 필터 · 월별 묶음 · 크기 */
.albumx h2 select { max-width: 52%; font-size: .85rem; padding: 4px 8px; margin-left: auto; }
.alfilters { margin-bottom: 8px; }
.alrow { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-width: 0; }
.allab { flex: none; width: 2.6em; font-size: .8rem; color: var(--muted); font-weight: 600; }
.alchips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 22px 4px; margin: 0 -10px; flex: 1; min-width: 0; scrollbar-width: none; scroll-snap-type: x proximity; overscroll-behavior-x: contain; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%); }
.alchips::-webkit-scrollbar { display: none; }
.alchips > * { scroll-snap-align: start; flex: none; }
.alchip { flex: none; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 4px 11px; font-size: .85rem; white-space: nowrap; }
.alchip small { color: var(--muted); font-size: .72rem; }
.alchip.on { background: var(--hl); font-weight: 700; box-shadow: 0 2px 0 var(--line-strong); }
.alextra { margin: 2px 0 6px; }
.alextra summary { cursor: pointer; font-size: .85rem; color: var(--muted); padding: 4px 0; }
.alview { display: flex; align-items: center; gap: 6px; margin: 4px 0 10px; flex-wrap: wrap; }
.alview .btn.on { background: var(--hl); font-weight: 700; }
.almonth { margin-bottom: 14px; }
.almonth h3 { font-family: var(--font-hand); font-size: 1.15rem; margin: 6px 0 8px; padding-left: 8px; border-left: 4px solid var(--accent); }
.albody.size-s .albumgrid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 4px; }
.albody.size-l .albumgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.albumgrid .ph { position: relative; }
.albumgrid .ph.used::after { content: "✓ 붙임"; position: absolute; right: 3px; bottom: 3px; background: var(--accent); color: var(--accent-ink); font-size: .68rem; padding: 1px 6px; border-radius: 99px; }
/* 일촌평 */
.ilchon { margin-top: 12px; padding-top: 10px; border-top: 1.5px dashed var(--line-strong); }
.ilchon h3 { font-size: 1rem; margin-bottom: 6px; }
.ilform { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.ilform .ilwho { flex: none; font-weight: 700; font-size: .9rem; }
.ilform input { min-width: 0; flex: 1; }
.ilitem { padding: 6px 0; border-top: 1px dotted var(--line-strong); line-height: 1.45; overflow-wrap: anywhere; }
.ilitem:first-of-type { border-top: 0; }
.ilx { border: 0; background: transparent; color: var(--muted); padding: 0 4px; margin-left: 4px; font-size: .8rem; }
/* 주크박스: 화면 아래에 얇게 붙는 플레이어 바 */
:root { --juke-bottom: 0px; --juke-h: 48px; }
@media (max-width: 699px) { :root { --juke-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); --juke-h: 46px; } }
#jukebar { position: fixed; left: 0; right: 0; bottom: var(--juke-bottom); z-index: 19; background: var(--surface); color: var(--ink); border-top: 1.5px solid var(--line-strong); box-shadow: 0 -6px 16px -10px rgba(60, 40, 10, .5); }
#jukebar[hidden] { display: none; }
body.hasjuke #app { padding-bottom: calc(var(--juke-h) + var(--juke-bottom) + 24px); }
@media (max-width: 699px) { body.hasjuke #app { padding-bottom: calc(var(--nav-h) + var(--juke-h) + env(safe-area-inset-bottom) + 12px); } }
.jbmain { display: flex; align-items: center; gap: 10px; height: var(--juke-h); padding: 0 14px; max-width: 1380px; margin: 0 auto; min-width: 0; }
.jbnote { flex: none; font-size: 1.1rem; }
.jbctl { display: flex; align-items: center; gap: 2px; flex: none; }
.jbbtn { border: 0; background: transparent; color: inherit; font-size: 1rem; min-width: 34px; height: 34px; border-radius: 99px; padding: 0 8px; white-space: nowrap; }
.jbbtn:hover { background: var(--hl); }
.jbplay { background: var(--accent); color: var(--accent-ink); width: 38px; height: 38px; }
.jbplay:hover { background: var(--accent); filter: brightness(1.1); }
.jbinfo { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; overflow: hidden; }
.jbinfo b, .jbinfo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.jbinfo span { font-size: .85rem; flex: none; max-width: 40%; }
.jbtime { flex: none; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.jbvol { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: .9rem; }
.jbvol input { width: 84px; }
.jbhint { font-size: .9rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jbedit { flex: none; }
.jbseek { position: absolute; left: 0; right: 0; top: -7px; width: 100%; height: 14px; margin: 0; padding: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; z-index: 1; }
.jbseek::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--line) var(--p, 0%)); border-radius: 2px; }
.jbseek::-moz-range-track { height: 4px; background: var(--line); border-radius: 2px; }
.jbseek::-moz-range-progress { height: 4px; background: var(--accent); }
.jbseek::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: var(--accent); border: 0; opacity: 0; transition: opacity .15s; }
.jbseek:hover::-webkit-slider-thumb, #jukebar.playing .jbseek::-webkit-slider-thumb { opacity: 1; }
.jblist { position: absolute; left: 0; right: 0; bottom: 100%; max-height: 46dvh; overflow-y: auto; background: var(--surface); border-top: 1.5px solid var(--line-strong); box-shadow: 0 -10px 20px -12px rgba(60, 40, 10, .5); padding: 6px 14px 10px; }
.jblist[hidden] { display: none; }
.jukelist { list-style: none; margin: 0; padding: 0; max-width: 900px; margin: 0 auto; }
.jukelist li { display: flex; gap: 8px; align-items: baseline; padding: 7px 6px; border-bottom: 1px dotted var(--line); cursor: pointer; }
.jukelist li .jn { width: 1.6em; color: var(--muted); font-size: .8rem; text-align: right; flex: none; }
.jukelist li .jt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.jukelist li.now { background: var(--hl); font-weight: 700; border-radius: 4px; }
.jukeauto { display: flex; align-items: center; gap: 6px; max-width: 900px; margin: 8px auto 0; color: var(--muted); }
@media (max-width: 640px) { .jbvol, .jbtime { display: none; } .jbmain { gap: 6px; padding: 0 8px; } .jbinfo span { display: none; } .jbhint { font-size: .8rem; } }
.jkres, .jklist { display: grid; gap: 4px; margin: 6px 0; max-height: 220px; overflow-y: auto; }
.jkrow { display: flex; align-items: center; gap: 8px; padding: 4px 2px; border-bottom: 1px dotted var(--line); }
.jkrow .jt { overflow-wrap: anywhere; }
.jkrow .jn { width: 1.6em; color: var(--muted); font-size: .8rem; text-align: right; flex: none; }
.jkinfo { flex: 1; min-width: 0; }
.jkrow.in { opacity: .6; }
dialog.wide { max-width: min(760px, 96vw); }
.jktabs { display: flex; gap: 6px; margin-bottom: 10px; }
.jktabs .btn.on { background: var(--hl); font-weight: 700; }
.jkpane .jkres { max-height: 44dvh; }
.jkgroup { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; background: var(--surface-2); }
.jkghead { display: flex; align-items: center; gap: 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--line-strong); margin-bottom: 2px; }
.jkcover { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface); }
.jkcount { margin: 2px 0 6px; }
.jkgroups { margin-bottom: 6px; }
.jkartists { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; max-height: 120px; overflow-y: auto; }
.jkmine { margin-top: 12px; padding-top: 8px; border-top: 1.5px dashed var(--line-strong); }
.jkmine .jklist { max-height: 180px; }
/* 작은 방(서명·홈)은 움직이는 알갱이를 빼고 하늘만 보여 준다 */
.stage.mini .wxp { display: none; }
.stage.mini .wxfx i, .stage.mini .wxfx i::before, .stage.mini .wxfx i::after { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .wxfx i, .wxfx i::before, .wxfx i::after { animation: none !important; }
  .wxdrop, .wxflake, .wxripple, .wxshoot, .wxfly { display: none; }
}
.mmmood { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: -2.2cqw; font-size: 2.6cqw; line-height: 1; padding: .35em .5em; background: #fff; border: 1.5px solid var(--ink); border-radius: 12px; white-space: nowrap; box-shadow: 0 2px 0 rgba(74, 53, 36, .25); animation: mmfloat 2.2s ease-in-out infinite; }
.mmmood::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 8px; height: 8px; background: #fff; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: translateX(-50%) rotate(45deg); }
@keyframes mmfloat { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-6%); } }
.stage.mini { max-width: 190px; border-width: 2px; pointer-events: none; }
.stage.mini .ritem.avatar, .stage.mini .ritem.avatar svg { animation: none !important; }
.stage.mini .mmmood { font-size: 5cqw; }
.miniroom { display: block; text-decoration: none; }
.sig { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line-strong); }
.sig .miniroom { width: 150px; flex: none; }
.minirooms { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.miniwrap { width: 128px; text-align: center; }
.miniwrap .miniroom { width: 100%; }
.mesubs { display: flex; flex-wrap: wrap; gap: 6px; }
.mesubs .btn.on { background: var(--hl); border-color: var(--accent); font-weight: 700; }
.mepreview { position: relative; }
.hdfilters { flex-wrap: wrap; }
.hdfilters select { max-width: 100%; min-width: 0; }
.facegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.facebtn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 10px; font-size: .72rem; color: var(--ink); cursor: pointer; }
.facebtn:hover { background: var(--hl); }
.facebtn.on { background: var(--hl); border-color: var(--accent); font-weight: 700; }
.facebtn img { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 6%; display: block; border-radius: 6px; pointer-events: none; }
.faceauto { width: 100%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 6px; background: var(--surface-2); font-size: .9rem; }
.mepmood { position: absolute; top: 2px; right: 2px; font-size: 1.2rem; background: #fff; border: 1.5px solid var(--ink); border-radius: 10px; padding: 1px 5px; }
.cropwrap { width: 280px; height: 280px; }
.cropwrap.lasso::after { display: none; }
.cropwrap canvas { cursor: crosshair; }
.rhandle { position: absolute; right: -10px; bottom: -10px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); cursor: nwse-resize; touch-action: none; z-index: 8; }
.rsize { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; }
.rsize input { width: 120px; min-height: 0; padding: 0; }
.gdup { position: absolute; left: 0; right: 0; bottom: 0; font-style: normal; font-size: .68rem; text-align: center; background: rgba(74, 53, 36, .78); color: #fff; border-radius: 0 0 9px 9px; padding: 1px 0; pointer-events: none; }
.gifgrid.found .gifcell { position: relative; }
.cropwrap canvas.pick { cursor: copy; }

/* ── 글자 줄바꿈·좁은 화면 대비(공통) ─────────────────────────
   버튼·칩·탭의 글자는 도중에 끊기지 않게 하고, 자리가 모자라면 버튼이 아니라 줄(행) 쪽이 다음 줄로 내려가게 한다. */
.btn, .chip, .alchip, .pill, .tab, .badge { white-space: nowrap; }
.row > .btn, .row > a.btn, .row > label.btn { flex: none; }
.head, .card h2, .actions, .pickbar, .alview { flex-wrap: wrap; }
.head h1 { min-width: 0; overflow-wrap: anywhere; }
.card h2 { row-gap: 6px; }
.t, .s, .rintro, .gb, .postbody, .cmtext, .ilitem, .newstext { overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .item { flex-wrap: wrap; }
  .item > .grow { flex-basis: 55%; min-width: 0; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  main#main { padding-right: 12px; }
}
/* 주크박스 위젯형: 왼쪽 메뉴가 있는 넓은 화면(기본 다이어리 등)에서는 메뉴 밑의 작은 플레이어로 보인다. 그 밖에는 위의 얇은 바. */
@media (min-width: 1100px) and (min-height: 760px) {
  :root:not([data-skin]) #jukebar, :root:is([data-skin=gameboy]) #jukebar {
    left: max(14px, calc((100vw - 1380px) / 2 + 14px)); right: auto; width: calc(var(--rail) - 4px); bottom: 24px; border: 1.5px solid var(--line-strong); border-radius: 14px;
    box-shadow: var(--shadow); padding: 8px 10px 10px;
  }
  :root:not([data-skin]) #jukebar .jbmain, :root:is([data-skin=gameboy]) #jukebar .jbmain { height: auto; padding: 0; flex-wrap: wrap; gap: 6px 6px; max-width: none; }
  :root:not([data-skin]) #jukebar .jbnote, :root:not([data-skin]) #jukebar .jbtime,
  :root:is([data-skin=gameboy]) #jukebar .jbnote, :root:is([data-skin=gameboy]) #jukebar .jbtime { display: none; }
  :root:not([data-skin]) #jukebar .jbvol, :root:is([data-skin=gameboy]) #jukebar .jbvol { flex: 1 1 100%; order: 5; } :root:not([data-skin]) #jukebar .jbvol input, :root:is([data-skin=gameboy]) #jukebar .jbvol input { flex: 1; width: auto; }
  :root:not([data-skin]) #jukebar .jbinfo, :root:is([data-skin=gameboy]) #jukebar .jbinfo { order: -1; flex: 1 1 100%; flex-direction: column; gap: 0; }
  :root:not([data-skin]) #jukebar .jbinfo span, :root:is([data-skin=gameboy]) #jukebar .jbinfo span { max-width: 100%; }
  :root:not([data-skin]) #jukebar .jbctl, :root:is([data-skin=gameboy]) #jukebar .jbctl { flex: 1; justify-content: center; }
  :root:not([data-skin]) #jukebar .jbseek, :root:is([data-skin=gameboy]) #jukebar .jbseek { position: static; margin: 0 0 4px; }
  :root:not([data-skin]) #jukebar .jbedit, :root:is([data-skin=gameboy]) #jukebar .jbedit { flex: 1 1 100%; }
  :root:not([data-skin]) #jukebar .jblist, :root:is([data-skin=gameboy]) #jukebar .jblist { left: 0; right: auto; width: 320px; border: 1.5px solid var(--line-strong); border-radius: 12px; bottom: calc(100% + 6px); }
  :root:not([data-skin]) body.hasjuke #app { padding-bottom: 28px; }
}
/* 미니홈 꾸미기 도구: 묶음 탭 + 칸마다 제목이 있는 그룹 */
.toptabs { display: flex; gap: 4px; margin: 2px 0 12px; border-bottom: 1.5px solid var(--line-strong); overflow-x: auto; scrollbar-width: none; }
.toptabs::-webkit-scrollbar { display: none; }
.toptab { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap; }
.toptab.on { color: var(--ink); border-bottom-color: var(--accent); background: var(--hl); border-radius: 8px 8px 0 0; }
.toolpane { min-width: 0; }
.rgroup { padding: 10px 0; border-top: 1px dashed var(--line-strong); }
.rgroup:first-child { border-top: 0; padding-top: 0; }
.rgroup h3 { font-size: .9rem; margin-bottom: 8px; color: var(--muted); font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.optgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.opt { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--surface); min-height: 40px; font-size: .88rem; text-align: center; }
.opt.on { background: var(--hl); border-color: var(--accent); font-weight: 700; box-shadow: 0 0 0 1px var(--accent); }
.opt .oi { font-size: 1.1rem; }
.rsub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.rsub > .muted { min-width: 5.5em; }
.seg { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: 99px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 7px 14px; white-space: nowrap; font-size: .88rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.rselbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 12px; margin-bottom: 12px; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); }
.rselbar.on { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.rseltitle { flex: 1 1 100%; font-size: .9rem; }
.rgrp { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rsize { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 180px; min-width: 0; }
.rsize input { flex: 1; min-width: 0; }
.rtools .rtabs { margin-bottom: 10px; }
.editbar { position: sticky; bottom: calc(var(--juke-bottom, 0px) + var(--juke-extra, 0px) + 8px); z-index: 4; display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 10px 12px; background: var(--surface); border: 1.5px solid var(--accent); border-radius: 12px; box-shadow: 0 6px 16px -6px rgba(60, 40, 10, .5); }
.pickbar { bottom: calc(var(--juke-bottom, 0px) + var(--juke-extra, 0px) + 8px) !important; }
body.hasjuke { --juke-extra: var(--juke-h); }
@media (min-width: 700px) { .editbar { bottom: calc(var(--juke-extra, 0px) + 10px); } .pickbar { bottom: calc(var(--juke-extra, 0px) + 10px) !important; } }
/* 더보기: 묶음 제목 */
.moregroups { display: grid; gap: 18px; max-width: 760px; }
.moregroup .card { margin-bottom: 0; }
.moretitle { font-size: .82rem !important; letter-spacing: .06em; color: var(--muted); font-family: var(--font) !important; font-weight: 700; margin: 0 0 6px 4px; text-transform: none; }
.jbshuf { opacity: .55; }
.jbshuf.on { opacity: 1; background: var(--hl); box-shadow: inset 0 0 0 1.5px var(--accent); }
.jico { display: block; margin: auto; }
.jbbtn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
body.juke-away #jukebar .jbedit, body.juke-away #jukebar .jukeauto { display: none; }

.jbvol2 { display: none; align-items: center; gap: 8px; padding: 4px 4px 8px; } .jbvol2 input { flex: 1; min-width: 0; }
@media (max-width: 640px) { .jbvol2 { display: flex; } }
.alscroll { position: relative; flex: 1; min-width: 0; }
.alscroll > .alchips { margin: 0; padding-left: 4px; padding-right: 4px; -webkit-mask-image: none; mask-image: none; cursor: grab; }
.alscroll.fl > .alchips { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 34px); mask-image: linear-gradient(90deg, transparent 0, #000 34px); }
.alscroll.fr > .alchips { -webkit-mask-image: linear-gradient(270deg, transparent 0, #000 34px); mask-image: linear-gradient(270deg, transparent 0, #000 34px); }
.alscroll.fl.fr > .alchips { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 34px, #000 calc(100% - 34px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 34px, #000 calc(100% - 34px), transparent 100%); }
.alarrow { position: absolute; top: 50%; transform: translateY(-58%); width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 1.15rem; line-height: 1; padding: 0 0 2px; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow); z-index: 2; }
.alarrow[hidden] { display: none; }
.alarrow.l { left: -2px; } .alarrow.r { right: -2px; }
