/* Tombol Pemicu Modal Universal — Selaras dengan DUS Arena Sudoku & Cari Kata */
.dus-mem-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-mem-trigger-info { display: flex !important; flex-direction: column !important; gap: 3px !important; min-width: 0 !important; }
.dus-mem-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-mem-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-mem-trigger-desc { font-size: 0.82rem !important; color: #525740 !important; margin: 0 !important; padding: 0 !important; line-height: 1.4 !important; }
.dus-mem-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-mem-trigger-btn:hover { background: #58650f !important; color: #ffffff !important; transform: translateY(-1px) !important; }
.dus-mem-trigger-btn svg { flex-shrink: 0 !important; }

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

/* Kanvas Fullscreen Menutupi Seluruh Halaman & Mobile Dock */
.dus-mem-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: flex; 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; transition: opacity 0.2s ease, visibility 0.2s ease; }
.dus-mem-modal-overlay.is-active { opacity: 1; visibility: visible; }

/* Wrapper Utama Game */
.dus-mem-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-mem-wrap * { box-sizing: border-box; }

.dus-mem-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.dus-mem-brand { min-width: 0; }
.dus-mem-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-mem-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-mem-top-right { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

.dus-mem-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-mem-timer-box svg { flex-shrink: 0; }

.dus-mem-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-mem-action-icon-btn:hover { background: #dfe4c9; color: #26291b; }
.dus-mem-action-icon-btn.dus-mem-close-modal { background: #6b7a14; color: #ffffff; border-color: #6b7a14; }
.dus-mem-action-icon-btn.dus-mem-close-modal:hover { background: #58650f; }

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

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

/* Pemilih Mode & Tema */
.dus-mem-select-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.dus-mem-select-box { display: flex; flex-direction: column; gap: 2px; background: #ffffff; border: 1px solid #cbd0b2; border-radius: 9px; padding: 5px 9px; min-width: 0; }
.dus-mem-select-label { font-size: 0.62rem; font-weight: 800; color: #808000; text-transform: uppercase; letter-spacing: 0.05em; }
.dus-mem-select-box select { width: 100%; border: none; background: transparent; color: #26291b; font-size: 0.8rem; font-weight: 700; cursor: pointer; outline: none; padding: 0; }

/* Metrik Pasangan & Langkah */
.dus-mem-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.dus-mem-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-mem-metric-pill strong { font-size: 0.9rem; font-weight: 800; color: #262e24; font-variant-numeric: tabular-nums; }

/* Status */
.dus-mem-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-mem-status.is-match { background: #e4ead0; color: #36420b; font-weight: 700; }
.dus-mem-status.is-solved { background: #fef3c7; color: #78350f; font-weight: 700; }

/* Papan & Grid Kartu 3D */
.dus-mem-board-shell { position: relative; width: 100%; max-width: 390px; margin: 0 auto; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; border: 2.5px solid #55610f; background: #eef0e0; box-shadow: 0 6px 18px -4px rgba(85, 97, 15, 0.12); }
.dus-mem-board { --mem-cols: 4; --mem-rows: 4; position: absolute !important; inset: 0 !important; display: grid !important; grid-template-columns: repeat(var(--mem-cols), minmax(0, 1fr)) !important; grid-template-rows: repeat(var(--mem-rows), minmax(0, 1fr)) !important; gap: 7px !important; padding: 9px !important; width: 100% !important; height: 100% !important; margin: 0 !important; perspective: 900px; }

.dus-mem-card { position: relative; width: 100%; height: 100%; border: none; background: transparent; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; outline: none; }
.dus-mem-card-inner { position: relative; width: 100%; height: 100%; transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1); transform-style: preserve-3d; }
.dus-mem-card.is-flipped .dus-mem-card-inner,
.dus-mem-card.is-matched .dus-mem-card-inner,
.dus-mem-card.is-peeking .dus-mem-card-inner { transform: rotateY(180deg); }

.dus-mem-face { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px; overflow: hidden; transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }

/* Sisi Belakang Kartu — Pola Kisi Wajik Ala Kartu Bridge */
.dus-mem-back { background: linear-gradient(145deg, #6b7a14 0%, #4e590d 100%); border: 1.5px solid #424c0a; color: #fefce8; box-shadow: 0 2px 5px rgba(38, 46, 36, 0.14); }
.dus-mem-back::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 5px;
  border: 1px solid rgba(254, 243, 199, 0.36);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M8 0L16 8L8 16L0 8Z' fill='none' stroke='%23ffffff' stroke-opacity='0.17' stroke-width='0.8'/%3E%3Cpath d='M8 3.2L12.8 8L8 12.8L3.2 8Z' fill='none' stroke='%23fef3c7' stroke-opacity='0.16' stroke-width='0.65'/%3E%3Ccircle cx='8' cy='8' r='1' fill='%23fef3c7' fill-opacity='0.24'/%3E%3Ccircle cx='0' cy='0' r='0.85' fill='%23ffffff' fill-opacity='0.2'/%3E%3Ccircle cx='16' cy='0' r='0.85' fill='%23ffffff' fill-opacity='0.2'/%3E%3Ccircle cx='0' cy='16' r='0.85' fill='%23ffffff' fill-opacity='0.2'/%3E%3Ccircle cx='16' cy='16' r='0.85' fill='%23ffffff' fill-opacity='0.2'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-position: center center;
  pointer-events: none;
}
.dus-mem-card:hover:not(.is-flipped):not(.is-matched) .dus-mem-back { background: linear-gradient(145deg, #768717 0%, #57630f 100%); }

.dus-mem-back-mark {
  position: relative;
  z-index: 1;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6e7e15 0%, #505c0d 100%);
  border: 1.5px solid rgba(254, 243, 199, 0.65);
  box-shadow: 0 0 0 2.5px #535f0e, 0 0 0 3.5px rgba(255, 255, 255, 0.26), 0 3px 8px rgba(0, 0, 0, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
  color: #fefce8;
}
.dus-mem-board[data-cols="5"] .dus-mem-back-mark {
  width: 42px;
  height: 42px;
  font-size: 0.72rem;
  box-shadow: 0 0 0 2px #535f0e, 0 0 0 3px rgba(255, 255, 255, 0.26), 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Sisi Depan Kartu (Terbuka) */
.dus-mem-front { transform: rotateY(180deg); background: #ffffff; border: 1.5px solid #c8cdb0; color: #262e24; gap: 3px; }
.dus-mem-card.is-flipped .dus-mem-front { border-color: #d97706; background: #fffdf5; box-shadow: 0 3px 10px rgba(217, 119, 6, 0.14); }
.dus-mem-card.is-mismatch .dus-mem-front { border-color: #dc2626 !important; background: #fef2f2 !important; color: #991b1b !important; }
.dus-mem-card.is-matched .dus-mem-front { border-color: #9ba856; background: #f2f5e4; color: #4d590c; }
.dus-mem-card.is-peeking .dus-mem-front { border-color: #6b7a14; background: #f8f9f0; }

.dus-mem-symbol-svg { width: 52%; height: 52%; max-width: 34px; max-height: 34px; stroke: currentColor; flex-shrink: 0; }
.dus-mem-symbol-caption { font-size: clamp(0.52rem, 1.8vw, 0.64rem); font-weight: 700; color: #535b32; line-height: 1.1; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dus-mem-concept-tag { font-size: 0.5rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: #808000; line-height: 1; }
.dus-mem-concept-word { font-size: clamp(0.66rem, 2.5vw, 0.84rem); font-weight: 800; letter-spacing: 0.02em; color: #1f2216; line-height: 1.15; text-align: center; word-break: normal; overflow-wrap: normal; }
.dus-mem-board[data-cols="5"] .dus-mem-concept-word { font-size: clamp(0.56rem, 2.1vw, 0.72rem); }

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

.dus-mem-footer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 2px; }
.dus-mem-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-mem-btn-olive:hover { background: #58650f; }
.dus-mem-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-mem-modal-overlay { align-items: center; }
  .dus-mem-wrap { max-width: 720px; min-height: auto; padding: 24px; justify-content: center; }
  .dus-mem-top { margin-bottom: 18px; }
  .dus-mem-heading { font-size: 1.4rem; }
  .dus-mem-main { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: stretch; }
  .dus-mem-board-shell { max-width: 360px; }
  .dus-mem-right { justify-content: space-between; }
  .dus-mem-concept-word { font-size: 0.82rem; }
  .dus-mem-board[data-cols="5"] .dus-mem-concept-word { font-size: 0.7rem; }
}

/* Modal Dalam Papan (Menang & Cara Bermain) */
.dus-mem-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-mem-modal-inner[hidden] { display: none; }
.dus-mem-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-mem-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-mem-modal-title { font-size: 1.05rem; font-weight: 800; color: #4d590c; margin-bottom: 6px; }
.dus-mem-modal-desc { font-size: 0.8rem; color: #525740; margin: 0 0 12px; line-height: 1.45; text-align: left; }
.dus-mem-save-box { background: #f7f8ee; padding: 9px; border-radius: 8px; margin-bottom: 10px; border: 1px solid #dce0c5; text-align: left; }
.dus-mem-label { display: block; font-size: 0.73rem; font-weight: 700; color: #4d590c; margin-bottom: 5px; }
.dus-mem-input-row { display: flex; gap: 6px; justify-content: center; }
.dus-mem-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-mem-btn-gold { padding: 5px 12px; background: #d97706; color: #ffffff; border: none; border-radius: 6px; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.dus-mem-filter-msg { font-size: 0.72rem; color: #b91c1c; margin-top: 4px; min-height: 13px; }

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