/* Juragan Kota: permainan papan matematika. Aturan: window.JURAGAN (juragan.js). Gambar: window.JK_SVG[id]. */
.jk { --jk: #0f766e; --jk-soft: #ccfbf1; --jk-ink: #134e4a; }
.jk-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: clamp(6px, 1.4vw, 14px); overflow-y: auto; overflow-x: hidden; background: linear-gradient(180deg, #ecfeff, #fff 60%); -webkit-overflow-scrolling: touch; }
.jk-main { flex: none; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.jk-side { flex: none; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
@media (min-aspect-ratio: 23/20) and (min-width: 700px) {
  .jk-wrap { flex-direction: row; overflow: hidden; }
  .jk-main { flex: 1 1 0; min-height: 0; }
  .jk-side { flex: 0 0 clamp(250px, 31vw, 400px); overflow-y: auto; overflow-x: hidden; padding: 2px; }
  .jk-view { flex: 1 1 auto; height: auto !important; min-height: 0; }
}
@media (min-aspect-ratio: 23/20) and (max-height: 520px) and (min-width: 560px) {
  .jk-wrap { flex-direction: row; overflow: hidden; }
  .jk-main { flex: 1 1 0; min-height: 0; }
  .jk-side { flex: 0 0 clamp(210px, 31vw, 400px); overflow-y: auto; overflow-x: hidden; padding: 2px; }
  .jk-view { flex: 1 1 auto; height: auto !important; min-height: 0; }
}

/* peta */
.jk-view { position: relative; width: 100%; height: clamp(210px, 40dvh, 440px); background: #9fd8f0; border: 3px solid #0c4a6e; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 22px rgba(12, 74, 110, .25); touch-action: manipulation; }
.jk-map { position: absolute; left: 0; top: 0; transform-origin: 0 0; transition: transform .6s ease; will-change: transform; --ns: 30px; }
.jk-map svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.jk-n { position: absolute; width: var(--ns); height: var(--ns); margin: calc(var(--ns) / -2) 0 0 calc(var(--ns) / -2); padding: 0; border-radius: 50%; border: 3px solid var(--g, #475569); background: #fffdf5; cursor: pointer; box-shadow: 0 2px 4px rgba(0, 0, 0, .35); font: inherit; color: var(--ink); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.jk-n::before { content: ''; position: absolute; inset: calc(var(--ns) * -.18); }   /* area sentuh lebih luas */
.jk-n .ic { position: absolute; inset: 2px; display: block; border-radius: 50%; overflow: hidden; }
.jk-n .ic svg { width: 100%; height: 100%; display: block; }
.jk-n.sp { border-radius: 30%; background: #fef9c3; border-color: #a16207; }
.jk-n.sp .ic { border-radius: 24%; }
.jk-n.kp { background: #dbeafe; border-color: #1d4ed8; }
.jk-n.pj { background: #fee2e2; border-color: #be123c; }
.jk-n.cur { animation: jk-cur 1s ease 2; }
@keyframes jk-cur { 50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, .8), 0 2px 4px rgba(0, 0, 0, .35); } }
.jk-n.flash { animation: jk-flash .9s ease 2; }
@keyframes jk-flash { 50% { transform: scale(1.3); } }
.jk-n:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.jk-n .lb { position: absolute; left: 50%; transform: translateX(-50%); font-weight: 800; font-size: clamp(9px, calc(var(--ns) * .34), 13px); line-height: 1.05; color: #0f172a; white-space: nowrap; text-align: center; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff, 0 0 4px #fff; pointer-events: none; }
.jk-n .lb small { display: block; font-weight: 700; font-size: .88em; color: #334155; }
.jk-n .lb.down { top: 100%; margin-top: 3px; }
.jk-n .lb.up { bottom: 100%; margin-bottom: 3px; }
.jk-n .lb.left { right: 100%; left: auto; top: 50%; transform: translateY(-50%); margin-right: 3px; text-align: right; }
.jk-n .lb.right { left: 100%; top: 50%; transform: translateY(-50%); margin-left: 3px; text-align: left; }
.jk-n .own { position: absolute; top: -26%; right: -26%; width: 48%; height: 48%; min-width: 15px; min-height: 15px; border-radius: 50%; background: var(--t); border: 2px solid #fff; box-shadow: 0 0 0 1px #0f172a; color: #fff; font-weight: 800; font-size: calc(var(--ns) * .3); display: grid; place-items: center; line-height: 1; z-index: 2; }
.jk-n .hs { position: absolute; left: -34%; bottom: -26%; width: 56%; height: 56%; z-index: 2; display: flex; }
.jk-n .hs svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.jk-zoom { position: absolute; right: 8px; top: 8px; z-index: 7; min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid #0c4a6e; background: rgba(255, 255, 255, .95); color: #0c4a6e; font: 800 14px var(--font); cursor: pointer; touch-action: manipulation; }
.jk-zoom[aria-pressed="true"] { background: #0c4a6e; color: #fff; }
.jk-tip { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 8; background: #fff; border: 3px solid #0c4a6e; border-radius: 14px; padding: 8px 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); font-size: clamp(12px, 1.6vw, 16px); line-height: 1.4; color: var(--ink); max-width: 460px; margin: 0 auto; }
.jk-tip[hidden] { display: none; }
.jk-tip b { font-size: 1.1em; }
.jk-tip button { float: right; min-width: 44px; min-height: 44px; margin: -8px -10px 0 6px; border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); }
.jk-tip .gr { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--g); vertical-align: middle; margin-right: 4px; border: 1px solid #0f172a; }

/* kontrol */
.jk-ctl { background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.jk-ctl-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: center; }
.jk-turn { font-weight: 800; font-size: clamp(14px, 2vw, 20px); color: var(--c, var(--ink)); line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jk-turn.tahan::after { content: ' (karantina)'; font-weight: 700; color: #92400e; }
.jk-dice { display: flex; gap: 8px; }
.jk-die { width: 46px; height: 46px; background: #fff; border: 2px solid #1f2937; border-radius: 22%; box-shadow: 0 2px 0 rgba(0, 0, 0, .25); position: relative; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 14%; gap: 0; }
.jk-die i { border-radius: 50%; background: transparent; margin: 8%; }
.jk-die i.on { background: #1f2937; }
.jk-die.roll { animation: jk-roll .5s linear 1; }
@keyframes jk-roll { 0% { transform: rotate(0) translateY(0); } 25% { transform: rotate(-70deg) translateY(-8px); } 50% { transform: rotate(120deg) translateY(0); } 75% { transform: rotate(240deg) translateY(-5px); } 100% { transform: rotate(360deg) translateY(0); } }
.jk-roll { min-height: 52px; min-width: 120px; padding: 0 28px; border-radius: 999px; border: 0; background: var(--ok); color: #fff; font: 800 clamp(20px, 2.6vw, 28px) var(--font); cursor: pointer; box-shadow: 0 4px 0 #047857; touch-action: manipulation; }
.jk-roll:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #047857; }
.jk-roll:disabled { background: #94a3b8; box-shadow: 0 4px 0 #64748b; cursor: default; }
.jk-roll:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.jk-left { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.jk-left span { background: #fff; border: 2px solid var(--c); border-radius: 999px; padding: 0 7px; font-weight: 800; font-size: 13px; line-height: 1.5; color: var(--ink); }
.jk-left span.on { background: var(--c); color: #fff; }
.jk-log { font-size: clamp(12px, 1.5vw, 15px); font-weight: 600; color: var(--muted); text-align: left; line-height: 1.3; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 6px 10px; }
.jk-log div { padding: 1px 0; }
.jk-log div:first-child { color: var(--ink); font-weight: 800; }
.jk-banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 9; background: var(--c, #0f766e); color: #fff; border: 3px solid #fff; border-radius: 18px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); padding: 8px 16px; font-weight: 800; font-size: clamp(15px, 2.2vw, 26px); text-align: center; max-width: 92%; animation: jk-pop .35s ease-out; pointer-events: none; }
.jk-banner[hidden] { display: none; }
@keyframes jk-pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }

/* bidak */
.jk-tokens { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.jk-tk { position: absolute; left: 0; top: 0; width: calc(var(--ns) * .9); height: calc(var(--ns) * 1.05); will-change: transform; }
.jk-tk .in { width: 100%; height: 100%; }
.jk-tk.hop .in { animation: jk-hop .2s ease-out; }
@keyframes jk-hop { 50% { transform: translateY(-25%); } }
.jk-tk svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.jk-tk.me .in { filter: drop-shadow(0 0 4px #f59e0b) drop-shadow(0 0 2px #f59e0b); }
.jk-tk .fb { width: 100%; height: 100%; border-radius: 50%; background: var(--t); border: 2px solid #fff; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 11px; }

/* panel tim */
.jk-teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (min-aspect-ratio: 23/20) and (min-width: 560px) { .jk-teams { grid-template-columns: 1fr; } }
.jk-team { position: relative; background: #fff; border: 3px solid var(--t); border-radius: 14px; padding: 4px 8px; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 8px; align-items: center; }
.jk-team.on { background: var(--t); color: #fff; box-shadow: 0 0 0 3px #fde68a; }
.jk-team .pic { width: 34px; height: 38px; grid-row: 1 / 3; }
.jk-team .pic svg { width: 100%; height: 100%; display: block; }
.jk-team .nm { font-weight: 800; font-size: clamp(13px, 1.5vw, 17px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; }
.jk-team:not(.on) .nm { color: var(--ink); }
.jk-team .st { font-weight: 700; font-size: clamp(11px, 1.3vw, 14px); display: flex; flex-wrap: wrap; gap: 0 8px; color: inherit; }
.jk-team:not(.on) .st { color: var(--muted); }
.jk-team .st b { font-variant-numeric: tabular-nums; }
.jk-team .money { font-weight: 800; font-size: clamp(13px, 1.5vw, 17px); }
.jk-team .tg { font-size: 11px; background: #fef3c7; color: #92400e; border-radius: 999px; padding: 0 6px; font-weight: 800; }
.jk-float { position: absolute; right: 8px; top: -4px; font-weight: 800; font-size: 15px; z-index: 5; pointer-events: none; padding: 0 8px; border-radius: 999px; background: #fff; border: 2px solid currentColor; animation: jk-float 1.5s ease-out forwards; }
.jk-float.plus { color: #047857; } .jk-float.minus { color: #be123c; }
@keyframes jk-float { 0% { transform: translateY(10px); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-18px); opacity: 0; } }

/* popup */
.jk-pop { text-align: left; width: min(560px, 100%); padding: clamp(12px, 2.4vw, 24px); }
.jk-pop h2 { margin: 0 0 4px; font-size: clamp(18px, 2.6vw, 26px); text-align: center; }
.jk-pop p { margin: 0 0 8px; }
.jk-pop .sub { text-align: center; font-weight: 700; color: var(--muted); font-size: clamp(13px, 1.7vw, 16px); }
.jk-pop .q { font-weight: 800; color: var(--ink); font-size: clamp(16px, 2.3vw, 24px); line-height: 1.4; margin: 6px 0 10px; }
.jk-pop .ico { width: 54px; height: 54px; margin: 0 auto 4px; display: block; }
.jk-pop .ico svg { width: 100%; height: 100%; display: block; }
.jk-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.jk-o { min-height: 48px; border: 3px solid var(--sky-100); background: var(--sky-50); color: var(--ink); border-radius: 14px; font: 800 clamp(15px, 2vw, 20px) var(--font); padding: 6px 10px; cursor: pointer; text-align: center; touch-action: manipulation; display: flex; align-items: center; justify-content: center; gap: 6px; }
.jk-o b { flex: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--sky-100); font-size: 13px; display: grid; place-items: center; color: var(--sky-d); }
.jk-o:hover:not(:disabled) { border-color: var(--violet); }
.jk-o:disabled { cursor: default; }
.jk-o.ok { background: #dcfce7; border-color: var(--ok); }
.jk-o.bad { background: #ffe4e6; border-color: var(--bad); }
.jk-o:focus-visible, .jk-pop button:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.jk-timer { height: 10px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin: 0 0 8px; }
.jk-timer i { display: block; height: 100%; width: 100%; background: var(--ok); transform-origin: left; }
.jk-fb { border-radius: 14px; padding: 8px 12px; margin-top: 10px; font-weight: 700; font-size: clamp(14px, 1.8vw, 17px); line-height: 1.45; color: var(--ink); background: #f1f5f9; }
.jk-fb.ok { background: #dcfce7; } .jk-fb.bad { background: #ffe4e6; }
.jk-fb b.r { display: block; font-size: 1.15em; }
.jk-fb.ok b.r { color: var(--ok); } .jk-fb.bad b.r { color: var(--bad); }
.jk-fb .pb { display: block; font-weight: 600; margin-top: 2px; }
.jk-pop .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.jk-pop .row .primary { margin-top: 0; min-height: 52px; font-size: clamp(18px, 2.4vw, 24px); padding: 0 30px; }
.jk-pop .row .secondary { margin-top: 0; min-height: 48px; }
.jk-info { text-align: center; font-weight: 800; font-size: clamp(16px, 2.2vw, 22px); color: var(--ink); margin: 6px 0; line-height: 1.4; }
.jk-info small { display: block; font-weight: 600; color: var(--muted); font-size: .8em; }
.jk-info .amt { color: var(--bad); } .jk-info .amt.plus { color: var(--ok); }

/* kartu terbalik */
.jk-card { perspective: 800px; width: min(300px, 86%); height: clamp(150px, 26vh, 200px); margin: 6px auto; }
.jk-card .in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s; transform: rotateY(180deg); }
.jk-card.open .in { transform: rotateY(0deg); }
.jk-card .f, .jk-card .b { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 16px; border: 4px solid #1f2937; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; text-align: center; }
.jk-card .f { background: #fffbeb; }
.jk-card.peluang .f { background: #eff6ff; }
.jk-card .b { transform: rotateY(180deg); background: repeating-linear-gradient(45deg, #f59e0b 0 10px, #fbbf24 10px 20px); }
.jk-card.peluang .b { background: repeating-linear-gradient(45deg, #3b82f6 0 10px, #60a5fa 10px 20px); }
.jk-card .b svg { width: 56px; height: 56px; }
.jk-card .f .jn { font-weight: 800; font-size: 13px; letter-spacing: .5px; color: #92400e; text-transform: uppercase; }
.jk-card.peluang .f .jn { color: #1d4ed8; }
.jk-card .f .tx { font-weight: 800; color: var(--ink); font-size: clamp(14px, 1.9vw, 18px); line-height: 1.35; }
.jk-card .f svg { width: 36px; height: 36px; }

/* pengaturan, hasil */
.jk-names { display: grid; gap: 6px; }
.jk-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; }
.jk-names input[hidden] { display: none; }
.jk-resume-info { margin: 8px 0 0 !important; font-size: 14px !important; font-weight: 700; }
.jk-rank { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.jk-rank li { display: grid; grid-template-columns: 30px 38px minmax(0, 1fr); gap: 2px 8px; align-items: center; border: 3px solid var(--t); border-radius: 14px; padding: 4px 10px; background: #fff; }
.jk-rank li.win { background: #fef9c3; box-shadow: 0 0 0 3px #f59e0b; }
.jk-rank .n { font-weight: 800; font-size: 20px; color: var(--ink); text-align: center; }
.jk-rank .pic { width: 34px; height: 38px; }
.jk-rank .pic svg { width: 100%; height: 100%; display: block; }
.jk-rank .tx { min-width: 0; font-weight: 800; color: var(--ink); font-size: clamp(14px, 1.8vw, 18px); }
.jk-rank .tx small { display: block; font-weight: 600; color: var(--muted); font-size: .8em; }
.jk-recap { text-align: left; margin: 6px 0; }
.jk-recap h3 { margin: 8px 0 4px; }
.jk-recap ol { margin: 0; padding-left: 20px; color: var(--ink); font-weight: 600; font-size: clamp(13px, 1.6vw, 16px); max-height: 28vh; overflow: auto; }
.jk-recap li { margin: 0 0 6px; }
.jk-recap li span { display: block; color: var(--muted); font-weight: 600; font-size: .92em; }
.jk-recap .who { color: var(--ink); font-weight: 800; }

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

/* layar pendek */
@media (max-height: 520px) and (min-aspect-ratio: 23/20) {
  .jk-ctl { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 2px 12px; padding: 4px 10px; }
  .jk-turn { flex: 0 1 auto; text-align: center; font-size: 14px; }
  .jk-die { width: 36px; height: 36px; } .jk-roll { min-height: 44px; min-width: 104px; padding: 0 20px; font-size: 20px; }
  .jk-team { padding: 2px 8px; } .jk-team .pic { width: 26px; height: 30px; }
  .jk-log { padding: 3px 8px; }
}
@media (max-height: 420px) {
  .jk-pop { padding: 8px 12px; } .jk-pop .q { margin: 2px 0 6px; } .jk-o { min-height: 44px; } .jk-card { height: 120px; }
  .jk-pop .ico { display: none; } .panel h1 { font-size: 22px; } .jk-pop h2 { font-size: 18px; } .jk-pop .sub { font-size: 12px; margin: 0 0 4px; } .jk-pop .q { font-size: 15px; } .jk-pop .row { margin-top: 6px; } .jk-pop .row .primary { min-height: 46px; font-size: 18px; } .jk-fb { margin-top: 6px; padding: 4px 10px; font-size: 13px; }
}
@media (max-width: 380px) { .jk-opts { grid-template-columns: 1fr; } .jk-team .pic { width: 26px; height: 30px; } }

@media (prefers-reduced-motion: reduce) {
  .jk-tk, .jk-card .in { transition: none; }
  .jk-die.roll, .jk-tk.hop .in, .jk-cell.flash, .jk-banner, .jk-float { animation: none; }
  .jk-float { opacity: 1; }
}

/* efek kartu */
.jk-card .f { overflow: hidden; }
.jk-card.open.bencana .in { animation: jk-shake .6s .7s 1; }
@keyframes jk-shake { 0%, 100% { transform: rotateY(0) translateX(0); } 20% { transform: rotateY(0) translateX(-8px); } 40% { transform: rotateY(0) translateX(8px); } 60% { transform: rotateY(0) translateX(-5px); } 80% { transform: rotateY(0) translateX(4px); } }
.jk-card.bencana .f { background: #e2e8f0; }
.jk-card.harta .f { background: #fef9c3; box-shadow: inset 0 0 22px rgba(245, 158, 11, .6); }
.jk-card .fx { position: absolute; inset: 0; pointer-events: none; }
.jk-card .fx.bencana svg { position: absolute; right: 4px; top: 2px; width: 54px; height: 32px; animation: jk-drift 2.4s ease-in-out infinite alternate; }
@keyframes jk-drift { to { transform: translateX(-10px); } }
.jk-card .fx.harta i { position: absolute; width: 22px; height: 22px; bottom: -24px; opacity: 0; animation: jk-rise 2.2s ease-out infinite; }
.jk-card .fx.harta i svg { width: 100%; height: 100%; }
.jk-card .fx.harta i:nth-child(1) { left: 8%; animation-delay: .7s; } .jk-card .fx.harta i:nth-child(2) { left: 30%; animation-delay: 1.1s; }
.jk-card .fx.harta i:nth-child(3) { right: 28%; animation-delay: 1.5s; } .jk-card .fx.harta i:nth-child(4) { right: 8%; animation-delay: .9s; }
@keyframes jk-rise { 0% { transform: translateY(0) scale(.6); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-170px) scale(1.1) rotate(25deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .jk-card.open.bencana .in, .jk-card .fx.bencana svg { animation: none; } .jk-card .fx.harta i { animation: none; opacity: 1; bottom: 6px; } }
