/* ============================================================
   GoTracks 디자인 시스템 v1 — 단일 출처. 패치는 여기 규칙 안에서.
   토큰 → 기본 → 헤더 → 레이아웃 → 카드/타일 → 리스트 → 모달 → 로그인 → 지도 → 반응형
   ============================================================ */

/* ---------- 1. 토큰 ---------- */
:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --line: #262b36; --border: #333a48;
  --text: #e8eaf0; --muted: #8b93a7;
  --accent: #ff5a1f; --drive: #ff5a1f; --walk: #2ecc71; --visit: #5b6cff; --warn: #ffd166; --danger: #ff6b6b;
  --overlay: rgba(15,17,21,.92); --topbar: rgba(15,17,21,.92); --code: #0a0c10;
  --shadow: 0 2px 10px rgba(0,0,0,.28); --shadow-lg: 0 12px 32px rgba(0,0,0,.45);
  --r-sm: 10px; --r: 14px; --r-lg: 18px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --hdr: 54px; --stick: 110px;
  color-scheme: dark;
}
html.light {
  --bg: #f4f5f8; --panel: #ffffff; --panel2: #eef0f4; --line: #e2e6ee; --border: #cfd5e0;
  --text: #15181e; --muted: #667085; --walk: #16a34a; --visit: #4f5fe6;
  --overlay: rgba(255,255,255,.95); --topbar: rgba(244,245,248,.92); --code: #eef0f4;
  --shadow: 0 2px 8px rgba(20,30,60,.08); --shadow-lg: 0 10px 28px rgba(20,30,60,.14);
  color-scheme: light;
}

