:root {
  --ink: #173d42;
  --ink-2: #4f6c70;
  --ink-3: #7d9497;
  --paper: rgba(255, 250, 241, 0.93);
  --paper-solid: #fffaf1;
  --line: rgba(23, 61, 66, 0.12);
  --teal: #0f5c63;
  --teal-2: #13797f;
  --sun: #f08a3c;
  --sun-ink: #a8520f; /* teks oranye kecil di atas kertas krem (kontras 5,2:1) */
  --sun-soft: #fde6d2;
  --sea: #3b9dc6;
  --shadow: 0 10px 30px rgba(9, 38, 48, 0.18), 0 2px 6px rgba(9, 38, 48, 0.08);
  --r: 18px;
  --gut: 16px;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #3b9dc6; }
body { -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#map { position: fixed; inset: 0; display: block; cursor: grab; }
#map.dragging { cursor: grabbing; }

.glass {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- atas ---------- */
.hud-top {
  position: fixed; top: var(--gut); left: var(--gut); right: var(--gut);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.badge { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 999px; }
.logo { width: 40px; height: 40px; flex: none; border-radius: 50%; display: block; } /* logo.svg = logo channel (kota-alpha/brand) */
.city { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; line-height: 1.15; }
.meta { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meta b { color: var(--ink); font-weight: 700; }
.sep { margin: 0 6px; color: var(--ink-3); }
.clock { padding: 9px 16px; border-radius: 16px; text-align: right; }
#clock { font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.1; }
#phase { font-size: 12px; color: var(--ink-2); font-weight: 600; }

/* ---------- zoom ---------- */
.zoom {
  position: fixed; right: var(--gut); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; border-radius: 14px; overflow: hidden;
}
.zoom button { width: 42px; height: 42px; border: 0; background: transparent; display: grid; place-items: center; }
.zoom button + button { border-top: 1px solid var(--line); }
.zoom button:hover { background: rgba(15, 92, 99, 0.08); }
.zoom svg, .dock svg, .search svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- dok bawah ---------- */
.dock {
  position: fixed; left: 50%; bottom: calc(var(--gut) + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; gap: 10px; align-items: stretch; width: min(640px, calc(100vw - 2 * var(--gut)));
}
.search { position: relative; flex: 1; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 999px; min-height: 48px; }
.search svg { color: var(--ink-2); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); padding: 12px 0; }
.search input::placeholder { color: var(--ink-3); }
.search:focus-within { outline: 2px solid var(--teal-2); outline-offset: 1px; }
.dock-btn { display: flex; align-items: center; gap: 8px; padding: 0 16px; border-radius: 999px; font-weight: 700; font-size: 14px; min-height: 48px; border: 1px solid rgba(255, 255, 255, 0.75); }
.dock-btn:hover { background: var(--paper-solid); }
.dock-btn.on { background: var(--teal); color: #fff; }
a.dock-btn { color: inherit; text-decoration: none; }
.dock-btn.play svg { color: var(--sun); stroke-width: 2; }
.dock .search { min-width: 0; } /* dok berisi 4 item: kotak cari boleh menyempit di HP */
.dock { width: min(760px, calc(100vw - 2 * var(--gut))); } /* tombol Main Kurir: kotak cari tetap lega di desktop */
.search input { text-overflow: ellipsis; }

.suggest {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); margin: 0; padding: 6px; list-style: none;
  border-radius: 16px; max-height: 50vh; overflow: auto;
}
.suggest li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.suggest li[aria-selected='true'], .suggest li:hover { background: rgba(15, 92, 99, 0.08); }
.suggest .empty { color: var(--ink-2); cursor: default; }
.s-name { font-weight: 700; font-size: 14px; }
.s-sub { font-size: 12px; color: var(--ink-2); }

.avatar {
  --h: 180;
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: hsl(var(--h) 55% 46%); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: 0.02em;
}
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }

/* ---------- kartu ---------- */
.card {
  position: fixed; left: var(--gut); top: 92px; width: 340px; max-width: calc(100vw - 2 * var(--gut));
  border-radius: var(--r); padding: 16px; animation: rise 0.22s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.card-head { display: flex; gap: 12px; align-items: center; padding-right: 28px; }
.card .kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sun-ink); }
.card h3 { margin: 2px 0 0; font-size: 18px; line-height: 1.2; letter-spacing: -0.01em; }
.card .handle { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.x {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(15, 92, 99, 0.08); font-size: 18px; line-height: 1; display: grid; place-items: center;
}
.x:hover { background: rgba(15, 92, 99, 0.16); }
.rank { margin-top: 14px; padding: 12px; border-radius: 14px; background: var(--sun-soft); }
.rank-title { font-weight: 800; font-size: 15px; }
.rank-at { font-size: 13px; color: var(--ink-2); }
.bar { height: 6px; border-radius: 99px; background: rgba(23, 61, 66, 0.12); margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--sun); border-radius: inherit; }
.rank .sub { margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0 0; font-size: 13.5px; }
.card dt { color: var(--ink-2); }
.card dd { margin: 0; font-weight: 600; }
.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 999px; padding: 9px 14px; font-weight: 700; font-size: 13px; background: var(--teal); color: #fff; }
.btn.ghost { background: rgba(15, 92, 99, 0.08); color: var(--ink); }
.btn:hover { filter: brightness(1.08); }
.people { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; max-height: 260px; overflow: auto; }
.people li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.people li:hover { background: rgba(15, 92, 99, 0.07); }
.people .avatar { width: 28px; height: 28px; font-size: 11px; }
.muted { color: var(--ink-2); font-size: 13px; margin: 10px 0 0; }

/* ---------- toast ---------- */
.toasts { position: fixed; top: 92px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 2 * var(--gut))); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: 16px;
  font-size: 14px; animation: rise 0.25s ease-out;
}
.toast .ic { width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; flex: none; }
.toast .ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toast .tx { flex: 1; line-height: 1.35; }
.toast .tx small { display: block; color: var(--ink-2); font-size: 12px; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: 0.3s; }

/* ---------- panel kedatangan ---------- */
.panel {
  position: fixed; right: calc(var(--gut) + 56px); top: 92px; bottom: 88px; width: 330px; max-width: calc(100vw - 2 * var(--gut));
  border-radius: var(--r); display: flex; flex-direction: column; overflow: hidden; animation: rise 0.22s ease-out;
}
.panel-head { position: relative; padding: 16px 16px 8px; }
.panel h2 { margin: 0; font-size: 17px; }
.flight-now { margin: 0 16px; padding: 10px 12px; border-radius: 12px; background: var(--sun-soft); font-size: 13px; }
.flight-now b { font-weight: 800; }
.arr-list { list-style: none; margin: 8px 0 0; padding: 0 8px 12px; overflow: auto; }
.arr-list li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; }
.arr-list li:hover { background: rgba(15, 92, 99, 0.07); }
.arr-list .when { margin-left: auto; font-size: 12px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- info ---------- */
.modal { position: fixed; inset: 0; background: rgba(9, 38, 48, 0.35); display: grid; place-items: center; padding: var(--gut); }
.modal-box { position: relative; border-radius: 22px; padding: 26px; max-width: 460px; width: 100%; background: var(--paper-solid); max-height: calc(100vh - 2 * var(--gut)); max-height: calc(100dvh - 2 * var(--gut)); overflow: auto; overscroll-behavior: contain; }
.modal-box h2 { margin: 0 0 8px; font-size: 21px; letter-spacing: -0.01em; }
.modal-box p { line-height: 1.55; margin: 8px 0; color: var(--ink-2); }
.modal-box p b { color: var(--ink); }
.modal-box p a { color: var(--teal-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.modal-box p a b { color: inherit; }
.steps { margin: 14px 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; line-height: 1.45; }
.steps li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.fine { font-size: 12.5px; }
kbd { font: inherit; font-size: 12px; padding: 1px 6px; border-radius: 6px; background: rgba(15, 92, 99, 0.08); }

/* ---------- mode siaran (?stream) ---------- */
body.is-stream .dock, body.is-stream .zoom, body.is-stream .panel, body.is-stream .toasts { display: none !important; }
body.is-stream #map { cursor: default; }
body.is-stream .card .x { display: none; }
body.is-stream .hud-top { top: 22px; left: 26px; right: 26px; }
body.is-stream .badge { padding: 12px 22px 12px 12px; }
body.is-stream .logo { width: 48px; height: 48px; }
body.is-stream .city { font-size: 22px; }
body.is-stream .meta { font-size: 15px; }
body.is-stream #clock { font-size: 28px; }
body.is-stream .card { left: auto; right: 26px; top: 120px; width: 360px; animation: none; }
.stream { position: fixed; inset: 0; pointer-events: none; }
.s-flight { position: absolute; left: 50%; top: 26px; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 16px; display: flex; gap: 10px; align-items: center; }
.s-flight .live { width: 10px; height: 10px; border-radius: 50%; background: #e8473c; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.s-bottom { position: absolute; left: 26px; right: 26px; bottom: 22px; display: grid; gap: 10px; }
.s-cta {
  display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-radius: 18px;
  background: var(--teal); color: #fff; box-shadow: var(--shadow);
}
.s-cta .big { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.s-cta .big b { color: #ffd08a; }
.s-cta .small { font-size: 14px; opacity: 0.85; margin-top: 2px; }
.s-cta .word { margin-left: auto; padding: 8px 16px; border-radius: 12px; background: #ffd08a; color: var(--teal); font-weight: 800; font-size: 22px; letter-spacing: 0.06em; }
.s-ticker { display: flex; align-items: center; gap: 12px; border-radius: 14px; padding: 8px 8px 8px 14px; overflow: hidden; }
.tk-label { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sun-ink); white-space: nowrap; }
.tk-viewport { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.tk-track { display: inline-flex; gap: 22px; white-space: nowrap; font-weight: 700; font-size: 15px; animation: tick 40s linear infinite; }
.tk-track span { color: var(--ink-2); font-weight: 600; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- voting fasilitas (js/votes.js) ---------- */
.vote-chip {
  display: flex; align-items: center; gap: 8px; align-self: center; min-width: 0; max-width: 400px;
  padding: 8px 14px 8px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden;
}
/* Ada chip voting: hanya chip yang menyempit; lencana kota & jam tetap seukuran tanpa voting. */
@media (min-width: 341px) {
  .hud-top.has-vote .badge, .hud-top.has-vote .clock { flex: none; }
}
.vote-chip:hover { background: var(--paper-solid); }
.vote-chip svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--sun-ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vote-chip span { overflow: hidden; text-overflow: ellipsis; }
.vote-chip .vc-short { display: none; }
.vote-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 9px; }
.vote-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 3px 10px; font-size: 13.5px; }
.vote-list .vk { grid-row: span 2; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--teal); color: #fff; font-weight: 800; font-size: 12px; }
.vote-list .vn { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-list .vv { font-weight: 800; font-variant-numeric: tabular-nums; }
.vote-list .bar { grid-column: 2 / 4; margin-top: 0; height: 5px; }
.vote-list li.win .vk { background: #2e9b6a; }
.vote-list li.win .bar i { background: #2e9b6a; }
.actions a.btn { text-decoration: none; }
#info-vote a { color: var(--teal-2); font-weight: 700; }
body.is-stream .vote-chip { display: none !important; }
/* Siaran: di bawah lencana kota, kiri atas; tidak sampai ke kolom kartu (kanan) maupun ajakan/ticker (bawah). */
.s-vote {
  position: absolute; left: 26px; top: 112px; max-width: calc(100% - 26px - 26px - 360px - 24px);
  padding: 9px 16px; border-radius: 14px; font-size: 15px; font-weight: 700; line-height: 1.5;
}
/* Bagian-bagian baris tidak dipatahkan. Pemisah "·" ada di celah sebelum bagian bertanda .d; bagian yang
   jatuh di awal baris membawa pemisahnya ke luar .sv-in, sehingga terpotong (tidak menggantung). */
.s-vote .sv-in { display: block; overflow: hidden; }
.s-vote .sv-flow { display: flex; flex-wrap: wrap; align-items: baseline; margin-left: -18px; }
.s-vote .sv-flow > span { position: relative; margin-left: 18px; white-space: nowrap; }
.s-vote .sv-flow > .d::before { content: '·'; position: absolute; left: -12px; color: var(--ink-3); font-weight: 700; }
.s-vote .sv-lead { color: var(--sun-ink); font-weight: 800; margin-right: -8px; }
.s-vote i { font-style: normal; display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-right: 6px; padding: 0 5px; border-radius: 6px; background: var(--teal); color: #fff; font-size: 12px; font-weight: 800; vertical-align: 1px; }
.s-vote b { color: var(--teal); font-weight: 800; font-variant-numeric: tabular-nums; }
.s-vote .sv-t { color: var(--ink-2); font-weight: 600; }

/* Tablet: kalimat chip tidak muat utuh; tampil ikon + "Voting" (kalimat lengkapnya di jendela Info & kartu lahan). */
@media (max-width: 860px) {
  .vote-chip .vc-long { display: none; }
  .vote-chip .vc-short { display: block; }
}

/* ---------- layar kecil ---------- */
@media (max-width: 720px) {
  :root { --gut: 12px; }
  .badge { padding: 8px 12px 8px 8px; gap: 10px; }
  .logo { width: 34px; height: 34px; }
  .city { font-size: 15px; }
  .meta { font-size: 12px; }
  #pending-wrap, .meta .sep { display: none; }
  #clock { font-size: 18px; }
  .clock { padding: 8px 12px; }
  .zoom { top: auto; bottom: 84px; transform: none; }
  .dock-btn span { display: none; }
  .dock-btn { padding: 0 14px; }
  .card { top: auto; bottom: 76px; left: var(--gut); right: var(--gut); width: auto; max-height: 60vh; overflow: auto; }
  .panel { left: var(--gut); right: var(--gut); top: 76px; bottom: 76px; width: auto; }
  .toasts { top: 70px; }
  /* HP: chip hanya ikon (teksnya tetap untuk pembaca layar) supaya lencana kota & jam tidak terdesak */
  .vote-chip { flex: none; padding: 9px; }
  .vote-chip .vc-long { display: none; }
  .vote-chip .vc-short { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* HP sangat sempit: tanpa chip, supaya lencana kota & jam tidak terdesak (voting tetap di papan lahan & Info). */
@media (max-width: 340px) {
  .vote-chip { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
