/* ============================================================
 * nav_guide.css — หน้าโหมดนำทางแบบสด (คู่กับ nav_guide.js)
 * มือถือแนวตั้ง: คอลัมน์เดียว เลื่อนได้ทั้งหน้า ปุ่มล่างติดขอบ
 * จอกว้าง/แนวนอน (iPad): 2 คอลัมน์ — ซ้ายลูกศร ขวาข้อมูล/ภาพ ไม่ถูกตัดล่าง
 * ============================================================ */
html.ng-lock, html.ng-lock body { overflow: hidden !important; }

.ng {
  --ng-g: #0F5C30; --ng-g2: #176B3A; --ng-gt: #E7F4EC; --ng-ink: #183B2A; --ng-mut: #66766D;
  --ng-y: #A86B00; --ng-yt: #FFF1CC; --ng-r: #C53030; --ng-rt: #FBE3DF; --ng-line: #E1EAE4;
  position: fixed; inset: 0; z-index: 900; background: #fff; color: var(--ng-ink);
  display: none; flex-direction: column;
  font-family: 'Sarabun', 'Prompt', system-ui, sans-serif;
  padding-top: env(safe-area-inset-top);
}
.ng.show { display: flex; }
.ng svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- หัว ---------- */
.ng-top { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px 10px; border-bottom: 1px solid var(--ng-line); flex-shrink: 0; }
.ng-title { flex: 1; min-width: 0; }
.ng-title b { display: block; font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 17px; line-height: 1.4; }
.ng-title small { display: block; font-size: 13px; color: var(--ng-mut); margin-top: 2px; line-height: 1.5; }
.ng-x { width: 40px; height: 40px; border-radius: 99px; border: none; background: var(--ng-gt); color: var(--ng-g); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; flex-shrink: 0; }

/* ---------- เนื้อหา (เลื่อนได้) ---------- */
.ng-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 16px 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.ng-dial { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 6px; }
.ng-info { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 560px; margin: 0 auto; }

/* วงลูกศร */
.ng-ring { position: relative; width: min(46vw, 190px); aspect-ratio: 1; border-radius: 50%; background: #F1F5F2; color: var(--ng-g2);
  display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px var(--ng-line); transition: background .25s, color .25s, box-shadow .25s, opacity .25s; }
.ng-arrow { width: 52%; height: 52%; display: flex; align-items: center; justify-content: center; transition: transform .18s linear; will-change: transform; }
.ng-arrow svg { width: 100%; height: 100%; stroke-width: 1.6; fill: currentColor; fill-opacity: .14; }
.ng-done { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }
.ng-done svg { width: 50%; height: 50%; stroke-width: 2.4; }
.ng-ring.rough .ng-arrow { opacity: .55; }
.ng-ring.nohead { box-shadow: inset 0 0 0 2px var(--ng-line); }

