/* Tebak Gambar Kotak */
:root { --tk: #b45309; --tk-soft: #fef3c7; }
.tk-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: clamp(4px, 1vh, 10px); padding: clamp(6px, 1.2vw, 14px); background: linear-gradient(180deg, #fffbeb, #fff 60%); overflow-x: hidden; overflow-y: auto; }
.tk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* tim */
.tk-hud { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; justify-content: center; flex: none; }
.tk-tm { display: inline-flex; align-items: baseline; gap: 8px; background: #fff; border: 3px solid var(--tc); border-radius: 999px; padding: 1px 14px; font-weight: 800; font-size: clamp(13px, 1.7vw, 20px); color: var(--ink); line-height: 1.5; max-width: 32vw; min-width: 0; }
.tk-tm.t0 { --tc: var(--team-a); } .tk-tm.t1 { --tc: var(--team-b); } .tk-tm.t2 { --tc: #059669; }
.tk-tm .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tk-tm .sc { white-space: nowrap; flex: none; }
.tk-tm .sc b { font-size: 1.2em; font-variant-numeric: tabular-nums; }
.tk-tm.on { background: var(--tc); color: #fff; box-shadow: 0 0 0 3px #fde68a; }
.tk-hud[data-n="1"] .tk-tm { max-width: 80vw; }

/* susunan utama */
.tk-main { flex: 1; min-height: 0; display: flex; gap: clamp(8px, 1.4vw, 18px); }
.tk-main.loading { opacity: .6; }
.tk-left { flex: 1 1 50%; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.tk-right { flex: 1 1 50%; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; }

/* gambar dan kotak penutup */
.tk-artbx { flex: 1; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; }
.tk-art { position: relative; flex: none; width: 240px; height: 240px; border-radius: var(--rd, 12px); overflow: hidden; background: #fff; border: 4px solid #fff; box-shadow: 0 0 0 3px var(--tk), 0 6px 0 3px #78350f; box-sizing: content-box; --q: 40px; }
.tk-pic { position: absolute; inset: 0; background: linear-gradient(160deg, #ecfeff, #f0fdf4 55%, #fefce8); }
.tk-pic svg { display: block; width: 100%; height: 100%; }
.tk-cover, .tk-ping { position: absolute; inset: 0; display: grid; pointer-events: none; }
.tk-c { position: relative; display: block; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.75), inset 0 -3px 0 rgba(120,53,15,.28); transform-origin: 50% 50%; transition: transform .5s cubic-bezier(.5, -.2, .6, 1), opacity .45s ease; will-change: transform, opacity; }
.tk-c.a { background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.45) 0 14%, transparent 15%), linear-gradient(135deg, #fcd34d, #f59e0b); }
.tk-c.b { background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.4) 0 14%, transparent 15%), linear-gradient(135deg, #fbbf24, #d97706); }
.tk-c::after { content: '?'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 900 var(--q) var(--font); color: #78350f; opacity: .28; }
.tk-c.o { opacity: 0; transform: perspective(240px) rotateX(-95deg) scale(.7); }
.tk-cover.noanim .tk-c { transition: none; }
.tk-ping i { display: block; border: 4px solid #fff; box-shadow: 0 0 0 3px var(--tk), 0 0 14px 4px rgba(245,158,11,.7); animation: tk-ping 1s ease-out forwards; border-radius: 4px; }
@keyframes tk-ping { 0% { opacity: 1; transform: scale(1.25); } 30% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }

/* indikator */
.tk-meter { flex: none; display: flex; flex-wrap: wrap; gap: 4px 6px; justify-content: center; align-items: center; min-height: 30px; }
.tk-st { background: #fff; border: 2px solid var(--tk); color: var(--ink); border-radius: 999px; padding: 0 10px; font-weight: 700; font-size: clamp(12px, 1.35vw, 16px); line-height: 1.7; white-space: nowrap; display: inline-flex; gap: 5px; align-items: baseline; }
.tk-st i { font-style: normal; color: var(--muted); font-weight: 600; }
.tk-st .sh { display: none; }
.tk-st b { font-variant-numeric: tabular-nums; }
.tk-st.pt { background: var(--tk-soft); } .tk-st.pt b { color: var(--tk); font-size: 1.15em; }
.tk-skip { min-height: 44px; min-width: 76px; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--ink); font: 800 14px var(--font); padding: 0 14px; cursor: pointer; touch-action: manipulation; }
.tk-skip.arm { background: #fee2e2; border-color: #be123c; color: #9f1239; }

/* pertanyaan dan petunjuk */
.tk-info { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.tk-q { margin: 0; font-size: clamp(18px, 2.4vw, 30px); color: var(--tk); line-height: 1.15; flex: none; }
.tk-clues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 0 1 auto; min-height: 44px; max-height: 9.5em; counter-reset: c; }
.tk-clues li { counter-increment: c; position: relative; padding: 2px 8px 2px 30px; background: var(--tk-soft); border-radius: 10px; color: var(--ink); font-weight: 600; font-size: clamp(14px, 1.55vw, 19px); line-height: 1.3; flex: none; }
.tk-clues li::before { content: counter(c); position: absolute; left: 6px; top: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--tk); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.tk-clues li.none, .tk-clues li.more { background: transparent; color: var(--muted); font-weight: 600; font-style: italic; padding-left: 8px; font-size: clamp(12px, 1.3vw, 15px); }
.tk-clues li.none::before, .tk-clues li.more::before { display: none; }
.tk-clues li.new { animation: tk-new 1.4s ease-out 2; }
@keyframes tk-new { 0%, 100% { background: var(--tk-soft); } 40% { background: #fde047; } }
.tk-fb { flex: none; min-height: 2.7em; max-height: 9em; overflow-y: auto; font-weight: 600; color: var(--ink); font-size: clamp(13px, 1.5vw, 18px); line-height: 1.35; }
.tk-fb .ok { color: #047857; } .tk-fb .no { color: #be123c; } .tk-fb .warn { color: #b45309; }
.tk-fb .jw { font-size: 1.15em; color: var(--tk); }
.tk-fb .fk { display: block; margin-top: 4px; padding: 4px 10px; background: #ecfdf5; border-radius: 10px; font-weight: 600; color: #064e3b; }
.tk-fb .fk i { font-style: normal; font-weight: 800; }

/* tebakan dan papan ketik */
.tk-input { flex: none; display: flex; flex-direction: column; gap: 5px; }
.tk-input[hidden], .tk-next[hidden] { display: none; }
.tk-guess { position: relative; min-height: 46px; display: flex; align-items: center; justify-content: center; border: 4px solid var(--tk); border-radius: 14px; background: #fff; color: var(--ink); font: 800 clamp(20px, 2.8vw, 30px) var(--font); letter-spacing: .06em; padding: 0 10px; overflow: hidden; white-space: nowrap; text-transform: uppercase; }
.tk-txt { overflow: hidden; text-overflow: clip; }
.tk-caret { width: 3px; height: 1.1em; background: var(--tk); margin-left: 2px; animation: tk-blink 1s steps(1) infinite; flex: none; }
@keyframes tk-blink { 50% { opacity: 0; } }
.tk-ph { position: absolute; left: 0; right: 0; text-align: center; font-size: .6em; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); pointer-events: none; }
.tk-kb { display: flex; flex-direction: column; gap: 4px; }
.tk-row { display: flex; gap: 4px; justify-content: center; }
.tk-row.r1 { padding: 0 5%; }
.tk-k { flex: 1 1 0; min-width: 0; height: clamp(44px, 6.4vh, 56px); padding: 0; border-radius: 10px; border: 2px solid #fcd34d; background: #fffbeb; color: var(--ink); font: 800 clamp(16px, 2.2vw, 22px) var(--font); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; box-shadow: 0 3px 0 #f59e0b; }
.tk-k:active { transform: translateY(2px); box-shadow: 0 1px 0 #f59e0b; background: #fde68a; }
.tk-k.sp { flex: 2.6 1 0; font-size: clamp(13px, 1.6vw, 17px); }
.tk-gr { display: flex; gap: 5px; align-items: stretch; }
.tk-gr .tk-guess { flex: 1 1 auto; min-width: 0; }
.tk-k.bs { flex: none; width: clamp(48px, 5vw, 64px); height: auto; min-height: 44px; font-size: clamp(18px, 2vw, 24px); }
.tk-go { flex: none; width: clamp(88px, 10vw, 140px); height: auto; min-height: 44px; border-radius: 14px; border: 0; background: var(--ok); color: #fff; font: 800 clamp(18px, 2.2vw, 24px) var(--font); cursor: pointer; box-shadow: 0 4px 0 #047857; touch-action: manipulation; }
.tk-go:active { transform: translateY(2px); box-shadow: 0 2px 0 #047857; }
.tk-next { flex: none; display: flex; justify-content: center; padding: 4px 0; position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(255,251,235,0), #fffbeb 30%); }
.tk-next .primary { margin-top: 0; width: 100%; max-width: 420px; min-height: 56px; font-size: clamp(18px, 2.4vw, 26px); padding: 0 20px; }

/* potret (HP): gambar di atas, papan ketik di bawah */
@media (orientation: portrait) {
  .tk-main { flex-direction: column; flex: 1 0 auto; }
  .tk-left { flex: 1 1 0; min-height: 168px; }
  .tk-right { flex: none; }
  .tk-info { flex: none; }
  .tk-clues { flex: none; height: 3.75em; max-height: none; min-height: 0; }
  .tk-clues li { font-size: 14px; line-height: 1.25; }
  .tk-clues li.more { display: none; }
  .tk-fb { min-height: 2.7em; max-height: 6.8em; font-size: 14px; }
  .tk-info { gap: 3px; }
  .tk-right { gap: 4px; }
  .tk-meter { min-height: 0; }
  .tk-st { line-height: 1.55; }
  .tk-skip { min-height: 44px; }
  .stage:has(> .tk) { --gap: 4px; }
  .tk .topbar { padding: 2px 8px; }
  .tk .topbar .iconbtn.ic { width: 44px; min-width: 44px; min-height: 44px; height: 44px; }
  .tk-tm { line-height: 1.4; }
  .tk-q { font-size: clamp(17px, 5vw, 26px); }
  .tk-tm { max-width: 46vw; }
  .tk-hud[data-n="3"] .tk-tm { max-width: 31vw; padding: 1px 8px; gap: 4px; font-size: 12px; border-width: 2px; }
  .tk-tm { padding: 1px 10px; }
  .tk-k { height: 44px; }
  .tk-wrap { padding: 4px 6px; }
}
@media (orientation: portrait) and (max-height: 600px) {
  .tk-left { min-height: 128px; }
  .tk-wrap { gap: 3px; }
  .tk-q { font-size: 17px; }
}
@media (orientation: portrait) and (min-width: 700px) {
  .tk-left { min-height: 40vh; }
  .tk-k { height: 58px; }
  .tk-go, .tk-k.bs { min-height: 58px; }
  .tk-clues { height: auto; min-height: 5.6em; }
  .tk-clues li { font-size: 18px; }
  .tk-fb { font-size: 18px; }
}
/* lanskap pendek (HP): tombol lebih rendah supaya gambar, petunjuk, dan papan ketik muat */
@media (orientation: landscape) and (max-height: 520px) {
  .tk-wrap { padding: 4px 8px; gap: 3px; }
  .tk-tm { border-width: 2px; padding: 0 10px; font-size: 13px; }
  .tk-main { gap: 8px; }
  .tk-q { font-size: 17px; }
  .tk-main.done .tk-fb { max-height: none; }
  .tk-clues { max-height: 4.8em; min-height: 2.7em; }
  .tk-clues li { font-size: 13px; padding-block: 1px; }
  .tk-clues li.more { display: none; }
  .tk-fb { min-height: 1.4em; max-height: 2.7em; font-size: 12.5px; line-height: 1.25; }
  .tk-fb .fk { margin-top: 2px; padding: 2px 8px; }
  .tk-guess { min-height: 34px; border-width: 3px; font-size: 20px; border-radius: 10px; }
  .tk-k { height: 34px; border-radius: 8px; box-shadow: 0 2px 0 #f59e0b; font-size: 16px; }
  .tk-go, .tk-k.bs { min-height: 34px; font-size: 16px; }
  .tk-kb { gap: 3px; } .tk-row { gap: 3px; } .tk-input { gap: 3px; }
  .tk-meter { min-height: 0; }
  .tk-st { line-height: 1.5; font-size: 12px; padding: 0 8px; }
  .tk-skip { min-height: 36px; min-width: 64px; font-size: 13px; }
  .tk-art { border-width: 3px; }
  .tk-next .primary { min-height: 44px; font-size: 18px; }
}

/* setelah ronde selesai: jawaban dan fakta lebih lega */
.tk-main.done .tk-info { overflow: auto; }
.tk-main.done .tk-clues { height: auto; max-height: none; min-height: 0; overflow: visible; flex: none; }
.tk-main.done .tk-fb { max-height: none; overflow: visible; }

/* pengaturan dan hasil */
.tk-names { display: grid; gap: 6px; }
.tk-names input { font: 700 16px var(--font); padding: 8px 14px; border: 2px solid var(--line); border-radius: 999px; min-width: 0; width: 100%; text-align: center; color: var(--ink); }
.tk-names input:nth-child(1) { border-color: var(--team-a); } .tk-names input:nth-child(2) { border-color: var(--team-b); } .tk-names input:nth-child(3) { border-color: #059669; }
.tk-names input[hidden] { display: none; }
.tk-score { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 6px 0 4px; }
.tk-sc { display: flex; flex-wrap: wrap; gap: 2px 12px; justify-content: center; align-items: baseline; min-width: 150px; flex: 1 1 150px; max-width: 260px; border: 3px solid var(--sc); border-radius: 18px; padding: 6px 12px; color: var(--ink); font-weight: 600; font-size: 15px; background: #fff; }
.tk-sc .n { flex: 1 0 100%; font-size: 18px; color: var(--sc); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-sc.win { background: #fefce8; border-color: #f59e0b; box-shadow: 0 0 0 3px #fde68a; }
.tk-rh { margin: 14px 0 6px !important; }
.tk-recap { list-style: none; margin: 0; padding: 2px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 6px; text-align: left; }
.tk-recap li { display: flex; align-items: center; gap: 10px; background: #fffbeb; border: 2px solid #fde68a; border-radius: 14px; padding: 4px 10px 4px 4px; color: var(--ink); }
.tk-recap li.won { background: #ecfdf5; border-color: #a7f3d0; }
.tk-recap li.lost, .tk-recap li.skip { background: #fff1f2; border-color: #fecdd3; }
.tk-recap .th { flex: none; width: 56px; height: 56px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.tk-recap .tx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: clamp(13px, 1.5vw, 16px); line-height: 1.3; }
.tk-recap .nm { font-size: 1.1em; font-weight: 800; }
.tk-recap em { font-style: normal; font-weight: 800; font-size: .92em; }
.tk-recap .won em { color: #047857; } .tk-recap .lost em, .tk-recap .skip em { color: #be123c; }
.tk-recap .fk { color: var(--muted); font-weight: 600; font-size: .92em; }
.tk-redo { margin: 10px 0 2px; padding: 8px 12px; background: var(--tk-soft); border-radius: 14px; color: var(--ink); font-size: clamp(14px, 1.6vw, 17px); text-transform: none; }
.tk-redo[hidden] { display: none; }
#overlay-result .panel { width: min(900px, 100%); }
@media (max-height: 520px) { #overlay-result .trophy { width: 40px; margin-bottom: 0; } #overlay-result .winner { font-size: clamp(24px, 8vh, 34px); margin: 0; } #overlay-result .stats { margin: 4px 0; } .tk-recap li { padding-block: 2px; } }

/* hormati preferensi gerak: kotak memudar saja */
@media (prefers-reduced-motion: reduce) {
  .tk-c { transition: opacity .25s linear; will-change: auto; }
  .tk-c.o { transform: none; }
  .tk-ping i { animation: none; opacity: 0; }
  .tk-clues li.new { animation: none; background: #fde047; }
  .tk-caret { animation: none; }
  .tk-k:active, .tk-go:active { transform: none; }
}

/* HP sempit: label indikator dipendekkan */
@media (max-width: 360px) { .tk-kb, .tk-row { gap: 3px; } .tk-row.r1 { padding: 0 3%; } .tk-wrap { padding: 4px 4px; } }
@media (max-width: 440px) {
  .tk-st .lg { display: none; } .tk-st .sh { display: inline; }
  .tk-st { padding: 0 8px; gap: 3px; }
  .tk-skip { min-width: 64px; padding: 0 10px; }
  .tk-meter { gap: 4px; }
}