/* ---------- 2. 기본 ---------- */
* { box-sizing: border-box; }
html { overflow-x: hidden; }
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");
html, body { margin: 0; max-width: 100vw; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Pretendard Variable", Pretendard, -apple-system, "Segoe UI", Roboto, "Noto Sans KR", sans-serif; -webkit-font-smoothing: antialiased; letter-spacing: -.01em; }
body { padding-top: var(--hdr); }

/* 폰에서 글자를 탭하면 크롬이 그 단어를 선택해 '구글 검색' 창을 띄운다(탭하여 검색).
   대시보드는 눌러서 읽는 화면이라 방해만 되므로, 터치 기기에서만 화면 글자를 선택 대상에서
   뺀다. PC 는 그대로 선택·복사된다. 실제로 복사할 일이 있는 입력칸·요약·메모는 다시 켠다.
   아래 code{user-select:all} 은 이 규칙보다 뒤에 있어 그대로 유지된다(2026-09-06). */
@media (hover: none) and (pointer: coarse) {
  body { -webkit-user-select: none; user-select: none; }
  /* 진짜로 글자를 넣고 고치는 칸만 연다. 요약·메모 같은 '보여주는 문단' 을 열어 두면
     그 위에서 여전히 검색창이 뜬다(고콜 통화 요약에서 확인, 2026-09-07).
     꼭 복사해야 할 곳이 생기면 그 요소에 class="selectable" 을 붙이면 된다. */
  input, textarea, select, [contenteditable], .selectable {
    -webkit-user-select: text; user-select: text; }
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h3 { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 22px var(--sp-2); font-size: 14px; line-height: 1.6; }

/* 폼 컨트롤 공통 */
input:not([type]), input[type=text], input[type=number], input[type=search], input[type=password] {
  width: 100%; background: var(--panel2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 13px; font-size: 16px; outline: none; transition: border-color .15s; }
input:focus { border-color: var(--accent); }
input:-webkit-autofill, input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px var(--panel2) inset; -webkit-text-fill-color: var(--text); caret-color: var(--text); border: 1px solid var(--border); transition: background-color 9999s; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
code { display: block; background: var(--code); border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--r-sm);
  word-break: break-all; font-size: 12px; user-select: all; }

/* 버튼 변형 */
.btn, .modal-box .row button, .modal-box .row .btn, .login-card button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 14px; border-radius: var(--r-sm); font-weight: 700; font-size: 15px;
  white-space: nowrap; background: var(--accent); color: #fff; transition: filter .15s, transform .05s; }
.btn:hover, .modal-box .row button:hover { filter: brightness(1.08); }
.btn:active, .modal-box .row button:active { transform: scale(.98); }
.ghost, .btn.ghost, .modal-box .row button.ghost { background: var(--panel2); color: var(--text); font-weight: 600; }
.danger, .modal-box .row button.danger { color: var(--danger); }
.list li .edit, .list li .mode, .datenav button, .cal-head button, .map-ctl button {
  display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.list li .edit:hover, .list li .mode:hover, .datenav button:hover, .cal-head button:hover { color: var(--text); border-color: var(--border); }

/* ---------- 3. 헤더 / 탭 / 날짜 ---------- */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: var(--hdr);
  display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-4);
  background: var(--topbar); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 20px; letter-spacing: -.5px; }
.logo-mark { color: var(--accent); font-size: 16px; }
.logo-text { display: inline; }
.logo b { color: var(--accent); font-weight: inherit; }
.tabs { display: flex; margin-left: auto; padding: 3px; border-radius: 999px; background: var(--panel2); }
.tabs button { padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--muted); }
.tabs button.active { background: var(--accent); color: #fff; }
.user { display: flex; align-items: center; gap: 2px; color: var(--muted); font-size: 14px; }
.user span { margin-right: 6px; white-space: nowrap; }
.user button, .user a { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-sm); font-size: 18px; color: var(--muted); }
.user button:hover, .user a:hover { color: var(--text); background: var(--panel2); }
.user a.hub-back { color: var(--accent); font-size: 13px; margin-right: 2px; }
.badge { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.datenav { position: sticky; top: var(--hdr); z-index: 19; display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px var(--sp-4); background: var(--topbar); backdrop-filter: blur(10px); }
.datenav button { width: 38px; height: 38px; font-size: 20px; line-height: 1; color: var(--text); }
.datenav button.ghost { width: auto; padding: 0 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.datenav button.datelabel, .datelabel { flex: 0 0 auto; width: auto !important; min-width: 0; height: 38px; padding: 0 var(--sp-3); line-height: 38px; border: 0 !important; background: transparent !important;
  font-weight: 800; font-size: 17px; color: var(--text) !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.datenav { flex-wrap: nowrap; overflow: visible; }
@media (max-width: 480px) { .datenav { gap: 6px; padding-left: var(--sp-2); padding-right: var(--sp-2); } .datenav button { width: 34px; height: 34px; } .datenav button.datelabel { font-size: 16px; } .datenav button.ghost { padding: 0 8px; } }

/* ---------- 4. 레이아웃 ---------- */
main { display: grid; gap: var(--sp-3); padding: var(--sp-4); grid-template-columns: 1fr;
       max-width: 1180px; margin-left: auto; margin-right: auto; width: 100%; }   /* 푸터와 좌우 폭을 맞춘다 — 푸터만 1180px 이라 넓은 화면에서 줄이 어긋났다(2026-09-03) */  /* 위·아래 여백을 같게 — 예전엔 위 0 / 아래 48px 이라 헤더에 붙고 푸터에서 떴다 */
.side { display: contents; }

/* ---------- 5. 카드 / 타일 ---------- */
.card, .tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card { padding: var(--sp-4); }
.card h3 { margin: 0 0 var(--sp-3); font-size: 13px; font-weight: 700; letter-spacing: .4px; color: var(--muted); }
.card h3 + p { margin-top: -6px; }
.card p { margin: 0 0 var(--sp-3); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.tile { position: relative; overflow: hidden; padding: 14px 16px; min-width: 0; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border); }
.tile.drive::before { background: var(--drive); }
.tile.walk::before { background: var(--walk); }
.tile .k { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .4px; }
.tile .v { margin-top: 2px; font-size: 28px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile .s { margin-top: 2px; color: var(--muted); font-size: 12px; }
.tile .cmp { margin-top: 4px; font-size: 11px; font-weight: 600; }
.cmp .up { color: var(--walk); } .cmp .down { color: var(--danger); } .cmp .flat { color: var(--muted); }
.goal { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); }
.goal .bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.goal .bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--walk); transition: width .4s; }
.goal .bar i.done { background: var(--warn); }
.goal span { color: var(--muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 건강 카드: 동일 크기 3칸, 같은 배경 */
.h-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.h-grid.three { grid-template-columns: repeat(3, 1fr); }
.h-big, .h-item { min-width: 0; padding: var(--sp-3); border-radius: var(--r); background: var(--panel2); }
.health .k, .h-item .k { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health .v { margin-top: 4px; font-size: 22px; font-weight: 800; letter-spacing: -.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.h-big .v { color: var(--accent); }
.health .v small { margin-left: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.health .s { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.35; }
#homeWrap .v { font-size: 20px; }
#weightWrap { margin-top: var(--sp-4); }
#weightWrap .k { color: var(--muted); font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.card .tip, .tip { margin: var(--sp-4) 0 0; padding: 9px 12px; border-left: 3px solid var(--walk); border-radius: var(--r-sm);
  background: var(--panel2); font-size: 13px; }
.tip:empty { display: none; }
.nudge { border-color: rgba(255,209,102,.55); }
.nudge h3 { color: var(--warn); }

/* 차트 / 파이 */
.pie-row { display: flex; align-items: center; gap: var(--sp-4); }
.pie-row canvas { flex: none; max-width: 150px; max-height: 150px; }
.legend { flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: var(--sp-2); padding: 3px 0; }
.legend i { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.legend .pct { margin-left: auto; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.legend li.grp { margin-top: 4px; padding-top: 6px; border-top: 1px dashed var(--line); }
.legend li.sub { padding-left: 12px; }

/* ---------- 6. 리스트 (타임라인·장소·검색·관리) ---------- */
.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.list li:first-child { border-top: 0; }
.list li > div:nth-child(2) { flex: 1; min-width: 0; }
.list li.empty { display: block; cursor: default; }
.ic { flex: none; width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); }
.ic svg { width: 22px; height: 22px; display: block; }
.ic.visit, .ic.drive, .ic.walk, .ic.home, .ic.trans { border-radius: var(--r-sm); font-size: 13px; font-weight: 800; }
.ic.visit { background: var(--visit); color: #fff; }   /* 순위 숫자·달력 등 텍스트 아이콘용 */
.ic.walk { background: var(--walk); color: #fff; } .ic.drive { background: var(--drive); color: #fff; }
.list .main { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { margin-top: 2px; color: var(--muted); font-size: 12px; }
.list .sub .cont { color: var(--warn); }
.list .memo { display: block; width: 100%; margin-top: 6px; padding: 6px 10px; font-size: 13px; border-radius: 8px; border: 1px dashed var(--border); background: transparent; color: var(--text); }
.list .memo::placeholder { color: var(--muted); }
.list .memo:focus { border-style: solid; border-color: var(--accent); background: var(--panel2); }
.list .memo:not(:placeholder-shown) { border-style: solid; background: var(--panel2); }
.list .memo.saved { border-color: var(--walk); }
.list .sub.addr:empty { display: none; }
.list .sub.addr { white-space: normal; word-break: keep-all; font-variant-numeric: tabular-nums; }
.list .stat { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; color: var(--muted); font-size: 12px; }
.list .stat b { color: var(--text); font-weight: 600; }
.list .right { flex: none; text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list .right small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.list li .edit, .list li .mode { flex: none; height: 32px; min-width: 32px; padding: 0 8px; font-size: 14px; }
.list li .mode { font-size: 12px; }
.list li .mode.ov { border-color: var(--warn); color: var(--warn); }
.list li .ign:hover { color: var(--danger); border-color: var(--danger); }
.list li.empty a { color: var(--accent); font-weight: 600; }
.list li .approve { background: var(--walk); border-color: var(--walk); color: #fff; }
.list li .pair.on { border-color: var(--accent); color: var(--accent); }
.pill { display: inline-block; padding: 2px 7px; border-radius: 999px; background: var(--panel2); color: var(--muted); font-size: 11px; font-weight: 600; vertical-align: middle; }

/* ---------- 7. 모달 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--sp-4); background: rgba(0,0,0,.6); }
.modal-box { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; overflow-x: hidden;
  padding: var(--sp-5); border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.modal-box h3 { margin: 0 0 var(--sp-2); font-size: 17px; font-weight: 800; }
.modal-box h3 .small { font-weight: 600; }
.modal-box .sec { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
/* 구역 사이 구분선 — 위아래 여백을 같게 둔다 */
.modal-box .divide { margin: var(--sp-5) 0 var(--sp-4); border-top: 1px solid var(--line); }
/* 큰 제목(h3)과 구역 제목(h4)을 눈에 띄게 나눈다 */
.modal-box h4 { margin: 0 0 var(--sp-2); font-size: 15px; font-weight: 700; color: var(--text); }
.modal-box h4 .small { font-weight: 600; }
.modal-box p { margin: 0 0 var(--sp-2); }
/* 설정 창 글자 크기 체계 — 예전엔 제목 15px / 라벨 14px / 설명 12px / 체크박스 글자는
   상속이 안 돼 16px 로 제각각이었다. 세 단으로 정리한다(2026-09-09).
     h4 15px 구역 제목 · label 14px 조작 · .small 12.5px 설명 */
.modal-box .muted.small, .modal-box p.small { font-size: 12.5px; line-height: 1.6; }
.modal-box h4 + p.small, .modal-box h4 + .muted.small { margin-top: calc(var(--sp-2) * -1 + 2px); }
.modal-box input, .modal-box select, .modal-box button { font-family: inherit; }
.modal-box label { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-2) 0; font-size: 14px; color: var(--muted); }
/* 설정 창의 조작 요소는 종류가 달라도 같은 크기·높이로 보이게 한다.
   예전엔 입력칸 44px / 선택상자 34px 로 제각각이었다(2026-09-04). */
.modal-box label { margin: var(--sp-3) 0; }
.modal-box label > span, .modal-box label { color: var(--muted); }
.modal-box label input[type=text], .modal-box label input[type=number],
.modal-box label input[type=password], .modal-box label select {
  flex: 0 0 190px; width: 190px; height: 38px; padding: 0 12px;
  font-size: 15px; line-height: 38px; text-align: left;
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text); }
.modal-box label select { cursor: pointer; }
/* 두 칸(.grid2) 라벨은 세로 배치라 위의 190px 이 '너비'가 아니라 '높이'로 잡힌다 — 되돌린다 */
.modal-box .grid2 label input[type=text], .modal-box .grid2 label input[type=number],
.modal-box .grid2 label input[type=password], .modal-box .grid2 label select {
  flex: 0 0 auto; width: 100%; height: 44px; line-height: 44px; }
/* 설정 창 버튼도 같은 리듬으로 — 본문 버튼(44px)보다 조금 낮게 */
.modal-box .row button, .modal-box .row .btn { min-height: 40px; font-size: 14px; }
.modal-box label.chk { justify-content: flex-start; margin-top: var(--sp-3); cursor: pointer; color: var(--text); }
.modal-box code { margin: var(--sp-2) 0; }
.modal-box .list { max-height: 45vh; overflow-y: auto; overflow-x: hidden; margin-top: var(--sp-2); }
.modal-box .list:empty { display: none; }
.modal-box .row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.modal-box .row > * { flex: 1 1 0; min-width: 0; }
.modal-box .row > .wide { flex-basis: 100%; }
.modal-box a:not(.btn) { color: var(--accent); font-weight: 600; }

/* 달력 */
.cal { max-width: 360px; }
.cal-head { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); margin: 4px 0 var(--sp-3); }
.cal-head b { font-size: 17px; font-weight: 800; min-width: 150px; text-align: center; white-space: nowrap; }
.cal-head button { width: 38px; height: 38px; font-size: 20px; color: var(--text); border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow { padding: 4px 0; text-align: center; color: var(--muted); font-size: 11px; font-weight: 700; }
.cal-grid .d { position: relative; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 5px; border-radius: var(--r-sm); font-size: 14px; cursor: pointer; border: 1px solid transparent; }
.cal-grid .d .km { margin-top: 2px; font-size: 9.5px; line-height: 1.15; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-grid .d .km b { font-weight: 600; }
.cal-grid .d .km .dr { color: var(--drive); } .cal-grid .d .km .wk { color: var(--walk); }
.cal-grid .d.sel .km, .cal-grid .d.sel .km .dr, .cal-grid .d.sel .km .wk { color: #fff; }
.cal-grid .dow.sat, .cal-grid .d.sat { color: #4f8cff; }
.cal-grid .dow.sun, .cal-grid .d.sun, .cal-grid .d.hol { color: var(--danger); }
.cal-grid .d.hol .hn { font-size: 8.5px; line-height: 1; color: var(--danger); margin-top: 1px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .sat { color: #4f8cff; } .cal .sun { color: var(--danger); }
.cal { max-width: 420px; }
.cal-grid .d:hover { background: var(--panel2); }
.cal-grid .d.today { border-color: var(--accent); }
.cal-grid .d.sel { background: var(--accent); color: #fff; }
.cal-grid .d.has::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--walk); }
.cal-grid .d.sel.has::after { background: #fff; }
.cal-grid .d.empty { cursor: default; border: 0; }
#shot.busy { opacity: .5; pointer-events: none; }

/* ---------- 8. 로그인 / 가입 ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: var(--sp-4); }
.login-card { display: flex; flex-direction: column; gap: var(--sp-3); width: 100%; max-width: 360px;
  padding: 32px 28px; border-radius: 22px; background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.login-card .logo { justify-content: center; font-size: 28px; }
.login-card p { margin: 0; text-align: center; }
.login-card button { width: 100%; }
.err { min-height: 1em; color: var(--danger); font-size: 13px; }

/* ---------- 9. 지도 ---------- */
.map { position: relative; isolation: isolate; width: 100%; height: 46vh; min-height: 280px; overflow: hidden;
  border-radius: var(--r-lg); border: 2px solid var(--border); background: var(--panel); box-shadow: var(--shadow-lg); }
.map > #map { width: 100%; height: 100%; }
.map > div { border-radius: var(--r-lg); }
.map::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), inset 0 0 40px rgba(0,0,0,.3); }
html.light .map::after { box-shadow: inset 0 0 0 1px rgba(0,0,0,.04), inset 0 0 32px rgba(0,0,0,.06); }
html:not(.light) .map img[src*="daumcdn"], html:not(.light) .map img[src*="kakaocdn"] { filter: invert(1) hue-rotate(180deg) brightness(.9) saturate(.6); }
.map-ctl { position: absolute; right: 12px; bottom: 14px; z-index: 5; display: flex; flex-direction: column; gap: 6px; }
.map-ctl button { width: 40px; height: 40px; font-size: 20px; font-weight: 700; color: var(--text); background: var(--overlay); border-color: var(--border); box-shadow: var(--shadow); backdrop-filter: blur(6px); }
#locate { color: var(--text); }
#locate svg { display: block; }
#locate.busy { opacity: .5; }
#partners { font-size: 17px; }
#partners.on { border-color: var(--visit); box-shadow: 0 0 0 2px rgba(91,108,255,.35); }

.gt-label { padding: 3px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--overlay); color: var(--text);
  font-size: 12px; font-weight: 700; white-space: nowrap; transform: translateY(-28px); box-shadow: var(--shadow); }
.gt-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--visit); border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(91,108,255,.35); }
.gt-pin { width: 18px; height: 18px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--warn); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.gt-avatar { width: 28px; height: 28px; border-radius: 50%; filter: drop-shadow(0 2px 4px rgba(0,0,0,.45)); }
.gt-avatar svg { display: block; }
.gt-avatar.me, .gt-avatar.partner { animation: gt-pulse 1.8s ease-out infinite; }
.gt-me-label, .gt-partner-label { transform: translateY(18px); }
.gt-label.blue { border-color: #2f6fff; }
.gt-label.red { border-color: #e5484d; }
@keyframes gt-pulse { 0% { box-shadow: 0 0 0 0 rgba(0,0,0,.25); } 100% { box-shadow: 0 0 0 14px rgba(0,0,0,0); } }

/* ---------- 10. 반응형 ---------- */
@media (max-width: 640px) {
  /* 모바일: 헤더 2줄 — 1줄 로고·아이콘, 2줄 탭(전체 폭 균등) */
  .top { height: auto; flex-wrap: wrap; gap: 0 var(--sp-2); padding: 8px var(--sp-3) 8px; }
  .logo { flex: 1; font-size: 19px; }
  .user { flex: none; gap: 0; order: 2; }
  .user span { display: none; }
  .tabs { order: 3; flex-basis: 100%; margin: 8px 0 0; }
  .tabs button { flex: 1; padding: 8px 0; font-size: 14px; }
}
@media (max-width: 420px) {
  .health .v { font-size: 19px; }
  .health .s { font-size: 10px; }
  .tile .v { font-size: 24px; }
}
/* 모바일 칸 순서는 hub.css 에 있다 — main 의 실제 배치 규칙(.hub-grid)이 그 파일이라 거기서 잡아야 한다. */
@media (min-width: 900px) {
  main { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .side { display: grid; gap: var(--sp-3); }
  .map { position: sticky; top: var(--stick); align-self: start; height: calc(100vh - var(--stick) - 16px); }
}

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--panel2); }
.seg button { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.seg button.active { background: var(--accent); color: #fff; }

/* 내 장소 폼 */
.pform { margin-top: var(--sp-2); padding: var(--sp-3); border-radius: var(--r); background: var(--panel2); display: flex; flex-direction: column; gap: var(--sp-2); }
.pform input { background: var(--panel); }
.pf-row { display: flex; gap: var(--sp-2); }
.pf-row input { flex: 1; min-width: 0; }
.pf-row button { flex: none; padding: 0 14px; min-height: 42px; border-radius: var(--r-sm); font-weight: 700; }
#pfResults { max-height: 160px; }
#pfResults li { padding: 8px 0; }
#pfResults li .main { font-size: 14px; }
.pform .row { margin-top: 0; }
#myPlaces li .preset { color: var(--muted); }
#myPlaces li .edit { font-size: 13px; }

/* 타임라인 편집 토글 */
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.card-head h3 { margin: 0; }
.mini { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 700; }
.mini.on { border-color: var(--accent); color: var(--accent); }
#list:not(.editing) li .mode, #list:not(.editing) li .ign { display: none; }
.list .sub .wk { color: var(--walk); font-weight: 600; }
#list:not(.editing) li.edit-only { display: none; }

#play { font-size: 15px; }
#play.on { border-color: var(--accent); color: var(--accent); }
.gt-play-label { transform: translateY(20px); border-color: var(--accent); }

/* 경로 진행 화살표 */
.gt-arrow { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid #fff; opacity: .95; filter: drop-shadow(0 0 1px rgba(0,0,0,.6)); }

#playSpeed { width: 40px; height: 40px; padding: 0; border-radius: var(--r-sm); border: 1px solid var(--accent); background: var(--overlay); color: var(--accent); font-size: 11px; font-weight: 800; text-align: center; -webkit-appearance: none; appearance: none; cursor: pointer; }

/* 모달 우상단 고정 닫기 */
.modal-box { position: relative; }
.modal-x { position: absolute; top: 10px; right: 10px; z-index: 3; width: 32px; height: 32px; border-radius: 50%; background: var(--panel2); color: var(--muted); font-size: 15px; font-weight: 700; box-shadow: var(--shadow); }
.modal-box > h3:first-of-type { padding-right: 40px; }
.modal-box.cal .cal-head { padding-right: 40px; padding-left: 40px; }
.modal-x:hover { color: var(--text); }


/* 허브(대시보드)로 — 고트랙·고머니·고콜 공통. 허브를 거쳤든 직접 들어왔든 항상 보인다 */
.hub-home { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  margin-left: var(--sp-2); border-radius: 999px; background: var(--panel2); color: var(--muted);
  font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.hub-home:hover { color: var(--text); }
/* ◆ 는 그 앱의 색을 따라간다(2026-09-20 지시) — 앱마다 제 색을 쓰는 체계.
   각 화면이 --app 을 정하지 않으면 예전처럼 주황(--accent)이다. */
.hub-home .dia { color: var(--app, var(--accent)); }
@media (max-width: 640px) { .hub-home { padding: 0 10px; } .hub-home .t { display: none; } }


/* ── 푸터 (허브·고트랙·고머니·고콜 공통, 2026-08-28 이관) ── */
.foot { max-width: 1180px; margin: var(--sp-5) auto 0; padding: var(--sp-4) var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
.foot-brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.foot-brand .logo { font-size: 16px; }
.foot-brand .logo-mark.hub { color: var(--accent); font-size: 14px; }
.foot-links, .foot-contact { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.foot a { color: var(--muted); text-decoration: none; } .foot a:hover { color: var(--text); }
.foot-contact b { color: var(--accent); }


/* ── 모바일 정리 (2026-08-28) ──
   헤더가 2줄로 늘어나는데 body 의 위 여백은 --hdr(54px) 고정이라 내용을 가렸다.
   모바일에서는 헤더를 fixed 대신 sticky 로 두어 제 높이만큼 자리를 차지하게 한다. */
@media (max-width: 640px) {
  body { padding-top: 0; }
  .top { position: sticky; }
  /* 헤더와 날짜바가 둘 다 sticky 면 서로 겹친다 — 모바일에선 날짜바를 흐름에 둔다 */
  .datenav { position: static; }
  main { padding: var(--sp-3); }
  .foot { padding-left: var(--sp-3); padding-right: var(--sp-3); }
}
/* 가로 스크롤 방지 — 어떤 요소든 폭을 넘겨도 화면이 좌우로 흔들리지 않게 */
/* body 에 overflow-x 를 주면 body 가 스크롤 컨테이너가 되어 그 안의 position:sticky 가
   통째로 무력화된다(지도가 스크롤을 따라오지 않던 원인). html 만으로 충분하다. */
html { overflow-x: hidden; }


/* 헤더·날짜바가 스크롤되는 내용 위에 겹칠 때 배경이 반투명(.92)이라 내용이 비쳐 보였다.
   backdrop-filter 를 지원하지 않는 브라우저(구형 안드로이드 웹뷰 등)에선 흐림 없이 그대로 비친다.
   두 요소 모두 불투명 처리한다. 지도 위 컨트롤(--overlay)·모달 딤은 의도된 반투명이라 그대로 둔다. */
.top { background: var(--bg); }
/* 날짜바: sticky 를 풀어 본문을 가리지 않게 하고, 헤더에 붙여 위·아래 여백을 맞춘다.
   (예전엔 스크롤 시 카드 위에 겹쳤고, 위 공백만 크고 아래는 붙어 보였다) */
.datenav { position: static; top: auto; margin: 0; padding: 12px var(--sp-4);
           background: var(--bg); border-bottom: 1px solid var(--line); }


/* 그리드·플렉스 자식은 기본값이 min-width:auto 라, 줄바꿈 없는 긴 텍스트가 들어가면
   칸이 내용 폭만큼 벌어져 컨테이너 밖으로 넘친다(모바일 가로 스크롤의 주범).
   .tile 에만 걸려 있던 방어를 그리드 자식 전반으로 넓힌다. */
main > *, .tiles > *, .h-grid > *, .grid2 > * { min-width: 0; }

/* 모바일 푸터: 로고 옆에 긴 설명이 붙어 어중간하게 접혔다 — 줄을 나눠 왼쪽 정렬로 정리 */
@media (max-width: 640px) {
  .foot { gap: 10px; font-size: 12px; }
  .foot-brand { flex-direction: column; align-items: flex-start; gap: 4px; }
  .foot-links, .foot-contact { gap: 8px 12px; }
}


/* 로고 글자는 앱 아이콘과 같은 서체(Poppins Bold)로 — 아이콘은 서버에서 이 폰트로 렌더링된다.
   한글 본문은 그대로 Pretendard 를 쓰고, 로고 심볼(▲·₩)도 시스템 폰트를 유지한다. */
@font-face { font-family: "PoppinsLogo"; src: url("/static/Poppins-Bold.ttf") format("truetype");
             font-weight: 700; font-style: normal; font-display: swap; }
.logo-text { font-family: "PoppinsLogo", "Pretendard Variable", Pretendard, sans-serif;
             font-weight: 700; letter-spacing: -.2px; }

/* 저작권과 이용 고지: PC 는 한 줄(·로 구분), 모바일은 줄을 나눈다 */
.foot-notice::before { content: " · "; }
@media (max-width: 640px) {
  .foot-notice { display: block; }
  .foot-notice::before { content: none; }
}

/* 맨 위로 — 목록이 길어지는 화면용. 400px 이상 내리면 나타난다 */
.totop { position: fixed; right: 18px; bottom: 22px; z-index: 30; width: 44px; height: 44px;
  display: none; align-items: center; justify-content: center; padding: 0 0 2px;
  border: 0; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 20px; font-weight: 800; line-height: 1; box-shadow: var(--shadow-lg);
  cursor: pointer; transition: transform .12s; }
.totop:active { transform: scale(.94); }
.totop.show { display: inline-flex; }
.totop:hover { filter: brightness(1.08); }
@media (max-width: 640px) { .totop { right: 14px; bottom: calc(16px + env(safe-area-inset-bottom)); } }

/* 낮/밤 전환 아이콘 — 네 앱 공통. 누르면 바뀔 모드를 보여준다(어두울 때 해, 밝을 때 달).
   이모지는 기기마다 모양·색이 달라 SVG 로 통일했다. */
/* 고명함 띠 — 가로로 긴 명함 모양으로 글자만 늘어놓고 옆으로 넘겨 본다(2026-09-16 지시).
   단색으로 깔끔하게: 사진도 그림자도 없이 배경 한 겹과 테두리 한 줄만 쓴다.
   한 장은 실제 명함(90×50mm) 비율인 232×132, 대신 칸 자체가 화면 폭을 다 쓴다(2026-09-16). */
#cardGd { grid-column: 1 / -1; }   /* 명함 띠는 옆으로 밀어 보는 것이라 화면 폭을 다 쓴다(2026-09-16) */
/* 좌우 화살표 — 손으로 밀지 않아도 넘길 수 있게(2026-09-17 지시). 자동 넘김은 app.js 에서. */
.gd-wrap { position: relative; }
.gd-nav { position: absolute; top: calc(50% - 4px); transform: translateY(-50%); z-index: 2;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  font-size: 17px; line-height: 1; box-shadow: var(--shadow); opacity: .92; }
.gd-nav.prev { left: -2px; }
.gd-nav.next { right: -2px; }
.gd-nav:hover { opacity: 1; border-color: var(--accent); color: var(--accent); }
.gd-nav[disabled] { opacity: .25; pointer-events: none; }
@media (max-width: 640px) { .gd-nav { width: 26px; height: 26px; font-size: 15px; } }
.gd-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 8px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.gd-strip::-webkit-scrollbar { height: 6px; }
.gd-strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.namecard { flex: 0 0 auto; width: 232px; height: 132px; padding: 14px 16px;
  display: flex; flex-direction: column; justify-content: center; scroll-snap-align: start;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.namecard { position: relative; }
/* 오른쪽 위 작은 통화 건수 — 고콜에 기록이 있는 사람만(2026-09-17 지시) */
.nc-call { position: absolute; top: 8px; right: 10px; padding: 1px 7px; border-radius: 999px;
  background: var(--panel); border: 1px solid #e64980; color: #e64980;
  font-size: 11px; font-weight: 700; line-height: 1.5; font-variant-numeric: tabular-nums; }
.namecard > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.namecard .nc-name { font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.namecard .nc-sub, .namecard .nc-tel { font-size: 12px; color: var(--muted); }
.namecard .nc-co { margin-top: 6px; font-size: 12px; font-weight: 600; }
.namecard .nc-tel { margin-top: 2px; font-variant-numeric: tabular-nums; }

#themeBtn svg { display: block; }
#themeBtn .ic-moon { display: none; }
html.light #themeBtn .ic-moon { display: inline; }
html.light #themeBtn .ic-sun { display: none; }