.ng[data-tier="good"] .ng-ring,
.ng[data-tier="near"] .ng-ring { background: #DDF3E5; color: #237A45; box-shadow: 0 0 0 9px rgba(35,122,69,.08), inset 0 0 0 1px #B9DFC5; }
.ng[data-tier="go"] .ng-ring { background: #EEF4F0; color: var(--ng-g2); }
.ng[data-tier="wrong"] .ng-ring { background: var(--ng-rt); color: var(--ng-r); box-shadow: 0 0 0 9px rgba(197,48,48,.08), inset 0 0 0 1px #EAB8B0; }
.ng[data-tier="wait"] .ng-ring { opacity: .6; }
.ng.arrived .ng-ring { background: #CDEED9; color: #176B3A; box-shadow: 0 0 0 11px rgba(23,107,58,.10), inset 0 0 0 1px #A7D9B8; }
.ng.arrived .ng-arrow { display: none; }
.ng.arrived .ng-done { display: flex; }

.ng-chip { margin-top: 16px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; border-radius: 99px; background: #F2F6F3; font-size: 15px; font-weight: 600; min-height: 22px; max-width: 100%; line-height: 1.45; }
.ng-chip:empty { display: none; }
.ng-chip.ok { background: #DDF3E5; color: #237A45; }
.ng-chip.back { background: var(--ng-yt); color: var(--ng-y); }
.ng-chip.muted { background: #F2F6F3; color: var(--ng-mut); font-weight: 500; font-size: 13.5px; }
.ng-chip.rough::after { content: '(ทิศโดยประมาณ)'; font-weight: 500; font-size: 12.5px; color: var(--ng-mut); }

.ng-dist { font-family: 'Prompt', sans-serif; font-size: 52px; font-weight: 700; line-height: 1.1; margin-top: 12px; }
.ng-dist span { font-size: 19px; font-weight: 400; color: var(--ng-mut); margin-left: 6px; }
.ng.arrived .ng-dist { font-size: 34px; color: #176B3A; }
.ng-state { font-size: 15px; color: #42544A; margin-top: 6px; line-height: 1.55; }
.ng-acc { font-size: 12.5px; color: #829087; margin-top: 4px; }
.ng-acc:empty { display: none; }
.ng-perm { margin-top: 12px; padding: 9px 16px; border-radius: 12px; border: 1.5px solid var(--ng-g); background: #fff; color: var(--ng-g); font: inherit; font-weight: 600; cursor: pointer; }

/* ผู้ช่วย */
.ng-helper { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: #F5F8F6; border: 1px solid var(--ng-line); }
.ng-helper img { width: 54px; height: 54px; object-fit: contain; flex-shrink: 0; }
.ng-helper small { display: block; font-family: 'Prompt', sans-serif; font-size: 12px; font-weight: 700; color: #607068; }
.ng-helper p { margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.5; }
.ng[data-tier="wrong"] .ng-helper { background: #FFF5F3; border-color: #F0D4CE; }
.ng.arrived .ng-helper { background: #EFF8F2; border-color: #D3E9DA; }

/* ถึงแล้ว */
.ng-arrived { display: none; background: #F4F7F5; border-radius: 16px; padding: 16px 18px; line-height: 1.65; font-size: 15px; }
.ng.arrived .ng-arrived { display: block; }
.ng-arrived b { display: flex; align-items: center; gap: 8px; font-family: 'Prompt', sans-serif; font-size: 18px; color: #176B3A; }
.ng-arrived b svg { font-size: 22px; }
.ng-arrived p { margin: 8px 0 0; }
.ng-where { font-weight: 600; }
.ng-inside { display: flex; gap: 8px; align-items: flex-start; }
.ng-inside svg { font-size: 18px; margin-top: 3px; color: var(--ng-g); }
.ng-arrived img { display: block; width: 100%; max-height: 46vh; object-fit: cover; border-radius: 12px; margin-top: 12px; }
.ng-ask { font-size: 13px; color: var(--ng-mut); }

/* เส้นทาง / จุดสังเกต */
.ng-route:empty { display: none; }
.ng-route { display: flex; flex-direction: column; gap: 8px; }
.ng-rt-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--ng-line); border-radius: 14px; }
.ng-rt-row svg { font-size: 20px; color: var(--ng-g); margin-top: 2px; }
.ng-rt-row small { display: block; font-size: 12px; color: var(--ng-mut); font-weight: 600; }
.ng-rt-row p { margin: 0; font-size: 14.5px; line-height: 1.55; }
.ng-steps { border: 1px solid var(--ng-line); border-radius: 14px; padding: 0 14px; }
.ng-steps summary { display: flex; align-items: center; gap: 8px; padding: 11px 0; font-weight: 600; font-size: 14.5px; cursor: pointer; list-style: none; }
.ng-steps summary::-webkit-details-marker { display: none; }
.ng-steps summary svg { font-size: 19px; color: var(--ng-g); }
.ng-step { padding: 8px 0 10px; border-top: 1px dashed var(--ng-line); }
.ng-step b { font-size: 13.5px; color: var(--ng-g); }
.ng-step p { margin: 2px 0 0; font-size: 14px; line-height: 1.55; }

/* ---------- ปุ่มล่าง (ติดขอบเสมอ) ---------- */
.ng-actions { display: flex; gap: 8px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--ng-line); background: #fff; flex-shrink: 0; }
.ng-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 8px; border-radius: 13px; font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; border: none; white-space: nowrap; }
.ng-btn svg { font-size: 17px; }
.ng-btn[hidden] { display: none; }
.ng-ghost { background: var(--ng-gt); color: var(--ng-g); }
.ng-main { background: linear-gradient(135deg, #2D6A4F 0%, #1B4332 100%); color: #fff; flex: 1.2; }

/* ---------- จอเล็กมาก ---------- */
@media (max-width: 380px) {
  .ng-dist { font-size: 44px; }
  .ng-btn span { display: none; }
}
/* ---------- จอเตี้ย (มือถือแนวนอน) ---------- */
@media (max-height: 520px) {
  .ng-ring { width: 120px; }
  .ng-dist { font-size: 38px; }
}
/* ---------- จอกว้าง / แนวนอน: 2 คอลัมน์ ---------- */
@media (min-width: 720px) and (min-aspect-ratio: 1/1) {
  .ng-body { flex-direction: row; align-items: flex-start; gap: 28px; padding: 24px 28px; }
  .ng-dial { flex: 0 0 42%; position: sticky; top: 0; padding-top: 16px; }
  .ng-info { flex: 1; max-width: none; margin: 0; }
  .ng-ring { width: min(30vh, 220px); }
  .ng-arrived img { max-height: 52vh; }
  .ng-actions { justify-content: flex-end; }
  .ng-btn { flex: 0 0 auto; padding: 12px 22px; }
}
@media (min-width: 720px) and (max-aspect-ratio: 1/1) {
  .ng-ring { width: 210px; }
}
