/* KIOSCAN Home 화면
   방향: 집 안 벽 같은 차분한 바탕, 글자는 짙은 남회색. 강조는 한 곳 — "오늘" 하루 띠의 이벤트 표시
   색: plaster 바탕 · paper 면 · ink 글자 · graphite 보조 글자 · seam 선 · 이벤트 3색(사람 amber · 동물 green · 차량 violet) */
:root {
  --plaster: #eef0ef;
  --paper: #ffffff;
  --ink: #1b2733;
  --graphite: #5a6470;
  --seam: #d9dddf;
  --seam-strong: #c4c9cc;
  --rec: #b9c4cf;
  --person: #d99400;
  --animal: #2f8a66;
  --vehicle: #6a58cc;
  --live: #d23c3c;
  --focus: #2457c5;
  --stage: #10161c;
  --r-s: 6px;
  --r-m: 10px;
  font-family: "IBM Plex Sans KR", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root {
    --plaster: #161b20;
    --paper: #1d242b;
    --ink: #e6eaed;
    --graphite: #9aa5af;
    --seam: #2c353e;
    --seam-strong: #3b4651;
    --rec: #43515e;
    --person: #f0b429;
    --animal: #4fb98d;
    --vehicle: #9a8cf0;
    --focus: #7aa2ff;
    --stage: #0c1014;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--plaster); }
body { min-height: 100vh; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; margin-top: 22px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hint { color: var(--graphite); font-size: 14px; }
code { font-size: 13px; background: var(--plaster); padding: 1px 5px; border-radius: 4px; }

/* 머리 */
.top {
  display: flex; align-items: baseline; gap: 24px;
  padding: 18px 28px; border-bottom: 1px solid var(--seam); background: var(--paper);
}
.brand { font-weight: 600; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.summary { color: var(--graphite); font-size: 14px; margin-left: auto; display: flex; gap: 18px; }

/* 틀 */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: calc(100vh - 61px); }
.rail { border-right: 1px solid var(--seam); background: var(--paper); padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; }
.main { padding: 26px 32px 60px; max-width: 1240px; width: 100%; }

/* 카메라 목록 */
.cams { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cams button {
  width: 100%; text-align: left; background: none; border: 0; border-radius: var(--r-s);
  padding: 10px 12px; cursor: pointer; display: grid; gap: 2px;
}
.cams button:hover { background: color-mix(in srgb, var(--plaster) 55%, transparent); }
.cams button[aria-current="true"] { background: var(--plaster); }
.cams button[aria-current="true"] .n { font-weight: 600; }
.cams .n { font-weight: 500; }
.cams .s { font-size: 13px; color: var(--graphite); display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--seam-strong); flex: none; }
.dot.on { background: var(--live); }

/* 버튼 */
.btn {
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  border-radius: var(--r-s); padding: 8px 16px; cursor: pointer; font-weight: 500;
}
.btn:hover { opacity: .88; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--seam-strong); }
.btn.ghost:hover { border-color: var(--ink); opacity: 1; }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.danger:hover { border-color: var(--live); color: var(--live); }
.add { margin-top: 4px; }

/* 빈 화면 */
.empty { max-width: 520px; padding-top: 10vh; display: grid; gap: 14px; justify-items: start; }
.empty p { color: var(--graphite); }

/* 카메라 머리 */
.cam-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.state { color: var(--graphite); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.cam-actions { margin-left: auto; display: flex; gap: 6px; }

/* 영상 */
.stage {
  position: relative; background: var(--stage); border-radius: var(--r-m); overflow: hidden;
  aspect-ratio: 16 / 9; max-height: 62vh; width: 100%;
}
.stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage-msg {
  position: absolute; inset: 0; display: grid; place-items: center; color: #c9d1d8; font-size: 15px;
  pointer-events: none; text-align: center; padding: 20px;
}
.stage-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); color: #fff; font-size: 14px;
}
.stage-bar .btn { margin-left: auto; background: #fff; color: #111; border-color: #fff; }
.quality { position: absolute; top: 12px; right: 12px; display: flex; background: rgba(0, 0, 0, .45); border-radius: var(--r-s); padding: 2px; }
.quality button { background: none; border: 0; color: #d6dde3; font-size: 13px; padding: 4px 10px; border-radius: 4px; cursor: pointer; }
.quality button[aria-pressed="true"] { background: rgba(255, 255, 255, .92); color: #111; }
.live-tag { position: absolute; top: 12px; left: 12px; color: #fff; font-size: 13px; display: flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, .45); padding: 3px 9px; border-radius: var(--r-s); }

/* 오늘 하루 띠 — 이 화면에서 가장 눈에 띄는 것 */
.day { margin-top: 22px; }
.day-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 10px; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--graphite); margin-left: auto; }
.k::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.k.person::before { background: var(--person); }
.k.animal::before { background: var(--animal); }
.k.vehicle::before { background: var(--vehicle); }
.k.rec::before { background: var(--rec); }
.ribbon {
  position: relative; height: 56px; background: var(--paper); border: 1px solid var(--seam);
  border-radius: var(--r-s); cursor: pointer; overflow: visible;
  --div: 24;
  background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(100% / var(--div) - 1px), var(--seam) calc(100% / var(--div) - 1px), var(--seam) calc(100% / var(--div)));
}
.rib-rec { position: absolute; left: 0; right: 0; bottom: 6px; height: 12px; }
.rib-rec span { position: absolute; top: 0; height: 100%; background: var(--rec); border-radius: 2px; min-width: 2px; }
.rib-ev { position: absolute; inset: 6px 0 22px; }
.range { display: flex; border: 1px solid var(--seam-strong); border-radius: var(--r-s); padding: 2px; }
.range button { background: none; border: 0; font-size: 13px; padding: 3px 10px; border-radius: 4px; cursor: pointer; color: var(--graphite); }
.range button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.rib-ev button {
  position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; border: 0; padding: 0; border-radius: 2px; cursor: pointer;
}
.rib-ev button:hover, .rib-ev button:focus-visible { width: 8px; margin-left: -4px; }
.rib-ev .person { background: var(--person); }
.rib-ev .animal { background: var(--animal); }
.rib-ev .vehicle { background: var(--vehicle); }
.rib-now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--live); }
.rib-peek {
  position: absolute; bottom: calc(100% + 8px); transform: translateX(-50%); background: var(--paper);
  border: 1px solid var(--seam-strong); border-radius: var(--r-s); padding: 4px; width: 188px; z-index: 5;
  box-shadow: 0 6px 24px rgba(15, 25, 35, .18); pointer-events: none; font-size: 13px;
}
.rib-peek img { width: 100%; display: block; border-radius: 3px; aspect-ratio: 16 / 9; object-fit: cover; }
.rib-peek span { display: block; padding: 4px 4px 2px; }
.hours { display: flex; justify-content: space-between; font-size: 12px; color: var(--graphite); margin-top: 6px; }

