@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

:root {
  --bg: #ffffff; --fg: #0a0a0a; --sub: #6b6b6b; --muted: #a3a3a3;
  --line: #ececec; --card: #f5f5f5; --chip: #ededed;
  --ok: #1a7f37; --no: #c62828; --warn: #b26a00;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0a0a0a; --fg: #f5f5f5; --sub: #a0a0a0; --muted: #6b6b6b; --line: #1f1f1f; --card: #151515; --chip: #222; --ok: #4ade80; --no: #f87171; --warn: #fbbf24; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: 'Pretendard Variable', Pretendard, -apple-system, system-ui, sans-serif; font-size: 15px; line-height: 1.5; letter-spacing: -0.01em; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.wrap { max-width: 560px; margin: 0 auto; min-height: 100dvh; position: relative; }

/* 워드마크 */
.wm { font-weight: 300; letter-spacing: -0.045em; font-size: 22px; line-height: 1; white-space: nowrap; }
.wm b { font-weight: 850; }
.wm.lg { font-size: 40px; }

/* 상단바 */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.top .back { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 4px; background: none; border: 0; padding: 8px 0; cursor: pointer; }
.top .r { font-size: 13px; color: var(--sub); }

main { padding: 14px 18px calc(96px + env(safe-area-inset-bottom)); }

/* 하단 탭 */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; font-size: 11px; color: var(--muted); font-weight: 600; }
.nav a.on { color: var(--fg); }
.nav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 공통 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 48px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--fg); color: var(--bg); font-weight: 700; cursor: pointer; width: 100%; }
.btn:disabled { opacity: .35; }
.btn.ghost { background: var(--card); color: var(--fg); }
.btn.line { background: transparent; border: 1px solid var(--line); color: var(--fg); }
.btn.sm { height: 36px; width: auto; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn.danger { background: transparent; color: var(--no); border: 1px solid var(--line); }
.input { width: 100%; height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 0 16px; outline: none; }
.input:focus, textarea.input:focus { border-color: var(--fg); }
textarea.input { height: auto; min-height: 220px; padding: 14px 16px; resize: vertical; line-height: 1.6; }
select.input { appearance: none; }
.field { margin-bottom: 12px; }
.label { font-size: 13px; color: var(--sub); margin: 0 0 6px 2px; font-weight: 600; }
.muted { color: var(--sub); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.sp { flex: 1; }
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; } .mb { margin-bottom: 12px; }
h2 { font-size: 20px; margin: 4px 0 14px; letter-spacing: -0.03em; }
h3 { font-size: 15px; margin: 0 0 10px; }

/* 게이트(로그인·위치) */
.gate { min-height: 100dvh; display: flex; flex-direction: column; padding: 0 24px calc(28px + env(safe-area-inset-bottom)); max-width: 440px; margin: 0 auto; }
.gate .hero { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px 0 24px; }
.gate .hero p { color: var(--sub); margin: 14px 0 0; font-size: 15px; }
.gate h1 { font-size: 24px; letter-spacing: -0.035em; margin: 26px 0 6px; line-height: 1.3; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--sub); background: var(--card); padding: 14px; border-radius: 12px; margin: 12px 0; line-height: 1.55; cursor: pointer; }
.consent input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--fg); flex: none; }

/* 배지 */
.nick { font-weight: 650; display: inline-flex; align-items: center; gap: 3px; }
.badge { width: 14px; height: 18px; object-fit: contain; vertical-align: -3px; }

/* 상태 요약 */
.strip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.strip a { background: var(--card); border-radius: 12px; padding: 12px 14px; }
.strip .k { font-size: 12px; color: var(--sub); font-weight: 600; }
.strip .v { font-size: 16px; font-weight: 750; margin-top: 2px; }

