/* URINARY 웹 시뮬레이터 셸 — 폰 프레임 + 컨트롤 패널 */
:root {
  --bg: #eceff3;
  --panel: #ffffff;
  --ink: #151a22;
  --muted: #667085;
  --line: #e2e6ec;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --bezel: #0c0e12;
  --ok: #16a34a;
  --bad: #dc2626;
  --sb: #ffffff;   /* 상태바 배경 — 앱이 postMessage 로 바꿔 준다 */
  --sb-ink: #111;
  --nb: #ffffff;   /* 내비게이션 바 배경 */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --panel: #161920;
    --ink: #e7eaf0;
    --muted: #98a1b3;
    --line: #242934;
    --accent: #6f9cff;
    --accent-ink: #0b1220;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans KR", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app { display: grid; grid-template-columns: 300px 1fr; height: 100dvh; }

/* ---------- 패널 ---------- */
.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 22px 18px 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; letter-spacing: .04em; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
h2 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }

button, .btn {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, border-color .12s;
}
button:hover, .btn:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }

.seg { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; }
.seg button { flex: 1 1 auto; border: 0; border-radius: 9px; padding: 7px 8px; font-size: 12.5px; white-space: nowrap; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.screens { display: flex; flex-direction: column; gap: 2px; }
.screens button {
  justify-content: flex-start;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  padding: 7px 9px;
  text-align: left;
}
.screens button .no { width: 22px; flex: none; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.screens button[aria-current="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); font-weight: 600; }
.screens .grp { margin: 10px 9px 2px; font-size: 11px; font-weight: 700; color: var(--muted); }

.actions { display: flex; flex-direction: column; gap: 8px; }
.note { color: var(--muted); font-size: 12.5px; }

footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.health::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--muted); }
.health[data-state="ok"]::before { background: var(--ok); }
.health[data-state="warn"]::before { background: #d97706; }
.health[data-state="down"]::before { background: var(--bad); }

/* ---------- 폰 프레임 ---------- */
.stage { display: grid; place-items: center; min-width: 0; min-height: 0; overflow: hidden; }
.fit { position: relative; }          /* 크기는 JS 가 배율 적용 후 값으로 지정 */
.device {
  position: absolute; top: 0; left: 0;
  transform-origin: top left;
  padding: 10px;
  border-radius: 48px;
  background: var(--bezel);
  box-shadow: 0 0 0 1.5px #2a2f39 inset, 0 40px 70px -28px rgba(8, 12, 24, .5), 0 8px 18px -8px rgba(8, 12, 24, .35);
}
.screen {
  width: var(--w);
  border-radius: 38px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.statusbar {
  position: relative;
  flex: none;
  height: 30px;
  padding: 0 22px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--sb);
  color: var(--sb-ink);
  font: 600 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  transition: background .2s, color .2s;
}
.statusbar::after {            /* 펀치홀 카메라 */
  content: "";
  position: absolute; left: 50%; top: 9px;
  width: 11px; height: 11px; margin-left: -5.5px;
  border-radius: 50%;
  background: #0b0d11;
}
.icons { display: inline-flex; align-items: center; gap: 5px; }
iframe#frame, .empty { flex: none; width: var(--w); height: var(--h); border: 0; background: #fff; display: block; }
.empty { display: grid; place-content: center; text-align: center; color: #667085; padding: 24px; }
.navbar {
  flex: none;
  height: 22px;
  display: grid;
  place-items: center;
  background: var(--nb);
  transition: background .2s;
}
.navbar i { width: 104px; height: 4px; border-radius: 2px; background: #111; opacity: .85; }

/* ---------- 좁은 화면 (실제 폰으로 열었을 때): 프레임 없이 꽉 채운다 ---------- */
@media (max-width: 760px) {
  .app { display: block; }
  .panel, .statusbar, .navbar { display: none; }
  .stage { display: block; height: 100dvh; }
  .fit { width: 100vw !important; height: 100dvh !important; }
  .device { position: static; transform: none !important; padding: 0; border-radius: 0; box-shadow: none; background: transparent; }
  .screen { width: 100vw; border-radius: 0; }
  iframe#frame, .empty { width: 100vw; height: 100dvh; }
}
