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

:root {
  --accent: #2f6df6;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #16181d;
  --sub: #4b5160;
  --muted: #8a909c;
  --line: #e6e8ec;
  --soft: #eef1f6;
  --agree: #1f9d55;
  --disagree: #e5484d;
  --warn: #e8590c;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --card: #181b21; --ink: #eef0f4; --sub: #b7bcc7; --muted: #7f8693;
    --line: #2a2e37; --soft: #20242c; --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: anywhere;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }

/* 상단바 */
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(12px + var(--safe-t)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  display: flex; align-items: center; gap: 10px;
}
.top .brand { font-weight: 800; font-size: 19px; letter-spacing: -.02em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .role { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: var(--bg); }
.ver { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.wrap { max-width: 720px; margin: 0 auto; padding: 4px 16px calc(96px + var(--safe-b)); }
.wrap.wide { max-width: 1100px; }

/* 카드 */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); }
.card h3 { margin: 0 0 6px; font-size: 16.5px; letter-spacing: -.01em; }
.card.tap { cursor: pointer; transition: transform .08s; }
.card.tap:active { transform: scale(.99); }
.sec-title { display: flex; align-items: center; justify-content: space-between; margin: 18px 2px 10px; }
.sec-title h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.sub { color: var(--sub); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.body-text { white-space: pre-wrap; color: var(--sub); margin: 8px 0 0; }
.empty { text-align: center; color: var(--muted); padding: 48px 12px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }

/* 버튼 */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 10px 14px; border-radius: 12px; font-weight: 650; cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn:active { opacity: .8; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--disagree); }
.btn.danger.solid { background: var(--disagree); border-color: var(--disagree); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; padding: 14px; font-size: 15.5px; border-radius: 14px; }

/* 폼 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 650; color: var(--sub); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 13px; outline: none; font-size: 16px;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea.input { min-height: 120px; resize: vertical; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--sub); }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.notice-box { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--sub); }

/* 배지 */
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--soft); color: var(--sub); }
.badge.open { background: color-mix(in srgb, var(--agree) 14%, transparent); color: var(--agree); }
.badge.closed { background: var(--soft); color: var(--muted); }
.badge.pin { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.badge.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--disagree) 14%, transparent); color: var(--disagree); }
.badge.dummy { background: #7c3aed22; color: #7c3aed; }

/* 투표 */
.vote-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 12px; }
.vote-btn { padding: 13px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-weight: 750; cursor: pointer; font-size: 15px; }
.vote-btn.agree.on { background: var(--agree); border-color: var(--agree); color: #fff; }
.vote-btn.disagree.on { background: var(--disagree); border-color: var(--disagree); color: #fff; }
.vote-btn:disabled { cursor: default; opacity: .6; }
.vote-btn.on:disabled { opacity: 1; }
.bar { height: 12px; border-radius: 999px; background: var(--soft); overflow: hidden; display: flex; }
.bar .a { background: var(--agree); }
.bar .d { background: var(--disagree); }
.legend { display: flex; justify-content: space-between; font-size: 13px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.legend .a { color: var(--agree); font-weight: 700; }
.legend .d { color: var(--disagree); font-weight: 700; }

/* 하단 탭 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b));
}
.tabs button { background: none; border: 0; padding: 6px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 650; color: var(--muted); cursor: pointer; position: relative; }
.tabs button svg { width: 24px; height: 24px; }
.tabs button.on { color: var(--accent); }
.tabs .dot { position: absolute; top: 2px; left: 56%; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--disagree); color: #fff; font-size: 10px; line-height: 16px; }

/* 상단 탭(관리자·개발자) */
.seg { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex-shrink: 0; border: 1px solid var(--line); background: var(--card); padding: 8px 13px; border-radius: 999px; font-weight: 650; font-size: 13.5px; cursor: pointer; color: var(--sub); }
.seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* 모달 */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 12, 16, .45); z-index: 100; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { background: var(--card); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + var(--safe-b)); animation: up .2s; }
@media (min-width: 700px) { .modal-bg { align-items: center; } .modal { border-radius: 20px; } }
.modal h3 { margin: 0 0 14px; font-size: 18px; }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(24px); opacity: .6 } }

/* 토스트 */
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 200; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: fade .15s; }

/* 배너 */
.banner { margin: 0 16px 10px; padding: 10px 14px; border-radius: 12px; color: #fff; font-weight: 650; font-size: 14px; white-space: pre-wrap; }
.imp-bar { background: #7c3aed; color: #fff; padding: 8px 16px; font-size: 13px; font-weight: 700; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.imp-bar button { background: #fff; color: #7c3aed; border: 0; border-radius: 8px; padding: 4px 10px; font-weight: 700; cursor: pointer; }

/* 표 */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table.tbl { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.tbl th, .tbl td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.tbl th { position: sticky; top: 0; background: var(--soft); font-weight: 700; color: var(--sub); }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--soft); }
.tbl .null { color: var(--muted); font-style: italic; }

/* 통계 타일 */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat .n { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* 코드 표시 */
.code-big { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 34px; font-weight: 800; letter-spacing: .08em; text-align: center; padding: 18px; border-radius: 16px; background: var(--soft); margin: 10px 0; user-select: all; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* 댓글 */
.comment { padding: 12px 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; }
.who { font-weight: 700; font-size: 13.5px; }

.photo-view { width: 100%; border-radius: 12px; background: var(--soft); display: block; }
.toggle { position: relative; display: inline-block; width: 46px; height: 28px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .15s; cursor: pointer; }
.toggle span::after { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(18px); }
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.set-row:first-child { border-top: 0; }
.set-row .t { font-weight: 650; }
.set-row .d { font-size: 12.5px; color: var(--muted); }

/* 사용자 홈 */
.icon-btn { background: none; border: 0; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--ink); cursor: pointer; flex-shrink: 0; }
.icon-btn:active { background: var(--soft); }
.icon-btn svg { width: 24px; height: 24px; }
.big-btn {
  display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; text-align: left;
  width: 100%; padding: 22px 20px; margin: 12px 0 0; border-radius: 22px; border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow); cursor: pointer; color: var(--ink);
}
.big-btn:active { transform: scale(.985); }
.big-btn .bi { grid-row: span 2; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.big-btn .bi svg { width: 28px; height: 28px; }
.big-btn .bt { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.big-btn .bs { font-size: 13.5px; color: var(--muted); }
.big-btn.live { grid-template-columns: 22px 1fr; background: #e5484d; border-color: #e5484d; color: #fff; padding: 18px 20px; }
.big-btn.live .bs { color: rgba(255,255,255,.85); }
.live-dot { grid-row: span 2; width: 14px; height: 14px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.8) } 100% { box-shadow: 0 0 0 12px rgba(255,255,255,0) } }
.notice-strip { display: flex; gap: 10px; align-items: center; width: 100%; margin-top: 16px; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: left; color: var(--ink); font-weight: 600; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; margin: 6px 0 10px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
