/* Klasifikasi Makhluk Hidup: Belajar, Pohon, Susun Takson, Tebak Kingdom, Siapa Lebih Dekat, Kuis, Pasangkan Nama */
.km { --km: #15803d; --km-soft: #dcfce7; --ca: #c2410c; --cb: #1d4ed8; }
.km-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: clamp(8px, 1.6vw, 18px); overflow-y: auto; overflow-x: hidden; background: linear-gradient(180deg, #f0fdf4, #fff 55%); -webkit-overflow-scrolling: touch; user-select: text; -webkit-user-select: text; }
.km-view { display: flex; flex-direction: column; gap: clamp(8px, 1.4vh, 14px); min-width: 0; }
.km-view[hidden] { display: none; }
.km-hud { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.km-hud:empty { display: none; }
.km-chip { background: #fff; border: 3px solid var(--c); color: var(--ink); border-radius: 999px; padding: 2px 14px; font-weight: 800; font-size: clamp(13px, 1.6vw, 19px); display: inline-flex; gap: 6px; align-items: baseline; }
.km-chip b { font-size: 1.2em; font-variant-numeric: tabular-nums; }
.km-chip i { font-style: normal; }
.km-chip.on { background: var(--c); color: #fff; }
.km-qn { font-weight: 800; color: var(--muted); font-size: clamp(13px, 1.5vw, 17px); margin-left: 6px; }
.km-ilm, i.km-ilm { font-style: italic; }
.km h2 { margin: 0; font-size: clamp(18px, 2.4vw, 26px); }
.km h3 { margin: 0 0 6px; font-size: clamp(16px, 1.9vw, 20px); }
.km-names { display: grid; gap: 6px; }
.km-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; }
.km-names input[hidden] { display: none; }
#game-opts[hidden] { display: none; }

/* gambar organisme */
.km-pic { display: inline-block; width: var(--ps, 64px); height: var(--ps, 64px); flex: none; line-height: 0; }
.km-pic svg { width: 100%; height: 100%; display: block; }
.km-ph { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: var(--h, #94a3b8); color: #fff; font: 800 calc(var(--ps, 64px) * .5)/1 var(--font); }

/* tab belajar */
.km-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.km-tab { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 3px solid var(--line); background: #fff; color: var(--ink); font: 800 clamp(14px, 1.6vw, 17px) var(--font); cursor: pointer; }
.km-tab[aria-selected="true"] { background: var(--km); border-color: var(--km); color: #fff; }
.km-panel[hidden] { display: none; }
.km-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.km-note { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; color: var(--ink); font-size: clamp(14px, 1.6vw, 17px); line-height: 1.5; }
.km-note p { margin: 0 0 6px; } .km-note ul { margin: 4px 0 0; padding-left: 20px; } .km-note li { margin: 2px 0; }
.km-note.tip { background: #fffbeb; border-color: #fde68a; }
.km-kgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 12px; }
.km-kcard { background: #fff; border: 3px solid var(--kc); border-radius: 20px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.km-kcard h3 { margin: 0; font-size: clamp(20px, 2.4vw, 26px); color: var(--ink); }
.km-kcard h3 small { font-size: .6em; color: var(--muted); font-weight: 700; margin-left: 6px; }
.km-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.km-tag { background: var(--kt); border: 2px solid var(--kc); border-radius: 12px; padding: 2px 10px; font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.km-tag b { font-weight: 800; }
.km-kcard ul { margin: 0; padding-left: 20px; color: var(--ink); font-size: clamp(14px, 1.5vw, 16px); line-height: 1.45; }
.km-ex { display: flex; flex-wrap: wrap; gap: 8px; }
.km-exb { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 88px; min-height: 44px; padding: 6px 4px; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer; font: 700 12px/1.2 var(--font); color: var(--ink); --ps: 56px; }
.km-exb:hover { border-color: var(--kc); background: var(--kt); }
.km-exb span.n { text-align: center; overflow-wrap: anywhere; }
.km-tblwrap { overflow-x: auto; border: 2px solid var(--line); border-radius: 16px; background: #fff; max-width: 100%; -webkit-overflow-scrolling: touch; }
.km-tblwrap:focus-visible { outline: 3px solid var(--amber); }
.km-tbl { border-collapse: collapse; width: 100%; min-width: 640px; font-size: clamp(13px, 1.5vw, 16px); color: var(--ink); }
.km-tbl th, .km-tbl td { padding: 8px 10px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.4; }
.km-tbl thead th { background: #f0fdf4; border-top: 0; white-space: nowrap; }
.km-tbl tbody th { border-left: 6px solid var(--kc); white-space: nowrap; }
.km-ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: l; }
.km-ladder li { counter-increment: l; display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: start; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; margin-left: calc(var(--k) * 10px); color: var(--ink); line-height: 1.45; font-size: clamp(14px, 1.5vw, 16px); }
.km-ladder li::before { content: counter(l); width: 32px; height: 32px; border-radius: 50%; background: var(--km); color: #fff; font-weight: 800; display: grid; place-items: center; }
.km-ladder b { display: block; font-size: 1.1em; }
.km-ladder em { font-style: normal; color: var(--km); font-weight: 800; }
.km-bin { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: clamp(26px, 5vw, 44px); font-weight: 800; color: var(--ink); justify-content: center; }
.km-bin span small { display: block; font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; }
.km-bin .g { color: #c2410c; } .km-bin .s { color: #1d4ed8; }
.km-yn { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.km-yn div { border-radius: 12px; padding: 6px 10px; font-weight: 700; color: var(--ink); border: 2px solid; }
.km-yn .ok { background: #ecfdf5; border-color: #059669; } .km-yn .no { background: #fff1f2; border-color: #be123c; }
.km-yn small { display: block; font-weight: 600; color: var(--muted); }

/* pohon */
.km-pair { display: flex; align-items: stretch; justify-content: center; gap: 8px; flex-wrap: wrap; }
.km-pick { display: flex; align-items: center; gap: 10px; text-align: left; min-height: 72px; padding: 6px 14px 6px 8px; border-radius: 18px; border: 4px solid var(--pc); background: #fff; cursor: pointer; font: inherit; color: var(--ink); flex: 1 1 200px; max-width: 340px; --ps: 60px; }
.km-pick.a { --pc: var(--ca); } .km-pick.b { --pc: var(--cb); }
.km-pick:hover { background: #f8fafc; }
.km-pick small { display: block; font-weight: 800; color: var(--pc); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.km-pick b { display: block; font-size: clamp(16px, 2vw, 20px); }
.km-pick i { display: block; font-size: 14px; color: var(--muted); }
.km-vs { align-self: center; font-weight: 800; color: var(--muted); }
@media (max-width: 640px) { .km-pick { flex: 1 1 100%; max-width: none; } .km-vs { display: none; } }
.km-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center; }
.km-mini { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font: 800 15px var(--font); color: var(--ink); cursor: pointer; }
.km-mini:hover { border-color: var(--km); background: var(--km-soft); }
.km-mini.dice { background: var(--km); color: #fff; border-color: var(--km); }
.km-ringkas { margin: 0; text-align: center; font-weight: 800; color: var(--ink); font-size: clamp(15px, 1.9vw, 21px); line-height: 1.4; }
.km-meter { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.km-seg { display: flex; gap: 4px; width: min(420px, 100%); }
.km-seg i { flex: 1; height: 16px; border-radius: 6px; background: #e2e8f0; border: 2px solid #cbd5e1; }
.km-seg i.on { background: #22c55e; border-color: #15803d; }
.km-meter p { margin: 0; font-weight: 800; color: var(--ink); font-size: clamp(14px, 1.6vw, 17px); text-align: center; }
.km-treecard { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 8px; min-width: 0; overflow: hidden; }
.km-tree { display: block; margin: 0 auto; width: 100%; height: auto; font-family: var(--font); }
.km-tree.v { max-width: 460px; } .km-tree.mini { max-width: 380px; }
.km-tree .nd rect { stroke-width: 3; }
.km-tree .nd.all rect { fill: #dcfce7; stroke: #15803d; } .km-tree .nd.l0 rect { fill: #ffedd5; stroke: #c2410c; } .km-tree .nd.l1 rect { fill: #dbeafe; stroke: #1d4ed8; }
.km-tree .nd.l2 rect { fill: #fae8ff; stroke: #a21caf; } .km-tree .nd.part rect { fill: #fef9c3; stroke: #a16207; } .km-tree .nd.root rect { fill: #f1f5f9; stroke: #475569; }
.km-tree .nd text { fill: #0f172a; text-anchor: middle; } .km-tree .nd .cap { fill: #475569; font-weight: 700; } .km-tree .nd .nm { font-weight: 800; } .km-tree .nd .it { font-style: italic; }
.km-tree .ed { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.km-tree .ed.all { stroke: #15803d; stroke-width: 7; } .km-tree .ed.l0 { stroke: #c2410c; stroke-width: 4; } .km-tree .ed.l1 { stroke: #1d4ed8; stroke-width: 4; } .km-tree .ed.l2 { stroke: #a21caf; stroke-width: 4; } .km-tree .ed.part { stroke: #a16207; stroke-width: 5; }
.km-tree .cab rect { fill: none; stroke: #f59e0b; stroke-width: 4; stroke-dasharray: 7 5; animation: km-dash 1.4s linear infinite; }
.km-tree .star circle { fill: #f59e0b; stroke: #92400e; stroke-width: 2; } .km-tree .star text { fill: #451a03; text-anchor: middle; font-weight: 800; }
@keyframes km-dash { to { stroke-dashoffset: -24; } }
.km-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; font-weight: 700; color: var(--ink); }
.km-legend li { display: inline-flex; align-items: center; gap: 6px; }
.km-legend i { display: inline-block; width: 26px; height: 0; border-top: 5px solid; border-radius: 3px; } .km-legend i.all { border-color: #15803d; border-top-width: 7px; } .km-legend i.a { border-color: #c2410c; } .km-legend i.b { border-color: #1d4ed8; }
.km-legend i.st { width: 18px; height: 18px; border: 2px solid #92400e; border-radius: 50%; background: #f59e0b; }

/* pemilih organisme */
.km-pickpanel { text-align: left; }
.km-pickpanel h2 { margin: 0 44px 8px 0; }
.km-pickgrid h3 { margin: 10px 0 6px; font-size: 16px; color: var(--muted); }
.km-pgrp { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.km-po { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; min-height: 44px; border-radius: 14px; border: 3px solid var(--line); background: #fff; cursor: pointer; font: 800 13px/1.2 var(--font); color: var(--ink); text-align: center; --ps: 60px; }
.km-po:hover:not(:disabled) { border-color: var(--km); background: var(--km-soft); }
.km-po[aria-pressed="true"] { border-color: var(--km); background: var(--km-soft); }
.km-po:disabled { opacity: .4; cursor: not-allowed; }
.km-po span.n { overflow-wrap: anywhere; }

/* kartu detail organisme */
.km-detail { text-align: left; }
.km-dtop { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-right: 44px; }
.km-dtop .km-pic { --ps: clamp(96px, 20vh, 140px); }
.km-dtop h2 { margin: 0; font-size: clamp(24px, 4vw, 36px); }
.km-dtop p { margin: 2px 0 0; font-size: clamp(16px, 2vw, 20px); font-weight: 700; color: var(--km); }
.km-dtbl { width: 100%; border-collapse: collapse; margin: 10px 0 4px; color: var(--ink); font-size: 15px; }
.km-dtbl th, .km-dtbl td { padding: 4px 8px; border-top: 1px solid var(--line); text-align: left; }
.km-dtbl th { width: 38%; color: var(--muted); }
.km-detail ul { margin: 4px 0; padding-left: 20px; color: var(--ink); line-height: 1.45; font-size: 15px; }
.km-detail p.kv { margin: 6px 0 0; font-size: 15px; text-align: left; color: var(--ink); }

/* kuis */
.km-turn { text-align: center; font-weight: 800; font-size: clamp(14px, 1.7vw, 18px); color: var(--c); }
.km-prompt { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 2vw, 22px); background: #fff; border: 4px solid var(--km); border-radius: 24px; padding: 8px 14px; min-height: 80px; flex-wrap: wrap; }
.km-prompt .km-pic { --ps: clamp(80px, 22vh, 150px); }
.km-qtext { margin: 0; flex: 1 1 220px; text-align: center; font-weight: 800; color: var(--ink); font-size: clamp(18px, 2.6vw, 30px); line-height: 1.3; overflow-wrap: anywhere; }
.km-opts { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1.2vw, 14px); }
.km-opts.c1 { grid-template-columns: 1fr; }
@media (max-width: 480px) { .km-opts { grid-template-columns: 1fr; } .km-opts.pic { grid-template-columns: 1fr 1fr; } }
.km-opt { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: clamp(56px, 9vh, 88px); padding: 6px 12px 6px 30px; border-radius: 18px; border: 4px solid var(--km-soft); background: #fff; color: var(--ink); font: 800 clamp(16px, 2.2vw, 26px)/1.25 var(--font); cursor: pointer; text-align: center; overflow-wrap: anywhere; --ps: 54px; }
.km-opts.pic .km-opt { flex-direction: column; padding: 6px 8px; --ps: clamp(56px, 12vh, 96px); }
.km-opt kbd { position: absolute; top: 3px; left: 8px; font: 800 12px var(--font); color: var(--muted); }
.km-opt small { display: block; font-size: .6em; font-weight: 700; color: var(--muted); }
.km-opt:hover:not(:disabled) { border-color: var(--km); }
.km-opt:disabled { cursor: default; }
.km-opt.good { background: #bbf7d0; border-color: var(--ok); }
.km-opt.bad { background: #fecdd3; border-color: var(--bad); }
.km-fb { min-height: 1.4em; text-align: center; font-weight: 800; color: var(--muted); font-size: clamp(14px, 1.7vw, 19px); line-height: 1.4; }
.km-fb.ok b.r { color: var(--ok); } .km-fb.bad b.r { color: var(--bad); }
.km-fb p { margin: 4px 0 0; font-weight: 700; color: var(--ink); text-align: left; background: #f8fafc; border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; font-size: clamp(14px, 1.5vw, 16px); }
.km-next { align-self: center; margin-top: 0; min-height: 52px; padding: 0 34px; font-size: clamp(18px, 2vw, 24px); }
.km-next[hidden] { display: none; }

/* susun */
.km-sus-top { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; text-align: left; }
.km-sus-top .km-pic { --ps: 72px; }
.km-sus-top p { margin: 2px 0 0; color: var(--muted); font-weight: 700; font-size: 15px; max-width: 520px; }
.km-sus-main { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: start; }
@media (min-width: 720px) { .km-sus-main { grid-template-columns: 1.1fr .9fr; } }
.km-slots { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.km-slots li { display: flex; justify-content: center; }
.km-slot { width: var(--w, 100%); min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 4px 10px; border-radius: 14px; border: 3px dashed #94a3b8; background: #f8fafc; color: var(--ink); font: 800 clamp(15px, 1.9vw, 20px) var(--font); cursor: pointer; text-align: center; }
.km-slot .no { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #e2e8f0; display: grid; place-items: center; font-size: 14px; color: var(--ink); }
.km-slot .lb { font-size: 12px; color: var(--muted); font-weight: 700; }
.km-slot.fill { border-style: solid; border-color: var(--km); background: var(--km-soft); }
.km-slot.hot, .km-slot.want:hover { border-style: solid; border-color: var(--km); background: #ecfdf5; }
.km-slot.good { background: #bbf7d0; border-color: var(--ok); }
.km-slot.bad { background: #fecdd3; border-color: var(--bad); }
.km-slot.lock { cursor: default; }
.km-edge { text-align: center; font-weight: 800; color: var(--muted); font-size: 13px; }
.km-pool { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-content: flex-start; min-height: 56px; padding: 8px; border: 2px dashed var(--line); border-radius: 16px; background: #fff; }
.km-tcard { min-height: 48px; padding: 4px 14px; border-radius: 14px; border: 3px solid var(--km); background: #fff; color: var(--ink); font: 800 clamp(15px, 1.9vw, 20px) var(--font); cursor: grab; box-shadow: 0 4px 0 rgba(21,128,61,.3); touch-action: manipulation; }
.km-tcard.sel { background: #fef9c3; border-color: #ca8a04; box-shadow: 0 0 0 4px rgba(250,204,21,.6); }
.km-ghost { position: fixed; z-index: 99; pointer-events: none; transform: translate(-50%, -60%); opacity: .92; }
.km-sact { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.km-sact .primary { margin-top: 0; min-height: 52px; padding: 0 30px; font-size: 20px; }
.km-sact .primary:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.km-tip { margin: 0; text-align: center; color: var(--muted); font-weight: 700; font-size: 14px; }

/* pasangkan */
.km-rule { background: #fffbeb; border: 2px solid #fde68a; border-radius: 14px; padding: 6px 12px; color: var(--ink); font-size: 15px; }
.km-rule summary { cursor: pointer; font-weight: 800; min-height: 32px; display: flex; align-items: center; }
.km-rule ul { margin: 4px 0 6px; padding-left: 20px; line-height: 1.45; }
.km-pas { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 2vw, 24px); align-items: start; }
.km-col { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.km-pc { position: relative; width: 100%; display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 2px 10px; border-radius: 14px; border: 3px solid var(--line); background: #fff; color: var(--ink); font: 800 clamp(14px, 1.8vw, 19px)/1.25 var(--font); cursor: pointer; text-align: left; --ps: 42px; overflow-wrap: break-word; }
.km-pc.r { justify-content: center; text-align: center; }
.km-pc:hover:not(:disabled) { border-color: var(--km); }
.km-pc.sel { border-color: #ca8a04; background: #fef9c3; box-shadow: 0 0 0 3px rgba(250,204,21,.6); }
.km-pc.done { border-color: var(--ok); background: #ecfdf5; cursor: default; }
.km-col li { min-width: 0; }
.km-pc.done .bd { position: absolute; top: -7px; right: -5px; flex: none; min-width: 24px; height: 24px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 13px; display: grid; place-items: center; }
.km-pc.wrong { border-color: var(--bad); background: #fff1f2; animation: km-shake .35s; }
.km-pc.decoy.done { border-style: dashed; }
@keyframes km-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.km-colh { text-align: center; font-weight: 800; color: var(--muted); font-size: 13px; margin-bottom: 2px; }

/* hasil */
.km-score { display: flex; flex-direction: column; gap: 4px; font-size: clamp(15px, 2vw, 22px); margin-bottom: 6px; }
.km-recap { text-align: left; max-height: 36vh; overflow: auto; margin: 6px 0; }
.km-recap:empty { display: none; }
.km-recap h3 { margin: 4px 0 6px; font-size: 16px; }
.km-recap ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; color: var(--ink); font-size: 14px; line-height: 1.4; }
.km-recap li span { display: block; color: var(--muted); }

@media (max-height: 520px) {
  #overlay-result .trophy { display: none; } #overlay-result .winner { font-size: 30px; margin: 0; } #overlay-result .panel { padding-top: 14px; }
  .km-wrap { gap: 4px; padding: 4px 8px; }
  .km-prompt { min-height: 56px; border-width: 3px; padding: 4px 10px; }
  .km-prompt .km-pic { --ps: 64px; }
  .km-opt { min-height: 46px; border-width: 3px; }
  .km-opts { grid-template-columns: repeat(2, 1fr); }
  .km-recap { max-height: 28vh; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.km-pc.r { font-size: clamp(13px, 1.8vw, 19px); overflow-wrap: break-word; }
@media (max-width: 420px) { .km-pc { --ps: 34px; padding: 2px 6px; gap: 5px; font-size: 14px; } .km-pc.r { font-size: 13px; } .km-pas { gap: 6px; } }
