/* 포항 버스 노선 안내 — 배치(레이아웃). 색·글꼴·둥근 정도·그림자는 theme.css 의 변수만 쓴다.
   확정 디자인: docs/design/Final.dc.html (주행 화면), 다른 화면도 같은 톤(밝은 바탕, 흰 둥근 카드, 남색 버튼). */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ic { display: inline-flex; align-items: center; justify-content: center; line-height: 0; flex: none; }
.ico { display: block; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

#app { min-height: 100%; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; }

/* ── 머리줄 ── */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-top)) 12px 10px;
  background: var(--bg-soft); color: var(--ink);
  border-bottom: 1px solid var(--line);
  min-height: 64px;
}
.top h1 { font-size: 21px; font-weight: 700; margin: 0; flex: 1; min-width: 0; }
.top .back {
  width: var(--tap-min); height: var(--tap-min); border: 0; border-radius: 50%; flex: none;
  background: var(--white); color: var(--navy); box-shadow: var(--shadow-1);
  display: grid; place-items: center;
}
.top-dev { font-size: 13px; color: var(--muted); font-weight: 500; }

.page { width: 100%; max-width: 640px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.page.wide { max-width: 900px; }
.center-page { justify-content: center; text-align: center; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.lead { font-size: 20px; margin: 0; font-weight: 500; }
.warn { color: var(--red-dark); font-weight: 700; margin: 4px 0; white-space: pre-line; }
.hint { background: var(--navy-soft); color: var(--navy-dark); padding: 10px 14px; border-radius: var(--radius-md); margin: 0; font-size: 16px; }
.sec { font-size: 18px; font-weight: 700; margin: 14px 0 2px; color: var(--navy); }

/* ── 로고·상표 ── */
.logo-slot { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.logo-slot img { display: block; width: 32px; height: 32px; }
.logo-word { font-weight: 900; color: var(--navy); font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0 4px; text-align: center; }
.brand .logo-slot { flex-direction: column; gap: 6px; }
.brand .logo-slot img { width: 84px; height: 84px; filter: drop-shadow(0 8px 16px rgba(10, 76, 140, .25)); }
.brand .logo-word { font-size: 30px; line-height: 1.15; }
.brand-name { font-size: 18px; font-weight: 500; margin: 0; color: var(--ink-2); }
.brand-dev { font-size: 14px; color: var(--muted); }

/* ── 버튼 ── */
.btn {
  min-height: var(--tap); padding: 10px 18px; border-radius: var(--radius);
  border: 2px solid transparent; font-size: 19px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
}
.btn.big { min-height: 64px; font-size: 21px; width: 100%; border-radius: var(--radius-lg); }
.btn.small { min-height: var(--tap-min); padding: 6px 14px; font-size: 16px; border-radius: var(--radius-md); }
.btn.primary { background: var(--navy); color: var(--white); box-shadow: var(--shadow-navy); }
.btn.primary:active { background: var(--navy-dark); }
.btn.secondary { background: var(--white); color: var(--navy); border-color: var(--line); box-shadow: var(--shadow-1); }
.btn.danger { background: var(--red); color: var(--white); }
.btn.sim { background: var(--bump-soft); color: var(--bump-ink); border-color: var(--bump); }
.btn.kakao { background: var(--kakao); color: var(--kakao-ink); border-color: var(--kakao-border); box-shadow: none; }
.btn-col { display: flex; flex-direction: column; gap: 10px; }
.link { background: none; border: 0; color: var(--navy); font-size: 17px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; padding: 12px; min-height: var(--tap-min); }
.link-row { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-label { cursor: pointer; }

/* ── 입력 ── */
.lbl { font-weight: 700; display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: var(--white); font-size: 15px; font-family: var(--font-num); font-weight: 700; }
.num-input {
  width: 100%; height: 72px; font-size: 34px; text-align: center; letter-spacing: 10px; font-weight: 700;
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  border: 2px solid var(--line); border-radius: var(--radius); background: var(--white);
}
.num-input.long { letter-spacing: 4px; font-size: 30px; }
.num-input::placeholder { letter-spacing: 0; font-size: 20px; font-weight: 400; font-family: var(--font); color: #8c99a6; }
.num-input:focus, .field:focus, .search:focus { outline: 3px solid var(--focus); border-color: var(--route); }
.field { width: 100%; min-height: 52px; padding: 8px 14px; border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--white); font-size: 18px; }
.big-field { min-height: 64px; font-size: 21px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row > label { font-weight: 700; }
.form-row.two { flex-direction: row; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; min-height: var(--tap-min); }
.check input { width: 26px; height: 26px; accent-color: var(--navy); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn { flex: 1; min-height: 52px; border: 2px solid var(--line); background: var(--white); border-radius: var(--radius-md); font-weight: 700; font-size: 17px; padding: 6px 10px; }
.seg-btn[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* ── 카드·목록 ── */
.card { background: var(--card); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 8px; text-align: left; }
.card p { margin: 0; }
.card ul { margin: 0; padding-left: 20px; }
.card li { margin: 4px 0; }
.card .sec { margin-top: 0; }
.auth-card { gap: 10px; }
.blocked { border: 3px solid var(--red); }
.big-warn { font-size: 26px; font-weight: 900; color: var(--red-dark); }
.safety-box { background: var(--white); border-left: 6px solid var(--bump); border-radius: var(--radius-md); padding: 10px 14px; display: flex; flex-direction: column; text-align: left; font-size: 16px; box-shadow: var(--shadow-1); }
.safety-box span { color: var(--muted); font-size: 15px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { background: var(--white); border-radius: var(--radius-md); padding: 10px 14px; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-1); min-height: 64px; }
.li-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.li-main span { overflow-wrap: anywhere; }
.badge { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 700; background: var(--line-soft); color: var(--ink-2); vertical-align: middle; line-height: 1.6; }
.badge.test { background: var(--test-bg); color: var(--test-ink); border: 1px solid var(--test-border); }
.steps { margin: 0; padding-left: 22px; }

/* ── 인증코드 크게 ── */
.code-out { background: var(--white); border: 3px solid var(--navy); border-radius: var(--radius-lg); padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-1); }
.code-big { font-family: var(--font-num); font-size: 64px; font-weight: 800; letter-spacing: 6px; font-variant-numeric: tabular-nums; color: var(--navy); line-height: 1.1; }

/* ── 관리자 메뉴 ── */
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-item { min-height: 128px; border: 0; border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow-1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 12px 10px; }
.mi-ico { width: 52px; height: 52px; border-radius: var(--radius-md); background: var(--navy-soft); color: var(--navy); display: grid; place-items: center; margin-bottom: 4px; }
.mi-title { font-size: 18px; font-weight: 700; }
.mi-desc { font-size: 13px; color: var(--muted); text-align: center; line-height: 1.35; }
.preview-map, .admin-map { width: 100%; height: 320px; border-radius: var(--radius-lg); overflow: hidden; background: var(--map-bg); box-shadow: var(--shadow-1); }
.admin-map { height: 55vh; min-height: 300px; }
.filter { position: sticky; top: 64px; z-index: 2; background: var(--bg); padding: 4px 0; }

/* ── 노선 선택 ── */
.routes-top .logo-slot img { width: 36px; height: 36px; }
.routes-top .logo-word { font-size: 13px; }
.routes-top h1 { text-align: center; }
.search-wrap { padding: 12px 16px 0; max-width: 640px; margin: 0 auto; width: 100%; position: relative; }
.search-wrap .ic { position: absolute; left: 32px; top: 50%; transform: translateY(calc(-50% + 6px)); color: var(--muted); }
.search { width: 100%; height: 60px; font-size: 21px; padding: 0 16px 0 52px; border: 2px solid var(--line); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow-1); }
.route-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .route-grid { grid-template-columns: repeat(3, 1fr); } }
.route-btn {
  position: relative; min-height: 120px; border: 0; border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 10px;
}
.route-btn::before { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 5px; border-radius: 0 0 6px 6px; background: var(--route); }
.route-btn { overflow: hidden; }
.route-btn:active { transform: scale(.98); }
.rb-num { font-family: var(--font-num); font-size: 34px; font-weight: 800; line-height: 1.2; color: var(--white); background: var(--navy); border-radius: 12px; padding: 0 14px; }
.rb-sub { font-size: 15px; color: var(--muted); text-align: center; line-height: 1.35; }
.route-btn.test { background: var(--bg-soft); box-shadow: none; border: 2px dashed var(--line); }
.route-btn.test::before { background: var(--passed); }
.route-btn.test .rb-num { background: var(--white); color: var(--muted); border: 2px solid var(--line); }
.route-btn .badge { margin: 0; }
.group-label { grid-column: 1 / -1; margin: 8px 0 -4px; font-size: 15px; font-weight: 700; color: var(--muted); }
.foot { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 12px calc(10px + var(--safe-bottom)); background: var(--bg-soft); border-top: 1px solid var(--line); }
.foot-btn { flex: 1; min-height: var(--tap); border: 0; border-radius: var(--radius-md); background: var(--white); box-shadow: var(--shadow-1); font-size: 16px; font-weight: 700; color: var(--navy); display: flex; align-items: center; justify-content: center; gap: 6px; }
.foot-btn.admin { background: var(--navy); color: var(--white); }

/* ── 아래에서 올라오는 창 ── */
.sheet-wrap { position: fixed; inset: 0; background: var(--overlay); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg-soft); width: 100%; max-width: 640px; border-radius: 26px 26px 0 0; padding: 20px 16px calc(18px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 12px; max-height: 92dvh; overflow-y: auto; box-shadow: 0 -10px 30px rgba(13, 43, 74, .18); }
.sheet-title { margin: 0; font-size: 23px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sheet-title .rb-num { font-size: 26px; }
.sheet-body { margin: 0; white-space: pre-line; font-size: 18px; color: var(--ink-2); }
.sheet-buttons { display: flex; flex-direction: column; gap: 8px; }
.sheet-buttons .btn { width: 100%; min-height: 60px; }
.dir-row { display: flex; gap: 8px; }
.dir-btn { flex: 1; min-height: 96px; border: 3px solid var(--line); border-radius: var(--radius-lg); background: var(--white); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; gap: 2px; }
.dir-btn b { font-size: 21px; }
.dir-btn span { font-size: 15px; color: var(--muted); text-align: center; line-height: 1.35; }
.dir-btn[aria-pressed="true"] { border-color: var(--navy); background: var(--navy-soft); }
.dir-btn[aria-pressed="true"] b { color: var(--navy); }
.dir-btn:disabled { opacity: .4; }
.btn.start { min-height: 76px; font-size: 25px; }

/* ── 토스트 ── */
#toast {
  position: fixed; left: 50%; bottom: calc(150px + var(--safe-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--toast-bg); color: var(--white); padding: 12px 18px; border-radius: var(--radius-md); font-size: 17px; font-weight: 500;
  max-width: calc(100% - 32px); width: max-content; text-align: center; opacity: 0; pointer-events: none; transition: .2s; z-index: 200;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 설정 ── */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--white); border-radius: var(--radius-md); padding: 10px 14px; min-height: 64px; box-shadow: var(--shadow-1); }
.set-label { display: flex; flex-direction: column; font-weight: 700; }
.set-label small { font-weight: 400; color: var(--muted); font-size: 14px; }
.set-row .field { width: auto; max-width: 60%; }
.toggle { width: 72px; height: 40px; border-radius: var(--radius-pill); border: 0; background: var(--toggle-off); position: relative; flex: none; }
.toggle::after { content: ""; position: absolute; inset: -4px 0; } /* 보이는 크기는 그대로, 누르는 영역만 48px */
.toggle .knob { position: absolute; top: 4px; left: 4px; width: 32px; height: 32px; border-radius: 50%; background: var(--white); transition: .15s; box-shadow: 0 1px 3px rgba(21, 32, 43, .25); }
.toggle[aria-checked="true"] { background: var(--ok); }
.toggle[aria-checked="true"] .knob { left: 36px; }
.range { width: 50%; height: 48px; accent-color: var(--navy); }

/* ═════════ 주행 화면 ═════════ */
body[data-screen="nav"] { overflow: hidden; }
.screen[data-screen="nav"] {
  position: fixed; inset: 0; min-height: 0; height: 100dvh;
  display: grid; grid-template-rows: auto 1fr auto; grid-template-areas: "band" "body" "sim";
  background: var(--bg); overflow: hidden;
}
.sim-band {
  grid-area: band; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bump-soft); color: var(--bump-ink); border-bottom: 2px solid var(--bump);
  font-weight: 700; font-size: 15px; padding: calc(5px + var(--safe-top)) 8px 5px;
}
.sim-band::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--bump); }
.nav-body { grid-area: body; display: flex; min-height: 0; position: relative; }

/* 노선 타임라인(왼쪽 세로 띠) */
.strip { width: var(--strip-w); flex: none; position: relative; background: var(--bg-soft); display: flex; flex-direction: column; border-right: 1px solid var(--line); z-index: 2; }
.strip-off .strip { display: none; }
.tl-head { padding: calc(14px + var(--safe-top)) 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; border-bottom: 1px solid var(--line-soft); text-align: center; }
.is-sim .tl-head { padding-top: 12px; }
.route-num { background: var(--navy); color: var(--white); font-family: var(--font-num); font-weight: 800; font-size: 26px; border-radius: 10px; padding: 0 12px; line-height: 1.3; }
.tl-dir { font-size: 11px; color: var(--muted); font-weight: 500; line-height: 1.3; }
.tl-head .badge { margin: 0; font-size: 11px; }
.tl-body { flex: 1; position: relative; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.tl-body::before { content: ""; position: absolute; left: 30px; top: 0; bottom: 64px; width: 8px; background: var(--route); border-radius: 4px 4px 0 0; }
.tl-body::after { content: ""; position: absolute; left: 30px; bottom: 0; height: 64px; width: 8px; background: var(--passed-strip); }
.tl-items { list-style: none; margin: 0; padding: 18px 0 10px; flex: 1; min-height: 0; display: flex; flex-direction: column-reverse; justify-content: space-evenly; position: relative; z-index: 1; overflow: hidden; }
.tl-item { display: flex; align-items: center; gap: 10px; padding-left: 22px; min-height: 40px; flex-shrink: 0; }
.tl-mark { flex: none; width: 24px; height: 24px; box-sizing: border-box; }
.tl-item[data-kind="stop"] .tl-mark { border-radius: 50%; background: var(--white); border: 5px solid var(--route); }
.tl-item[data-kind="bump"] .tl-mark { width: 22px; height: 22px; margin-left: 1px; border-radius: 5px; background: var(--bump); border: 2px solid var(--white); transform: rotate(45deg); }
.tl-item[data-kind="other"] .tl-mark { border-radius: 50%; background: var(--other); border: 3px solid var(--white); }
.tl-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tl-name { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tl-item[data-kind="bump"] .tl-name { color: var(--bump-ink); }
.tl-item[data-kind="other"] .tl-name { color: var(--other); }
.tl-dist { font-size: 11px; color: var(--muted); font-family: var(--font-num); font-weight: 600; }
/* 단속카메라: 빨간 알약(가장 가까운 것은 꽉 찬 빨강, 나머지는 테두리만) */
.tl-item[data-kind="camera"] { padding-left: 12px; }
.tl-pill { display: flex; align-items: center; gap: 7px; border-radius: 14px; padding: 6px 9px 6px 6px; background: var(--white); border: 2px solid var(--red); color: var(--red-dark); max-width: 100px; }
.tl-pill .tl-limit { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--red-soft); color: var(--ink); display: flex; align-items: center; justify-content: center; font-family: var(--font-num); font-weight: 800; font-size: 13px; }
.tl-pill .tl-name { font-size: 11px; }
.tl-pill .tl-dist { font-size: 15px; font-weight: 800; color: inherit; }
.tl-item.focus .tl-pill { background: var(--red); border-color: var(--red); color: var(--white); box-shadow: 0 0 0 4px rgba(229, 50, 45, .22); }
.tl-item.focus .tl-pill .tl-limit { background: var(--white); }
.tl-empty { position: relative; z-index: 1; margin: auto 6px auto 46px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.tl-now { position: relative; z-index: 1; height: 64px; flex: none; display: flex; align-items: flex-start; gap: 7px; padding-left: 15px; }
.tl-bus { width: 38px; height: 38px; border-radius: 12px; background: var(--bus); color: var(--white); display: grid; place-items: center; box-shadow: var(--shadow-bus); }
.tl-now-label { font-size: 12px; font-weight: 700; color: var(--bus-ink); margin-top: 9px; }
.tl-foot { padding: 10px 6px calc(14px + var(--safe-bottom)); border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; align-items: center; gap: 5px; }
.tl-foot .logo-slot { flex-direction: column; gap: 5px; }
.tl-foot .logo-word { font-size: 11px; }
.is-sim .tl-foot { padding-bottom: 14px; }

/* 지도 영역 */
.map-area { flex: 1; position: relative; min-width: 0; overflow: hidden; background: var(--map-bg); }
.map { position: absolute; inset: 0; background: var(--map-bg); }
.map-missing { padding: 20px; color: var(--ink); }
.overlay-top { position: absolute; left: 10px; right: 10px; top: calc(12px + var(--safe-top)); z-index: 4; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.is-sim .overlay-top { top: 12px; }
.overlay-top > * { pointer-events: auto; }

/* 안내 카드(남색) */
.guide { background: var(--navy); color: var(--white); border-radius: 20px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-navy); min-height: 74px; transition: box-shadow .2s; }
.guide-tile { width: 48px; height: 48px; border-radius: 14px; background: var(--white); display: flex; align-items: center; justify-content: center; flex: none; color: var(--red); }
.guide[data-type="bump"] .guide-tile { color: var(--bump-ink); }
.guide[data-type="other"] .guide-tile { color: var(--other); }
.guide-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.guide-main { font-size: 24px; font-weight: 800; line-height: 1.15; display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.guide-num { font-family: var(--font-num); font-weight: 800; font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.guide-unit { font-size: 18px; font-weight: 700; }
.guide-label { font-size: 13px; font-weight: 500; color: var(--on-navy-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.limit-sign { width: 50px; height: 50px; border-radius: 50%; background: var(--white); border: 6px solid var(--red); box-sizing: border-box; display: flex; align-items: center; justify-content: center; font-family: var(--font-num); font-weight: 800; font-size: 19px; color: #111; flex: none; }
/* 평소(차분하게): 다음 위험지점 또는 안전 운행 중 */
.guide[data-state="calm"] .guide-tile, .guide[data-state="safe"] .guide-tile { background: rgba(255, 255, 255, .14); color: var(--white); }
.guide[data-state="calm"] .guide-num { font-size: 30px; }
.guide[data-state="calm"] .guide-unit { font-size: 15px; }
.guide[data-state="calm"] .limit-sign { width: 42px; height: 42px; border-width: 5px; font-size: 16px; }
.guide[data-state="safe"] .guide-main { font-size: 22px; font-weight: 700; }
/* 경고 순간: 테두리 강조 + 깜빡임 3번 */
.guide[data-state="warn"] { box-shadow: 0 0 0 4px var(--red), var(--shadow-navy); animation: guide-pulse 1s ease-in-out 3; }
.guide[data-state="warn"][data-type="bump"] { box-shadow: 0 0 0 4px var(--bump), var(--shadow-navy); }
.guide[data-state="warn"][data-type="other"] { box-shadow: 0 0 0 4px var(--other), var(--shadow-navy); }
.guide[data-state="warn"] .guide-label { color: var(--white); font-weight: 700; font-size: 14px; }
@keyframes guide-pulse { 50% { transform: scale(1.02); filter: brightness(1.15); } }

/* 타임라인 꺼짐일 때 작은 카드 2개 */
.mini-cards { display: flex; gap: 6px; }
.strip-on .mini-cards { display: none; }
.mini { flex: 1; min-width: 0; background: var(--white); border-radius: 14px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-1); }
.mini-label { font-size: 11px; font-weight: 700; }
.mini-bump .mini-label { color: var(--bump-ink); }
.mini-stop .mini-label { color: var(--route); }
.mini-val { font-family: var(--font-num); font-weight: 700; font-size: 18px; line-height: 1.3; }
.mini-stop .mini-val { font-family: var(--font); font-size: 14px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-val.none { font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--muted); }

/* 카드 아래 줄: 왼쪽 상태 알림, 오른쪽 버튼 */
.under-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.notes { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; pointer-events: auto; }
.pill { background: var(--white); border-radius: var(--radius-pill); padding: 4px 12px; font-size: 13px; font-weight: 700; box-shadow: var(--shadow-1); display: inline-flex; align-items: center; gap: 6px; }
.gps-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--red); flex: none; }
.gps[data-level="good"] .gps-dot { background: var(--ok); }
.gps[data-level="weak"] .gps-dot { background: var(--bump); }
.gps[data-level="lost"] .gps-dot { background: var(--red); animation: blink 1s infinite; }
.off-route { color: var(--red-dark); }
.map-note { background: var(--white); border-left: 5px solid var(--bump); color: var(--ink-2); padding: 6px 10px; border-radius: var(--radius-sm); font-size: 13px; box-shadow: var(--shadow-1); max-width: 220px; }
@keyframes blink { 50% { opacity: .35; } }
.top-ctrls { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: auto; flex: none; }
.tl-toggle { height: 48px; border-radius: 24px; border: 0; padding: 0 13px 0 11px; display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow-float); background: var(--white); color: var(--navy); font-size: 13px; font-weight: 700; white-space: nowrap; }
.tl-toggle[aria-pressed="true"] { background: var(--navy); color: var(--white); }
.round-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--white); border: 0; box-shadow: var(--shadow-float); display: flex; align-items: center; justify-content: center; color: var(--ink); flex: none; }
.zoom-ctrls { position: absolute; right: 10px; bottom: calc(132px + var(--safe-bottom)); z-index: 4; display: flex; flex-direction: column; background: var(--white); border-radius: 24px; box-shadow: var(--shadow-float); overflow: hidden; }
.is-sim .zoom-ctrls { bottom: 132px; }
.zoom { width: 48px; height: 48px; background: var(--white); border: 0; color: var(--ink); display: grid; place-items: center; }
.zoom + .zoom { border-top: 1px solid var(--line-soft); }

/* 지점 표시(관리자 기기만): 확대·축소 위 세로 둥근 버튼 2개. 한 번 누르면 바로 저장 */
.mark-ctrls { position: absolute; right: 6px; bottom: calc(240px + var(--safe-bottom)); z-index: 4; display: flex; flex-direction: column; gap: 10px; }
.is-sim .mark-ctrls { bottom: 240px; }
.mark-btn { width: var(--tap); height: var(--tap); border-radius: 50%; background: var(--white); border: 0; box-shadow: var(--shadow-float); display: grid; place-items: center; padding: 0; flex: none; }
.mark-btn:active { transform: scale(.94); }
.mark-camera { color: var(--red); box-shadow: 0 0 0 3px var(--red-soft), var(--shadow-float); }
.mark-bump { box-shadow: 0 0 0 3px var(--bump-soft), var(--shadow-float); }
.mark-diamond { width: 22px; height: 22px; border-radius: 5px; background: var(--bump); border: 2px solid var(--bump-ink); transform: rotate(45deg); box-sizing: border-box; }
/* 저장 알림 + [되돌리기] (10초): 지도 가운데 위쪽(버스·새 지점 표시를 가리지 않게) */
.mark-note { position: absolute; left: 10px; right: 76px; bottom: 46%; z-index: 6; background: var(--toast-bg); color: var(--white); border-radius: var(--radius-md); padding: 10px 10px 10px 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; box-shadow: var(--shadow-navy); }
.mark-note[hidden] { display: none; }
.mark-msg { flex: 1 1 150px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mark-text { font-size: 16px; font-weight: 700; line-height: 1.35; }
.mark-sub { font-size: 13px; font-weight: 500; color: var(--on-navy-soft); line-height: 1.35; }
.mark-sub[hidden] { display: none; }
.mark-undo { height: var(--tap-min); padding: 0 18px; border-radius: var(--radius-pill); border: 0; background: var(--white); color: var(--navy); font-size: 16px; font-weight: 800; flex: none; }
.mark-undo[hidden] { display: none; }

/* 아래 흰 카드: 속도 원, 노선 정보, 내 위치 */
.bottom-card { position: absolute; left: 10px; right: 10px; bottom: calc(14px + var(--safe-bottom)); z-index: 4; background: var(--white); border-radius: 22px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-card); }
.is-sim .bottom-card { bottom: 14px; }
.speed { width: 76px; height: 76px; border-radius: 50%; border: 5px solid var(--ok); box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; gap: 3px; flex: none; background: var(--white); }
.speed-num { font-family: var(--font-num); font-weight: 800; font-size: 30px; font-variant-numeric: tabular-nums; }
.speed-unit { font-size: 10px; color: var(--muted); }
.speed.over { background: var(--red); border-color: var(--red-dark); color: var(--white); }
.speed.over .speed-unit { color: var(--white); }
.bc-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.bc-route { display: flex; align-items: center; gap: 6px; min-width: 0; }
.strip-on .bc-route, .strip-on .bc-logo { display: none; }
.bc-route .route-num { font-size: 16px; border-radius: 8px; padding: 1px 8px; line-height: 1.3; }
.bc-dir { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-line { font-size: 12px; color: var(--muted); line-height: 1.4; }
.bc-line b { color: var(--ink); font-size: 14px; }
.strip-on .bc-line { display: flex; flex-direction: column; }
.strip-on .bc-line .sep { display: none; }
.bc-logo .logo-slot img { width: 16px; height: 16px; }
.bc-logo .logo-word { font-size: 11px; }
.recenter { width: 48px; height: 48px; border-radius: 50%; background: var(--route); border: 0; display: flex; align-items: center; justify-content: center; color: var(--white); flex: none; }
.recenter.attn { animation: ring 1s infinite; }
@keyframes ring { 50% { box-shadow: 0 0 0 6px rgba(10, 99, 201, .3); } }

/* 모의주행 재생 조작 */
.sim-ctrls { grid-area: sim; display: flex; align-items: center; gap: 8px; padding: 10px 12px calc(10px + var(--safe-bottom)); background: var(--white); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(21, 32, 43, .06); }
.sim-play { flex: none; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--navy); color: var(--white); display: grid; place-items: center; box-shadow: var(--shadow-navy); }
.sim-rate { flex: none; min-width: 56px; height: 48px; border-radius: 24px; border: 2px solid var(--bump); background: var(--bump-soft); color: var(--bump-ink); font-family: var(--font-num); font-size: 18px; font-weight: 800; }
.sim-progress { flex: 1; min-width: 40px; height: 48px; accent-color: var(--navy); }
.sim-time { flex: none; font-size: 13px; font-family: var(--font-num); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 0; text-align: right; color: var(--muted); }

.safety-note {
  position: fixed; left: 16px; right: 16px; top: 38%; z-index: 50; text-align: center;
  background: var(--toast-bg); color: var(--white); padding: 18px 16px; border-radius: var(--radius-lg); font-size: 21px; font-weight: 700;
  display: flex; flex-direction: column; gap: 4px; transition: opacity .4s; pointer-events: none; box-shadow: var(--shadow-navy);
}
.safety-note small { font-size: 15px; font-weight: 500; color: var(--on-navy-soft); }
.safety-note.hide { opacity: 0; }

/* 지도 위 표시 */
.me { width: 48px; height: 48px; }
.me.stale { opacity: .55; }
.hz { position: relative; cursor: pointer; display: grid; place-items: center; }
.hz-camera { width: 30px; height: 30px; border-radius: 50%; background: var(--red); border: 3px solid var(--white); color: var(--white); box-shadow: 0 2px 6px rgba(21, 32, 43, .3); }
.hz-bump { width: 26px; height: 26px; }
.hz-bump::before { content: ""; position: absolute; inset: 2px; border-radius: 6px; background: var(--bump); border: 2px solid var(--white); transform: rotate(45deg); box-shadow: 0 2px 6px rgba(21, 32, 43, .3); }
.hz-bump .ic { position: relative; color: #2a1d00; }
.hz-other { width: 28px; height: 28px; border-radius: 50%; background: var(--other); border: 3px solid var(--white); color: var(--white); font-weight: 900; font-size: 15px; box-shadow: 0 2px 6px rgba(21, 32, 43, .3); }
.hz-limit { position: absolute; right: -14px; top: -12px; background: var(--white); border: 3px solid var(--red); border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; font-family: var(--font-num); font-size: 11px; font-weight: 800; color: #111; }
.maplibregl-ctrl-attrib { font-size: 11px; }
.map-area .maplibregl-ctrl-bottom-left { bottom: calc(112px + var(--safe-bottom)); }
.is-sim .map-area .maplibregl-ctrl-bottom-left { bottom: 112px; }

/* 가로 거치: 카드들을 왼쪽 위·아래에 폭 제한으로 */
@media (orientation: landscape) and (max-height: 600px) {
  .overlay-top { right: auto; width: min(400px, calc(100% - 90px)); }
  .under-row { position: absolute; left: calc(100% + 10px); top: 0; width: max-content; }
  .bottom-card { right: auto; width: min(400px, calc(100% - 90px)); }
  .zoom-ctrls, .is-sim .zoom-ctrls { bottom: 14px; } /* 모의주행에서도 아래로(전에는 .is-sim 규칙에 밀려 위쪽 버튼과 겹침) */
  /* 지점 표시 버튼: 가로는 높이가 낮아 확대·축소 왼쪽에 가로로 */
  .mark-ctrls, .is-sim .mark-ctrls { flex-direction: row; bottom: 10px; right: 68px; }
  .mark-note { right: auto; width: min(360px, calc(50% - 40px)); box-sizing: border-box; bottom: 124px; flex-wrap: nowrap; }
  .tl-items { padding-top: 6px; }
  .tl-item:nth-child(n+4) { display: none; } /* 가로는 높이가 낮아 가까운 3개만 */
  .tl-head { padding-top: 8px; padding-bottom: 6px; }
  .safety-note { top: 30%; }
  .map-area .maplibregl-ctrl-bottom-left { bottom: 112px; }
}
/* 낮은 가로 화면(높이 420px 이하, 예: 800x360): 확대·축소 버튼을 가로로 눕혀 위쪽 버튼과 겹치지 않게 */
@media (orientation: landscape) and (max-height: 420px) {
  .zoom-ctrls { flex-direction: row; }
  .zoom + .zoom { border-top: 0; border-left: 1px solid var(--line-soft); }
  .mark-ctrls, .is-sim .mark-ctrls { right: 116px; }
}

/* 움직임 줄이기(기기 설정 "애니메이션 줄이기"): 깜빡임·고리·확대 효과를 끄고 테두리 강조만 남긴다 */
@media (prefers-reduced-motion: reduce) {
  .guide[data-state="warn"], .gps[data-level="lost"] .gps-dot, .recenter.attn { animation: none !important; }
  #toast, .safety-note, .toggle .knob { transition: none; }
}
