/* Tombol Pemicu Modal Universal — Selaras dengan DUS Arena */
.dus-kk-trigger-card { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 14px !important; background: linear-gradient(135deg, #fcfcf8 0%, #f4f5ea 100%) !important; border: 1px solid #d5d8be !important; border-radius: 14px !important; padding: 16px 20px !important; margin: 20px 0 !important; box-shadow: 0 4px 15px -3px rgba(85, 97, 15, 0.08) !important; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important; box-sizing: border-box !important; }
.dus-kk-trigger-info { display: flex !important; flex-direction: column !important; gap: 3px !important; min-width: 0 !important; }
.dus-kk-trigger-tag { font-size: 0.65rem !important; font-weight: 800 !important; letter-spacing: 0.08em !important; color: #808000 !important; text-transform: uppercase !important; line-height: 1.3 !important; }
.dus-kk-trigger-title { font-size: 1.1rem !important; font-weight: 800 !important; color: #262e24 !important; margin: 0 !important; padding: 0 !important; line-height: 1.2 !important; }
.dus-kk-trigger-desc { font-size: 0.82rem !important; color: #525740 !important; margin: 0 !important; padding: 0 !important; line-height: 1.4 !important; }
.dus-kk-trigger-btn { display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 6px !important; padding: 10px 18px !important; background: #6b7a14 !important; color: #ffffff !important; border: none !important; border-radius: 9px !important; font-size: 0.85rem !important; font-weight: 700 !important; line-height: 1.2 !important; cursor: pointer !important; transition: background 0.15s ease, transform 0.1s ease !important; white-space: nowrap !important; flex-shrink: 0 !important; text-decoration: none !important; touch-action: manipulation !important; }
.dus-kk-trigger-btn:hover { background: #58650f !important; color: #ffffff !important; transform: translateY(-1px) !important; }
.dus-kk-trigger-btn svg { flex-shrink: 0 !important; }

@media (max-width: 480px) {
  .dus-kk-trigger-card { flex-direction: column !important; align-items: flex-start !important; }
  .dus-kk-trigger-btn { width: 100% !important; }
}

/* Kanvas Fullscreen Menutupi Seluruh Halaman & Mobile Dock */
.dus-kk-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  background: linear-gradient(180deg, #fcfcf8 0%, #f4f5ea 100%) !important;
  z-index: 2147483647 !important;
  display: none !important;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  margin: 0 !important;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.dus-kk-modal-overlay[hidden],
.dus-kk-modal-overlay:not(.is-active) {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.dus-kk-modal-overlay:not(.is-active) * {
  pointer-events: none !important;
  visibility: hidden !important;
}

.dus-kk-modal-overlay.is-active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Wrapper Utama Game */
.dus-kk-wrap { width: 100%; max-width: 440px; min-height: 100%; padding: 14px 16px calc(24px + env(safe-area-inset-bottom, 0px)); background: transparent; border: none; border-radius: 0; box-shadow: none; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #26291b; box-sizing: border-box; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; display: flex; flex-direction: column; justify-content: space-between; }
.dus-kk-wrap * { box-sizing: border-box; }

.dus-kk-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.dus-kk-brand { min-width: 0; }
.dus-kk-tagline { font-size: 0.65rem; font-weight: 800; letter-spacing: 0.07em; color: #808000; text-transform: uppercase; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dus-kk-heading { font-size: 1.25rem; font-weight: 800; color: #262e24; line-height: 1.15; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dus-kk-top-right { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

.dus-kk-timer-box { display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 10px; background: #ebeed9; color: #4d590c; border: 1px solid #d7dcc0; border-radius: 10px; font-size: 0.86rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }
.dus-kk-timer-box svg { flex-shrink: 0; }

.dus-kk-action-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; background: #ebeed9; color: #4d590c; border: 1px solid #d7dcc0; border-radius: 10px; cursor: pointer; transition: background-color 0.15s ease, color 0.15s ease; touch-action: manipulation; flex-shrink: 0; }
.dus-kk-action-icon-btn:hover { background: #dfe4c9; color: #26291b; }
.dus-kk-action-icon-btn.dus-kk-close-modal { background: #6b7a14; color: #ffffff; border-color: #6b7a14; }
.dus-kk-action-icon-btn.dus-kk-close-modal:hover { background: #58650f; }

.dus-kk-main { display: flex; flex-direction: column; gap: 12px; }
.dus-kk-right { display: flex; flex-direction: column; gap: 9px; }

/* Tab Tingkat Kesulitan */
.dus-kk-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #e8ebd5; padding: 4px; border-radius: 10px; }
.dus-kk-tab { padding: 7px 4px; border: none; border-radius: 7px; background: transparent; color: #535b32; font-size: 0.78rem; font-weight: 700; cursor: pointer; transition: all 0.16s ease; touch-action: manipulation; }
.dus-kk-tab:hover { color: #26291b; }
.dus-kk-tab.is-active { background: #6b7a14; color: #ffffff; box-shadow: 0 2px 6px rgba(85, 97, 15, 0.25); }

/* Metrik */
.dus-kk-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.dus-kk-metric-pill { display: flex; align-items: center; justify-content: space-between; background: #ffffff; border: 1px solid #d7dcc0; border-radius: 9px; padding: 7px 11px; font-size: 0.78rem; color: #535b32; font-weight: 600; }
.dus-kk-metric-pill strong { font-size: 0.9rem; font-weight: 800; color: #262e24; font-variant-numeric: tabular-nums; }

/* Status */
.dus-kk-status { font-size: 0.8rem; text-align: center; color: #595e47; min-height: 31px; line-height: 1.35; background: #eff1e2; padding: 6px 10px; border-radius: 8px; transition: all 0.2s ease; }
.dus-kk-status.is-warn { background: #fef2f2; color: #991b1b; font-weight: 700; }
.dus-kk-status.is-solved { background: #fef3c7; color: #78350f; font-weight: 700; }

/* Papan & Grid Kandang KenKen — Dasar Berpola Wajik & Titik Olive */
.dus-kk-board-shell {
  position: relative;
  width: 100%;
  max-width: 390px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 3px solid #3f480b;
  background-color: #eef1df;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 1L23 12L12 23L1 12Z' fill='none' stroke='%2355610f' stroke-opacity='0.14' stroke-width='1'/%3E%3Ccircle cx='12' cy='12' r='1.35' fill='%236b7a14' fill-opacity='0.22'/%3E%3Ccircle cx='0' cy='0' r='1' fill='%23808000' fill-opacity='0.16'/%3E%3Ccircle cx='24' cy='0' r='1' fill='%23808000' fill-opacity='0.16'/%3E%3Ccircle cx='0' cy='24' r='1' fill='%23808000' fill-opacity='0.16'/%3E%3Ccircle cx='24' cy='24' r='1' fill='%23808000' fill-opacity='0.16'/%3E%3C/svg%3E"),
    linear-gradient(155deg, #f8f9ef 0%, #e7ebd3 100%);
  background-repeat: repeat, no-repeat;
  background-size: 24px 24px, 100% 100%;
  box-shadow: 0 6px 18px -4px rgba(85, 97, 15, 0.16);
}

.dus-kk-board {
  --kk-size: 5;
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(var(--kk-size), minmax(0, 1fr)) !important;
  grid-template-rows: repeat(var(--kk-size), minmax(0, 1fr)) !important;
  gap: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
}

.dus-kk-cell {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.56);
  border-top: 1px dashed rgba(85, 97, 15, 0.26);
  border-left: 1px dashed rgba(85, 97, 15, 0.26);
  border-right: none;
  border-bottom: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  outline: none;
  transition: background-color 0.14s ease;
}

.dus-kk-cell:hover { background-color: rgba(255, 255, 255, 0.78); }

.dus-kk-cell.b-top { border-top: 2px solid #3f480b; }
.dus-kk-cell.b-left { border-left: 2px solid #3f480b; }
.dus-kk-cell.b-right { border-right: 2px solid #3f480b; }
.dus-kk-cell.b-bottom { border-bottom: 2px solid #3f480b; }

.dus-kk-cell.is-peer { background-color: rgba(223, 229, 194, 0.62); }
.dus-kk-cell.is-selected { background-color: rgba(254, 243, 199, 0.92) !important; box-shadow: inset 0 0 0 2px #d97706; }
.dus-kk-cell.is-locked { background-color: rgba(232, 239, 202, 0.78); }
.dus-kk-cell.is-error { background-color: rgba(254, 242, 242, 0.92) !important; }
.dus-kk-cell.is-solved { background-color: rgba(232, 239, 202, 0.88) !important; }

.dus-kk-cage-clue { position: absolute; top: 3px; left: 4px; font-size: clamp(0.6rem, 2.2vw, 0.74rem); font-weight: 800; color: #4d590c; line-height: 1; letter-spacing: -0.02em; pointer-events: none; font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85); }
.dus-kk-board[data-size="6"] .dus-kk-cage-clue { font-size: clamp(0.54rem, 1.9vw, 0.66rem); top: 2px; left: 3px; }

.dus-kk-cell-val { font-size: clamp(1.1rem, 4.4vw, 1.48rem); font-weight: 800; color: #262e24; line-height: 1; margin-top: 8px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9); }
.dus-kk-cell.is-locked .dus-kk-cell-val { color: #55610f; }
.dus-kk-cell.is-error .dus-kk-cell-val { color: #b91c1c; }

/* Numpad */
.dus-kk-numpad { --kk-pad-cols: 6; display: grid; grid-template-columns: repeat(var(--kk-pad-cols), minmax(0, 1fr)); gap: 5px; }
.dus-kk-num-btn { height: 40px; border: 1px solid #cbd0b2; border-radius: 8px; background: #ffffff; color: #262e24; font-size: 1rem; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.12s ease; touch-action: manipulation; }
.dus-kk-num-btn:hover { background: #ebeed9; border-color: #808000; }
.dus-kk-num-btn:active { transform: scale(0.96); }
.dus-kk-num-btn.is-erase { color: #78350f; background: #fdfaf2; }

/* Tombol Bantuan & Aksi Bawah */
.dus-kk-tools-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.dus-kk-tool-btn { display: flex; align-items: center; justify-content: center; gap: 5px; width: 100%; padding: 8px 8px; background: #ffffff; border: 1px solid #cbd0b2; border-radius: 9px; font-size: 0.76rem; font-weight: 700; color: #3f4628; cursor: pointer; transition: all 0.15s ease; touch-action: manipulation; }
.dus-kk-tool-btn:hover:not(:disabled) { background: #ebeed9; }
.dus-kk-tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.dus-kk-footer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 2px; }
.dus-kk-btn-olive { padding: 10px 12px; background: #6b7a14; color: #ffffff; border: none; border-radius: 9px; font-size: 0.84rem; font-weight: 700; cursor: pointer; width: 100%; touch-action: manipulation; }
.dus-kk-btn-olive:hover { background: #58650f; }
.dus-kk-btn-outline { padding: 10px 12px; background: #ffffff; color: #4d590c; border: 1px solid #b5bc96; border-radius: 9px; font-size: 0.84rem; font-weight: 700; cursor: pointer; touch-action: manipulation; }

@media (min-width: 720px) {
  .dus-kk-modal-overlay { align-items: center; }
  .dus-kk-wrap { max-width: 720px; min-height: auto; padding: 24px; justify-content: center; }
  .dus-kk-top { margin-bottom: 18px; }
  .dus-kk-heading { font-size: 1.4rem; }
  .dus-kk-main { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: stretch; }
  .dus-kk-board-shell { max-width: 360px; }
  .dus-kk-right { justify-content: space-between; }
}

/* Modal Dalam Papan (Menang & Cara Bermain) */

/* Tirai Penutup Anti-Curang */
.dus-kk-curtain {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 35%, rgba(252, 252, 248, 0.94) 0%, rgba(232, 237, 208, 0.96) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpath d='M0 22L22 0L44 22L22 44Z' fill='none' stroke='%236b7a14' stroke-opacity='0.16' stroke-width='1'/%3E%3C/svg%3E");
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 1;
  visibility: inherit;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.dus-kk-curtain.is-hidden,
.dus-kk-curtain[hidden] {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: scale(1.03);
  pointer-events: none !important;
}

.dus-kk-curtain-card {
  width: 100%;
  max-width: 280px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(246, 248, 234, 0.94) 100%);
  border: 1.5px solid rgba(180, 131, 24, 0.42);
  border-radius: 14px;
  padding: 18px 16px;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 12px 28px -6px rgba(77, 89, 12, 0.22);
}

.dus-kk-emblem {
  width: 76px;
  height: 50px;
  margin: 0 auto 8px;
  border-radius: 11px;
  background: linear-gradient(180deg, #f3f5e4 0%, #e4e9cb 100%);
  border: 1px solid #cfd6b3;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 #ffffff;
}

.dus-kk-curtain-title {
  font-size: 1.02rem;
  font-weight: 800;
  color: #262e24;
  margin-bottom: 5px;
}

.dus-kk-curtain-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  background: #eef1dc;
  border: 1px solid #cfd6b3;
  color: #4d590c;
  font-size: 0.71rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.dus-kk-curtain-note {
  font-size: 0.76rem;
  color: #595e47;
  line-height: 1.4;
  margin: 0 0 13px;
}

.dus-kk-start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid #4d590c;
  background: linear-gradient(180deg, #7c8d19 0%, #5b690f 100%);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 5px 14px rgba(77, 89, 12, 0.3);
  transition: transform 0.12s ease, filter 0.15s ease;
  touch-action: manipulation;
}

.dus-kk-start-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.dus-kk-start-btn:active {
  transform: scale(0.97);
}

.dus-kk-modal-inner { position: absolute; inset: 0; background: rgba(31, 34, 22, 0.84); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 14px; z-index: 10; }
.dus-kk-modal-inner[hidden] { display: none; }
.dus-kk-modal-card { background: #ffffff; border-radius: 12px; padding: 18px; width: 100%; max-width: 300px; text-align: center; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25); }
.dus-kk-trophy { width: 36px; height: 36px; margin: 0 auto 6px; border-radius: 50%; background: #fef3c7; color: #d97706; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; }
.dus-kk-modal-title { font-size: 1.05rem; font-weight: 800; color: #4d590c; margin-bottom: 6px; }
.dus-kk-modal-desc { font-size: 0.8rem; color: #525740; margin: 0 0 12px; line-height: 1.45; text-align: left; }
.dus-kk-save-box { background: #f7f8ee; padding: 9px; border-radius: 8px; margin-bottom: 10px; border: 1px solid #dce0c5; text-align: left; }
.dus-kk-label { display: block; font-size: 0.73rem; font-weight: 700; color: #4d590c; margin-bottom: 5px; }
.dus-kk-input-row { display: flex; gap: 6px; justify-content: center; }
.dus-kk-input-row input { width: 112px; text-align: center; font-size: 0.92rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 5px 6px; border: 1.5px solid #6b7a14; border-radius: 6px; outline: none; }
.dus-kk-btn-gold { padding: 5px 12px; background: #d97706; color: #ffffff; border: none; border-radius: 6px; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.dus-kk-filter-msg { font-size: 0.72rem; color: #b91c1c; margin-top: 4px; min-height: 13px; }

/* Panel Rekor Lokal */
.dus-kk-lb-panel { margin-top: 14px; background: #ffffff; border: 1px solid #d5d8be; border-radius: 10px; padding: 10px 12px; text-align: left; }
.dus-kk-lb-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; font-weight: 700; color: #4d590c; padding-bottom: 6px; border-bottom: 1px solid #eceee0; margin-bottom: 6px; }
.dus-kk-link-btn { background: none; border: none; color: #9ca3af; font-size: 0.72rem; cursor: pointer; text-decoration: underline; }
.dus-kk-lb-list { font-size: 0.8rem; color: #374151; max-height: 120px; overflow-y: auto; }
.dus-kk-lb-item { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed #eceee0; }
.dus-kk-lb-item:last-child { border-bottom: none; }
.dus-kk-lb-tag { font-size: 0.7rem; background: #eef0df; color: #4d590c; padding: 1px 6px; border-radius: 4px; margin-left: 6px; text-transform: capitalize; }

.dus-kk-btn-ghost { margin-top: 7px; padding: 7px 10px; background: transparent; color: #595e47; border: 1px solid #d5d8be; border-radius: 8px; font-size: 0.78rem; font-weight: 700; cursor: pointer; width: 100%; touch-action: manipulation; }
.dus-kk-btn-ghost:hover { background: #f4f5ea; color: #262e24; }
.dus-kk-status.is-solved { cursor: pointer; }
