/* Ikan Makan Ikan: tampilan. Aturan: window.IKAN (ikan.js). Gambar: window.IK_SVG[id] (svg-ikan.js). Kanvas 2D + overlay HTML (gelembung soal, HUD). */
.ik { --ik-ink: #0f172a; --t0: #ea580c; --t1: #2563eb; }
.ik-wrap { flex: 1; min-height: 0; position: relative; overflow: hidden; background: #0c4a6e; padding: clamp(4px, .6vw, 8px); }
.ik-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ik-seas { position: absolute; inset: clamp(4px, .6vw, 8px); display: flex; gap: clamp(4px, .6vw, 8px); }
.ik-sea { flex: 1 1 0; min-width: 0; min-height: 0; position: relative; overflow: hidden; border-radius: 14px; border: 3px solid var(--t); background: #0e7490; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; cursor: crosshair; isolation: isolate; }
.ik-sea.off { display: none; }
.ik-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ik-bubs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }

/* gelembung soal: ukuran tetap, tidak ikut zoom */
.ik-b { position: absolute; left: 0; top: 0; transform: translate(-999px, -999px); display: none; padding: 2px 9px 3px; background: #fff; color: #0f172a; border: 2px solid #1e293b; border-radius: 14px; font: 800 var(--bf, 17px)/1.2 var(--font); white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: 0 2px 5px rgba(2, 6, 23, .35); will-change: transform; }
.ik-b::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 10px; margin-left: -5px; background: #fff; border-right: 2px solid #1e293b; border-bottom: 2px solid #1e293b; transform: rotate(45deg); border-radius: 0 0 3px 0; }
.ik-b.on { display: block; }
.ik-b.me { z-index: 3; background: var(--t); color: #fff; border-color: #fff; font-size: calc(var(--bf, 17px) * 1.25); padding: 1px 12px 2px; box-shadow: 0 2px 7px rgba(2, 6, 23, .5); }
.ik-b.me::after { background: var(--t); border-color: #fff; }
.ik-b.me.naik { animation: ik-pop .4s ease-out; }
.ik-b.jauh { opacity: .0; }

/* HUD */
.ik-hud { position: absolute; z-index: 4; top: 6px; left: 6px; right: 6px; display: flex; align-items: flex-start; gap: 6px; pointer-events: none; flex-wrap: wrap; }
.ik-sea.s1 .ik-hud { justify-content: flex-end; }
.ik-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .92); border: 3px solid var(--t); border-radius: 14px; padding: 2px 10px; color: var(--ik-ink); font-weight: 800; font-size: clamp(14px, 1.3vw, 22px); line-height: 1.25; max-width: 100%; }
.ik-chip .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--t); flex: none; }
.ik-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 12ch; }
.ik-lvbar { display: inline-flex; gap: 3px; align-items: center; }
.ik-lvbar i { width: clamp(9px, 1vw, 16px); height: clamp(10px, 1vw, 16px); border-radius: 4px; background: #cbd5e1; border: 1px solid #94a3b8; }
.ik-lvbar i.on { background: var(--t); border-color: var(--t); }
.ik-lvbar i.cur { box-shadow: 0 0 0 2px #fbbf24; }
.ik-lvn { font-variant-numeric: tabular-nums; }
.ik-ef { display: flex; gap: 4px; flex-wrap: wrap; width: 100%; pointer-events: none; }
.ik-sea.s1 .ik-ef { justify-content: flex-end; }
.ik-e { display: inline-flex; align-items: center; gap: 3px; background: rgba(15, 23, 42, .78); color: #fff; border-radius: 99px; padding: 1px 8px 1px 3px; font-weight: 800; font-size: clamp(12px, 1vw, 16px); }
.ik-e .ei { width: 22px; height: 22px; display: block; }
.ik-e .ei svg { width: 100%; height: 100%; display: block; }
.ik-e.bad { background: rgba(190, 18, 60, .85); }
.ik-clock { flex: none; font: 800 clamp(20px, 2vw, 30px) var(--font); font-variant-numeric: tabular-nums; background: #0f172a; color: #fff; border-radius: 14px; padding: 0 14px; line-height: 1.6; min-width: 76px; text-align: center; }
.ik-clock.low { background: #be123c; animation: ik-blink 1s steps(2) infinite; }
.topbar .ik-clock { margin-right: 4px; }
.ik-bot { position: absolute; z-index: 4; left: 6px; bottom: 6px; display: none; align-items: center; gap: 6px; background: rgba(15, 23, 42, .78); color: #fff; font-weight: 800; font-size: 14px; border-radius: 99px; padding: 2px 10px; pointer-events: none; }
.ik-bot.on { display: inline-flex; }
.ik-banner { position: absolute; z-index: 5; left: 50%; top: 24%; transform: translateX(-50%); max-width: 92%; background: rgba(15, 23, 42, .82); color: #fff; border: 3px solid #fff; border-radius: 16px; padding: 4px 16px; font: 800 clamp(18px, 2.2vw, 34px) var(--font); text-align: center; pointer-events: none; animation: ik-bn 1.4s ease-out forwards; white-space: nowrap; }
.ik-banner[hidden] { display: none; }
.ik-flash { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(ellipse at center, transparent 40%, rgba(220, 38, 38, .7)); opacity: 0; }
.ik-flash.on { animation: ik-fl .45s ease-out; }
.ik-flash.nl { background: radial-gradient(ellipse at center, transparent 45%, rgba(250, 204, 21, .55)); }
.ik-hint { position: absolute; z-index: 4; left: 50%; bottom: 8px; width: max-content; transform: translateX(-50%); background: rgba(15, 23, 42, .78); color: #fff; font-weight: 700; font-size: clamp(13px, 1.1vw, 18px); border-radius: 99px; padding: 3px 14px; pointer-events: none; max-width: 94%; text-align: center; }
.ik-hint[hidden] { display: none; }

.ik-pause { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(12, 74, 110, .6); }
.ik-pause[hidden] { display: none; }
.ik-pausecard { background: #fff; border: 4px solid var(--amber); border-radius: 24px; padding: 14px 28px 18px; display: grid; gap: 6px; justify-items: center; font: 800 28px var(--font); color: var(--ik-ink); }

/* popup */
.ik-names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ik-names input { min-height: 46px; border-radius: 14px; border: 3px solid var(--line); padding: 0 12px; font: 700 17px var(--font); min-width: 0; color: var(--ink); }
.ik-names input:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.ik-names input[hidden] { display: none; }
.ik-how { text-align: left; margin-top: 12px; color: var(--muted); font-size: clamp(14px, 1.5vw, 17px); line-height: 1.5; }
.ik-how summary { cursor: pointer; font-weight: 800; color: var(--ink); min-height: 32px; }
.ik-how ol { margin: 6px 0 0; padding-left: 22px; }
.ik-how li { margin: 3px 0; }
.ik-res { width: min(900px, 100%); }
.ik-stars { font-size: clamp(30px, 5vw, 56px); letter-spacing: 6px; color: #f59e0b; line-height: 1.1; min-height: 0; }
.ik-stars:empty { display: none; }
.ik-stars .off { color: #cbd5e1; }
.ik-tblw { overflow-x: auto; margin: 8px 0; }
.ik-tbl { border-collapse: collapse; width: 100%; font-size: clamp(14px, 1.4vw, 18px); font-weight: 700; color: var(--ik-ink); }
.ik-tbl th, .ik-tbl td { border: 2px solid #e2e8f0; padding: 5px 8px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ik-tbl th:first-child, .ik-tbl td:first-child { text-align: left; }
.ik-tbl thead th { background: #f1f5f9; }
.ik-tbl tr.win td, .ik-tbl tr.win th { background: #fef9c3; }
.ik-edu { font-size: clamp(13px, 1.3vw, 16px) !important; margin: 4px 0 0 !important; }
.ik-tip { display: inline-block; background: #e0f2fe; color: #075985; border-radius: 99px; padding: 0 10px; font-weight: 800; font-size: .85em; }

/* layar sempit: potret */
.rotate-hint[hidden] { display: none; }
@media (max-width: 700px) and (orientation: portrait) {
  .ik-seas { flex-direction: column; }
  .ik-chip { padding: 1px 8px; font-size: 14px; }
  .ik-chip .nm { max-width: 8ch; }
  .ik-clock { font-size: 20px; min-width: 62px; padding: 0 8px; }
  #fullscreen { display: none; }
  .topbar { gap: 5px; padding: 6px 8px; }
  .topbar .ik-clock { margin-left: auto; }
  .ik-sea { border-width: 2px; }
}

/* HP landscape (layar pendek) */
@media (max-height: 560px) {
  .stage { --gap: 3px; }
  .game { border-width: 2px; border-radius: 14px; }
  .topbar .title { display: block; flex: 1; visibility: hidden; }
  .ik-wrap { padding: 3px; }
  .ik-seas { inset: 3px; gap: 3px; }
  .ik-sea { border-width: 2px; border-radius: 10px; }
  .ik-hud { top: 4px; left: 4px; right: 4px; gap: 3px; }
  .ik-chip { padding: 0 8px; border-width: 2px; border-radius: 10px; font-size: 14px; gap: 4px; }
  .ik-chip .nm { display: none; }
  .ik-sea.dua .ik-chip .nm { display: none; }
  .ik-chip .dot { width: 11px; height: 11px; }
  .ik-lvbar i { width: 8px; height: 10px; }
  .ik-e { font-size: 12px; }
  .ik-e .ei { width: 18px; height: 18px; }
  .ik-clock { font-size: 18px; min-width: 54px; padding: 0 8px; border-radius: 10px; line-height: 1.5; }
  .ik-b { padding: 1px 7px 2px; border-radius: 11px; }
  .ik-hint { font-size: 12px; bottom: 4px; padding: 1px 10px; }
  .ik-banner { top: 28%; font-size: 18px; padding: 2px 12px; }
  .ik-names input { min-height: 40px; }
  #overlay-setup .panel { width: min(980px, 100%); padding: 8px 14px 10px; }
  #overlay-setup .panel > p { display: none; }
  #overlay-setup .panel h1 { margin: 0; }
  #overlay-setup .setup-cols { grid-template-columns: 1fr 1fr; gap: 0 18px; }
  #overlay-setup .setup-col > h3:first-child { margin-top: 4px; }
  #overlay-setup .options { gap: 6px; }
  #overlay-setup .op-desc { font-size: 12px !important; line-height: 1.3; }
  #overlay-setup .opt, .setup-cols .opt { min-height: 40px; font-size: 14px; padding: 0 10px; }
  #overlay-setup .actions { padding-top: 6px; }
  .ik-how { display: none; }
  .ik-stars { font-size: 28px; }
  .ik-res .trophy { display: none; }
  .ik-res .winner { font-size: 28px; margin: 0; }
  .ik-res .stats { margin: 0 0 4px; font-size: 14px; }
  .ik-tbl { font-size: 13px; }
  .ik-tbl th, .ik-tbl td { padding: 2px 6px; }
  .ik-edu { display: none; }
}

@keyframes ik-pop { 50% { scale: 1.3; } }
@keyframes ik-blink { 50% { opacity: .55; } }
@keyframes ik-bn { 0% { opacity: 0; scale: .6; } 15% { opacity: 1; scale: 1.08; } 25% { scale: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ik-fl { 0% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ik-b.me.naik, .ik-clock.low { animation: none; }
  .ik-banner { animation-duration: 2s; animation-name: ik-bn-r; }
  .ik-flash.on { animation-duration: .01s; opacity: 0; }
}
@keyframes ik-bn-r { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* tombol sentuh >= 44px (menimpa pengecilan style.css di layar pendek) */
.ik .iconbtn { min-height: 44px; min-width: 44px; }
.ik .iconbtn.ic { width: 44px; }
.ik .topbar { min-height: 0; }
