:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #16181c; --muted: #6b7280; --line: #e5e7eb;
  --brand: #e8590c; --brand-soft: #fff0e6; --ok: #16a34a; --ok-soft: #e8f7ee; --warn: #b45309; --warn-soft: #fff7e0;
  --bad: #dc2626; --bad-soft: #fdecec; --blue: #2563eb; --blue-soft: #e8efff; --side: #111317; --side-text: #d6d9de;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #141517; --card: #1d1f22; --text: #e8e6e3; --muted: #a3a8ae; --line: #2f3236;
    --brand-soft: #3a2518; --ok-soft: #13301f; --warn-soft: #332a10; --bad-soft: #3a1616; --blue-soft: #16223d; --side: #0b0c0e; }
}
:root[data-theme="dark"] { --bg: #141517; --card: #1d1f22; --text: #e8e6e3; --muted: #a3a8ae; --line: #2f3236;
  --brand-soft: #3a2518; --ok-soft: #13301f; --warn-soft: #332a10; --bad-soft: #3a1616; --blue-soft: #16223d; --side: #0b0c0e; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; font-size: 14px; line-height: 1.55; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.shell { display: flex; min-height: 100%; }
.side { width: 230px; flex: none; background: var(--side); color: var(--side-text); padding: 18px 12px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 6px; }
.brand b { display: block; color: #fff; font-size: 17px; }
.brand span { font-size: 12px; opacity: .7; }
.eye { width: 30px; height: 30px; border-radius: 9px; background: url("icon.svg") center / cover no-repeat; flex: none; }   /* 앱과 같은 로고 */
.role { font-size: 12px; opacity: .9; display: flex; flex-direction: column; gap: 4px; padding: 0 6px; }
.role select { background: #1f2328; color: #fff; border: 1px solid #333840; border-radius: 8px; padding: 6px 8px; }
.who-name { color: #fff; font-weight: 700; font-size: 14px; }
.side-btn { background: #1f2328; border: 1px solid #333840; color: var(--side-text); border-radius: 8px; padding: 5px 10px; margin-top: 6px; }
body.locked .side { display: none; }
.login { max-width: 400px; margin: 8vh auto 0; }
.login label { display: block; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.login input, .login select { width: 100%; margin-top: 4px; }
#menu { display: flex; flex-direction: column; gap: 2px; }
#menu button { background: none; border: 0; color: var(--side-text); text-align: left; padding: 8px 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
#menu button:hover { background: #1f2328; }
#menu button.on { background: var(--brand); color: #fff; font-weight: 700; }
#menu button[disabled] { opacity: .35; cursor: not-allowed; }
#menu .cnt { background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; font-weight: 700; }
.open-app { margin-top: auto; color: #fff; text-decoration: none; background: #1f2328; border-radius: 10px; padding: 9px 10px; text-align: center; font-weight: 600; }
.main { flex: 1; padding: 26px 28px 60px; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 4px; }
.desc { color: var(--muted); margin: 0 0 18px; }
h2 { font-size: 16px; margin: 22px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.card + .card { margin-top: 12px; }
.grid .card + .card { margin-top: 0; }
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.stat .s { font-size: 12px; color: var(--muted); }
.stat.alert { border-color: var(--bad); }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.tw { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.p-ok { background: var(--ok-soft); color: var(--ok); } .p-warn { background: var(--warn-soft); color: var(--warn); }
.p-bad { background: var(--bad-soft); color: var(--bad); } .p-gray { background: var(--bg); color: var(--muted); } .p-blue { background: var(--blue-soft); color: var(--blue); }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 6px 12px; font-weight: 600; }
.btn:hover { border-color: var(--brand); }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.note { color: var(--muted); font-size: 12.5px; }
.empty { color: var(--muted); text-align: center; padding: 22px; }
input[type=text], input[type=password], input[type=number], select.in, textarea { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 9px; }
input[type=number] { width: 110px; text-align: right; }
.judge { display: grid; grid-template-columns: minmax(240px, 360px) 1fr; gap: 16px; }
.judge video { display: block; width: auto; height: auto; max-width: 100%; max-height: 420px; margin: 0 auto; border-radius: 10px; background: #000; }   /* 세로 영상도 모양 그대로 */
.votes { display: flex; gap: 4px; }
.votes span { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.v-yes { background: var(--ok-soft); color: var(--ok); } .v-no { background: var(--bad-soft); color: var(--bad); }
.lock { background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 8px, var(--card) 8px, var(--card) 16px); border: 1px dashed var(--line); border-radius: 10px; padding: 12px; }
.bar { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: rgba(17,19,23,.94); color: #fff; padding: 9px 16px; border-radius: 99px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 50; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#modal .dim { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 40; padding: 16px; }
#modal .box { background: var(--card); border-radius: 16px; padding: 20px; max-width: 440px; width: 100%; }
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; }
  #menu { flex-direction: row; overflow-x: auto; }
  #menu button { white-space: nowrap; }
  .open-app { margin-top: 0; }
  .main { padding: 18px 16px 50px; }
  .judge { grid-template-columns: 1fr; }
}