/* 세그먼트 */
.seg { display: flex; background: var(--card); border-radius: 11px; padding: 3px; margin-bottom: 6px; }
.seg button { flex: 1; height: 34px; border: 0; background: transparent; border-radius: 8px; font-weight: 650; font-size: 13px; color: var(--sub); cursor: pointer; }
.seg button.on { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 글 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.item { display: block; padding: 15px 2px; border-bottom: 1px solid var(--line); }
.item .t { font-weight: 680; font-size: 16px; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { color: var(--sub); font-size: 14px; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 7px; flex-wrap: wrap; }
.meta .nick { color: var(--sub); font-weight: 600; }
.rank { display: inline-flex; width: 20px; color: var(--fg); font-weight: 800; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }
.rule { font-size: 12px; color: var(--muted); margin: 8px 2px 0; }

.fab { position: fixed; right: max(18px, calc(50% - 262px)); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 15; height: 48px; padding: 0 20px; border-radius: 24px; border: 0; background: var(--fg); color: var(--bg); font-weight: 750; box-shadow: 0 6px 20px rgba(0,0,0,.18); cursor: pointer; }

/* 글 상세 */
.post h1 { font-size: 21px; margin: 6px 0 8px; letter-spacing: -0.03em; line-height: 1.35; word-break: break-all; }
.post .body { white-space: pre-wrap; word-break: break-word; font-size: 16px; line-height: 1.7; margin: 22px 0 26px; }
.likebtn { height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--line); background: transparent; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.likebtn.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.cmts { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 6px; }
.cmt { padding: 13px 0; border-bottom: 1px solid var(--line); }
.cmt .b { white-space: pre-wrap; word-break: break-word; margin-top: 3px; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--chip); color: var(--sub); }
.linkbtn { background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; }
.cbar { position: fixed; left: 0; right: 0; bottom: calc(57px + env(safe-area-inset-bottom)); z-index: 14; background: var(--bg); border-top: 1px solid var(--line); }
.cbar .in { max-width: 560px; margin: 0 auto; display: flex; gap: 8px; padding: 10px 18px; }
.cbar input { flex: 1; height: 42px; border-radius: 21px; border: 1px solid var(--line); background: var(--card); padding: 0 16px; outline: none; }
.cbar button { flex: none; white-space: nowrap; height: 42px; padding: 0 16px; border-radius: 21px; border: 0; background: var(--fg); color: var(--bg); font-weight: 700; }

/* 세탁실 */
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--sub); margin: 0 0 14px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.room { background: var(--card); border-radius: 18px; padding: 14px 10px; }
.rowlbl { font-size: 12px; font-weight: 700; color: var(--sub); margin: 0 4px 6px; display: flex; justify-content: space-between; }
.machines { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.mc { aspect-ratio: 3 / 4; border-radius: 9px; border: 1.5px solid var(--line); background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; padding: 0; position: relative; }
.mc .n { font-size: 11px; font-weight: 800; }
.mc .st { font-size: 10px; font-weight: 650; color: var(--sub); line-height: 1.1; }
.mc .ring { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); }
.mc.idle .ring { border-color: var(--fg); }
.mc.run { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.mc.run .st { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.mc.run .ring { border-color: var(--bg); border-top-color: transparent; animation: spin 1.6s linear infinite; }
.mc.done { border-color: var(--fg); border-style: dashed; }
.mc.done .st { color: var(--fg); }
.mc.broken { opacity: .45; }
.mc.broken .ring { border-color: var(--no); }
.mc.mine::after { content: ''; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.divider { height: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.counts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }

/* PX */
.pxcard { border-radius: 20px; padding: 28px 22px; text-align: center; background: var(--card); }
.pxcard .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: 2px; }
.pxcard .big { font-size: 34px; font-weight: 850; letter-spacing: -0.04em; }
.votes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.vote { border-radius: 16px; border: 1.5px solid var(--line); background: var(--bg); padding: 16px 10px; cursor: pointer; text-align: center; }
.vote.on { border-color: var(--fg); background: var(--fg); color: var(--bg); }
.vote .vt { font-weight: 750; }
.vote .vc { font-size: 12px; opacity: .7; margin-top: 2px; }
.bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: currentColor; }

/* 시트 */
.dim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; opacity: 0; transition: opacity .2s; }
.dim.show { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--bg); border-radius: 20px 20px 0 0; padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; transform: translateY(100%); transition: transform .22s ease; }
.sheet.show { transform: none; }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 16px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.chip { height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line); background: transparent; font-weight: 650; cursor: pointer; }
.chip.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.stack > * + * { margin-top: 8px; }

/* 토스트 */
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px); background: var(--fg); color: var(--bg); padding: 11px 18px; border-radius: 22px; font-size: 14px; font-weight: 600; z-index: 60; opacity: 0; transition: .2s; pointer-events: none; max-width: 88vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--fg); animation: spin .8s linear infinite; margin: 40px auto; }

/* 관리자 */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
.tabs button { flex: none; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: transparent; font-weight: 650; font-size: 13px; cursor: pointer; }
.tabs button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; font-size: 14px; }
.kv dt { color: var(--sub); }
.kv dd { margin: 0; word-break: break-all; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stats div { background: var(--card); border-radius: 12px; padding: 10px 12px; }
.stats b { display: block; font-size: 20px; }
.stats span { font-size: 11px; color: var(--sub); }
.log { font-size: 13px; border-bottom: 1px solid var(--line); padding: 8px 0; display: grid; grid-template-columns: 92px 1fr; gap: 8px; }
.log .tm { color: var(--muted); font-size: 12px; }
.pill { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--chip); }
.pill.red { color: var(--no); } .pill.green { color: var(--ok); }
