/* Ojek Online Pintar: tampilan. Aturan: window.OJEK (ojek.js). Gambar: window.OJ_SVG[id] (svg-ojek.js). */
.oj { --oj: #0f766e; --oj-ink: #0f172a; --oj-soft: #ecfdf5; --ok2: #047857; --bad2: #be123c; }
.oj-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: clamp(6px, 1vw, 12px); overflow: hidden; background: linear-gradient(180deg, #ecfdf5, #f8fafc 60%); }
.oj-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* bilah atas: jam dan skor */
.oj-bar { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px 18px; flex-wrap: wrap; }
.oj-clock { font: 800 clamp(22px, 3vw, 40px) var(--font); font-variant-numeric: tabular-nums; background: #0f172a; color: #fff; border-radius: 14px; padding: 0 16px; line-height: 1.4; min-width: 92px; text-align: center; }
.oj-clock.low { background: #be123c; animation: oj-blink 1s steps(2) infinite; }
.oj-clock.extra { background: #b45309; }
.oj-score { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.oj-chip { display: inline-flex; align-items: center; gap: 6px; border: 3px solid var(--t); border-radius: 999px; background: #fff; padding: 0 12px; font-weight: 800; font-size: 15px; line-height: 1.7; color: var(--oj-ink); }
.oj-chip i { width: 14px; height: 14px; border-radius: 50%; background: var(--t); display: inline-block; }
.oj-chip b { font-variant-numeric: tabular-nums; }
.oj-tabs { display: none; gap: 6px; width: 100%; }
.oj-tabs button { flex: 1; min-height: 48px; border-radius: 12px; border: 3px solid var(--t); background: #fff; color: var(--oj-ink); font: 800 15px var(--font); cursor: pointer; touch-action: manipulation; position: relative; }
.oj-tabs button[aria-selected="true"] { background: var(--t); color: #fff; }
.oj-tabs button .dot { position: absolute; right: 6px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: #f59e0b; border: 2px solid #fff; display: none; }
.oj-tabs button.alert .dot { display: block; }

/* panel tim */
.oj-panels { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(6px, 1vw, 14px); }
.oj-panels.satu { grid-template-columns: minmax(0, 1fr); max-width: 1200px; width: 100%; margin: 0 auto; }
.oj-panel { position: relative; min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; background: #fff; border: 4px solid var(--t); border-radius: 18px; padding: 6px; overflow: hidden; }
.oj-panel.bot-hidden { display: none; }
.oj-head { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 0 4px; }
.oj-name { font-weight: 800; font-size: clamp(16px, 1.5vw, 24px); color: var(--t); display: flex; align-items: center; gap: 6px; min-width: 0; }
.oj-name .mt { width: 34px; height: 34px; flex: none; }
.oj-name .mt svg { width: 100%; height: 100%; display: block; }
.oj-money { font-weight: 800; font-size: clamp(16px, 1.5vw, 24px); color: var(--oj-ink); font-variant-numeric: tabular-nums; margin-left: auto; }
.oj-stat { width: 100%; display: flex; flex-wrap: wrap; gap: 0 12px; font-weight: 700; font-size: clamp(13px, 1.1vw, 16px); color: #334155; }
.oj-stat b { font-variant-numeric: tabular-nums; color: var(--oj-ink); }

/* peta */
.oj-view { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; background: #cfe8d5; border: 3px solid #14532d; border-radius: 14px; overflow: hidden; }
.oj-map { position: relative; aspect-ratio: 720 / 480; width: 100%; max-height: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.oj-map.fit-h { width: auto; height: 100%; }
.oj-map > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.oj-layer { position: absolute; inset: 0; pointer-events: none; }
.oj-kw { position: absolute; transform: translate(-50%, -50%); width: var(--ks); height: var(--ks); }
.oj-kw .ic { display: block; width: 100%; height: 100%; }
.oj-kw .ic svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.oj-kw .lb { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); white-space: nowrap; font-weight: 800; font-size: var(--lf); line-height: 1.05; color: #0f172a; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff; }
.oj-lamp { position: absolute; transform: translate(-50%, -50%); width: var(--ls); height: var(--ls); }
.oj-lamp svg { width: 100%; height: 100%; display: block; }
.oj-rambu { position: absolute; transform: translate(-50%, -50%); width: var(--ls); height: var(--ls); }
.oj-rambu svg { width: 100%; height: 100%; display: block; }
.oj-motor { position: absolute; width: var(--ms); height: var(--ms); transform: translate(-50%, -62%); z-index: 6; transition: left .12s linear, top .12s linear; }
.oj-motor svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); }
.oj-motor.flip svg { transform: scaleX(-1); }
.oj-motor.frozen svg { filter: grayscale(1) drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); }
.oj-motor.waiting { animation: oj-bob .8s ease-in-out infinite; }
.oj-motor .tag { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); background: var(--t); color: #fff; font-weight: 800; font-size: var(--lf); line-height: 1.3; border-radius: 6px; padding: 0 5px; white-space: nowrap; }
.oj-map.small .oj-motor .tag { display: none; }
.oj-pin.lama { animation: oj-blink .5s steps(2) infinite; }
.oj-pin { position: absolute; transform: translate(-50%, -88%); width: var(--ps); height: var(--ps); z-index: 5; animation: oj-pulse 1.1s ease-in-out infinite; transform-origin: 50% 100%; }
.oj-pin svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); }
.oj-pin .ring { position: absolute; left: 50%; bottom: -4px; width: calc(var(--ps) * 1.1); height: calc(var(--ps) * .45); transform: translateX(-50%); border-radius: 50%; border: 3px solid #f59e0b; opacity: .9; }
.oj-pin .km { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 3px; background: #fff; border: 2px solid #475569; border-radius: 999px; font-weight: 800; font-size: var(--lf); line-height: 1.3; padding: 0 6px; color: #0f172a; white-space: nowrap; font-variant-numeric: tabular-nums; }
.oj-pin.lama .km { background: #fee2e2; border-color: #be123c; }
.oj-pin.lock { opacity: .35; animation: none; filter: grayscale(.8); }
.oj-pin.tdk-sempat .km::after { content: ' !'; color: #be123c; }
.oj-pin.gone { opacity: 0; transition: opacity .3s; }
.oj-pin.tolak { animation: oj-shake .4s 2; }
.oj-pin .jn { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 2px; background: #be123c; color: #fff; font-weight: 800; font-size: var(--lf); border-radius: 8px; padding: 0 8px; line-height: 1.5; white-space: nowrap; display: none; }
.oj-pin.tolak .jn { display: block; }
.oj-route { fill: none; stroke: var(--t); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; opacity: .55; stroke-dasharray: 2 12; }
.oj-freeze { position: absolute; inset: 0; z-index: 9; background: rgba(15, 23, 42, .35); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.oj-freeze span { background: #fff; border: 4px solid #0ea5e9; border-radius: 16px; font-weight: 800; font-size: clamp(16px, 2vw, 26px); padding: 4px 16px; color: #075985; }
.oj-freeze[hidden] { display: none; }
.oj-toast { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 10; max-width: 92%; background: var(--c, #0f766e); color: #fff; border: 3px solid #fff; border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); padding: 4px 14px; font-weight: 800; font-size: clamp(14px, 1.4vw, 20px); text-align: center; pointer-events: none; animation: oj-pop .25s ease-out; }
.oj-toast[hidden] { display: none; }

/* kartu order aktif */
.oj-cards { flex: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; min-height: 64px; }
.oj-cards.satu-kartu { grid-template-columns: minmax(0, 1fr); }
.oj-card { border: 3px solid #cbd5e1; border-radius: 12px; background: #f8fafc; padding: 4px 8px; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 8px; align-items: center; min-width: 0; }
.oj-card .ci { width: 44px; height: 44px; grid-row: 1 / 3; }
.oj-card .ci svg { width: 100%; height: 100%; display: block; }
.oj-card .ct { font-weight: 800; font-size: clamp(14px, 1.2vw, 17px); color: var(--oj-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oj-card .cs { font-weight: 700; font-size: clamp(13px, 1.05vw, 15px); color: #475569; display: flex; gap: 2px 8px; flex-wrap: wrap; align-items: center; }
.oj-card .late { color: #be123c; }
.oj-card .bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: #e2e8f0; overflow: hidden; margin-top: 3px; }
.oj-card .bar i { display: block; height: 100%; background: var(--t); transition: width .2s linear; }
.oj-card button.bt { min-height: 48px; min-width: 48px; border-radius: 10px; border: 2px solid #be123c; background: #fff; color: #be123c; font: 800 14px var(--font); padding: 0 12px; cursor: pointer; touch-action: manipulation; }
.oj-card.kosong { grid-template-columns: 1fr; color: #64748b; font-weight: 700; font-size: clamp(13px, 1.1vw, 16px); text-align: center; border-style: dashed; padding: 14px 8px; }
.oj-card.kosong.tutup { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }

/* modal di dalam panel tim */
.oj-modal { position: absolute; inset: 0; z-index: 20; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center; padding: clamp(6px, 1.2vw, 14px); }
.oj-modal[hidden] { display: none; }
.oj-box { width: min(560px, 100%); max-height: 100%; overflow-y: auto; background: #fff; border: 4px solid var(--t); border-radius: 18px; padding: clamp(10px, 1.6vw, 20px); text-align: left; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.oj-box h2 { margin: 0 0 2px; font-size: clamp(18px, 1.8vw, 26px); text-align: center; color: var(--oj-ink); }
.oj-box .sub { text-align: center; font-weight: 700; color: #475569; font-size: clamp(14px, 1.2vw, 17px); margin: 0 0 6px; }
.oj-box .ico { width: 56px; height: 56px; margin: 0 auto 2px; display: block; }
.oj-box .ico svg { width: 100%; height: 100%; display: block; }
.oj-box .q { font-weight: 800; color: var(--oj-ink); font-size: clamp(16px, 1.5vw, 23px); line-height: 1.4; margin: 6px 0 10px; overflow-wrap: anywhere; }
.oj-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.oj-opts.satu { grid-template-columns: minmax(0, 1fr); }
.oj-o { min-height: 52px; border: 3px solid #bae6fd; background: #f0f9ff; color: var(--oj-ink); border-radius: 14px; font: 800 clamp(15px, 1.4vw, 20px) var(--font); padding: 6px 10px; cursor: pointer; text-align: center; touch-action: manipulation; display: flex; align-items: center; justify-content: center; gap: 6px; }
.oj-o:hover:not(:disabled) { border-color: var(--t); }
.oj-o:disabled { cursor: default; }
.oj-o.ok { background: #dcfce7; border-color: #16a34a; }
.oj-o.bad { background: #ffe4e6; border-color: #e11d48; }
.oj-o.aksi { text-align: left; justify-content: flex-start; font-size: clamp(14px, 1.25vw, 18px); line-height: 1.3; }
.oj-o:focus-visible, .oj-box button:focus-visible, .oj-card button:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.oj-fb { border-radius: 14px; padding: 8px 12px; margin-top: 10px; font-weight: 700; font-size: clamp(14px, 1.2vw, 17px); line-height: 1.45; color: var(--oj-ink); background: #f1f5f9; }
.oj-fb.ok { background: #dcfce7; } .oj-fb.bad { background: #ffe4e6; }
.oj-fb b.r { display: block; font-size: 1.15em; }
.oj-fb.ok b.r { color: var(--ok2); } .oj-fb.bad b.r { color: var(--bad2); }
.oj-fb .pb { display: block; font-weight: 600; margin-top: 2px; }
.oj-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.oj-btn { min-height: 52px; min-width: 120px; padding: 0 26px; border-radius: 999px; border: 0; background: #059669; color: #fff; font: 800 clamp(17px, 1.6vw, 22px) var(--font); cursor: pointer; box-shadow: 0 4px 0 #047857; touch-action: manipulation; }
.oj-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #047857; }
.oj-btn:disabled { background: #94a3b8; box-shadow: 0 4px 0 #64748b; cursor: default; }
.oj-btn.sec { background: #fff; color: #334155; border: 3px solid #94a3b8; box-shadow: none; min-height: 48px; font-size: 15px; }
.oj-btn.bahaya { background: #fff; color: #be123c; border: 3px solid #be123c; box-shadow: none; min-height: 48px; font-size: 15px; }
.oj-list { margin: 4px 0 8px; padding: 0; list-style: none; display: grid; gap: 4px; font-weight: 700; font-size: clamp(14px, 1.2vw, 17px); color: var(--oj-ink); }
.oj-list li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #cbd5e1; padding: 2px 0; }
.oj-list li b { font-variant-numeric: tabular-nums; }
.oj-timer { height: 10px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin: 0 0 8px; }
.oj-timer i { display: block; height: 100%; width: 100%; background: #f59e0b; transform-origin: left; }

/* kembalian */
.oj-kas { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 6px 0; text-align: center; }
.oj-kas div { background: #f1f5f9; border-radius: 12px; padding: 4px 6px; font-weight: 700; font-size: clamp(13px, 1.1vw, 15px); color: #475569; }
.oj-kas b { display: block; font-size: clamp(16px, 1.5vw, 22px); color: var(--oj-ink); font-variant-numeric: tabular-nums; }
.oj-kas .tot { grid-column: 1 / -1; background: #fef9c3; }
.oj-kas .tot.pas { background: #dcfce7; } .oj-kas .tot.lebih { background: #ffe4e6; }
.oj-uang { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 6px 0; }
.oj-uang button { position: relative; min-height: 56px; border: 3px solid #cbd5e1; background: #fff; border-radius: 10px; padding: 2px; cursor: pointer; touch-action: manipulation; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 800 13px var(--font); color: #0f172a; }
.oj-uang button svg { width: 100%; height: 36px; display: block; }
.oj-uang button .n { position: absolute; right: -4px; top: -6px; min-width: 22px; height: 22px; border-radius: 99px; background: #0f766e; color: #fff; font-size: 13px; line-height: 22px; text-align: center; display: none; padding: 0 4px; }
.oj-uang button.has .n { display: block; }
.oj-uang button.fallback { font-size: 14px; }

/* pengaturan dan hasil */
.oj-names { display: grid; gap: 6px; }
.oj-names input { font: 700 16px var(--font); padding: 8px 14px; border: 2px solid var(--line); border-radius: 999px; min-width: 0; width: 100%; box-sizing: border-box; text-align: center; min-height: 44px; }
.oj-names input[hidden] { display: none; }
.oj-how { margin: 8px 0 0; text-align: left; font-size: 14px; font-weight: 600; color: #334155; }
.oj-how summary { cursor: pointer; font-weight: 800; min-height: 32px; }
.oj-how ol { margin: 4px 0 0; padding-left: 20px; }
.oj-res { width: min(1040px, 100%); max-width: 1040px; }
.oj-tblw { overflow-x: auto; margin: 8px 0; }
.oj-tbl { border-collapse: collapse; width: 100%; font-size: clamp(13px, 1.3vw, 16px); font-weight: 700; color: var(--oj-ink); }
.oj-tbl th, .oj-tbl td { border: 2px solid #e2e8f0; padding: 4px 6px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.oj-tbl th:first-child, .oj-tbl td:first-child { text-align: left; }
.oj-tbl thead th { background: #f1f5f9; }
.oj-tbl tr.win td, .oj-tbl tr.win th { background: #fef9c3; }
.oj-tbl .neg { color: #be123c; }

/* rotate hint: hanya HP potret (peta tetap bisa dimainkan di potret) */
@media (max-width: 640px) and (orientation: portrait) { .rotate-hint { display: flex; } .rotate-hint[hidden] { display: none; } }
.rotate-hint[hidden] { display: none; }

/* layar sempit: satu peta, tim bergantian */
@media (max-width: 820px), (max-aspect-ratio: 5/4), (max-height: 560px) {
  .oj-panels, .oj-panels.satu { grid-template-columns: minmax(0, 1fr); }
  .oj-panels:not(.satu) .oj-panel:not(.aktif) { display: none; }
  .oj-tabs.on { display: flex; }
  .oj-panel { overflow-y: auto; }
  .oj-view { flex: none; }
  .oj-map { max-height: none; }
  .oj-cards { grid-template-columns: minmax(0, 1fr); }
  .oj-wrap { overflow-y: auto; }
  .oj-modal { position: fixed; align-items: flex-end; padding: 6px; }
  .oj-panels.satu .oj-panel, .oj-panel { flex: none; }
  .oj-panels { flex: none; }
}
/* HP landscape (layar pendek): satu panel tim, peta di kiri, kartu order di kanan, modal penuh dan bisa digulir */
@media (max-height: 560px) {
  .oj-wrap { overflow: hidden; padding: 4px 6px; gap: 4px; }
  .oj-panels, .oj-panels.satu { flex: 1; min-height: 0; max-width: none; }
  .oj-panel { flex: 1; min-height: 0; overflow: hidden; display: grid; grid-template-columns: minmax(0, 58%) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 4px 8px; padding: 4px; border-width: 3px; }
  .oj-head { grid-column: 2; grid-row: 1; }
  .oj-view { grid-column: 1; grid-row: 1 / span 2; flex: none; min-height: 0; height: 100%; }
  .oj-cards { grid-column: 2; grid-row: 2; overflow-y: auto; min-height: 0; }
  .oj-modal { position: fixed; inset: 0; align-items: center; padding: 4px; }
  .oj-box { max-height: 100%; padding: 8px 12px; }
  .oj-box .ico { display: none; }
  .oj-box .q { margin: 2px 0 6px; }
  .oj-opts { grid-template-columns: 1fr 1fr; gap: 6px; }
  .oj-tabs button { min-height: 40px; }
  .oj-clock { font-size: 22px; line-height: 1.25; }
  .oj-chip { line-height: 1.4; font-size: 14px; }
  .oj-panel { grid-template-columns: minmax(0, 62%) minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .oj-opts { grid-template-columns: 1fr; }
  .oj-uang { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@keyframes oj-pulse { 50% { transform: translate(-50%, -88%) scale(1.12); } }
@keyframes oj-bob { 50% { margin-top: -3px; } }
@keyframes oj-blink { 50% { opacity: .65; } }
@keyframes oj-pop { from { transform: translate(-50%, 0) scale(.7); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes oj-shake { 25% { margin-left: -6px; } 75% { margin-left: 6px; } }
@media (prefers-reduced-motion: reduce) {
  .oj-pin, .oj-pin.tolak, .oj-pin.lama, .oj-motor.waiting, .oj-clock.low, .oj-toast { animation: none; }
  .oj-motor { transition: none; }
}
