/* 가족 홈 — 한 장짜리 스타일. 색은 맨 위 변수만 바꾸면 전체가 바뀐다(어두운 모드는 OS 설정을 따른다).
   배치: 넓은 화면 = 위 메뉴 · 휴대폰(≤720px) = 아래 탭 메뉴. 카드·타일은 grid 로 화면 폭에 맞춰 줄 수가 바뀐다. */
:root {
  --bg: #f6f4fb; --panel: #ffffff; --text: #1f1d2b; --muted: #77738a; --line: #e7e3f2;
  --accent: #7c5cff; --accent2: #ff7aa8; --ok: #12a26b; --bad: #e5484d; --warn: #f5a524;
  --radius: 16px; --shadow: 0 6px 24px rgba(60, 40, 120, .08);
  --grad: linear-gradient(135deg, #7c5cff 0%, #b06cff 45%, #ff7aa8 100%);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14131c; --panel: #1e1c2a; --text: #ecebf5; --muted: #9a96b0; --line: #2d2a3d; --shadow: 0 6px 24px rgba(0, 0, 0, .35); }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 -apple-system, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
input[type=checkbox] { width: auto; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--grad); color: #fff; border: 0; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.4em; font-size: 14px; }
.okmsg { color: var(--ok); min-height: 1.4em; font-size: 14px; }

/* ── 머리 · 메뉴 ── */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .in { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 16px; }
.brand { font-weight: 800; font-size: 18px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--text); padding: 8px 12px; border-radius: 999px; display: flex; align-items: center; gap: 6px; }
.nav a.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; }
.nav .ico { font-size: 18px; }
.sess { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.sess b { color: var(--text); font-variant-numeric: tabular-nums; }
.sess b.low { color: var(--bad); }
.sess label { display: inline-flex; gap: 4px; margin: 0; align-items: center; }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 96px; }
@media (max-width: 720px) {
  .top .in { padding: 8px 12px; gap: 8px; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; justify-content: space-around; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 30; }
  .nav a { flex-direction: column; gap: 0; font-size: 11px; padding: 4px 6px; }
  .sess .hide-sm { display: none; }
  main { padding: 14px 12px 96px; }
}

