/* Self-contained GM switch UI for games with their own modal styles. */
.gmk-chip {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 10px 0 9px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 999px;
  color: #f5ffe9;
  background: rgba(47, 60, 42, .64);
  box-shadow: 0 5px 16px rgba(30, 45, 24, .28);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.gmk-chip:active {
  transform: scale(.95);
}

.gmk-chip.on {
  border-color: rgba(206, 255, 165, .65);
  background: rgba(65, 112, 43, .86);
  box-shadow: 0 5px 18px rgba(64, 112, 40, .35);
}

.gmk-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c8b79f;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .12);
}

.gmk-chip.on .gmk-chip-dot {
  background: #bcff7f;
  box-shadow: 0 0 8px rgba(188, 255, 127, .85);
}

.gmk-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(57, 38, 22, .48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gmk-overlay.show {
  display: flex;
}

.gmk-card {
  width: min(360px, 94vw);
  max-height: min(88dvh, 650px);
  overflow-y: auto;
  padding: 20px 19px 18px;
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 24px;
  color: #463021;
  background:
    radial-gradient(240px 140px at 50% -18%, #fff9e9, transparent 72%),
    linear-gradient(165deg, #fffefa, #fff3e3);
  box-shadow:
    0 26px 70px rgba(57, 36, 20, .36),
    inset 0 1px 0 #fff;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  animation: gmkPop .28s cubic-bezier(.22, 1.22, .5, 1) both;
}

.gmk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.gmk-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 850;
  letter-spacing: .03em;
  line-height: 1.25;
}

.gmk-close {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #9a7d66;
  background: rgba(0, 0, 0, .055);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.gmk-close:hover {
  color: #463021;
  background: rgba(0, 0, 0, .09);
}

.gmk-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
  padding: 12px 13px;
  border-radius: 15px;
  background: rgba(255, 248, 232, .92);
  box-shadow: inset 0 0 0 1px rgba(214, 160, 96, .22);
  text-align: left;
}

.gmk-status strong {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.35;
}

.gmk-status small {
  display: block;
  margin-top: 3px;
  color: #8a6f58;
  font-size: 10.5px;
  line-height: 1.5;
}

.gmk-switch {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 30px;
}

.gmk-switch input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.gmk-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d8c7b4;
  box-shadow: inset 0 1px 4px rgba(92, 63, 36, .15);
  transition: background .2s ease;
}

.gmk-track::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fffdf7;
  box-shadow: 0 2px 6px rgba(96, 63, 33, .22);
  transition: transform .2s cubic-bezier(.3, 1.4, .5, 1);
}

.gmk-switch input:checked + .gmk-track {
  background: #79c451;
}

.gmk-switch input:checked + .gmk-track::after {
  transform: translateX(22px);
}

.gmk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.gmk-btn {
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 13px;
  color: #463021;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 4px 12px rgba(140, 96, 56, .09);
  font: inherit;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, opacity .16s ease;
}

.gmk-btn:hover {
  transform: translateY(-1px);
}

.gmk-btn:active {
  transform: scale(.98);
}

.gmk-btn:disabled {
  opacity: .52;
  cursor: default;
  transform: none;
}

.gmk-btn.primary {
  color: #fff;
  border-color: rgba(255, 255, 255, .42);
  background: linear-gradient(140deg, #68c994, #319d67);
  box-shadow: 0 8px 20px rgba(45, 143, 94, .27);
}

.gmk-btn.wide {
  grid-column: 1 / -1;
}

.gmk-note {
  margin: 12px 2px 2px;
  color: #9b7f68;
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

@keyframes gmkPop {
  0% { opacity: 0; transform: translateY(12px) scale(.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 860px) {
  .gmk-chip {
    right: max(9px, env(safe-area-inset-right));
    bottom: max(9px, env(safe-area-inset-bottom));
    height: 26px;
    font-size: 9px;
  }

  .gmk-card {
    padding: 16px 15px 14px;
    border-radius: 21px;
  }

  .gmk-btn {
    min-height: 47px;
    font-size: 13px;
  }
}