/* 아래 두 칸 */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; margin-top: 34px; }
.count { color: var(--graphite); font-weight: 400; margin-left: 4px; }

/* 이벤트 목록: 카드가 아니라 줄 */
.ev-list { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--seam); }
.ev-list li { border-bottom: 1px solid var(--seam); }
.ev {
  display: grid; grid-template-columns: 168px 1fr auto; gap: 16px; align-items: center;
  padding: 12px 6px; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; border-radius: var(--r-s);
}
.ev:hover { background: var(--paper); }
.ev[aria-current="true"] { background: var(--paper); }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 4px; overflow: hidden; background: var(--stage); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb i { position: absolute; border: 1.5px solid var(--person); border-radius: 2px; }
.thumb i.animal { border-color: var(--animal); }
.thumb i.vehicle { border-color: var(--vehicle); }
.ev-what { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.ev-what::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--person); }
.ev-what.animal::before { background: var(--animal); }
.ev-what.vehicle::before { background: var(--vehicle); }
.ev-when { color: var(--graphite); font-size: 14px; }
.ev-clip { font-size: 13px; color: var(--graphite); white-space: nowrap; }
.ev-clip.ready { color: var(--ink); }

/* 측정 */
.measure { align-self: start; }
.measure .hint { margin-top: 4px; }
.facts { margin: 14px 0 0; display: grid; grid-template-columns: 1fr auto; border-top: 1px solid var(--seam); }
.facts dt, .facts dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--seam); font-size: 14px; }
.facts dt { color: var(--graphite); }
.facts dd { text-align: right; font-weight: 500; }
.facts dd small { display: block; font-weight: 400; color: var(--graphite); font-size: 12px; }

