* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #222;
  --sub: #8a8580;
  --line: #ececec;
  --accent: #d3e3fb;      /* 배경화면 1번(블루)의 연한 하늘색 */
  --accent-deep: #a8c5ef; /* 달력 선택 동그라미 */
}

body {
  font-family: "Pretendard", "Apple SD Gothic Neo", -apple-system, sans-serif;
  letter-spacing: -0.01em;
  font-weight: 300;
  background: linear-gradient(180deg, #ffffff 0%, #f3f1f6 100%);
  color: var(--ink);
  min-height: 100vh;
}

.wrap { max-width: 900px; margin: 0 auto; padding: 32px 16px 80px; }

header { text-align: center; margin-bottom: 20px; }
.eyebrow { font-size: 11px; letter-spacing: 0.2em; color: var(--sub); font-weight: 400; }
h1 { font-size: 26px; font-weight: 500; letter-spacing: -0.03em; margin: 6px 0; }
.desc { font-size: 13px; color: var(--sub); }

/* ===== 미리보기 ===== */
.preview { width: 100%; overflow: hidden; border-radius: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12); }
.scaler { width: 1280px; transform-origin: top left; }

/* ===== 저장되는 바탕화면 (1280 × 800) ===== */
.desktop {
  --wall: linear-gradient(135deg, #ffd1dc 0%, #ffb3c7 50%, #f6a3c0 100%);
  --g-ink: #1d1d1f; --g-sub: rgba(60, 60, 67, 0.6); --g-line: rgba(60, 60, 67, 0.12); --g-soft: rgba(255, 255, 255, 0.4); --g-inv: #fff;
  width: 1280px; height: 800px; position: relative; overflow: hidden;
  background: var(--wall); font-family: "Pretendard", "Apple SD Gothic Neo", sans-serif; letter-spacing: -0.01em; font-weight: 300; color: #1d1d1f;
}

.desktop.on-dark { --g-ink: #fff; --g-sub: rgba(235, 235, 245, 0.6); --g-line: rgba(235, 235, 245, 0.16); --g-soft: rgba(255, 255, 255, 0.12); --g-inv: #1d1d1f; }

/* 하양 배경: 흰색 + 가 안 보여서 회색으로 */
.desktop.on-white .empty-bg, .desktop.on-white .dock-icon .empty-bg { color: rgba(60, 60, 67, 0.3); }

/* 메뉴바 */
.menubar {
  height: 30px; padding: 0 14px 0 20px; display: flex; justify-content: space-between; align-items: center;
  background: rgba(255, 255, 255, 0.3); font-size: 13.5px; font-weight: 300; color: #1d1d1f;
}
.menubar.on-dark { background: rgba(0, 0, 0, 0.18); color: #fff; }
.menu-left { display: flex; gap: 22px; align-items: center; }
.menu-left b { font-weight: 400; }
.menu-right { display: flex; gap: 15px; align-items: center; }
.mb-ico { width: 16px; height: 16px; display: block; }
.mb-ico.wide { width: 23px; height: 20px; }
.mb-ime { font-size: 10.5px; font-weight: 400; line-height: 1; padding: 3px 4px; border-radius: 4px; background: #1d1d1f; color: #fff; }
.menubar.on-dark .mb-ime { background: #fff; color: #1d1d1f; }
.mb-clock { font-weight: 300; margin-left: 2px; }

/* 위젯 배치: 8칸 × 5줄 */
.widgets {
  position: absolute; left: 24px; right: 24px; top: 52px; height: 620px;
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(5, 1fr); gap: 14px;
}
.w {
  position: relative; border-radius: 22px; overflow: hidden;
  background: rgba(255, 255, 255, 0.3); color: var(--g-ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 22px rgba(0, 0, 0, 0.08);
}
.desktop.on-dark .w { background: rgba(255, 255, 255, 0.12); }
.desktop .w.dark { background: rgba(28, 28, 32, 0.82); color: #fff; }
.w-label { font-size: 12px; font-weight: 300; opacity: 0.65; }
.photo-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.empty-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 200; color: rgba(255, 255, 255, 0.95); background: rgba(255, 255, 255, 0.22); }
/* 사진 위젯 빈 상태: 유리 + 가운데 + */
.w-photo > .empty-bg { background: none; font-size: 54px; }

/* 사진형 위젯 (최애, 사진, 굿즈) */
/* 부문 이름 알약 라벨 (사진 위젯 라벨이랑 같은 모양) */
.tag-chip {
  display: inline-block; font-size: 11px; font-weight: 400; color: #fff; white-space: nowrap;
  background: rgba(0, 0, 0, 0.3); padding: 3px 8px; border-radius: 999px;
}
.tag-chip .pin { margin-right: 5px; }
.am-chip { position: absolute; top: 10px; right: 10px; z-index: 2; }
.cal-chip { position: absolute; top: 14px; left: 14px; z-index: 2; }
.w-photo .chip {
  position: absolute; left: 10px; top: 10px; z-index: 2; font-size: 11px; font-weight: 400; color: #fff;
  background: rgba(0, 0, 0, 0.3); padding: 3px 8px; border-radius: 999px;
}
.w-photo .cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 26px 14px 11px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.38) 100%);
  color: #fff; font-size: 12px; font-weight: 300; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.w-photo .cap:empty { display: none; }
/* 사진 없을 땐 코멘트 아래 어두운 그라데이션 빼기 */
.w-photo > .empty-bg ~ .cap { background: none; color: var(--g-ink); }

/* 프로필 (옛날 인스타 느낌) */
.w-profile { padding: 18px; display: flex; flex-direction: column; }
.prof-top { display: flex; gap: 14px; align-items: center; }
.prof-avatar { width: 78px; height: 78px; border-radius: 50%; background-size: cover; background-position: center; border: 3px solid rgba(255, 255, 255, 0.85); flex: none; }
.prof-nick { font-size: 20px; font-weight: 500; }
.prof-handle { font-size: 13px; opacity: 0.6; margin-top: 2px; }
.prof-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; text-align: center; border-top: 1px solid var(--g-line); padding-top: 12px; }
.prof-stats b { display: flex; align-items: center; justify-content: center; height: 26px; font-size: 20px; font-weight: 500; } /* 숫자·배터리 칸 높이 통일 */
.love-batt { display: block; width: 40px; height: 20px; position: relative; left: 3.5px; } /* 꼭지 빼고 몸통이 가운데 오게 */
.prof-stats span { font-size: 11px; opacity: 0.6; }
.prof-quote { margin-top: auto; font-size: 16px; font-weight: 400; color: #48484a; }
.desktop.on-dark .prof-quote { color: rgba(255, 255, 255, 0.85); }
/* 형광펜 밑줄: 글자 아래쪽 절반만 배경화면 색으로 */
.prof-quote .hl {
  display: inline-block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top;
  padding: 0 3px; background: linear-gradient(180deg, rgba(0, 0, 0, 0) 48%, var(--pen) 48%, var(--pen) 90%, rgba(0, 0, 0, 0) 90%);
}

/* Now Playing (올해의 노래) */
.w-nowplaying { padding: 10px 12px; display: flex; flex-direction: column; }
.np-top { display: flex; justify-content: space-between; align-items: flex-start; }
.np-art { width: 44px; height: 44px; border-radius: 8px; position: relative; overflow: hidden; flex: none; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }
.np-art .empty-bg { font-size: 22px; }
.w-nowplaying .np-tag { position: absolute; top: 10px; right: 10px; z-index: 2; font-size: 9.5px; padding: 2px 6px; } /* 오른쪽 위 가장자리에 붙게 */
.np-title { margin-top: 8px; font-size: 13px; font-weight: 500; /* 커버 바로 아래로 올리고 조금 더 진하게 */ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { font-size: 11px; font-weight: 400; color: var(--g-ink); opacity: 0.6; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 애플뮤직 창 (올해의 앨범 + 최애 수록곡) */
.w-applemusic { border-radius: 18px; display: flex; padding: 6px; }
.am-side { width: 86px; flex: none; padding: 8px 6px; background: var(--g-soft); border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 13px; }
.am-lights { display: flex; gap: 5px; margin: 0 0 9px 3px; }
.am-lights i { display: block; width: 9px; height: 9px; border-radius: 50%; }
.am-lights .r { background: #ff5f57; }
.am-lights .y { background: #febc2e; }
.am-lights .g { background: #28c840; }
.am-side-h { font-size: 8.5px; font-weight: 400; color: var(--g-sub); margin: 8px 5px 2px; white-space: nowrap; }
.am-side-item { font-size: 10.5px; font-weight: 300; padding: 4px 5px; border-radius: 6px; white-space: nowrap; overflow: hidden; }
.am-side-item.on { background: var(--g-soft); font-weight: 400; }

.am-main { flex: 1; min-width: 0; position: relative; overflow: hidden; padding: 6px 8px 0 12px; display: flex; flex-direction: column; }
.am-head { display: flex; gap: 12px; align-items: flex-end; }
.am-cover { width: 104px; height: 104px; flex: none; position: relative; overflow: hidden; border-radius: 8px; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18); }
.am-cover .empty-bg { font-size: 38px; }
.am-meta { flex: 1; min-width: 0; }
.am-kicker { font-size: 10px; font-weight: 300; color: #fa2d48; }
.am-album { font-size: 17px; font-weight: 400; line-height: 1.25; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-year { font-size: 10px; color: var(--g-sub); margin-top: 2px; }
.am-btns { display: flex; gap: 6px; margin-top: 8px; }
.am-btns span { font-size: 10px; font-weight: 400; padding: 5px 12px; border-radius: 999px; background: var(--g-soft); color: #fa2d48; }

.am-tracks { list-style: none; margin-top: 10px; flex: 1; overflow: hidden; }
.am-tracks li { height: 25px; display: flex; align-items: center; gap: 9px; padding: 0 4px; font-size: 11px; color: var(--g-sub); border-bottom: 1px solid var(--g-line); }
.am-tracks .no { width: 12px; flex: none; text-align: center; }
.am-tracks .am-ghost { flex: 1; }
.am-tracks .am-ghost i { display: block; height: 6px; border-radius: 3px; background: var(--g-line); }
.am-tracks .tt { flex: 1; min-width: 0; font-weight: 400; color: var(--g-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-tracks .time { flex: none; }
.am-tracks li.on .no, .am-tracks li.on .time { color: #fa2d48; }

.am-player {
  position: absolute; left: 8px; right: 4px; bottom: 4px; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--g-soft); border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 20px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.am-ctrl { display: flex; align-items: center; gap: 7px; flex: none; }
.am-ctrl img { display: block; width: 12px; height: 12px; }
.am-mini { width: 28px; height: 28px; flex: none; position: relative; overflow: hidden; border-radius: 6px; }
.am-mini .empty-bg { font-size: 13px; }
.am-np { flex: 1; min-width: 0; }
.am-np-title { font-size: 10.5px; font-weight: 300; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-np-sub { font-size: 9px; color: var(--g-sub); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-prog { height: 2px; margin-top: 3px; border-radius: 1px; background: var(--g-line); overflow: hidden; }
.am-prog i { display: block; width: 45%; height: 100%; background: var(--g-sub); }

/* 캘린더 (올해의 오프) */
.w-cal { padding: 10px; display: flex; flex-direction: column; }
.cal-photo { flex: 1; min-height: 44px; position: relative; overflow: hidden; border-radius: 12px; }
.cal-photo .empty-bg { font-size: 30px; }
.cal-date { padding: 8px 4px 0; }
.cal-dow { font-size: 11px; font-weight: 400; color: #ff3b30; }
.cal-num { font-size: 44px; font-weight: 200; line-height: 1; margin-top: 2px; letter-spacing: -0.02em; }
.cal-ym { font-size: 11px; font-weight: 300; color: var(--g-sub); margin-top: 4px; }
.cal-date.empty { opacity: 0.45; }
.cal-date.empty .cal-dow { color: var(--g-sub); }
/* 공놀이 버전: 경기 결과 한 줄 */
.cal-score { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 6px; padding: 0 4px; font-size: 11px; font-weight: 400; white-space: nowrap; }
.cal-score span { overflow: hidden; text-overflow: ellipsis; }
.cal-score b { flex: none; font-size: 10px; font-weight: 500; padding: 1px 6px; border-radius: 999px; color: #fff; background: var(--g-sub); }
.cal-score b.tag-승 { background: #ff3b30; }
.cal-score b.tag-패 { background: #3a3a3c; }
.cal-event { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 6px; border-radius: 6px; background: var(--g-soft); overflow: hidden; }
.cal-event i { width: 3px; height: 13px; border-radius: 2px; background: #ff3b30; flex: none; }
.cal-event span { font-size: 11px; font-weight: 400; color: var(--g-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 영상 (올해의 직캠) */
.w-video .vbar { position: absolute; left: 14px; right: 14px; bottom: 34px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); z-index: 2; overflow: hidden; }
.w-video .vbar i { display: block; width: 38%; height: 100%; background: #ff3b5c; }

/* 메모 (올해의 떡밥) */
.w-memo > .empty-bg { background: none; font-size: 54px; }
.memo-chip { position: absolute; top: 10px; left: 10px; z-index: 2; }

/* 독 */
.dock {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center; padding: 9px 12px;
  background: rgba(255, 255, 255, 0.4); border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 22px;
}
.dock-icon { width: 54px; height: 54px; border-radius: 14px; position: relative; overflow: hidden; background: rgba(255, 255, 255, 0.35); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); }
.dock-icon .empty-bg { font-size: 22px; font-weight: 300; background: none; color: rgba(255, 255, 255, 0.95); }
.dock-app { width: 52px; height: 52px; display: block; }
.dock-sep { width: 1px; height: 44px; background: rgba(0, 0, 0, 0.15); margin: 0 2px; }

/* ===== 버튼 ===== */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 20px; }
button {
  width: 100%; padding: 14px; border: none; border-radius: 14px; cursor: pointer;
  background: var(--accent); color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 300;
}
button:active { transform: scale(0.98); }
button.ghost { background: #fff; border: 1.5px solid var(--line); box-shadow: none; color: var(--sub); }

/* ===== 입력 ===== */
.panel { background: #fff; border-radius: 18px; padding: 20px; margin-bottom: 16px; }
.panel h3 { font-size: 16px; font-weight: 400; margin-bottom: 12px; }
.hint { font-size: 12px; color: var(--sub); margin: -6px 0 12px; }
input[type="text"], input[type="date"] {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 15px; font-family: inherit; background: #fafafa; color: var(--ink);
}
input::placeholder { color: #bdb8b3; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 44px; height: 44px; padding: 0; border-radius: 12px; box-shadow: none; border: 2px solid #fff; outline: 1.5px solid var(--line); }
.swatches button.on { outline: 2.5px solid var(--ink); }

/* 위젯 누를 수 있게 */
.desktop [data-cat] { cursor: pointer; }

/* 편집 창 (폰: 아래에서 올라옴 / 컴퓨터: 가운데) */
.sheet {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0.35); opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.sheet.open { opacity: 1; pointer-events: auto; }
.sheet-panel {
  width: 100%; max-width: 460px; background: #fff; border-radius: 22px 22px 0 0; padding: 18px 20px 28px;
  transform: translateY(24px); transition: transform 0.2s;
  max-height: 88vh; overflow-y: auto; /* 칸 많으면 창 안에서 스크롤 */
}
.sheet.open .sheet-panel { transform: none; }
@media (min-width: 700px) {
  .sheet { align-items: center; }
  .sheet-panel { border-radius: 22px; }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sheet-head h3 { font-size: 18px; font-weight: 400; }
.sheet-done { width: auto; padding: 8px 18px; font-size: 14px; font-weight: 300; }
.sheet-body { display: grid; gap: 14px; }
.sheet-photo { display: flex; gap: 14px; align-items: center; }
.sheet-thumb {
  width: 88px; height: 88px; border-radius: 16px; flex: none; background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; font-size: 32px; color: rgba(0, 0, 0, 0.18);
}
.sheet-thumb.round { border-radius: 50%; }
.sheet-photo-btns { display: grid; gap: 8px; }
.sheet-btn {
  display: inline-block; width: auto; padding: 10px 16px; border: none; border-radius: 12px; cursor: pointer; text-align: center;
  background: var(--accent); color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 300;
}
.sheet-btn.ghost { background: #fff; border: 1px solid var(--line); color: var(--sub); }
.sheet-btn[hidden] { display: none; }
.sheet-field { display: grid; gap: 6px; }
.sheet-field span { font-size: 12px; font-weight: 300; color: var(--sub); }
.sheet-field input { font-size: 16px; font-weight: 300; }
.prefix-row { display: flex; align-items: center; gap: 8px; }
.sheet-field .prefix-row .prefix { flex: none; font-size: 16px; font-weight: 400; color: var(--ink); }
.prefix-row input { flex: 1; min-width: 0; }
.sheet-field .rename-note { font-size: 11px; color: var(--sub); }

/* 우리 팀 고르기 (공놀이 버전 직관) */
.team-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.team-chips .team-chip {
  width: auto; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff;
  box-shadow: none; font-family: inherit; font-size: 13px; font-weight: 400; color: var(--ink); cursor: pointer;
}
.team-chips .team-chip.on { background: var(--accent-deep); border-color: var(--accent-deep); font-weight: 500; }
.team-label { margin-top: 6px; }
.sheet-note { font-size: 12px; color: var(--sub); margin-top: -6px; }
.my-team { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.my-team span { font-size: 15px; font-weight: 400; }
.my-team button { width: auto; padding: 8px 16px; font-size: 14px; }
.league-chips { margin-bottom: 2px; }
.sheet-result { font-size: 14px; font-weight: 400; color: var(--ink); min-height: 18px; margin-top: -4px; }

/* 날짜 고르기 (미니 달력) */
.dp { border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px 10px; }
.dp.attn { animation: dp-attn 1.4s ease; }
@keyframes dp-attn { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); } 25%, 60% { box-shadow: 0 0 0 3px var(--accent-deep); } }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dp-title { font-size: 15px; font-weight: 400; }
.dp button { width: auto; padding: 0; border: none; border-radius: 50%; background: none; box-shadow: none; font-family: inherit; color: var(--ink); cursor: pointer; }
.dp .dp-nav { width: 34px; height: 34px; font-size: 22px; line-height: 1; }
.dp .dp-nav:disabled { opacity: 0.2; cursor: default; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; text-align: center; }
.dp-dow { font-size: 11px; color: var(--sub); padding: 4px 0; }
.dp .dp-day { width: 36px; height: 36px; margin: 0 auto; font-size: 15px; font-weight: 300; }
.dp .dp-day:hover { background: #f2f2f5; }
.dp .dp-day.on, .dp .dp-day.on:hover { background: var(--accent-deep); font-weight: 500; }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font-size: 14px; padding: 10px 18px; border-radius: 20px;
  opacity: 0; pointer-events: none; transition: 0.25s; z-index: 30; /* 편집 창 위에 보이게 */
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