/* ── 카드 · 격자 ── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card h2 { margin: 0 0 12px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1; }
.hero { background: var(--grad); color: #fff; border-radius: var(--radius); padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.hero h1 { margin: 0 0 4px; font-size: 22px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar h1 { margin: 0; font-size: 20px; flex: 1; min-width: 160px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ── 분류 색(일정·소식) ── */
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--c, #888); color: #fff; }
.cat-family { --c: #7c5cff; } .cat-birthday { --c: #ff7aa8; } .cat-anniv { --c: #f5a524; } .cat-plan { --c: #3b82f6; }
.cat-health { --c: #12a26b; } .cat-trip { --c: #06b6d4; } .cat-school { --c: #8b5e34; }
.cat-notice { --c: #e5484d; } .cat-event { --c: #7c5cff; } .cat-memo { --c: #3b82f6; } .cat-etc { --c: #77738a; }

/* ── 목록 ── */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.dday { min-width: 58px; text-align: center; font-weight: 800; color: var(--accent); }
.dday.today { color: var(--accent2); }

/* ── 달력 ── */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .h { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal .d { min-height: 92px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; cursor: pointer; overflow: hidden; }
.cal .d.out { opacity: .4; }
.cal .d.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal .d.sel { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.cal .n { font-size: 13px; font-weight: 600; }
.cal .sun .n, .cal .h.sun { color: var(--bad); } .cal .sat .n, .cal .h.sat { color: #3b82f6; }
.cal .ev { display: block; font-size: 11px; color: #fff; background: var(--c); border-radius: 4px; padding: 0 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .cal .d { min-height: 56px; } .cal .ev { font-size: 0; height: 6px; padding: 0; } }

/* ── 사진 ── */
.crumb { font-size: 14px; margin-bottom: 8px; }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); cursor: pointer; border: 1px solid var(--line); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.tile:hover img { transform: scale(1.04); }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; color: #fff; font-size: 13px; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); }
.tile .ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 40px; }
.tile .play { position: absolute; top: 8px; right: 8px; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.album.tile { aspect-ratio: 4 / 3; }
.plist td, .plist th { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: middle; }
.plist { width: 100%; border-collapse: collapse; }
.plist img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.plist tr { cursor: pointer; }
@media (max-width: 720px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; } .plist .hide-sm { display: none; } }

/* 상세 보기 · 전체화면 · 자동 넘김 */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(10, 8, 20, .94); display: none; color: #fff; }
.viewer.on { display: flex; }
.viewer .stage { flex: 1; position: relative; display: grid; place-items: center; min-width: 0; }
.viewer .stage img, .viewer .stage video { max-width: 100%; max-height: 100vh; object-fit: contain; }
.viewer .info { width: 300px; background: rgba(255, 255, 255, .06); padding: 16px; overflow: auto; font-size: 14px; }
.viewer .info dt { color: #aaa; font-size: 12px; margin-top: 10px; } .viewer .info dd { margin: 0; word-break: break-all; }
.viewer .vbar { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; z-index: 2; }
.viewer .vbar .btn { background: rgba(0, 0, 0, .45); color: #fff; border-color: rgba(255, 255, 255, .2); }
.viewer .nav-l, .viewer .nav-r { position: absolute; top: 50%; transform: translateY(-50%); font-size: 34px; background: rgba(0, 0, 0, .3); border: 0; color: #fff; border-radius: 999px; width: 48px; height: 48px; cursor: pointer; z-index: 2; }
.viewer .nav-l { left: 10px; } .viewer .nav-r { right: 10px; }
.viewer .vposter { text-align: center; } .viewer .vposter .big { font-size: 72px; }
.viewer.full .info, .viewer.full .vbar .hide-full { display: none; }
@media (max-width: 720px) { .viewer { flex-direction: column; } .viewer .info { width: auto; max-height: 34vh; } .viewer .stage img, .viewer .stage video { max-height: 64vh; } .viewer.full .stage img, .viewer.full .stage video { max-height: 100vh; } }

/* ── 창(dialog) · 알림 ── */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(520px, 94vw); background: var(--panel); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
dialog::backdrop { background: rgba(20, 16, 40, .5); backdrop-filter: blur(2px); }
dialog form { padding: 20px; }
dialog h3 { margin: 0 0 6px; }
dialog .row.end { justify-content: flex-end; margin-top: 16px; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; opacity: 0; transition: opacity .25s; z-index: 99; pointer-events: none; max-width: 90vw; }
#toast.on { opacity: .95; }
#toast.bad { background: var(--bad); color: #fff; }

/* ── 로그인 ── */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, color-mix(in srgb, var(--accent) 25%, transparent), transparent 50%), radial-gradient(circle at 80% 90%, color-mix(in srgb, var(--accent2) 25%, transparent), transparent 50%), var(--bg); }
.auth-card { width: min(400px, 100%); }
.auth-card .brand { font-size: 28px; text-align: center; display: block; margin-bottom: 6px; }
.qr svg { width: 200px; height: 200px; background: #fff; border-radius: 12px; padding: 6px; }
.steps { display: flex; gap: 8px; margin-bottom: 12px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--grad); }

/* ── 차트(SVG) ── */
.chart svg { width: 100%; height: 160px; display: block; }
.chart .bar { fill: url(#gbar); } .chart text { font-size: 11px; fill: var(--muted); }

/* ── 표(관리자) ── */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl-wrap { overflow-x: auto; }
.badge { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--line); }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }

/* ── 올리기 진행 · 재접속 안내 · 끌어다 놓기 ── */
.up-panel { position: fixed; right: 16px; bottom: 90px; width: min(380px, 92vw); z-index: 60; padding: 14px; }
.up-bar { height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; margin: 10px 0 6px; }
.up-bar span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .3s; }
.up-txt { font-size: 12px; word-break: break-all; }
.up-pending { margin-bottom: 12px; border-color: var(--warn); }
.drop { outline: 3px dashed var(--accent); outline-offset: -8px; }
.cal .lun { font-size: 10px; font-weight: 400; color: var(--muted); }
@media (max-width: 720px) { .cal .lun { display: block; font-size: 9px; } }
.subtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.subtabs a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); }
.subtabs a.on { background: var(--grad); color: #fff; border: 0; }