/* 대화상자 */
.dlg {
  border: 1px solid var(--seam-strong); border-radius: var(--r-m); padding: 26px; width: min(460px, calc(100vw - 32px));
  background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(10, 20, 30, .25);
}
.dlg::backdrop { background: rgba(20, 28, 36, .45); }
.dlg h2 { margin-bottom: 14px; }
.dlg label { display: block; color: var(--graphite); font-size: 14px; margin-bottom: 6px; }
.dlg input { width: 100%; padding: 10px 12px; border: 1px solid var(--seam-strong); border-radius: var(--r-s); background: var(--plaster); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dlg > p { margin-top: 10px; }
.code { font-size: 44px; font-weight: 600; letter-spacing: .14em; margin: 4px 0 2px !important; }
.cmd {
  background: var(--plaster); border: 1px solid var(--seam); border-radius: var(--r-s); padding: 10px 12px;
  white-space: pre-wrap; word-break: break-all; font-size: 13px; margin: 8px 0;
}

.dlg .sub { color: var(--graphite); font-size: 14px; margin-bottom: 8px; }
.avail { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.avail li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--seam); border-radius: var(--r-s); }
.avail li span { flex: 1; font-weight: 500; }

/* 로그인 */
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--graphite); }
.summary + .who { margin-left: 18px; }
.auth { min-height: calc(100vh - 61px); display: grid; place-items: start center; padding: 12vh 16px 40px; }
.auth-form { width: min(380px, 100%); display: grid; gap: 6px; }
.auth-form h1 { margin-bottom: 18px; }
.auth-form label { color: var(--graphite); font-size: 14px; margin-top: 10px; }
.auth-form input { padding: 11px 12px; border: 1px solid var(--seam-strong); border-radius: var(--r-s); background: var(--paper); }
.auth-form .btn { margin-top: 14px; padding: 11px 16px; }
.auth-err { color: var(--live); font-size: 14px; min-height: 1.4em; margin-top: 6px; }
.auth-switch { color: var(--graphite); font-size: 14px; margin-top: 10px; }
.link { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* 처리 중 팝업 */
.busy {
  border: 1px solid var(--seam-strong); border-radius: var(--r-m); background: var(--paper); color: var(--ink);
  padding: 18px 22px; display: none; align-items: center; gap: 14px; box-shadow: 0 20px 60px rgba(10, 20, 30, .25);
}
.busy[open] { display: flex; }
.busy::backdrop { background: rgba(20, 28, 36, .3); }
.busy p { font-size: 15px; }
.spin {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2px solid var(--seam-strong); border-top-color: var(--ink); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

/* 좁은 화면 (폰) */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--seam); flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 16px; }
  .cams { flex-direction: row; }
  .cams button { white-space: nowrap; }
  .add { margin: 0 0 0 auto; white-space: nowrap; }
  .main { padding: 18px 16px 48px; }
  .cols { grid-template-columns: 1fr; gap: 30px; }
  .ev { grid-template-columns: 120px 1fr; }
  .ev-clip { grid-column: 2; }
  .top { padding: 14px 16px; }
  .summary { display: none; }
  .legend { display: none; }
  .cam-actions { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
